/[PAMELA software]/tracker/ground/source/readraw/runheaderpkt.c
ViewVC logotype

Contents of /tracker/ground/source/readraw/runheaderpkt.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations) (download)
Wed Mar 8 15:00:39 2006 UTC (18 years, 9 months ago) by pam-fi
Branch point for: MAIN, trk-ground
File MIME type: text/plain
Initial revision

1
2 /* decode the TRK_CALIB_USED field and the part of ACQ_BUILD_INFO
3 concerning the tracker, in the runheader packet */
4
5
6 #include <stdio.h> /* include standard i/o library */
7 #include <stdlib.h> /* include standard library */
8 #include <string.h> /* include string library */
9 #include <unistd.h> /* include unix standard library */
10 #include <sys/types.h> /* */
11 #include <sys/stat.h> /* */
12 #include <fcntl.h> /* */
13 #include <errno.h> /* error simbol definitions */
14 #include <time.h> /* system time definitions */
15 #include <math.h> /* math library */
16
17
18
19 void getbytes_(int *nbytes, char *buffer, int *p, unsigned int *value);
20
21 void runheaderpkt_(char *buffer,int *len, unsigned int *trk_calib_used_out, unsigned int *acq_build_info_out) {
22
23
24 /* int i; */
25 /* printf("runheaderpkt: \n %i \n %i \n",*len,*error); */
26 /* for(i=0;i<*len;i++){ */
27 /* printf("%i %hhx \n",buff, *buff);//buffer e' integer*1 (=1 byte), quindi devo dividere per 4 con hh */
28 /* printf("%i %hhx \n \n",buffer, *buffer); */
29 /* // printf("\n %i \n",i); */
30 /* buff++; */
31 /* }; */
32 /* printf(" \n"); */
33
34
35
36 char *buff=buffer;
37 int i1=1;
38 int nbytes1=1;
39 int nbytes2=2;
40 int nbytes4=4;
41 unsigned int out;
42
43 unsigned int compilationtimestamp;
44 char rm_acq_setting_mode;
45 unsigned int obt_time_sync;
46 unsigned int last_time_sync_info;
47 char favourite_working_schedule;
48 char effective_working_schedule;
49 unsigned int prh_var_trigger_mode_a;
50 unsigned int prh_var_trigger_mode_b;
51 char rm_acq_after_calib;
52 unsigned int trk_calib_used;
53 unsigned int acq_build_info;
54 /* ground data format has changed at a certain moment: before acq_var_info was
55 UINT8 (--> len=36), later UINT16 (--> len=37) */
56 char acq_var_info_OLD;
57 unsigned short int acq_var_info_NEW; //this will be the final flight data format
58 char cal_dsp_mask;
59 unsigned short int crcdsp;
60
61
62
63
64
65 getbytes_(&nbytes4,buff,&i1,&out);
66 compilationtimestamp=out;
67
68 getbytes_(&nbytes1,buff,&i1,&out);
69 rm_acq_setting_mode=out;
70
71 getbytes_(&nbytes4,buff,&i1,&out);
72 obt_time_sync=out;
73
74 getbytes_(&nbytes4,buff,&i1,&out);
75 last_time_sync_info=out;
76
77 getbytes_(&nbytes1,buff,&i1,&out);
78 favourite_working_schedule=out;
79
80 getbytes_(&nbytes1,buff,&i1,&out);
81 effective_working_schedule=out;
82
83 getbytes_(&nbytes4,buff,&i1,&out);
84 prh_var_trigger_mode_a=out;
85
86 getbytes_(&nbytes4,buff,&i1,&out);
87 prh_var_trigger_mode_b=out;
88
89 getbytes_(&nbytes1,buff,&i1,&out);
90 rm_acq_after_calib=out;
91
92 getbytes_(&nbytes4,buff,&i1,&out);
93 trk_calib_used=out;
94
95 getbytes_(&nbytes4,buff,&i1,&out);
96 acq_build_info=out;
97
98 if(*len==36) {
99 getbytes_(&nbytes1,buff,&i1,&out);
100 acq_var_info_OLD=out;
101 }
102 else if(*len==37) {
103 getbytes_(&nbytes2,buff,&i1,&out);
104 acq_var_info_NEW=out;
105 }
106 else {
107 printf("runheaderpkt: error: wrong runheader packet length: %i \n",*len);
108 }
109
110 getbytes_(&nbytes1,buff,&i1,&out);
111 cal_dsp_mask=out;
112
113 getbytes_(&nbytes2,buff,&i1,&out);
114 crcdsp=out;
115
116
117 /* printf("compilationtimestamp: \t\t %u \n",compilationtimestamp); */
118 /* printf("rm_acq_setting_mode: \t\t %x \n",rm_acq_setting_mode); */
119 /* printf("obt_time_sync: \t\t\t %u \n",obt_time_sync); */
120 /* printf("last_time_sync_info: \t\t %u \n",last_time_sync_info); */
121 /* printf("favourite_working_schedule: \t %x \n",favourite_working_schedule); */
122 /* printf("effective_working_schedule: \t %x \n",effective_working_schedule); */
123 /* printf("prh_var_trigger_mode_a: \t %u \n",prh_var_trigger_mode_a); */
124 /* printf("prh_var_trigger_mode_b: \t %u \n",prh_var_trigger_mode_b); */
125 /* printf("rm_acq_after_calib: \t\t %x \n",rm_acq_after_calib); */
126 /* printf("trk_calib_used: \t\t %i \n",trk_calib_used); */
127 /* printf("acq_build_info: \t\t %x \n",acq_build_info); */
128 /* if(*len==36) { */
129 /* printf("acq_var_info_OLD: \t\t %x \n",acq_var_info_OLD); */
130 /* } */
131 /* else if(*len==37) { */
132 /* printf("acq_var_info_NEW: \t\t %x \n",acq_var_info_NEW); */
133 /* } */
134 /* printf("cal_dsp_mask: \t\t\t %x \n",cal_dsp_mask); */
135 /* printf("crcdsp: \t\t\t\t %x \n",crcdsp); */
136
137
138 *trk_calib_used_out=trk_calib_used;
139 *acq_build_info_out=acq_build_info;
140
141 /* printf("%x %x \n",*trk_calib_used_out,*acq_build_info_out); */
142
143
144 }

  ViewVC Help
Powered by ViewVC 1.1.23