EDT, Inc.
2019 April 29
35
VisionLink F-series
Appendix C: Timestamping
The following C++ struct encapsulates this footer structure, including showing the struct with bit fields representing the
packed BCD values from the IRIG signal.
// ts_raw_t is defined in libedt_timing.h
// Packed BCD from IRIGB
typedefstruct { // Raw timecode format
u_long seconds:6;
u_long minutes:6;
u_long hours:5;
u_long days:9; // days in the year
u_long years:6;
} ts_raw_t;
// This structure is defined in pdv_irig.h
typedef struct Irig2Record {
u_int magic; /* magic */
u_int framecnt; /* starts at 0 */
/* There are two modes - seconds from 1970 (Unix time) or BCD mode, in which the BCD
values from IRIG are packed into 32 bits in the raw structure */
union {u_int seconds;
ts_raw_t raw;
} t;
u_int clocks; /* how many 40 MHz ticks in last second */
u_int tickspps; /* 40 MHz ticks since last second */
struct { /* status bits */
u_char type: 4;
u_char irig_ok:1;
u_char pps_ok:1;
u_char had_irig_error:1;
u_char had_pps_error:1;
} status;
u_char reserved[3];
double timestamp; /* holds a 64-bit unix seconds time */
/* This must be filled in by software */
} Irig2Record;
IRIG API
In the EDT digital imaging library routines, extra data added by the board or software (outside of the defined image)
typically is called a
header
. In this case, however, such data is at the end, so it is called a
footer
.
EDT’s
software development kit for the IRIG option includes various files and library routines specific to IRIG, including
but not necessarily limited to those described below.
simple_irig2.c
Example application that shows how to access IRIG information from frames captured using IRIG configuration.
libpdv.c
In addition to subroutines and functions for other purposes,
libpdv.c
includes the IRIG functions below.
To return the full size of the DMA (image data plus the 32-byte IRIG footer), enter...
int pdv_get_dmasize(PdvDev *pdv_p)
To return the footer’s byte offset from the beginning of the image data, enter...
int pdv_get_header_offset(PdvDev *pdv_p)