Changeset 651 in Sophya for trunk/Poubelle/archediab.old/archeops.c
- Timestamp:
- Nov 25, 1999, 3:05:04 PM (26 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Poubelle/archediab.old/archeops.c
r649 r651 121 121 /* ------------------------ configuration de vol 5 juillet 99-----------------------------*/ 122 122 123 /* ---------------------- modifié les indices de bolo le 15 septembre 1999-------------------*/ 124 123 125 param_bolo parametr={28,24,36,88,18, 124 126 … … 127 129 { 128 130 129 { 11 , 2,10, 1 , 200, 22000 , 200 }, /* 1*/131 { 11 , 2,10, 1 , 200, 22000 , 200 }, /* 0 */ 130 132 131 133 { 9 , 1,10, 2 , 200, 22000 , 200 }, … … 137 139 138 140 139 { 5 , 1,10, 5 ,1000, 4700 , 1000 }, /* 5*/141 { 5 , 1,10, 5 ,1000, 4700 , 1000 }, /* 4 */ 140 142 141 143 { 0 , 2,10, 6 ,1000, 4700 , 1000 }, … … 147 149 148 150 149 { 2 , 1,10,11, 1000, 4700 , 1000 }, /* 9*/151 { 2 , 1,10,11, 1000, 4700 , 1000 }, /* 8 */ 150 152 151 153 { 4 , 1,10,12, 1000, 4700 , 1000 }, … … 157 159 158 160 159 { 13 , 1,10,17, 1000, 4700 , 1000 }, /* 1 3*/161 { 13 , 1,10,17, 1000, 4700 , 1000 }, /* 12 */ 160 162 161 163 { 3 , 1,10,18, 1000, 4700 , 1000 }, … … 167 169 168 170 169 { 15 , 1,10,21, 200, 22000 , 200 }, /* 1 7*/171 { 15 , 1,10,21, 200, 22000 , 200 }, /* 16 */ 170 172 171 173 { 16 , 1,10,22, 200, 22000 , 200 }, … … 177 179 178 180 179 { 20 , 3,10,27, 1000, 22000 , 0 }, /* 2 1*/181 { 20 , 3,10,27, 1000, 22000 , 0 }, /* 20 */ 180 182 181 183 { 21 , 3,10,28, 1000, 1000 , 0 }, … … 1913 1915 1914 1916 1915 /* ------------------------------------ corps des fonctions ------------------------------ */ 1916 1917 /* -------------------------------------------------------------------------------------------- */ 1918 1919 1920 1921 1922 1923 1924 1925 unsigned int4 val_long(char x) 1917 1918 1919 1920 1921 1922 1923 int calcul_somme_block(block_type_modele* blk,int longueur) 1926 1924 1927 1925 { 1928 1926 1929 unsigned long a,xl; 1930 1931 char aa; 1932 1933 aa=x-2; 1934 1935 a=aa; 1936 1937 if(x<3) xl=x; else xl=((a&1) + 2)<<(a>>1); 1938 1939 return(xl); 1927 int i,so=0;; 1928 1929 for(i=0;i<(longueur/4-4);i++) so^=(int)blk->mot[i]; 1930 1931 /* somme sur tous les mots internes : on exclus le dbut, les codes et la fin */ 1932 1933 return((so^(so>>16))&0xffff); 1940 1934 1941 1935 } … … 1945 1939 1946 1940 1947 double val_double(char x) 1941 1942 1943 1944 1945 void valide_block(block_type_modele* blk,int type,int block_num) 1948 1946 1949 1947 { 1950 1948 1951 unsigned long a,xl; 1952 1953 if(x<0) x=-x; a=x; if(!a) xl=0; else xl=((a&1) + 2)<<(a>>1); 1954 1955 if(x>0) return(1e-4*(double)xl); else return(-1e-4*(double)xl); 1949 int somme,longueur; 1950 1951 def_long_block 1952 1953 longueur=long_block[type]; 1954 1955 /*printf("valide block adresse %x type %d numblock %d longueur=%d \n" */ 1956 1957 /* ,(unsigned)blk,type,block_num,longueur);*/ 1958 1959 blk->debut = debut_block_mesure; 1960 1961 somme=0;blk->code1 = (((long)longueur)<<16) | somme; 1962 1963 blk->code2 = (((long)block_num) & 0xffffff ) | ( (((long)type)<<24)&0xff000000 ); 1964 1965 1966 1967 blk->mot[longueur/4-4] = fin_block_mesure; 1968 1969 1970 1971 #if defined(_ECC_LIB_H_) 1972 1973 { 1974 1975 int place_ecc; 1976 1977 place_ecc=(longueur-4-ECC_SIZE-SIZE_HEAD-((longueur-4-SIZE_HEAD)/ECC_TOTAL)*ECC_SIZE)/4; 1978 1979 SetEcc( blk, (unsigned char *) &(blk->mot[place_ecc] ) ) ; 1956 1980 1957 1981 } 1958 1982 1959 1960 1961 int new_val_dac(int a,char code) 1983 #endif 1984 1985 1986 1987 somme=calcul_somme_block(blk,longueur); 1988 1989 blk->code1 = (((long)longueur)<<16) | somme; 1990 1991 /* l'ecc est faux car on a change la somme: mettre la somme a zero avant de tester ecc */ 1992 1993 } 1994 1995 1996 1997 /* Quand on est sur une machine swappee, on ne cherche pas a verifier */ 1998 1999 /* le checksum, puisqu'on a modifie les blocs, sans swapper par exemple */ 2000 2001 /* les chars des noms de bolometres et des chaines GPS... */ 2002 2003 #ifdef __alpha 2004 2005 #define SWAP 2006 2007 #endif 2008 2009 #if defined(Linux) || defined(linux) 2010 2011 #define SWAP 2012 2013 #endif 2014 2015 2016 2017 2018 2019 2020 2021 int verifie_block(block_type_modele* blk) 1962 2022 1963 2023 { 1964 2024 1965 if(code&0x80) a=(code&0x7f) <<5 ; 1966 1967 else { 1968 1969 if(code&0x40) a+=code&0x3f; 1970 1971 else a-=code&0x3f; 2025 int type,lg,som; 2026 2027 def_long_block 2028 2029 if(blk->debut != debut_block_mesure) return(block_debut_erreur); 2030 2031 type=type_block(blk); if( (type<0) ||(type>=nb_type_blocks) ) return(block_type_inconnu); 2032 2033 lg=longueur_block(blk); if( lg != long_block[type] ) return(block_longueur_erreur); 2034 2035 if( blk->mot[(lg/4)-4] != fin_block_mesure) return(block_fin_erreur); 2036 2037 #ifndef SWAP 2038 2039 som=calcul_somme_block(blk,lg); if( som!= somme_block(blk)) return(block_somme_erreur); 2040 2041 #endif 2042 2043 return(block_correct); 2044 2045 } 2046 2047 2048 2049 2050 2051 int verifie_block_printf(block_type_modele* blk) 2052 2053 { 2054 2055 int type,lg,som; 2056 2057 def_long_block 2058 2059 def_nom_block 2060 2061 if(blk->debut != debut_block_mesure) 2062 2063 { 2064 2065 printf(" erreur dans le code debut de block \n"); 2066 2067 return(block_debut_erreur); 2068 2069 } 2070 2071 2072 2073 type=type_block(blk); 2074 2075 if( (type<0) || (type>nb_type_blocks) ) 2076 2077 { 2078 2079 printf(" block de type %d inconnu\n",type); 2080 2081 return(block_type_inconnu); 1972 2082 1973 2083 } 1974 2084 1975 return(a); 2085 2086 2087 lg=longueur_block(blk); 2088 2089 if( lg!=long_block[type] ) 2090 2091 { 2092 2093 printf(" block type %s erreur de longueur (nominal=%d , dans le block=%d \n" 2094 2095 ,nom_block[type],long_block[type],lg); 2096 2097 return(block_longueur_erreur); 2098 2099 } 2100 2101 2102 2103 som=calcul_somme_block(blk,lg); 2104 2105 if( som!=somme_block(blk) ) 2106 2107 { 2108 2109 printf(" block type %s : erreur de somme (calculee=%d , dans le block=%d \n" 2110 2111 ,nom_block[type],som,somme_block(blk) ); 2112 2113 return(block_somme_erreur); 2114 2115 } 2116 2117 2118 2119 if(blk->mot[(lg/4)-4] != fin_block_mesure) 2120 2121 { 2122 2123 printf(" block type %s erreur de code fin de block : trouve %x au lieu de %x \n" 2124 2125 ,nom_block[type],(int)blk->mot[(lg/4)-4],fin_block_mesure); 2126 2127 return(block_fin_erreur); 2128 2129 } 2130 2131 2132 2133 return(block_correct); 1976 2134 1977 2135 } … … 1985 2143 1986 2144 1987 int calcul_somme_block(block_type_modele* blk,int longueur) 1988 1989 { 1990 1991 int i,so=0;; 1992 1993 for(i=0;i<(longueur/4-4);i++) so^=(int)blk->mot[i]; 1994 1995 /* somme sur tous les mots internes : on exclus le dbut, les codes et la fin */ 1996 1997 return((so^(so>>16))&0xffff); 1998 1999 } 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 void valide_block(block_type_modele* blk,int type,int block_num) 2010 2011 { 2012 2013 int somme,longueur; 2014 2015 def_long_block 2016 2017 longueur=long_block[type]; 2018 2019 /*printf("valide block adresse %x type %d numblock %d longueur=%d \n" */ 2020 2021 /* ,(unsigned)blk,type,block_num,longueur);*/ 2022 2023 blk->debut = debut_block_mesure; 2024 2025 somme=0;blk->code1 = (((long)longueur)<<16) | somme; 2026 2027 blk->code2 = (((long)block_num) & 0xffffff ) | ( (((long)type)<<24)&0xff000000 ); 2028 2029 2030 2031 blk->mot[longueur/4-4] = fin_block_mesure; 2032 2033 2034 2035 #if defined(_ECC_LIB_H_) 2036 2037 { 2038 2039 int place_ecc; 2040 2041 place_ecc=(longueur-4-ECC_SIZE-SIZE_HEAD-((longueur-4-SIZE_HEAD)/ECC_TOTAL)*ECC_SIZE)/4; 2042 2043 SetEcc( blk, (unsigned char *) &(blk->mot[place_ecc] ) ) ; 2044 2045 } 2046 2047 #endif 2048 2049 2050 2051 somme=calcul_somme_block(blk,longueur); 2052 2053 blk->code1 = (((long)longueur)<<16) | somme; 2054 2055 /* l'ecc est faux car on a change la somme: mettre la somme a zero avant de tester ecc */ 2056 2057 } 2058 2059 2060 2061 /* Quand on est sur une machine swappee, on ne cherche pas a verifier */ 2062 2063 /* le checksum, puisqu'on a modifie les blocs, sans swapper par exemple */ 2064 2065 /* les chars des noms de bolometres et des chaines GPS... */ 2066 2067 #ifdef __alpha 2068 2069 #define SWAP 2070 2071 #endif 2072 2073 #if defined(Linux) || defined(linux) 2074 2075 #define SWAP 2076 2077 #endif 2078 2079 2080 2081 2082 2083 2084 2085 int verifie_block(block_type_modele* blk) 2086 2087 { 2088 2089 int type,lg,som; 2090 2091 def_long_block 2092 2093 if(blk->debut != debut_block_mesure) return(block_debut_erreur); 2094 2095 type=type_block(blk); if( (type<0) ||(type>=nb_type_blocks) ) return(block_type_inconnu); 2096 2097 lg=longueur_block(blk); if( lg != long_block[type] ) return(block_longueur_erreur); 2098 2099 if( blk->mot[(lg/4)-4] != fin_block_mesure) return(block_fin_erreur); 2100 2101 #ifndef SWAP 2102 2103 som=calcul_somme_block(blk,lg); if( som!= somme_block(blk)) return(block_somme_erreur); 2104 2105 #endif 2106 2107 return(block_correct); 2108 2109 } 2110 2111 2112 2113 2114 2115 int verifie_block_printf(block_type_modele* blk) 2116 2117 { 2118 2119 int type,lg,som; 2120 2121 def_long_block 2122 2123 def_nom_block 2124 2125 if(blk->debut != debut_block_mesure) 2126 2127 { 2128 2129 printf(" erreur dans le code debut de block \n"); 2130 2131 return(block_debut_erreur); 2132 2133 } 2134 2135 2136 2137 type=type_block(blk); 2138 2139 if( (type<0) || (type>nb_type_blocks) ) 2140 2141 { 2142 2143 printf(" block de type %d inconnu\n",type); 2144 2145 return(block_type_inconnu); 2146 2147 } 2148 2149 2150 2151 lg=longueur_block(blk); 2152 2153 if( lg!=long_block[type] ) 2154 2155 { 2156 2157 printf(" block type %s erreur de longueur (nominal=%d , dans le block=%d \n" 2158 2159 ,nom_block[type],long_block[type],lg); 2160 2161 return(block_longueur_erreur); 2162 2163 } 2164 2165 2166 2167 som=calcul_somme_block(blk,lg); 2168 2169 if( som!=somme_block(blk) ) 2170 2171 { 2172 2173 printf(" block type %s : erreur de somme (calculee=%d , dans le block=%d \n" 2174 2175 ,nom_block[type],som,somme_block(blk) ); 2176 2177 return(block_somme_erreur); 2178 2179 } 2180 2181 2182 2183 if(blk->mot[(lg/4)-4] != fin_block_mesure) 2184 2185 { 2186 2187 printf(" block type %s erreur de code fin de block : trouve %x au lieu de %x \n" 2188 2189 ,nom_block[type],(int)blk->mot[(lg/4)-4],fin_block_mesure); 2190 2191 return(block_fin_erreur); 2192 2193 } 2194 2195 2196 2197 return(block_correct); 2198 2199 } 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2145 2146
Note:
See TracChangeset
for help on using the changeset viewer.