| 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 |
|
| 24 |
extern "C" { |
| 25 |
|
| 26 |
extern struct { |
| 27 |
unsigned char buffer[2]; |
| 28 |
} header_; |
| 29 |
|
| 30 |
void data2ntp_(); |
| 31 |
//Struct per il passaggio di dati da e verso la chiamata fortran |
| 32 |
} |
| 33 |
|
| 34 |
void testcrc_(unsigned char *crc, int *error) |
| 35 |
{ |
| 36 |
unsigned char *buff[2]; |
| 37 |
memcpy(*buff, header_.buffer, sizeof(header_.buffer)); |
| 38 |
*error = 1; |
| 39 |
printf("%i %i %i \n",buff[0],buff[15],*crc); |
| 40 |
if ((unsigned char)CM_Compute_CRC16(0, (unsigned char *)&buff, 15) == (unsigned char)*crc) *error = 0; |
| 41 |
|
| 42 |
} |