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