]> jspc29.x-matter.uni-frankfurt.de Git - mvd_soft.git/commitdiff
C unpacker: upgraded extract_info
authorPhilipp Klaus <klaus@physik.uni-frankfurt.de>
Mon, 29 May 2017 08:15:31 +0000 (10:15 +0200)
committerPhilipp Klaus <klaus@physik.uni-frankfurt.de>
Mon, 29 May 2017 08:15:31 +0000 (10:15 +0200)
normalmode/c_standalone/extract_info.c
normalmode/c_standalone/extract_info.h
normalmode/c_standalone/hld.c

index e7ff482e49950e0d1f3d5cee6f8206a039d118b5..dc1aabe0cb8a4e0877d629f5d36ea21f604202c1 100644 (file)
@@ -17,33 +17,40 @@ uint32_t num_events = 0;
 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;
 }
 
@@ -65,7 +72,7 @@ int main(int argc, char **argv)
                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)
        {
index 85084be98096ea8025be39e29b706ee894ddae4a..27931c174ea917b4541a5f7e0ed515183de02283 100644 (file)
@@ -12,3 +12,4 @@ uint32_t extern event_header[EVENT_HEADERSIZE];
 uint32_t extern subevent_header[SUBEVENT_HEADERSIZE];
 uint16_t extern subsubevent_header[SUBSUBEVENT_HEADERSIZE*2];
 uint32_t extern marker_timestamp, frame_timestamp;
+uint8_t  extern frame_marked;
index 56386f91a0efcb0a3460b246a6506375b54a5d07..eceb513a3aa7c470b5cfbad79eed5f1f2b9a7104 100644 (file)
@@ -8,6 +8,7 @@ uint32_t event_header[EVENT_HEADERSIZE];
 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))
 {
@@ -54,20 +55,22 @@ int read_subsubevent(unsigned long *pos, FILE *ptr_file, int (*sensor_callback)(
                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)
                {