/[PAMELA software]/yoda/techmodel/forroutines/tracker/readraw/readtrailer.c
ViewVC logotype

Contents of /yoda/techmodel/forroutines/tracker/readraw/readtrailer.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 5.0 - (show annotations) (download)
Mon Aug 29 09:46:13 2005 UTC (19 years, 4 months ago) by kusanagi
Branch: MAIN
CVS Tags: YODA5_0/00, YODA5_0/01, YODA5_0/02
Changes since 4.4: +0 -0 lines
File MIME type: text/plain
Starting form this version:
1) includes are defined with relative (not absolute) path respect to the YODA aplication
2) RegistryEvent class is foreseen to contain post-unpack data.

1 /*
2 * include needed system headers
3 */
4 #include <stdio.h> /* include standard i/o library */
5 #include <stdlib.h> /* include standard library */
6 #include <string.h> /* include string library */
7 #include <unistd.h> /* include unix standard library */
8 #include <sys/types.h> /* */
9 #include <sys/stat.h> /* */
10 #include <fcntl.h> /* */
11 #include <errno.h> /* error simbol definitions */
12 #include <time.h> /* system time definitions */
13 #include <math.h> /* math library */
14
15 void readtrailer_(unsigned short *trailer, int *error, int *fd)
16
17 {
18 int nread;
19 int i;
20 unsigned short word;
21
22 *error=0;
23
24 /*** read the buffer ***/
25 nread=read(*fd, trailer, 2*3);//il trailer e' lungo 6 parole da 8 bits
26 if( nread==0 ) {
27 printf("readtrailer: Unexpected end of file %d at %d \n",*fd,nread);
28 *error=1;
29 return ;
30 }
31 if ( nread != 6) {
32 printf("readtrailer: Error on reading: nread = %d \n",nread);
33 *error=-1;
34 return ;
35 }
36
37
38 /*** correct byte ***/ //endianess...
39 for(i=0; i<3; i++) {
40 word = trailer[i];
41 trailer[i] = ( (word&0x00ff) << 8 ) | ( (word&0xff00) >> 8 );
42 }
43
44 // for( i=0; i<3; i++) printf("%x \n",trailer[i]);//???
45
46 return;
47 }

  ViewVC Help
Powered by ViewVC 1.1.23