//mikhailov : //reading and updating of time sync information #include "descript.h" #include "CRC.h" //int RTtoMT,RT,Timesync,OBTtimesync; // Resurs time to moscow, Resurs time, ... extern long int Timesync; extern long int OBTtimesync; void RunHeaderReader(char *packet) { //char *packet=new char[Nmax]; //unsigned int type=0; /*PAMELA packet type*/ // unsigned int error=0;/*PAMELA packet error flag*/ //int Length=0; /*Length of filename*/ // long int counter[26];/*Counter for PAMELA packets in each dat file*/ // unsigned long int adr1=0;/*First byte of PAMELA packet in _cln2.pam*/ //unsigned long int adr2=0;/*Last byte of PAMELA packet in _cln2.pam*/ long int time=0; /*PAMELA packet time*/ // long int first[26]; /*First byte for PAMELA packets of given type*/ // long int last[26]; /*Last byte for PAMELA packets of given type*/ long int temp=0; //int type; // int packet_type; char *subData; // char eventCRC[2]; int j; FILE *ftime_sync; unsigned short calCRC; //calculated CRC of the data unsigned short readCRC; //CRC read from the end of the subpacket long int dataLength; long int length; long int RM_ACQ_SETTING_MODE,OBT_TIME_SYNC, LAST_TYME_SYNC_INFO, FAVOURITE_WORKING_SCHEDULE, EFFECTIVE_WORKING_SCHEDULE, PRH_VAR_TRIGGER_MODE_A, PRH_VAR_TRIGGER_MODE_B, RM_ACQ_AFTER_CALIB ; time=(long int)(unsigned char)(packet[11])+ 256*(long int)(unsigned char)(packet[10])+ 256*256*(long int)(unsigned char)(packet[9])+ 256*256*256*(long int)(unsigned char)(packet[8]); temp=(long int)(unsigned char)(packet[7])+ 256*(long int)(unsigned char)(packet[6])+ 256*256*(long int)(unsigned char)(packet[5]); if (fmod((float)(temp),(float)(10000.))==0.) cout<<"sorting "<read(subData, sizeof(unsigned char)*dataLength); */ calCRC = CM_Compute_CRC16(0, (unsigned char*)subData, dataLength); printf("crc %x %x\n",calCRC,readCRC); //took the final CRC to compare it with the previous calculated CRC of the data // for(j=0;j