/***************************************************************
 *
 * routine read_ev: routine to extract an event information 
 * from file acquired with Pamela acquisition programs
 *
 * June 2002
 *
 ***************************************************************/
/*
 * include needed system headers
 */
#include <stdio.h>       /* include standard i/o library */
#include <stdlib.h>      /* include standard library */
#include <string.h>      /* include string library */
#include <unistd.h>      /* include unix standard library */
#include <sys/types.h>   /* */
#include <sys/stat.h>    /* */
#include <fcntl.h>       /* */
#include <errno.h>       /* error simbol definitions */
#include <time.h>        /* system time definitions */
#include <math.h>        /* math library */
#include "CRC.h"

extern "C" {
  
 extern struct {
     unsigned char buffer[2];
    } header_; 

    void data2ntp_();
    //Struct per il passaggio di dati da e verso la chiamata fortran
}

void testcrc_(unsigned char *crc, int *error)
{
    unsigned char *buff[2];
    memcpy(*buff,       header_.buffer,       sizeof(header_.buffer));
    *error = 1; 
    printf("%i %i %i \n",buff[0],buff[15],*crc);
    if ((unsigned char)CM_Compute_CRC16(0, (unsigned char *)&buff, 15) == (unsigned char)*crc) *error = 0;

}
