int read_frame(unsigned long *pos, FILE *ptr_file)
{
uint16_t frame_length, sensor_id;
- uint32_t frame_start, frame_counter;
+ uint32_t frame_start, frame_counter, trailer;
uint16_t senlen;
+ uint8_t header_found, trailer_found;
fread(&frame_length, sizeof(uint16_t), 1, ptr_file);
frame_length = ntohs(frame_length);
fread(&sensor_id, sizeof(uint16_t), 1, ptr_file);
sensor_id = ntohs(sensor_id);
fseek(ptr_file, 12, SEEK_CUR);
fread(&frame_start, sizeof(uint32_t), 1, ptr_file);
- if (frame_start != 0x55555555)
- {
- print1("Bad header!\n");
- return 1;
- }
+ if (frame_start == 0x55555555)
+ header_found = 1;
+ else
+ header_found = 0;
fread(&frame_counter, sizeof(uint32_t), 1, ptr_file);
- frame_counter = ntohs(frame_counter);
+ frame_counter = ntohl(frame_counter);
fread(&senlen, sizeof(uint16_t), 1, ptr_file);
senlen = ntohs(senlen);
+ fseek(ptr_file, 2+senlen*4, SEEK_CUR);
+ fread(&trailer, sizeof(uint32_t), 1, ptr_file);
+ trailer = ntohl(trailer);
+ if (trailer == 0x80018001)
+ trailer_found = 1;
+ else
+ trailer_found = 0;
// from global state:
uint32_t seqnr = event_header[3];
uint32_t trignr = subevent_header[3];
uint16_t roc = ntohs(subsubevent_header[1]);
trignr = ntohl(trignr);
// output
- //print1("seqnr: 0x%08X trignr: 0x%08X mkd_timestamp: 0x%08X frame_length: 0x%04X sensor_id: 0x%02X sensor_frame_cnt: 0x%08X senlen: 0x%04X\n",
- // seqnr, trignr, marker_timestamp, frame_length, sensor_id, frame_counter, senlen);
- print1("%"PRIu32" %"PRIu32" %"PRIu16" %"PRIu32" %"PRIu16" %"PRIu16" %"PRIu32" %"PRIu16"\n",
- seqnr, trignr, roc, marker_timestamp, frame_length, sensor_id, frame_counter, senlen);
+ print2("seqnr: 0x%08X trignr: 0x%08X roc: 0x%04X mkd_timestamp: 0x%08X frame_length: 0x%04X sensor_id: 0x%02X sensor_frame_cnt: 0x%08X senlen: 0x%04X cntr: 0x%08X mkd: %d header_found: %d trailer_found: %d\n",
+ seqnr, trignr, roc, marker_timestamp, frame_length, sensor_id, frame_counter, senlen, frame_timestamp, frame_marked, header_found, trailer_found);
+ print1("%"PRIu32" %"PRIu32" %"PRIu16" %"PRIu32" %"PRIu16" %"PRIu16" %"PRIu32" %"PRIu16" %"PRIu32" %"PRIu8" %"PRIu8" %"PRIu8"\n",
+ seqnr, trignr, roc, marker_timestamp, frame_length, sensor_id, frame_counter, senlen, frame_timestamp, frame_marked, header_found, trailer_found);
return 0;
}
return 1;
}
- print1("seqnr trignr roc mkd_timestamp frame_length sensor_id sensor_frame_cnt senlen\n");
+ print1("seqnr trignr roc mkd_timestamp frame_length sensor_id sensor_frame_cnt senlen cntr mkd header_found trailer_found\n");
pos = 0;
while (read_event(&pos, ptr_myfile, &read_frame) == 0)
{
uint32_t subevent_header[SUBEVENT_HEADERSIZE];
uint16_t subsubevent_header[SUBSUBEVENT_HEADERSIZE*2];
uint32_t marker_timestamp, frame_timestamp;
+uint8_t frame_marked;
int read_event(unsigned long *pos, FILE *ptr_file, int (*sensor_callback)(unsigned long *pos, FILE *ptr_file))
{
header_version = roc_header[0];
data_version = roc_header[1];
header_size = roc_header[3];
- BOOL frame_marked = FALSE;
+ frame_marked = 0;
marker_timestamp = 0;
frame_timestamp = 0;
if (header_size >= 1)
{
if (!fread(&marker_timestamp, 4, 1, ptr_file)) return 1;
marker_timestamp = ntohl(marker_timestamp);
- frame_marked = marker_timestamp & 0x80000000;
+ frame_marked = (marker_timestamp & 0x80000000) >> 31;
marker_timestamp &= 0x00FFFFFF;
}
if (header_size >= 2)
{
if (!fread(&frame_timestamp, 4, 1, ptr_file)) return 1;
frame_timestamp = ntohl(frame_timestamp);
+ //frame_marked = frame_timestamp & 0x80000000;
+ frame_timestamp &= 0x00FFFFFF;
}
if (header_size >= 3)
{