/[PAMELA software]/calo/unpacking/testcrc.c
ViewVC logotype

Annotation of /calo/unpacking/testcrc.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1.1.1 - (hide annotations) (download) (vendor branch)
Mon Dec 5 16:23:22 2005 UTC (19 years ago) by mocchiut
Branch: MAIN, unpacking
CVS Tags: start, v1r00, HEAD
Changes since 1.1: +0 -0 lines
File MIME type: text/plain
Imported sources

1 mocchiut 1.1 /***************************************************************
2     *
3     * routine read_ev: routine to extract an event information
4     * from file acquired with Pamela acquisition programs
5     *
6     * June 2002
7     *
8     ***************************************************************/
9     /*
10     * include needed system headers
11     */
12     #include <stdio.h> /* include standard i/o library */
13     #include <stdlib.h> /* include standard library */
14     #include <string.h> /* include string library */
15     #include <unistd.h> /* include unix standard library */
16     #include <sys/types.h> /* */
17     #include <sys/stat.h> /* */
18     #include <fcntl.h> /* */
19     #include <errno.h> /* error simbol definitions */
20     #include <time.h> /* system time definitions */
21     #include <math.h> /* math library */
22     #include "CRC.h"
23     //extern "C" {
24     extern struct {
25     unsigned char buffer[16];
26     } header_;
27    
28     void data2ntp_();
29     //Struct per il passaggio di dati da e verso la chiamata fortran
30     //}
31    
32     void testcrc_(unsigned char *crc, int *error)
33     {
34     int i,j;
35     unsigned char ubuffer;
36     unsigned char calcrc;
37     unsigned char buff2[16];
38     *error = 1;
39    
40     j = 0;
41     for (i = 0; i < 16; i++){
42     // memcpy(&ubuffer<<i, header_.buffer[i], sizeof(header_.buffer));
43     if ( i < 8 ) {
44     memcpy(&buff2[7-i], &header_.buffer[i], sizeof(header_.buffer[i]));
45     } else {
46     j++;
47     memcpy(&buff2[16-j], &header_.buffer[i], sizeof(unsigned char));
48     }
49     }
50     // for (i = 0; i < 16; i++){
51     //printf("%i : buff2 %X\n",i,buff2[i]);
52     //}
53    
54     calcrc=CM_Compute_CRC16(0, &buff2, 15);
55    
56     //printf("%X = %X ? \n",calcrc,*crc);
57    
58     if ((unsigned char)calcrc == (unsigned char)*crc) *error = 0;
59    
60     }

  ViewVC Help
Powered by ViewVC 1.1.23