| 1 |  | 
|---|
| 2 | /*======================================================================*/ | 
|---|
| 3 | /*                                                                      */ | 
|---|
| 4 | /*               archeops.h  :  structure de données                    */ | 
|---|
| 5 | /*                                                                      */ | 
|---|
| 6 | /*======================================================================*/ | 
|---|
| 7 |  | 
|---|
| 8 | #define         _archeops | 
|---|
| 9 | #define         version_num             28 | 
|---|
| 10 |  | 
|---|
| 11 | /*  defini ici que si l'on n'a pas inclu ecclib.h qui contient les memes definitions */ | 
|---|
| 12 | #ifndef _ECC_LIB_H_ | 
|---|
| 13 | #define ECC_TOTAL 255 | 
|---|
| 14 | #define ECC_DATA 239       /* Nb de bytes de data encodes */ | 
|---|
| 15 | #define ECC_SIZE (ECC_TOTAL-ECC_DATA) /* Nb de bytes encodeurs */ | 
|---|
| 16 | #define SIZE_HEAD sizeof(int4)*3  /* 3 mots d'entete de blocs */ | 
|---|
| 17 | #endif | 
|---|
| 18 |  | 
|---|
| 19 | /*======================================================================*/ | 
|---|
| 20 | /*                                                                      */ | 
|---|
| 21 | /*                      historique des modifications                    */ | 
|---|
| 22 | /*                                                                      */ | 
|---|
| 23 | /*                                                                      */ | 
|---|
| 24 | /*  VERSION 24:                                                         */ | 
|---|
| 25 | /*                                                                      */ | 
|---|
| 26 | /*      - utilise le fichier archeops.c                                 */ | 
|---|
| 27 | /*      - nb_max_bolo=24  avec nb_bolo_util=18                          */ | 
|---|
| 28 | /*      - change la structure du block param                            */ | 
|---|
| 29 | /*      - change la structure du block dilution                         */ | 
|---|
| 30 | /*                                                                      */ | 
|---|
| 31 | /*  VERSION 25:                                                         */ | 
|---|
| 32 | /*                                                                      */ | 
|---|
| 33 | /*      - la compression marche                                         */ | 
|---|
| 34 | /*      - 4 signaux synchro O.K.                                        */ | 
|---|
| 35 | /*      - change la structure dil : contient les temperatures           */ | 
|---|
| 36 | /*                                                                      */ | 
|---|
| 37 | /*  VERSION 26:                                                         */ | 
|---|
| 38 | /*                                                                      */ | 
|---|
| 39 | /*      - int4 pour compatibilité toutes machines                       */ | 
|---|
| 40 | /*                                                                      */ | 
|---|
| 41 | /*  VERSION 27:                                                         */ | 
|---|
| 42 | /*      - ajout dans chaque block-type d'une structure "ecc" dont la    */ | 
|---|
| 43 | /*      taille est adaptee a la taille du bloc:                         */ | 
|---|
| 44 | /*              on ajoute 16 bytes servant a la correction d'erreur     */ | 
|---|
| 45 | /*              pour chaque paquet de 241 bytes de donnees.             */ | 
|---|
| 46 | /*      les bytes d'ECC sont calcules avant envoi sur la ligne          */ | 
|---|
| 47 | /*      telemesure.                                                     */ | 
|---|
| 48 | /*      Ils peuvent servir a l'arrivee pour verifier et corriger quand  */ | 
|---|
| 49 | /*      c'est possible les donnees. On peut corriger au maximu 7 bytes  */ | 
|---|
| 50 | /*      erronnes.                                                       */ | 
|---|
| 51 | /*                                                                      */ | 
|---|
| 52 | /*  VERSION 28:                                                         */ | 
|---|
| 53 | /*      - corrigée la taille du block gyroscope avec ecc                */ | 
|---|
| 54 | /*      - compatible avec la generation de l'ecc dans le transputer     */ | 
|---|
| 55 | /*      - mais sans ecc: trops long a calculer                          */ | 
|---|
| 56 |  | 
|---|
| 57 | /*======================================================================*/ | 
|---|
| 58 |  | 
|---|
| 59 |  | 
|---|
| 60 | /*======================================================================*/ | 
|---|
| 61 | /*  ---------------  parametres generaux de definition   -------------  */ | 
|---|
| 62 | /*======================================================================*/ | 
|---|
| 63 | #ifndef int4 | 
|---|
| 64 | #ifdef __alpha | 
|---|
| 65 | #define int4 int | 
|---|
| 66 | #undef programme | 
|---|
| 67 | #else | 
|---|
| 68 | #define int4 long | 
|---|
| 69 | #endif | 
|---|
| 70 | #endif | 
|---|
| 71 |  | 
|---|
| 72 | #ifdef linux | 
|---|
| 73 | #undef programme | 
|---|
| 74 | #endif | 
|---|
| 75 |  | 
|---|
| 76 |  | 
|---|
| 77 | #ifdef  _planck | 
|---|
| 78 | #define _archeops | 
|---|
| 79 | #define _trapani | 
|---|
| 80 | #define _sans_transputer | 
|---|
| 81 | #endif | 
|---|
| 82 |  | 
|---|
| 83 | #ifdef  _archeops | 
|---|
| 84 | /*#define _test_diabolo  relecture des blocks fabriques avec diabolo    */ | 
|---|
| 85 | #define _trapani                /*  configuration  prevue pour Trapani  */ | 
|---|
| 86 | /*#define _kiruna                 block standard prevu pour kiruna      */ | 
|---|
| 87 | #endif | 
|---|
| 88 |  | 
|---|
| 89 |  | 
|---|
| 90 |  | 
|---|
| 91 | /*======================================================================*/ | 
|---|
| 92 | /*  --------------      valeurs des parametres dans     -------------   */ | 
|---|
| 93 | /*  --------------      les différentes configurations  -------------   */ | 
|---|
| 94 | /*======================================================================*/ | 
|---|
| 95 | /*                                                                      */ | 
|---|
| 96 | /*  configuration pour Trapani : 3 bebos  /  12 bolos                   */ | 
|---|
| 97 | /*                                                                      */ | 
|---|
| 98 | /*  bebo1 :   voies  1  à  6    -->  bolo  1 a  6                       */ | 
|---|
| 99 | /*  bebo2 :   voies  9  à  14   -->  bolo  7 à 12                       */ | 
|---|
| 100 | /*                                                                      */ | 
|---|
| 101 | /*  bebo6 :                                                             */ | 
|---|
| 102 | /*      voies  41 42 43 44      =  carte simplifiee avec AMP01          */ | 
|---|
| 103 | /*      voies  45 et 46         = chauffage pour regulation             */ | 
|---|
| 104 | /*      on ecrira plus tard le stockage des donnees simplifiees         */ | 
|---|
| 105 | /*                                                                      */ | 
|---|
| 106 | /*                                                                      */ | 
|---|
| 107 | /*======================================================================*/ | 
|---|
| 108 |  | 
|---|
| 109 | /*      nb_per_block    doit etre divisible par 2                                               */ | 
|---|
| 110 | /*      nb_max_bolo     doit etre divisible par 2 pour archeops   (impair pour diabolo ?? )     */ | 
|---|
| 111 | /*      nb_bolo_util    doit etre divisible par 2 pour archeops   (impair pour diabolo ?? )     */ | 
|---|
| 112 |  | 
|---|
| 113 |  | 
|---|
| 114 | #ifdef  _trapani | 
|---|
| 115 | #define nb_max_bolo             24      /*  nombre maxi de bolos                                */ | 
|---|
| 116 | #define nb_bolo_util            18      /*  nombre de bolos réellement transmis                 */ | 
|---|
| 117 | #define nb_per_block            36      /*  nombre de periodes entieres dans un block           */ | 
|---|
| 118 | #define nb_max_mes_per          88      /*  nb de points maxi dans une periode complete         */ | 
|---|
| 119 | #define nb_photo_diodes         46      /*  nb de canaux de mesure du senseur stellaire         */ | 
|---|
| 120 | #endif | 
|---|
| 121 |  | 
|---|
| 122 | #ifdef  _kiruna | 
|---|
| 123 | #define nb_max_bolo             36      /*  nombre maxi de bolos                                */ | 
|---|
| 124 | #define nb_bolo_util            32      /*  nombre de bolos réellement transmis                 */ | 
|---|
| 125 | #define nb_per_block            36      /*  nombre de periodes entieres dans un block           */ | 
|---|
| 126 | #define nb_max_mes_per          88      /*  nb de points maxi dans une periode complete         */ | 
|---|
| 127 | #define nb_photo_diodes         46      /*  nb de canaux de mesure du senseur stellaire         */ | 
|---|
| 128 | #endif | 
|---|
| 129 |  | 
|---|
| 130 |  | 
|---|
| 131 | #ifdef  _diabolo | 
|---|
| 132 | #define nb_max_bolo             9       /*  nombre maxi de bolos                                */ | 
|---|
| 133 | #define nb_bolo_util            9       /*  nombre de bolos réellement transmis                 */ | 
|---|
| 134 | #define nb_per_block            20      /*  nombre de periodes entieres dans un block           */ | 
|---|
| 135 | #define nb_max_mes_per          128     /*  nb de points maxi dans une periode complete         */ | 
|---|
| 136 | #define nb_photo_diodes         0       /*  nb de canaux de mesure du senseur stellaire         */ | 
|---|
| 137 | #endif | 
|---|
| 138 |  | 
|---|
| 139 | #ifdef  _test_diabolo | 
|---|
| 140 | #define nb_max_bolo             9       /*  nombre maxi de bolos                                */ | 
|---|
| 141 | #define nb_bolo_util            9       /*  nombre de bolos réellement transmis                 */ | 
|---|
| 142 | #define nb_per_block            20      /*  nombre de periodes entieres dans un block           */ | 
|---|
| 143 | #define nb_max_mes_per          128     /*  nb de points maxi dans une periode complete         */ | 
|---|
| 144 | #define nb_photo_diodes         0       /*  nb de canaux de mesure du senseur stellaire         */ | 
|---|
| 145 | #endif | 
|---|
| 146 |  | 
|---|
| 147 |  | 
|---|
| 148 | #ifdef  _sans_transputer | 
|---|
| 149 | #define nb_byte_mot             5       /*  nombre d'octets dans un mot d'acquisition planck    */ | 
|---|
| 150 | #else | 
|---|
| 151 | #define nb_byte_mot             8       /*  nombre d'octets dans un mot d'acquisition archeops  */ | 
|---|
| 152 | #endif | 
|---|
| 153 |  | 
|---|
| 154 | #define nb_max_nom_bolo         24      /*  nombre maxi de noms et coef bolo dans la table      */ | 
|---|
| 155 |  | 
|---|
| 156 | #define nb_sync                 4       /*  nombre de signaux de synchro                        */ | 
|---|
| 157 | /*  6 pour diabolo                                      */ | 
|---|
| 158 | /* toujours multiple de 4 pour archeops                 */ | 
|---|
| 159 | #define nb_element_catalog      256     /* nombre d'éléments catalog par reponse enregistreur   */ | 
|---|
| 160 |  | 
|---|
| 161 |  | 
|---|
| 162 | #ifdef  transmet_data_brute | 
|---|
| 163 | #define         taille_maxi_block_archeops      sizeof(block_type_data_brute) | 
|---|
| 164 | #else                                   /*      le plus gros des différents blocks de télémesure*/ | 
|---|
| 165 | #define         taille_maxi_block_archeops      sizeof(block_type_bolo) | 
|---|
| 166 | #endif | 
|---|
| 167 |  | 
|---|
| 168 | #define         nombre_de_regul         4 | 
|---|
| 169 | #define         nombre_de_voies         6 | 
|---|
| 170 | #define         nb_type_blocks          20      /*  nombre de type de blocks (multiple de 4)    */ | 
|---|
| 171 | #define         nb_modes_telemesure     10 | 
|---|
| 172 | #define         nb_modes_flash           3 | 
|---|
| 173 |  | 
|---|
| 174 | /*======================================================================*/ | 
|---|
| 175 | /*  -------     codes  de  controle  pour  la  transmission    -----    */ | 
|---|
| 176 | /*=======================   télécommande      ==========================*/ | 
|---|
| 177 | /*======================================================================*/ | 
|---|
| 178 |  | 
|---|
| 179 |  | 
|---|
| 180 | /*   --------------   codes de reconnaissance des paquets de télécommande       --------------   */ | 
|---|
| 181 |  | 
|---|
| 182 | #define         debut_telecommande              0x23456789 | 
|---|
| 183 | #define         fin_telecommande                0x98765432 | 
|---|
| 184 |  | 
|---|
| 185 | /*   ------------ codes de direction des commandes envoyées a l'EPLD Archeops   --------------   */ | 
|---|
| 186 |  | 
|---|
| 187 | #define         tc_dir_transputer               1 | 
|---|
| 188 | #define         tc_dir_reset_epld               3 | 
|---|
| 189 | #define         tc_dir_reset_trp                4 | 
|---|
| 190 |  | 
|---|
| 191 | /*  -------------  codes  des  prefix des  telecommandes traités le transputer  --------------   */ | 
|---|
| 192 |  | 
|---|
| 193 | #define         tc_horloge                      255     /* (-1) */ | 
|---|
| 194 | #define         tc_cadence1                     128 | 
|---|
| 195 | #define         tc_cadence2                     129 | 
|---|
| 196 | #define         tc_cadence3                     130 | 
|---|
| 197 | #define         tc_regul                        251     /* (-5) */ | 
|---|
| 198 | #define         tc_switch_dil                   250 | 
|---|
| 199 | #define         tc_dac_dil                      249 | 
|---|
| 200 |  | 
|---|
| 201 | /*======================================================================*/ | 
|---|
| 202 | /*      telecommande reduite  sur 18 bit                                */ | 
|---|
| 203 | /*======================================================================*/ | 
|---|
| 204 |  | 
|---|
| 205 | /*______________________________________________________________________________________________*/ | 
|---|
| 206 | /*      1er mot :       code de debut de telecommande reduite                                   */ | 
|---|
| 207 | #define         tc_reduite                      248 | 
|---|
| 208 | /*______________________________________________________________________________________________*/ | 
|---|
| 209 | /*      2eme mot:       4bit:   16 codes  de direction  tc2                                     */ | 
|---|
| 210 | enum{tc2_reset_epld,tc2_bolo_dacV,tc2_bolo_dacI,tc2_bolo_dacT | 
|---|
| 211 | ,tc2_bolo_dacL,tc2_bolo_gain,tc2_bolo_voie,tc2_horloge | 
|---|
| 212 | ,tc2_regul,tc2_auto_bolo,tc2_auto_dilu,tc2_dilution | 
|---|
| 213 | ,tc2_raz_fet,tc2_reset};        /* 13 codes: reste 3 disponibles*/ | 
|---|
| 214 |  | 
|---|
| 215 |  | 
|---|
| 216 | /*______________________________________________________________________________________________*/ | 
|---|
| 217 | /*      3eme mot:       6bit:                                                                   */ | 
|---|
| 218 |  | 
|---|
| 219 | /*      code2=dac-gain-voie     :       numero de bolo                                          */ | 
|---|
| 220 |  | 
|---|
| 221 | /*      code2=tc2_horloge       :                                                               */ | 
|---|
| 222 | /*              soit un code defini                                                             */ | 
|---|
| 223 | enum{tc3_commande,tc3_periode,tc3_nb_mesures,tc3_temp_mort,tc3_flag}; | 
|---|
| 224 |  | 
|---|
| 225 |  | 
|---|
| 226 | /*      code2=tc2_regul :                                                                       */ | 
|---|
| 227 |  | 
|---|
| 228 |  | 
|---|
| 229 | /*      code2=tc2_auto_bolo     :                                               */ | 
|---|
| 230 |  | 
|---|
| 231 |  | 
|---|
| 232 | /*      code2=tc2_auto_dilu     :                                               */ | 
|---|
| 233 | /*      les valeurs des parametres d'auto_dilu ne depassent pas 128             */ | 
|---|
| 234 |  | 
|---|
| 235 |  | 
|---|
| 236 | /*      code2=tc2_dilution      :       commandes setbit,clrbit                                                 */ | 
|---|
| 237 | enum{tc3_clr_bit_dil,tc3_set_bit_dil,tc3_fet_raz}; | 
|---|
| 238 |  | 
|---|
| 239 | /*      code2=tc2_reset :       commandes setbit,clrbit                                                 */ | 
|---|
| 240 | #define tc3_reset       13 | 
|---|
| 241 | #define tc4_reset       73 | 
|---|
| 242 |  | 
|---|
| 243 | /*______________________________________________________________________________*/ | 
|---|
| 244 | /*      4eme mot:       8bit:   valeur a ecrire                 */ | 
|---|
| 245 |  | 
|---|
| 246 |  | 
|---|
| 247 | /*======================================================================*/ | 
|---|
| 248 | /*  -------     codes  de  controle  pour  la  transmission    -----    */ | 
|---|
| 249 | /*=========================   télémesure    ============================*/ | 
|---|
| 250 | /*======================================================================*/ | 
|---|
| 251 |  | 
|---|
| 252 | /*   -------   codes de reconnaissance des paquets de télémesure        */ | 
|---|
| 253 |  | 
|---|
| 254 | #define         debut_block_mesure              0x45627491 | 
|---|
| 255 | #define         fin_block_mesure                0x83260432 | 
|---|
| 256 |  | 
|---|
| 257 |  | 
|---|
| 258 |  | 
|---|
| 259 |  | 
|---|
| 260 |  | 
|---|
| 261 | /*======================================================================*/ | 
|---|
| 262 | /*  ------------------------------------------------------------------  */ | 
|---|
| 263 | /*  ---------   Les  formats  des  blocks  type   ARCHEOPS      ------- */ | 
|---|
| 264 | /*  ------------------------------------------------------------------  */ | 
|---|
| 265 | /*======================================================================*/ | 
|---|
| 266 |  | 
|---|
| 267 |  | 
|---|
| 268 |  | 
|---|
| 269 | /*==============================================================================================*/ | 
|---|
| 270 |  | 
|---|
| 271 | /*      Le tableau est lut dans le desordre par le mac en lecture de la carte pci :             */ | 
|---|
| 272 |  | 
|---|
| 273 | /*      Les entiers long sont ecrits tels quels                                                 */ | 
|---|
| 274 | /*      Les short sont ecrits permuté 2 a 2 par le tansputer                                    */ | 
|---|
| 275 | /*      Les tables char sont ecrits permuté 4 / 4 par le transputer                             */ | 
|---|
| 276 | /*      A la lecture dans le mac, tout est bon                                                  */ | 
|---|
| 277 |  | 
|---|
| 278 |  | 
|---|
| 279 | /*  ---------    structures N° 0 :   parametres de mesure des bolometres        -------------   */ | 
|---|
| 280 | /*  -----------------------------------------------------------------------------------------   */ | 
|---|
| 281 |  | 
|---|
| 282 | typedef struct | 
|---|
| 283 | { | 
|---|
| 284 | int4            numero_nom_coef;        /*  le numero pour retrouver le nom et les coef */ | 
|---|
| 285 | int4            bolo_code_util;         /*  le code d'utilisation du bolo               */ | 
|---|
| 286 | int4            bolo_bebo;              /*  l'acquisition:  0 pour MLPA 10 pour BEBODIFF*/ | 
|---|
| 287 | int4            bolo_num;               /*  l'adresse hard du bolo                      */ | 
|---|
| 288 | int4            bolo_gain;              /*  le gain du preampli                         */ | 
|---|
| 289 | int4            bolo_capa;              /*  la valeur capa du modulateur                */ | 
|---|
| 290 | int4            bolo_diviseur;          /*  le diviseur de la compensation              */ | 
|---|
| 291 | } | 
|---|
| 292 | param_un_bolo; | 
|---|
| 293 |  | 
|---|
| 294 |  | 
|---|
| 295 | typedef struct | 
|---|
| 296 | { | 
|---|
| 297 | char            bolo_nom[32];           /*  le nom de chaque bolometre                  */ | 
|---|
| 298 | int4            coef[7];                /*  les coef pour le calcul de la température   */ | 
|---|
| 299 | } | 
|---|
| 300 | nom_et_coef_bolo; | 
|---|
| 301 |  | 
|---|
| 302 |  | 
|---|
| 303 |  | 
|---|
| 304 | /* code_util des bolos  */ | 
|---|
| 305 | enum{bolo_hors_service,bolo_normal_transmis,bolo_normal_non_transmis,bolo_thermo_simplifie}; | 
|---|
| 306 |  | 
|---|
| 307 |  | 
|---|
| 308 | typedef struct          /*              table des parametres de mesure bolometre                */ | 
|---|
| 309 | /*      cette table ne change pas (en principe) en cours de mesure      */ | 
|---|
| 310 | { | 
|---|
| 311 | int4            numero_version;                 /*  numero de version du header archeops.h      */ | 
|---|
| 312 | int4            n_max_bolo;                     /*  nombre maxi de bolos  (divisible par 4)     */ | 
|---|
| 313 | int4            n_per_block;                    /*  nombre de periodes entieres dans un block   */ | 
|---|
| 314 | int4            n_max_mes_per;                  /*  nb de points maxi dans une periode complete */ | 
|---|
| 315 |  | 
|---|
| 316 | int4            nb_bolo;                        /*  nombre de bolometres effectivement lut      */ | 
|---|
| 317 | param_un_bolo   bolo[nb_max_bolo]; | 
|---|
| 318 | nom_et_coef_bolo nom_coef[nb_max_nom_bolo];     /*  nombre de nom et coef bolo                  */ | 
|---|
| 319 | } | 
|---|
| 320 | param_bolo; | 
|---|
| 321 |  | 
|---|
| 322 |  | 
|---|
| 323 |  | 
|---|
| 324 |  | 
|---|
| 325 | /* | 
|---|
| 326 | int4            bolo_code_util[nb_max_bolo]; | 
|---|
| 327 | char            bolo_nom[nb_max_bolo][32]; | 
|---|
| 328 |  | 
|---|
| 329 | int4            bolo_bebo[nb_max_bolo]; | 
|---|
| 330 | int4            bolo_num[nb_max_bolo]; | 
|---|
| 331 | int4            bolo_gain[nb_max_bolo]; | 
|---|
| 332 |  | 
|---|
| 333 | int4            bolo_capa[nb_max_bolo]; | 
|---|
| 334 | int4            bolo_diviseur[nb_max_bolo]; | 
|---|
| 335 |  | 
|---|
| 336 | int4            coef[nb_max_bolo][7]; | 
|---|
| 337 |  | 
|---|
| 338 | int4            presence_bebo; | 
|---|
| 339 | } | 
|---|
| 340 | param_bolo; | 
|---|
| 341 | */ | 
|---|
| 342 |  | 
|---|
| 343 | typedef struct                          /*      La structure de transfert transputer vers mac   */ | 
|---|
| 344 | { | 
|---|
| 345 | int4            debut;          /*      code de reconnaissance de debut de block        */ | 
|---|
| 346 | int4            code1;          /*      code1 du block                                  */ | 
|---|
| 347 | int4            code2;          /*      code2 du block                                  */ | 
|---|
| 348 |  | 
|---|
| 349 | param_bolo      param;          /*      les parametres de mesure des bolometres         */ | 
|---|
| 350 | #ifdef _ECC_LIB_H_ | 
|---|
| 351 | unsigned char ecc[((((sizeof( param_bolo)+SIZE_HEAD)/ECC_DATA)+1)*ECC_SIZE)] ; | 
|---|
| 352 | #endif | 
|---|
| 353 | int4            fin;            /*      code de reconnaissance de fin de block          */ | 
|---|
| 354 | } | 
|---|
| 355 | block_type_param; | 
|---|
| 356 |  | 
|---|
| 357 |  | 
|---|
| 358 |  | 
|---|
| 359 |  | 
|---|
| 360 | /*  -------------------   structures N° 1 :   journal de bord        ---------------------      */ | 
|---|
| 361 | /*  -----------------------------------------------------------------------------------------   */ | 
|---|
| 362 | #define long_page       10 | 
|---|
| 363 | typedef struct | 
|---|
| 364 | { | 
|---|
| 365 | int4            code2;          /*      code de la ligne du journal                     */ | 
|---|
| 366 | /*      code idem code2 debut de block :                */ | 
|---|
| 367 | /*      contient un code de commande                    */ | 
|---|
| 368 | /*      et le numero du block lors de la télécommande   */ | 
|---|
| 369 | char            mot[8];         /*      contenu de la ligne du  journal                 */ | 
|---|
| 370 | } | 
|---|
| 371 | ligne_journal; | 
|---|
| 372 |  | 
|---|
| 373 |  | 
|---|
| 374 | typedef struct | 
|---|
| 375 | { | 
|---|
| 376 | int4            debut;          /*      code de reconnaissance de debut de block        */ | 
|---|
| 377 | int4            code1;          /*      code1 du block                                  */ | 
|---|
| 378 | int4            code2;          /*      code2 du block                                  */ | 
|---|
| 379 |  | 
|---|
| 380 | ligne_journal   jj[long_page];  /*      block de 10 lignes de journal                   */ | 
|---|
| 381 | #ifdef _ECC_LIB_H_ | 
|---|
| 382 | unsigned char ecc[((((sizeof(ligne_journal)*long_page+SIZE_HEAD)/ECC_DATA)+1)*ECC_SIZE)] ; | 
|---|
| 383 | #endif | 
|---|
| 384 |  | 
|---|
| 385 | int4            fin;            /*      code de reconnaissance de fin de block          */ | 
|---|
| 386 | } | 
|---|
| 387 | block_type_journal; | 
|---|
| 388 |  | 
|---|
| 389 |  | 
|---|
| 390 | /*  ---------   structures N° 2 :  reglage_bolo , regul etc..   --------        */ | 
|---|
| 391 | /*  ------------------------------------------------------------------------------------------  */ | 
|---|
| 392 | #define bol_micro_volt(val,gain)        ((1e7*(double)val)/(65536.*gain)) | 
|---|
| 393 | /*  avec  gain = (double)parametr.bolo[bolo].bolo_gain*gain_ampli(reglage.bolo[bolo])                           */ | 
|---|
| 394 |  | 
|---|
| 395 |  | 
|---|
| 396 | /* gains 0 .. 15 pour MLPA  ///   gain 16..19  pour BEBO   ///   gain 20..22  pour BEDIF        */ | 
|---|
| 397 | #define def_gains       double gains_reels[32]={1,2,4,8,10,20,40,80,100,200,400,800,1000,2000,4000,8000,0.5,2.5,10,50,0.93,3.777,18.974}; | 
|---|
| 398 | /*                      gain bediff    10->9.3    40->37.77     200->189.74             */ | 
|---|
| 399 |  | 
|---|
| 400 |  | 
|---|
| 401 | /*  les definitions suivantes s'appliquent a une variable de type    reglage.bolo[bol]          */ | 
|---|
| 402 | #define         gainbrut(aa)    ((char)(((aa).mot1&0x1f))) | 
|---|
| 403 | #define         gain_ampli(aa)  gains_reels[gainbrut(aa)] | 
|---|
| 404 | #define         phase(aa)       ((char)(((aa).mot1&0x60)>>5)) | 
|---|
| 405 | #define         comm(aa)        ((char)(((aa).mot1&0x80)>>7)) | 
|---|
| 406 | #define         dac_V(aa)       ((int)(((aa).mot1&0xfff00)>>8)  ) | 
|---|
| 407 | #define         dac_I(aa)       ((int)(((aa).mot1&0xfff00000)>>20)) | 
|---|
| 408 |  | 
|---|
| 409 | #define         voie(aa)        ((char)(((aa).mot2&0xff))) | 
|---|
| 410 | #define         dac_T(aa)       ((int)(((aa).mot2&0xfff00)>>8)) | 
|---|
| 411 | #define         dac_L(aa)       ((int)(((aa).mot2&0xfff00000)>>20)) | 
|---|
| 412 |  | 
|---|
| 413 | /* | 
|---|
| 414 | #define         bolo_mot1(dacV,dacI,gainbrut,phase,comm)        ((gainbrut)&0x1f) | (((phase)&3)<<5) | (((comm)&1)<<7) | (((dacV)&0xfff)<<8) | (((dacI)&0xfff)<<20) | 
|---|
| 415 | #define         bolo_mot2(dacT,dacL,voie)                       ((voie)&0xff)     | (((dacT)&0xfff)<<8) | (((dacL)&0xfff)<<20) | 
|---|
| 416 | */ | 
|---|
| 417 |  | 
|---|
| 418 | #define         bolo_mot1(dacV,dacI,gainbrut,phase,comm)        (((long)(gainbrut))&0x1f) | ((((long)(phase))&3)<<5) | ((((long)(comm))&1)<<7) | ((((long)(dacV))&0xfff)<<8) | ((((long)(dacI))&0xfff)<<20) | 
|---|
| 419 | #define         bolo_mot2(dacT,dacL,voie)                       (((long)(voie))&0xff)     | ((((long)(dacT))&0xfff)<<8) | ((((long)(dacL))&0xfff)<<20) | 
|---|
| 420 |  | 
|---|
| 421 |  | 
|---|
| 422 | typedef struct | 
|---|
| 423 | { | 
|---|
| 424 | int4    mot1;           /*  dac1 = mot[11..0]; dac2=mot1[23..12]        */ | 
|---|
| 425 | /*  gain = mot1[27..24]; phase = mot1[31..28];  */ | 
|---|
| 426 | int4    mot2;           /*  dac3 = mot[11..0]; dac4=mot1[23..12]        */ | 
|---|
| 427 | /*  voie pour reglages auto  = mot2[31..24];    */ | 
|---|
| 428 | } | 
|---|
| 429 | reglage_un_bolo; | 
|---|
| 430 |  | 
|---|
| 431 |  | 
|---|
| 432 |  | 
|---|
| 433 | #ifdef programme        /***********   structure normale pour le mac   ****************/ | 
|---|
| 434 |  | 
|---|
| 435 | typedef struct | 
|---|
| 436 | { | 
|---|
| 437 | char    periode; | 
|---|
| 438 | char    nb_mesures; | 
|---|
| 439 | char    temp_mort; | 
|---|
| 440 | char    flag; | 
|---|
| 441 | } | 
|---|
| 442 | Horloge; | 
|---|
| 443 |  | 
|---|
| 444 | typedef struct | 
|---|
| 445 | { | 
|---|
| 446 | char    mode;                   /*   on_off et deglitch                         */ | 
|---|
| 447 | char    num_bolo;               /*   numero du bolo utilisé,    */ | 
|---|
| 448 | char    voie_chauf;             /*   la voie de sortie chauffage                */ | 
|---|
| 449 | char    prop;                   /*   zero dans prop -> chauffage=0;             */ | 
|---|
| 450 | char    integ; | 
|---|
| 451 | char    deriv; | 
|---|
| 452 | short   chauffage;              /*      valeur effective du chauffage           */ | 
|---|
| 453 | } | 
|---|
| 454 | regul_bolo;                     /*  longueur 2 entiers int4                     */ | 
|---|
| 455 |  | 
|---|
| 456 | typedef struct | 
|---|
| 457 | { | 
|---|
| 458 | char    mode; | 
|---|
| 459 | char    gain; | 
|---|
| 460 | char    courant; | 
|---|
| 461 | char    delai; | 
|---|
| 462 | } | 
|---|
| 463 | auto_bolo;                      /*  longueur 1 entiers int4                     */ | 
|---|
| 464 |  | 
|---|
| 465 | typedef struct | 
|---|
| 466 | { | 
|---|
| 467 | char    vanne; | 
|---|
| 468 | char    helium; | 
|---|
| 469 | char    chauffage; | 
|---|
| 470 | char    piles; | 
|---|
| 471 | char    transmission; | 
|---|
| 472 | char    temps_max_vanne; | 
|---|
| 473 | char    xx7; | 
|---|
| 474 | char    xx8; | 
|---|
| 475 | } | 
|---|
| 476 | auto_dilu;                      /*  longueur 1 entiers int4             */ | 
|---|
| 477 |  | 
|---|
| 478 |  | 
|---|
| 479 |  | 
|---|
| 480 | #else           /***********  structure swappée pour le transputer   ****************/ | 
|---|
| 481 |  | 
|---|
| 482 | typedef struct | 
|---|
| 483 | { | 
|---|
| 484 | char    flag; | 
|---|
| 485 | char    temp_mort; | 
|---|
| 486 | char    nb_mesures; | 
|---|
| 487 | char    periode; | 
|---|
| 488 | } | 
|---|
| 489 | Horloge; | 
|---|
| 490 |  | 
|---|
| 491 |  | 
|---|
| 492 | typedef struct | 
|---|
| 493 | { | 
|---|
| 494 | char    prop;                   /*   zero dans prop -> chauffage=0;             */ | 
|---|
| 495 | char    voie_chauf;             /*   la voie de sortie chauffage                */ | 
|---|
| 496 | char    num_bolo;               /*   numero du bolo utilisé,    */ | 
|---|
| 497 | char    mode;                   /*   on_off et deglitch                         */ | 
|---|
| 498 | short   chauffage;              /*      valeur effective du chauffage           */ | 
|---|
| 499 | char    deriv; | 
|---|
| 500 | char    integ; | 
|---|
| 501 | } | 
|---|
| 502 | regul_bolo;                     /*  longueur 2 entiers int4             */ | 
|---|
| 503 |  | 
|---|
| 504 |  | 
|---|
| 505 | typedef struct | 
|---|
| 506 | { | 
|---|
| 507 | char    delai; | 
|---|
| 508 | char    courant; | 
|---|
| 509 | char    gain; | 
|---|
| 510 | char    mode; | 
|---|
| 511 | } | 
|---|
| 512 | auto_bolo;                      /*  longueur 1 entiers int4             */ | 
|---|
| 513 |  | 
|---|
| 514 | typedef struct | 
|---|
| 515 | { | 
|---|
| 516 | char    piles; | 
|---|
| 517 | char    chauffage; | 
|---|
| 518 | char    helium;                 /* periode de mesure            */ | 
|---|
| 519 | char    vanne; | 
|---|
| 520 | char    xx8; | 
|---|
| 521 | char    xx7; | 
|---|
| 522 | char    temps_max_vanne; | 
|---|
| 523 | char    transmission; | 
|---|
| 524 | } | 
|---|
| 525 | auto_dilu;                      /*  longueur 1 entiers int4             */ | 
|---|
| 526 |  | 
|---|
| 527 |  | 
|---|
| 528 | #endif          /***********   fin des structures swappées       ****************/ | 
|---|
| 529 |  | 
|---|
| 530 | enum{regul_stop,regul_chauffage_null,regul_sans_deglitch,regul_avec_deglitch,stop_moteur,moteur_direct_p,moteur_regul_p,moteur_direct_m,moteur_regul_m}; | 
|---|
| 531 |  | 
|---|
| 532 | #define bit_piles_5V    1 | 
|---|
| 533 | #define bit_piles_15V   2 | 
|---|
| 534 | #define bit_piles_auto  4 | 
|---|
| 535 |  | 
|---|
| 536 | enum{vanne_zero,vanne_rien,vanne_ferme,vanne_ouvre,vanne_auto_pression,vanne_auto_P_T}; | 
|---|
| 537 | /*enum{trans_zero,trans_rien,trans_normal,trans_rapide,trans_lent};*/ | 
|---|
| 538 | enum{helium_zero,helium_continu,helium_40s,helium_400s}; | 
|---|
| 539 |  | 
|---|
| 540 |  | 
|---|
| 541 | typedef struct                                                  /*  int4 en mot de 32 bit       */ | 
|---|
| 542 | { | 
|---|
| 543 | Horloge                 horloge;                        /*                      1       */ | 
|---|
| 544 | reglage_un_bolo         bolo[nb_max_bolo];              /*      18 * 2  =       36      */ | 
|---|
| 545 | auto_bolo               autom[nombre_de_voies];         /*      6  * 1          6       */ | 
|---|
| 546 | regul_bolo              regul[nombre_de_regul];         /*      4  * 2  =       8       */ | 
|---|
| 547 | auto_dilu               dilu;                           /*                      2       */ | 
|---|
| 548 | } | 
|---|
| 549 | reglage_bolo;                                           /*      total 58                */ | 
|---|
| 550 |  | 
|---|
| 551 |  | 
|---|
| 552 | typedef struct | 
|---|
| 553 | { | 
|---|
| 554 | int4            debut;          /*      code de reconnaissance de debut de block        */ | 
|---|
| 555 | int4            code1;          /*      code1 du block                                  */ | 
|---|
| 556 | int4            code2;          /*      code2 du block                                  */ | 
|---|
| 557 | reglage_bolo    reglage; | 
|---|
| 558 | #ifdef _ECC_LIB_H_ | 
|---|
| 559 | unsigned char ecc[((((sizeof(reglage_bolo)+SIZE_HEAD)/ECC_DATA)+1)*ECC_SIZE)] ; | 
|---|
| 560 | #endif | 
|---|
| 561 | int4            fin;            /*      code de reconnaissance de fin de block          */ | 
|---|
| 562 | } | 
|---|
| 563 | block_type_reglage; | 
|---|
| 564 |  | 
|---|
| 565 | /*  ---------------------   structures N° 3 :    etat de la dilution    ----------------------- */ | 
|---|
| 566 | /*  ------------------------------------------------------------------------------------------- */ | 
|---|
| 567 | typedef struct | 
|---|
| 568 | { | 
|---|
| 569 | int4            debut;          /*      code de reconnaissance de debut de block        */ | 
|---|
| 570 | int4            code1;          /*      code1 du block                                  */ | 
|---|
| 571 | int4            code2;          /*      code2 du block                                  */ | 
|---|
| 572 | int4            switch_dil; | 
|---|
| 573 | int4            ADC_dil[48];    /*      la lecture des 48 ADC de la carte DIL           */ | 
|---|
| 574 | int4            DAC_dil[4];     /*      les 4 dac de la carte dilution                  */ | 
|---|
| 575 | int4            DAC_sst[4];     /*      les 4 dac de la carte sst                       */ | 
|---|
| 576 | int4            temperature[4]; /*      valeurs lues sur cartes BEDIFF modifiees        */ | 
|---|
| 577 | /*      int4            gyro_dil[3][nb_per_block*2];    les gyros  (block gyros)                */ | 
|---|
| 578 | /*      int4            data_dil[50];    data brutes de la dilution                             */ | 
|---|
| 579 | #ifdef _ECC_LIB_H_ | 
|---|
| 580 | unsigned char ecc[((((sizeof(int4)*64+SIZE_HEAD)/ECC_DATA)+1)*ECC_SIZE)] ; | 
|---|
| 581 | #endif | 
|---|
| 582 | int4            fin;            /*      code de reconnaissance de fin de block          */ | 
|---|
| 583 | } | 
|---|
| 584 | block_type_dilution; | 
|---|
| 585 |  | 
|---|
| 586 |  | 
|---|
| 587 | /*      signification des bit lus dans switch_dil       */ | 
|---|
| 588 | #define switch_EVF              0x00000080      /*      contact fin de course vanne fermee      */ | 
|---|
| 589 | #define switch_EVO              0x00000040      /*      contact fin de course vanne ouverte     */ | 
|---|
| 590 |  | 
|---|
| 591 | /* les bit suivants sont envoyés par telecommande et relus dans switch_dil      */ | 
|---|
| 592 | #define switch_helium           0x00200000      /*  13: commande sond niveau helium     */ | 
|---|
| 593 | #define switch_pile_par_5       0x00100000      /*  12: mise en parallele des piles pour le 5V  */ | 
|---|
| 594 | #define switch_pile_par_15      0x00080000      /*  11: mise en parallele des piles pour le 15V */ | 
|---|
| 595 | #define vanne_EVB               0x00008000      /*  7: commande vanne brooks    */ | 
|---|
| 596 | #define vanne_EVO               0x00010000      /*  8: commande vanne EVO       */ | 
|---|
| 597 | #define vanne_EVV               0x00020000      /*  9: commande vanne EVV       */ | 
|---|
| 598 | #define vanne_EVF               0x00040000      /*  10: commande vanne EVF      */ | 
|---|
| 599 | #define chauffage1              0x00004000      /*  6: chauffage 1      */ | 
|---|
| 600 | #define chauffage2              0x00002000      /*  5: chauffage 1      */ | 
|---|
| 601 | #define chauffage3              0x00001000      /*  4: chauffage 1      */ | 
|---|
| 602 | #define chauffage4              0x00000800      /*  3: chauffage 1      */ | 
|---|
| 603 | #define chauffage5              0x00000400      /*  2: chauffage 1      */ | 
|---|
| 604 | #define chauffage6              0x00000200      /*  1: chauffage 1      */ | 
|---|
| 605 | #define chauffage7              0x00000100      /*  0: chauffage 7      */ | 
|---|
| 606 |  | 
|---|
| 607 | enum{nbit_chauffage7,nbit_chauffage6,nbit_chauffage5,nbit_chauffage4,nbit_chauffage3 | 
|---|
| 608 | ,nbit_chauffage2,nbit_chauffage1,nbit_vanne_EVB,nbit_vanne_EVO | 
|---|
| 609 | ,nbit_vanne_EVV,nbit_vanne_EVF,nbit_switch_pile_par_15,nbit_switch_pile_par_5,nbit_switch_helium}; | 
|---|
| 610 |  | 
|---|
| 611 | /*  position des mesures sur les multiplexeurs          */ | 
|---|
| 612 | /* J10A  ->  temperatures basses t_b1 t_b2,t_b3 t_b4 36 37 41 35        */ | 
|---|
| 613 | /* J10B  ->  temperatures basses t_a1 t_a2,t_a3 t_a4 38 11 34 28        */ | 
|---|
| 614 | /* J1??  ->  temperatures hautes t_h1 t_h2,t_h3 t_h4    */ | 
|---|
| 615 |  | 
|---|
| 616 | enum{ | 
|---|
| 617 | /* multiplex11..18:*/   t_a2    ,mul12_ ,p_haut ,p_memb ,t_h1   ,t_h4   ,t_h3   ,t_h2 | 
|---|
| 618 | /* multiplex21..28:*/,  mul21_  ,mul22  ,p_charb,p_R4   ,mul25_ ,p_C3   ,p_R3   ,t_a4 | 
|---|
| 619 | /* multiplex31..38:*/,  mul31_  ,p_C4   ,p_air  ,t_a3   ,t_b4   ,t_b1   ,t_b2   ,t_a1 | 
|---|
| 620 | /* multiplex41..48:*/,  t_b3    ,d_4He  ,RP_He  ,t_pile ,d_3He  ,j_he3  ,j_he7  ,j_he4 | 
|---|
| 621 | /* multiplex51..58:*/,  j_he5   ,j_he1  ,j_he8  ,j_he2  ,j_he6  ,pirani ,mul57  ,mul58 | 
|---|
| 622 | /* multiplex61..68:*/,  p_m18B  ,p_10B  ,p_m18D ,mul64  ,p_p18B ,p_10T  ,p_Ch   ,p_p18D | 
|---|
| 623 | }; | 
|---|
| 624 | /* reste libres :  mul   12 - 21 - 22 - 25 -  31 - 44 - 57 - 58 - 64    */ | 
|---|
| 625 | /* T_A1 EST AUSSI LE DRIVER DU MOTEUR DE PIVOT   */ | 
|---|
| 626 |  | 
|---|
| 627 | #define  val_multiplex(qq)      (0.0003052*(double)((qq)-0x8000)) | 
|---|
| 628 | #define  val_temperature(qq)    ((val_multiplex(qq)<0.2)?-99:((1146.3/(val_multiplex(qq)-0.1)) - 245.13)) | 
|---|
| 629 |  | 
|---|
| 630 |  | 
|---|
| 631 | /*  ---------------------   structures N° 4 :     gps           ------------------------------- */ | 
|---|
| 632 | /*  ------------------------------------------------------------------------------------------- */ | 
|---|
| 633 |  | 
|---|
| 634 | #define GPS_DATA 80 | 
|---|
| 635 | typedef struct | 
|---|
| 636 | { | 
|---|
| 637 | int4            debut;          /*      code de reconnaissance de debut de block        */ | 
|---|
| 638 | int4            code1;          /*      code1 du block                                  */ | 
|---|
| 639 | int4            code2;          /*      code2 du block                                  */ | 
|---|
| 640 |  | 
|---|
| 641 | char            gps[GPS_DATA];  /*      les données GPS (une chaine maxi 80 cara)       */ | 
|---|
| 642 | #ifdef _ECC_LIB_H_ | 
|---|
| 643 | unsigned char ecc[((((GPS_DATA+SIZE_HEAD)/ECC_DATA)+1)*ECC_SIZE)] ; | 
|---|
| 644 | #endif | 
|---|
| 645 |  | 
|---|
| 646 | int4            fin;            /*      code de reconnaissance de fin de block          */ | 
|---|
| 647 | } | 
|---|
| 648 | block_type_gps; | 
|---|
| 649 |  | 
|---|
| 650 |  | 
|---|
| 651 |  | 
|---|
| 652 | /*  ---------------------   structures N° 5 :   tous les bolos 1 periode        --------------- */ | 
|---|
| 653 | /*  ------------------------------------------------------------------------------------------- */ | 
|---|
| 654 | typedef struct | 
|---|
| 655 | { | 
|---|
| 656 | int4            debut;          /*      code de reconnaissance de debut de block        */ | 
|---|
| 657 | int4            code1;          /*      code1 du block                                  */ | 
|---|
| 658 | int4            code2;          /*      code2 du block                                  */ | 
|---|
| 659 |  | 
|---|
| 660 | short           bol_per[nb_max_bolo][nb_max_mes_per]; | 
|---|
| 661 | #ifdef _ECC_LIB_H_ | 
|---|
| 662 | unsigned char ecc[((((sizeof(short)*nb_max_bolo*nb_max_mes_per+SIZE_HEAD)/ECC_DATA)+1)*ECC_SIZE)] ; | 
|---|
| 663 | #endif | 
|---|
| 664 |  | 
|---|
| 665 | int4            fin;            /*      code de reconnaissance de fin de block          */ | 
|---|
| 666 | } | 
|---|
| 667 | block_type_une_periode; | 
|---|
| 668 |  | 
|---|
| 669 | /*  ----------------   structures N° 6 :  signals de synchro (pour test au sol) --------------- */ | 
|---|
| 670 | /*  ------------------------------------------------------------------------------------------- */ | 
|---|
| 671 | typedef struct | 
|---|
| 672 | { | 
|---|
| 673 | int4            debut;          /*      code de reconnaissance de debut de block        */ | 
|---|
| 674 | int4            code1;          /*      code1 du block                                  */ | 
|---|
| 675 | int4            code2;          /*      code2 du block                                  */ | 
|---|
| 676 | char            synchro[nb_per_block*2][nb_sync]; | 
|---|
| 677 | #ifdef _ECC_LIB_H_ | 
|---|
| 678 | unsigned char ecc[((((nb_per_block*nb_sync*2+SIZE_HEAD)/ECC_DATA)+1)*ECC_SIZE)] ; | 
|---|
| 679 | #endif | 
|---|
| 680 |  | 
|---|
| 681 | int4            fin;            /*      code de reconnaissance de fin de block          */ | 
|---|
| 682 | } | 
|---|
| 683 | block_type_synchro_sol; | 
|---|
| 684 |  | 
|---|
| 685 | /*  ---------------------   structures N° 7 : block de données de pointage sol      ----------- */ | 
|---|
| 686 | /*  ------------------------------------------------------------------------------------------- */ | 
|---|
| 687 | typedef struct | 
|---|
| 688 | { | 
|---|
| 689 | int4            debut;          /*      code de reconnaissance de debut de block        */ | 
|---|
| 690 | int4            code1;          /*      code1 du block                                  */ | 
|---|
| 691 | int4            code2;          /*      code2 du block                                  */ | 
|---|
| 692 | char            comment[1024]; | 
|---|
| 693 | #ifdef _ECC_LIB_H_ | 
|---|
| 694 | unsigned char ecc[((((1024+SIZE_HEAD)/ECC_DATA)+1)*ECC_SIZE)] ; | 
|---|
| 695 | #endif | 
|---|
| 696 | int4            fin;            /*      code de reconnaissance de fin de block          */ | 
|---|
| 697 | } | 
|---|
| 698 | block_type_pointage_sol; | 
|---|
| 699 |  | 
|---|
| 700 |  | 
|---|
| 701 |  | 
|---|
| 702 | /*  -------------   structures N° 8 :   données brutes des bolometres    ---------------------- */ | 
|---|
| 703 | /*  ------------------------------------------------------------------------------------------- */ | 
|---|
| 704 | typedef struct | 
|---|
| 705 | { | 
|---|
| 706 | int4            debut;          /*      code de reconnaissance de debut de block        */ | 
|---|
| 707 | int4            code1;          /*      code1 du block                                  */ | 
|---|
| 708 | int4            code2;          /*      code2 du block                                  */ | 
|---|
| 709 | /*      pour chaque bolo, un vecteur 72 points          */ | 
|---|
| 710 | int4            data_bolo[nb_max_bolo][nb_per_block*2]; | 
|---|
| 711 | /*      data D.S.       (en mots de 32 bits)            */ | 
|---|
| 712 | #ifdef _ECC_LIB_H_ | 
|---|
| 713 | unsigned char ecc[((((sizeof(int4)*nb_max_bolo*nb_per_block*2+SIZE_HEAD)/ECC_DATA)+1)*ECC_SIZE)] ; | 
|---|
| 714 | #endif | 
|---|
| 715 | int4            fin;            /*      code de reconnaissance de fin de block          */ | 
|---|
| 716 | } | 
|---|
| 717 | block_type_bolo; | 
|---|
| 718 |  | 
|---|
| 719 | /*  ---------------------   structures N° 9 :   données des gyroscopes  */ | 
|---|
| 720 | /*  -----------------------------------------------------------------------------------------   */ | 
|---|
| 721 | typedef struct | 
|---|
| 722 | { | 
|---|
| 723 | int4            debut;          /*      code de reconnaissance de debut de block        */ | 
|---|
| 724 | int4            code1;          /*      code1 du block                                  */ | 
|---|
| 725 | int4            code2;          /*      code2 du block                                  */ | 
|---|
| 726 | /* chaque gyro: un vecteur tde 72 valeurs               */ | 
|---|
| 727 | int4            gyro[3][nb_per_block*2]; | 
|---|
| 728 | #ifdef _ECC_LIB_H_ | 
|---|
| 729 | unsigned char ecc[((((sizeof(int4)*3*nb_per_block*2+SIZE_HEAD)/ECC_DATA)+1)*ECC_SIZE)] ; | 
|---|
| 730 | #endif | 
|---|
| 731 | int4            fin;            /*      code de reconnaissance de fin de block          */ | 
|---|
| 732 | } | 
|---|
| 733 | block_type_gyro; | 
|---|
| 734 |  | 
|---|
| 735 | /*  ---------------------   structures N° 10 :   données senseur stellaire        -----------   */ | 
|---|
| 736 | /*  -----------------------------------------------------------------------------------------   */ | 
|---|
| 737 | typedef struct | 
|---|
| 738 | { | 
|---|
| 739 | int4            debut;          /*      code de reconnaissance de debut de block        */ | 
|---|
| 740 | int4            code1;          /*      code1 du block                                  */ | 
|---|
| 741 | int4            code2;          /*      code2 du block                                  */ | 
|---|
| 742 | int4            sst[nb_per_block*2][18]; | 
|---|
| 743 | /* chaque mesure: un paquet de 18 mots de 32 bits       */ | 
|---|
| 744 | #ifdef _ECC_LIB_H_ | 
|---|
| 745 | unsigned char ecc[((((sizeof(int4)*nb_per_block*2*18+SIZE_HEAD)/ECC_DATA)+1)*ECC_SIZE)] ; | 
|---|
| 746 | #endif | 
|---|
| 747 | int4            fin;            /*      code de reconnaissance de fin de block          */ | 
|---|
| 748 | } | 
|---|
| 749 | block_type_sst; | 
|---|
| 750 |  | 
|---|
| 751 | /*  ---------------------   structures N° 11 :    rien                    -----------           */ | 
|---|
| 752 | /*  -----------------------------------------------------------------------------------------   */ | 
|---|
| 753 | typedef struct | 
|---|
| 754 | { | 
|---|
| 755 | int4            debut;          /*      code de reconnaissance de debut de block        */ | 
|---|
| 756 | int4            code1;          /*      code1 du block                                  */ | 
|---|
| 757 | int4            code2;          /*      code2 du block                                  */ | 
|---|
| 758 | #ifdef _ECC_LIB_H_ | 
|---|
| 759 | unsigned char ecc[((((SIZE_HEAD)/ECC_DATA)+1)*ECC_SIZE)] ; | 
|---|
| 760 | #endif | 
|---|
| 761 | int4            fin;            /*      code de reconnaissance de fin de block          */ | 
|---|
| 762 | } | 
|---|
| 763 | block_type11; | 
|---|
| 764 |  | 
|---|
| 765 | /*  ---------------------   structures N° 12 :  data bolo apres compression sur 7 bit    ------ */ | 
|---|
| 766 | /*  ------------------------------------------------------------------------------------------- */ | 
|---|
| 767 | typedef struct | 
|---|
| 768 | { | 
|---|
| 769 | int4            debut;          /*      code de reconnaissance de debut de block        */ | 
|---|
| 770 | int4            code1;          /*      code1 du block                                  */ | 
|---|
| 771 | int4            code2;          /*      code2 du block                                  */ | 
|---|
| 772 | /*      nombre de mots = nb valeurs/4 +1                */ | 
|---|
| 773 | /*      pour chaque bolo, un vecteur  19 mots           */ | 
|---|
| 774 | unsigned int4   data_bolo[nb_bolo_util][ (nb_per_block/2) +1 ]; | 
|---|
| 775 | #ifdef _ECC_LIB_H_ | 
|---|
| 776 | unsigned char ecc[((((sizeof(int4)*nb_bolo_util*((nb_per_block/2) +1)+SIZE_HEAD)/ECC_DATA)+1)*ECC_SIZE)] ; | 
|---|
| 777 | #endif | 
|---|
| 778 |  | 
|---|
| 779 | int4            fin;            /*      code de reconnaissance de fin de block          */ | 
|---|
| 780 | } | 
|---|
| 781 | block_type_bolo_comprime; | 
|---|
| 782 |  | 
|---|
| 783 | /*  ---------------------   structures N° 13 :    block_type_gyro_comprime      -----------     */ | 
|---|
| 784 | /*  -----------------------------------------------------------------------------------------   */ | 
|---|
| 785 | typedef struct | 
|---|
| 786 | { | 
|---|
| 787 | int4            debut;          /*      code de reconnaissance de debut de block        */ | 
|---|
| 788 | int4            code1;          /*      code1 du block                                  */ | 
|---|
| 789 | int4            code2;          /*      code2 du block                                  */ | 
|---|
| 790 | /*      nombre de mots = nb valeurs/4 +1                */ | 
|---|
| 791 | unsigned int4   gyro[3][ (nb_per_block/2) +1 ]; | 
|---|
| 792 | #ifdef _ECC_LIB_H_ | 
|---|
| 793 | unsigned char ecc[((((sizeof(int4)*3*((nb_per_block/2) +1)+SIZE_HEAD)/ECC_DATA)+1)*ECC_SIZE)] ; | 
|---|
| 794 | #endif | 
|---|
| 795 | int4            fin;            /*      code de reconnaissance de fin de block          */ | 
|---|
| 796 | } | 
|---|
| 797 | block_type_gyro_comprime; | 
|---|
| 798 |  | 
|---|
| 799 | /*  ---------------------   structures N° 14 :    block_type_sst_comprime       -----------     */ | 
|---|
| 800 | /*  -----------------------------------------------------------------------------------------   */ | 
|---|
| 801 | typedef struct | 
|---|
| 802 | { | 
|---|
| 803 | int4            debut;          /*      code de reconnaissance de debut de block        */ | 
|---|
| 804 | int4            code1;          /*      code1 du block                                  */ | 
|---|
| 805 | int4            code2;          /*      code2 du block                                  */ | 
|---|
| 806 | /*      pour chaque diode, un vecteur  11 mots          */ | 
|---|
| 807 | unsigned int4   sst[nb_photo_diodes] [(nb_per_block*2/7) +1 ]; | 
|---|
| 808 | #ifdef _ECC_LIB_H_ | 
|---|
| 809 | unsigned char ecc[((((sizeof(int4)*nb_photo_diodes*((nb_per_block*2/7) +1)+SIZE_HEAD)/ECC_DATA)+1)*ECC_SIZE)] ; | 
|---|
| 810 | #endif | 
|---|
| 811 | int4            fin;            /*      code de reconnaissance de fin de block          */ | 
|---|
| 812 | } | 
|---|
| 813 | block_type_sst_comprime; | 
|---|
| 814 |  | 
|---|
| 815 |  | 
|---|
| 816 | /*  ---------------------   structures N° 15 : block_type_status_flash -------*/ | 
|---|
| 817 | /*  ----------------------------------------------------------------    */ | 
|---|
| 818 |  | 
|---|
| 819 | /* | 
|---|
| 820 | ** Quelque soit la commande, l'enregistreur renvoie toujours le meme type | 
|---|
| 821 | de bloc comprenant la commande, un mot d'erreur eventuel et le status. | 
|---|
| 822 |  | 
|---|
| 823 | ** L'enregistreur ne prend jamais l'initiative d'envoyer un bloc de status | 
|---|
| 824 | (sauf dans le cas ci-dessous). | 
|---|
| 825 |  | 
|---|
| 826 | ** Au reset, le controleur est un peu lent a demarrer (quelques secondes). | 
|---|
| 827 | Pour que tu puisse savoir quand il est pret, je propose de t'envoyer un | 
|---|
| 828 | bloc de type "block_type_status_flash" des que je suis pret (comme si tu | 
|---|
| 829 | avais envoye un bloc "block_type_cmd_flash" avec la commande | 
|---|
| 830 | "FLASH_STATUS_REQUEST" | 
|---|
| 831 |  | 
|---|
| 832 | */ | 
|---|
| 833 |  | 
|---|
| 834 | typedef struct {/* etat de l'enregistreur */ | 
|---|
| 835 | int4 nb_total_blocks ; | 
|---|
| 836 | int4 memoire_libre ; | 
|---|
| 837 | int4 nb_block_erreur ; | 
|---|
| 838 | } status_flash; | 
|---|
| 839 |  | 
|---|
| 840 | typedef struct { | 
|---|
| 841 | unsigned int4 debut ; | 
|---|
| 842 | unsigned int4 code1 ; | 
|---|
| 843 | unsigned int4 code2 ; | 
|---|
| 844 |  | 
|---|
| 845 | int4  commande; /* la commande a laquelle ce bloc repond      */ | 
|---|
| 846 | int4 erreur ;   /* Si la commande a induit une erreur */ | 
|---|
| 847 | status_flash status ; /* etat de l'enregistreur */ | 
|---|
| 848 | #ifdef _ECC_LIB_H_ | 
|---|
| 849 | unsigned char ecc[((((sizeof(int4)*2 + sizeof(status_flash)+SIZE_HEAD)/ECC_DATA)+1)*ECC_SIZE)] ; | 
|---|
| 850 | #endif | 
|---|
| 851 |  | 
|---|
| 852 | unsigned int4 fin ; /* code de reconnaissance de fin de block */ | 
|---|
| 853 | } block_type_status_flash ; | 
|---|
| 854 |  | 
|---|
| 855 | /*  ---------------------   structures N° 16 :    block_type_cmd_flash    ---------*/ | 
|---|
| 856 | /*  ------------------------------------------------------------------  */ | 
|---|
| 857 | typedef struct { | 
|---|
| 858 | unsigned int4 debut ; | 
|---|
| 859 | unsigned int4 code1 ; | 
|---|
| 860 | unsigned int4 code2 ; | 
|---|
| 861 |  | 
|---|
| 862 | int4  commande; /* type de commande a l'enregistreur flash */ | 
|---|
| 863 | #ifdef _ECC_LIB_H_ | 
|---|
| 864 | unsigned char ecc[((((sizeof(int4)+SIZE_HEAD)/ECC_DATA)+1)*ECC_SIZE)] ; | 
|---|
| 865 | #endif | 
|---|
| 866 |  | 
|---|
| 867 | int4  fin;      /* code de reconnaissance de fin de block */ | 
|---|
| 868 | } block_type_cmd_flash; | 
|---|
| 869 |  | 
|---|
| 870 | /* Commands from Transputer to Recorder */ | 
|---|
| 871 | enum { | 
|---|
| 872 | FLASH_STATUS_REQUEST, | 
|---|
| 873 | FLASH_EFFACE_TOUT1, FLASH_EFFACE_TOUT2, FLASH_EFFACE_TOUT3, | 
|---|
| 874 | FLASH_EFFACE_UTIL1, FLASH_EFFACE_UTIL2, FLASH_EFFACE_UTIL3 | 
|---|
| 875 | } ; | 
|---|
| 876 |  | 
|---|
| 877 | /* Errors from Recorder to Transputer. | 
|---|
| 878 | Pending question: what to do in case of FLASH_ERASE_END_ERROR ? | 
|---|
| 879 | */ | 
|---|
| 880 |  | 
|---|
| 881 | enum { | 
|---|
| 882 | FLASH_STATUS_OK,      /* Pas d'erreur */ | 
|---|
| 883 | FLASH_BAD_SEQUENCE,   /* Mauvaise sequence d'effacement */ | 
|---|
| 884 | FLASH_ERASE_START,    /* Debut d'effacement */ | 
|---|
| 885 | FLASH_ERASE_END_OK,   /* Fin d'effacement OK */ | 
|---|
| 886 | FLASH_ERASE_END_ERROR /* Erreur pendant l'effacement */ | 
|---|
| 887 | } ; | 
|---|
| 888 |  | 
|---|
| 889 |  | 
|---|
| 890 | /*  ---------------------   structures N° 17 : block brut de données ctb pour test      ------- */ | 
|---|
| 891 | /*  ------------------------------------------------------------------------------------------- */ | 
|---|
| 892 | typedef struct | 
|---|
| 893 | { | 
|---|
| 894 | int4            debut;          /*      code de reconnaissance de debut de block        */ | 
|---|
| 895 | int4            code1;          /*      code1 du block                                  */ | 
|---|
| 896 | int4            code2;          /*      code2 du block                                  */ | 
|---|
| 897 | #ifdef  transmet_data_brute | 
|---|
| 898 | char            data[nb_per_block*nb_max_mes_per*nb_byte_mot]; | 
|---|
| 899 | #ifdef _ECC_LIB_H_ | 
|---|
| 900 | unsigned char ecc[((((nb_per_block*nb_max_mes_per*nb_byte_mot+SIZE_HEAD)/ECC_DATA)+1)*ECC_SIZE)] ; | 
|---|
| 901 | #endif | 
|---|
| 902 | #else | 
|---|
| 903 | #ifdef _ECC_LIB_H_ | 
|---|
| 904 | unsigned char ecc[((((SIZE_HEAD)/ECC_DATA)+1)*ECC_SIZE)] ; | 
|---|
| 905 | #endif | 
|---|
| 906 | #endif | 
|---|
| 907 | int4            fin;            /*      code de reconnaissance de fin de block          */ | 
|---|
| 908 | } | 
|---|
| 909 | block_type_data_brute; | 
|---|
| 910 |  | 
|---|
| 911 | /*  ---------------------   structures N° 18 : block  vide pour l'instant             -------   */ | 
|---|
| 912 | /*  ------------------------------------------------------------------------------------------- */ | 
|---|
| 913 | typedef struct | 
|---|
| 914 | { | 
|---|
| 915 | int4            debut;          /*      code de reconnaissance de debut de block        */ | 
|---|
| 916 | int4            code1;          /*      code1 du block                                  */ | 
|---|
| 917 | int4            code2;          /*      code2 du block                                  */ | 
|---|
| 918 | #ifdef _ECC_LIB_H_ | 
|---|
| 919 | unsigned char ecc[((((SIZE_HEAD)/ECC_DATA)+1)*ECC_SIZE)] ; | 
|---|
| 920 | #endif | 
|---|
| 921 | int4            fin;            /*      code de reconnaissance de fin de block          */ | 
|---|
| 922 | } | 
|---|
| 923 | block_type_18; | 
|---|
| 924 |  | 
|---|
| 925 | /*  ---------------------   structures N° 19 : block  vide pour l'instant             -------   */ | 
|---|
| 926 | /*  ------------------------------------------------------------------------------------------- */ | 
|---|
| 927 | typedef struct | 
|---|
| 928 | { | 
|---|
| 929 | int4            debut;          /*      code de reconnaissance de debut de block        */ | 
|---|
| 930 | int4            code1;          /*      code1 du block                                  */ | 
|---|
| 931 | int4            code2;          /*      code2 du block                                  */ | 
|---|
| 932 | #ifdef _ECC_LIB_H_ | 
|---|
| 933 | unsigned char ecc[((((SIZE_HEAD)/ECC_DATA)+1)*ECC_SIZE)] ; | 
|---|
| 934 | #endif | 
|---|
| 935 | int4            fin;            /*      code de reconnaissance de fin de block          */ | 
|---|
| 936 | } | 
|---|
| 937 | block_type_19; | 
|---|
| 938 |  | 
|---|
| 939 |  | 
|---|
| 940 |  | 
|---|
| 941 | /*  ---------   block  modele  (plus gros que tous les autres pour reservation memoire)   ----  */ | 
|---|
| 942 | /*  -----------------------------------------------------------------------------------------   */ | 
|---|
| 943 |  | 
|---|
| 944 | typedef struct                          /*      La structure de transfert transputer vers mac   */ | 
|---|
| 945 | { | 
|---|
| 946 | int4            debut;          /*      code de reconnaissance de debut de block        */ | 
|---|
| 947 | int4            code1;          /*      code1 du block                                  */ | 
|---|
| 948 | int4            code2;          /*      code2 du block                                  */ | 
|---|
| 949 | int4            mot[(taille_maxi_block_archeops)/4]; | 
|---|
| 950 | #ifdef _ECC_LIB_H_ | 
|---|
| 951 | unsigned char ecc[((((sizeof(int4)*(taille_maxi_block_archeops/4)+SIZE_HEAD)/ECC_DATA)+1)*ECC_SIZE)] ; | 
|---|
| 952 | #endif | 
|---|
| 953 | int4            fin;            /* code de reconnaissance de fin de block               */ | 
|---|
| 954 | } | 
|---|
| 955 | block_type_modele; | 
|---|
| 956 |  | 
|---|
| 957 |  | 
|---|
| 958 |  | 
|---|
| 959 |  | 
|---|
| 960 |  | 
|---|
| 961 | /*==============================================================================================*/ | 
|---|
| 962 | /*==============================================================================================*/ | 
|---|
| 963 | /*  --------------  définitions permettant de travailler sur les blocks Archeops   -----------  */ | 
|---|
| 964 | /*==============================================================================================*/ | 
|---|
| 965 | /*==============================================================================================*/ | 
|---|
| 966 |  | 
|---|
| 967 |  | 
|---|
| 968 |  | 
|---|
| 969 | enum    {block_param,block_journal,block_reglage,block_dilution, | 
|---|
| 970 | block_gps,block_une_periode,block_synchro_sol,block_pointage_sol, | 
|---|
| 971 | block_bolo,block_gyro,block_sst,block_11, | 
|---|
| 972 | block_bolo_comprime,block_gyro_comprime,block_sst_comprime,block_status_flash, | 
|---|
| 973 | block_cmd_flash,block_data_brute,block_18,block_19}; | 
|---|
| 974 |  | 
|---|
| 975 |  | 
|---|
| 976 | #define def_nom_block   char nom_block[nb_type_blocks][32]={"block_param","block_journal","block_reglage","block_dilution",\ | 
|---|
| 977 | "block_gps","block_une_periode","block_synchro_sol","block_pointage_sol",\ | 
|---|
| 978 | "block_bolo","block_gyro","block_sst","block_11",\ | 
|---|
| 979 | "block_bolo_comprime","block_gyro_comprime","block_sst_comprime","block_status_flash",\ | 
|---|
| 980 | "block_cmd_flash","block_data_brute","",""}; | 
|---|
| 981 |  | 
|---|
| 982 |  | 
|---|
| 983 | #define def_long_block  int long_block[nb_type_blocks]={sizeof(block_type_param),sizeof(block_type_journal),sizeof(block_type_reglage),sizeof(block_type_dilution),\ | 
|---|
| 984 | sizeof(block_type_gps),sizeof(block_type_une_periode),sizeof(block_type_synchro_sol),sizeof(block_type_pointage_sol),\ | 
|---|
| 985 | sizeof(block_type_bolo),sizeof(block_type_gyro),sizeof(block_type_sst),sizeof(block_type11),\ | 
|---|
| 986 | sizeof(block_type_bolo_comprime),sizeof(block_type_gyro_comprime),sizeof(block_type_sst_comprime),sizeof(block_type_status_flash),\ | 
|---|
| 987 | sizeof(block_type_cmd_flash),sizeof(block_type_data_brute),sizeof(block_type_18),sizeof(block_type_19)}; | 
|---|
| 988 |  | 
|---|
| 989 |  | 
|---|
| 990 |  | 
|---|
| 991 |  | 
|---|
| 992 |  | 
|---|
| 993 | /*   le code du block contient  8  bit de type                                                  */ | 
|---|
| 994 | /*                              24 bit pour le numero du block(horloge locale)                  */ | 
|---|
| 995 | /*                              12 bit pour la longueur du block  (en octet)                    */ | 
|---|
| 996 | /*                              16 bit pour la somme de test de la validité du block            */ | 
|---|
| 997 |  | 
|---|
| 998 | /*  les define suivants doivent etre utilisés pour tester le type des blocks et les verifier    */ | 
|---|
| 999 |  | 
|---|
| 1000 |  | 
|---|
| 1001 | #define longueur_block(_bk)     ( (int) ((_bk)->code1>>16)      & 0xffff ) | 
|---|
| 1002 | #define somme_block(_bk)        ( (int)  (_bk)->code1           & 0xffff ) | 
|---|
| 1003 |  | 
|---|
| 1004 | #define type_block(_bk)         ( (int) ((_bk)->code2>>24)      & 0xff ) | 
|---|
| 1005 | #define numero_block(_bk)       ( (int)  (_bk)->code2           & 0xffffff ) | 
|---|
| 1006 |  | 
|---|
| 1007 | /* ce define cree le mot de controle de somme des blocks et de les verifier a la reception      */ | 
|---|
| 1008 |  | 
|---|
| 1009 |  | 
|---|
| 1010 | /*==============================================================================================*/ | 
|---|
| 1011 | /*==============================================================================================*/ | 
|---|
| 1012 | /*  -----------------  fonctions utilitaires de gestion des blocks Archeops   ----------------  */ | 
|---|
| 1013 | /*==============================================================================================*/ | 
|---|
| 1014 | /*==============================================================================================*/ | 
|---|
| 1015 |  | 
|---|
| 1016 |  | 
|---|
| 1017 | /* -------------------------------------------------------------------------------------------- */ | 
|---|
| 1018 | /* les fonctions suivantes sont des utilitaires permettant la gestion des blocks archeops       */ | 
|---|
| 1019 | /* il faut inclure une seule fois le header archeops.h précéde de :                             */ | 
|---|
| 1020 | /*                       #define utilitaires_de_block_archeops                                  */ | 
|---|
| 1021 | /* -------------------------------------------------------------------------------------------- */ | 
|---|
| 1022 |  | 
|---|
| 1023 |  | 
|---|
| 1024 | /* ----------------------------   prototypes des fonctions       ------------------------------ */ | 
|---|
| 1025 | /* -------------------------------------------------------------------------------------------- */ | 
|---|
| 1026 |  | 
|---|
| 1027 |  | 
|---|
| 1028 | /*      cette fonction calcule le code de somme pour le controle de parité des blocks           */ | 
|---|
| 1029 |  | 
|---|
| 1030 | int     calcul_somme_block(block_type_modele* blk,int longueur); | 
|---|
| 1031 |  | 
|---|
| 1032 |  | 
|---|
| 1033 |  | 
|---|
| 1034 |  | 
|---|
| 1035 |  | 
|---|
| 1036 | /*      cette fonction est a apeller lors de la création d'un block apres l'avoir rempli        */ | 
|---|
| 1037 | /*      elle permet de creer tous les mots de controle du block                                 */ | 
|---|
| 1038 |  | 
|---|
| 1039 | void    valide_block(block_type_modele* blk,int type,int block_num); | 
|---|
| 1040 |  | 
|---|
| 1041 |  | 
|---|
| 1042 |  | 
|---|
| 1043 | /*      cette fonction est a apeller pour vérifier la validité d'un block                       */ | 
|---|
| 1044 | /*      elle retourne 0 si le block est correct et sinon, un code d'erreur                      */ | 
|---|
| 1045 | /*      la seconde fonction sort les erreurs a l'ecran                                          */ | 
|---|
| 1046 |  | 
|---|
| 1047 | int     verifie_block(block_type_modele* blk); | 
|---|
| 1048 | int     verifie_block_printf(block_type_modele* blk); | 
|---|
| 1049 |  | 
|---|
| 1050 | enum    {block_correct,block_type_inconnu,block_longueur_erreur,block_somme_erreur | 
|---|
| 1051 | ,block_debut_erreur,block_fin_erreur}; | 
|---|
| 1052 |  | 
|---|
| 1053 | /*      cette fonction transforme un char (sur 8 bit) en double avec une echelle logarythmique  */ | 
|---|
| 1054 | /*      elle est en particulier utilisée pour calculer les coef de la regul                     */ | 
|---|
| 1055 |  | 
|---|
| 1056 | double  val_double(char x); | 
|---|
| 1057 |  | 
|---|
| 1058 | /*      cette fonction transforme un char (sur 8 bit) en entier int4 (echelle logarythmique)    */ | 
|---|
| 1059 | /*      elle est en particulier utilisée pour fixer le courant sur les bolometres               */ | 
|---|
| 1060 |  | 
|---|
| 1061 | unsigned int4   val_long(char x); | 
|---|
| 1062 |  | 
|---|
| 1063 | int     new_val_dac(int a,char  code); | 
|---|
| 1064 |  | 
|---|
| 1065 |  | 
|---|