Skip to content

Commit

Permalink
CLOCK_MONOTONIC_RAW
Browse files Browse the repository at this point in the history
  • Loading branch information
RainerZ committed Oct 27, 2024
1 parent 5e9fbdd commit 67f572b
Showing 1 changed file with 0 additions and 323 deletions.
323 changes: 0 additions & 323 deletions mdflib/src/mdf4.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,8 @@ typedef struct
#define MDF4_ID_PREFIX ((uint32_t)('#') + 0x100 * ('#'))
#define GENERATE_ID(A, B) (MDF4_ID_PREFIX + 0x10000 * (A) + 0x1000000 * (B))

#define isblockMDF4(p) (((p) != NULL) && ((p)->length >= sizeof(BLOCK_HEADER)) && (((((p)->id) >> 0) & 0xFF) == '#') && (((((p)->id) >> 8) & 0xFF) == '#') && (((((p)->id) >> 16) & 0xFF) >= 'A') && (((((p)->id) >> 16) & 0xFF) <= 'Z') && (((((p)->id) >> 24) & 0xFF) >= 'A') && (((((p)->id) >> 24) & 0xFF) <= 'Z'))

#define isblockMDF3(p) (((p) != NULL) \
\
&& ((p)->length >= sizeof(uint16_t) * 2) && (((((p)->id) >> 0) & 0xFF) >= 'A') && (((((p)->id) >> 0) & 0xFF) <= 'Z') && (((((p)->id) >> 8) & 0xFF) >= 'A') && (((((p)->id) >> 8) & 0xFF) <= 'Z'))

#define MDF4_MIN_TO_NS(_t_) ((__int64)(_t_) * 60 * 1000000000)
#define MDF4_MIN_TO_HRS(_t_) ((_t_) / 60)
#define MDF4_HRS_TO_MIN(_t_) ((_t_) * 60)

#define MDF4_SYNC_NONE 0
#define MDF4_SYNC_TIME 1
#define MDF4_SYNC_ANGLE 2
#define MDF4_SYNC_DISTANCE 3
#define MDF4_SYNC_INDEX 4

#define MDF4_TIME_FLAG_LOCAL_TIME (1 << 0)
#define MDF4_TIME_FLAG_OFFSETS_VALID (1 << 1)
Expand Down Expand Up @@ -217,94 +204,6 @@ typedef struct chblock_data
uint8_t ch_reserved[3];
} CHBLOCK_DATA;

#define MDF4_AT_ID GENERATE_ID('A', 'T')
#define MDF4_AT_MIN_LENGTH (sizeof(BLOCK_HEADER) + 9 * 8)
#define MDF4_AT_MIN_LINK_COUNT (sizeof(ATBLOCK_LINKS) / sizeof(mdf_link_t))

#define MDF4_AT_FLAG_EMBEDDED (1 << 0)
#define MDF4_AT_FLAG_COMPRESSED (1 << 1)
#define MDF4_AT_FLAG_MD5_VALID (1 << 2)

typedef struct atblock_links
{
mdf_link_t at_at_next;
mdf_link_t at_tx_filename;
mdf_link_t at_tx_mimetype;
mdf_link_t at_md_comment;

} ATBLOCK_LINKS;

typedef struct atblock_data
{
uint16_t at_flags;
uint16_t at_creator_index;
uint8_t at_reserved[4];
uint8_t at_md5_checksum[16];
uint64_t at_original_size;
uint64_t at_embedded_size;

} ATBLOCK_DATA;

#define MDF4_EV_ID GENERATE_ID('E', 'V')
#define MDF4_EV_MIN_LENGTH (sizeof(BLOCK_HEADER) + 9 * 8)
#define MDF4_EV_MIN_LINK_COUNT (sizeof(EVBLOCK_LINKS) / sizeof(mdf_link_t) - 1)

#define MDF4_EV_TYPE_RECORDING 0
#define MDF4_EV_TYPE_REC_INTERRUPT 1
#define MDF4_EV_TYPE_ACQ_INTERRUPT 2
#define MDF4_EV_TYPE_TRIGGER_REC_START 3
#define MDF4_EV_TYPE_TRIGGER_REC_STOP 4
#define MDF4_EV_TYPE_TRIGGER 5
#define MDF4_EV_TYPE_MARKER 6

#define MDF4_EV_SYNC_TIME MDF4_SYNC_TIME
#define MDF4_EV_SYNC_ANGLE MDF4_SYNC_ANGLE
#define MDF4_EV_SYNC_DISTANCE MDF4_SYNC_DISTANCE
#define MDF4_EV_SYNC_INDEX MDF4_SYNC_INDEX

#define MDF4_EV_RANGE_NONE 0
#define MDF4_EV_RANGE_BEGIN 1
#define MDF4_EV_RANGE_END 2

#define MDF4_EV_CAUSE_OTHER 0
#define MDF4_EV_CAUSE_ERROR 1
#define MDF4_EV_CAUSE_TOOL 2
#define MDF4_EV_CAUSE_SCRIPT 3
#define MDF4_EV_CAUSE_USER 4

#define MDF4_EV_FLAG_POST_PROCESSING (1 << 0)
#define MDF4_EV_FLAG_GROUP_NAME (1 << 1)

#define ev_ev_parent ev_parent

typedef struct evblock_links
{
mdf_link_t ev_ev_next;
mdf_link_t ev_parent;
mdf_link_t ev_ev_range;
mdf_link_t ev_tx_name;
mdf_link_t ev_md_comment;

mdf_link_t ev_scope[1];

} EVBLOCK_LINKS;

typedef struct evblock_data
{
uint8_t ev_type;
uint8_t ev_sync_type;
uint8_t ev_range_type;
uint8_t ev_cause;
uint8_t ev_flags;
uint8_t ev_reserved[3];
uint32_t ev_scope_count;
uint16_t ev_attachment_count;
uint16_t ev_creator_index;
int64_t ev_sync_base_value;

double ev_sync_factor;

} EVBLOCK_DATA;

#define MDF4_DG_ID GENERATE_ID('D', 'G')
#define MDF4_DG_MIN_LENGTH (sizeof(BLOCK_HEADER) + 5 * 8)
Expand Down Expand Up @@ -365,43 +264,6 @@ typedef struct cgblock_data

} CGBLOCK_DATA;

#define MDF4_SI_ID GENERATE_ID('S', 'I')
#define MDF4_SI_MIN_LENGTH (sizeof(BLOCK_HEADER) + 4 * 8)
#define MDF4_SI_MIN_LINK_COUNT (sizeof(SIBLOCK_LINKS) / sizeof(mdf_link_t))

#define MDF4_SI_TYPE_OTHER 0
#define MDF4_SI_TYPE_ECU 1
#define MDF4_SI_TYPE_BUS 2
#define MDF4_SI_TYPE_IO 3
#define MDF4_SI_TYPE_TOOL 4
#define MDF4_SI_TYPE_USER 5

#define MDF4_SI_BUS_NONE 0
#define MDF4_SI_BUS_OTHER 1
#define MDF4_SI_BUS_CAN 2
#define MDF4_SI_BUS_LIN 3
#define MDF4_SI_BUS_MOST 4
#define MDF4_SI_BUS_FLEXRAY 5
#define MDF4_SI_BUS_K_LINE 6
#define MDF4_SI_BUS_ETHERNET 7
#define MDF4_SI_BUS_USB 8

#define MDF4_SI_FLAG_SIMULATION (1 << 0)

typedef struct siblock_links
{
mdf_link_t si_tx_name;
mdf_link_t si_tx_path;
mdf_link_t si_md_comment;
} SIBLOCK_LINKS;

typedef struct siblock_data
{
uint8_t si_type;
uint8_t si_bus_type;
uint8_t si_flags;
uint8_t si_reserved[5];
} SIBLOCK_DATA;

#define MDF4_CN_ID GENERATE_ID('C', 'N')
#define MDF4_CN_MIN_LENGTH (sizeof(BLOCK_HEADER) + 17 * 8)
Expand Down Expand Up @@ -669,190 +531,5 @@ typedef struct dtblock_data
uint8_t dt_data[1];
} DTBLOCK_DATA;

#define MDF4_DV_ID GENERATE_ID('D', 'V')
#define MDF4_DV_MIN_LENGTH (sizeof(BLOCK_HEADER))
#define MDF4_DV_LINK_COUNT 0

typedef struct dvblock_data
{
uint8_t dv_data[1];
} DVBLOCK_DATA;

#define MDF4_DI_ID GENERATE_ID('D', 'I')
#define MDF4_DI_MIN_LENGTH (sizeof(BLOCK_HEADER))
#define MDF4_DI_LINK_COUNT 0

typedef struct diblock_data
{
uint8_t di_data[1];
} DIBLOCK_DATA;

#define MDF4_SR_ID GENERATE_ID('S', 'R')
#define MDF4_SR_MIN_LENGTH (sizeof(BLOCK_HEADER) + 5 * 8)
#define MDF4_SR_MIN_LINK_COUNT (sizeof(SRBLOCK_LINKS) / sizeof(mdf_link_t))

#define MDF4_SR_SYNC_TIME MDF4_SYNC_TIME
#define MDF4_SR_SYNC_ANGLE MDF4_SYNC_ANGLE
#define MDF4_SR_SYNC_DISTANCE MDF4_SYNC_DISTANCE
#define MDF4_SR_SYNC_INDEX MDF4_SYNC_INDEX

#define MDF4_SR_FLAG_INVAL_BYTES (1 << 0)
#define MDF4_SR_FLAG_DOMINANT_INVAL_BIT (1 << 1)

typedef struct srblock_links
{
mdf_link_t sr_sr_next;
mdf_link_t sr_data;
} SRBLOCK_LINKS;

typedef struct srblock_data
{
uint64_t sr_cycle_count;
double sr_interval;

uint8_t sr_sync_type;

uint8_t sr_flags;
uint8_t sr_reserved[6];
} SRBLOCK_DATA;

#define MDF4_RD_ID GENERATE_ID('R', 'D')
#define MDF4_RD_MIN_LENGTH (sizeof(BLOCK_HEADER))
#define MDF4_RD_LINK_COUNT 0

typedef struct rdblock_data
{
uint8_t rd_data[1];
} RDBLOCK_DATA;

#define MDF4_RV_ID GENERATE_ID('R', 'V')
#define MDF4_RV_MIN_LENGTH (sizeof(BLOCK_HEADER))
#define MDF4_RV_LINK_COUNT 0

typedef struct rvblock_data
{
uint8_t rv_data[1];
} RVBLOCK_DATA;

#define MDF4_RI_ID GENERATE_ID('R', 'I')
#define MDF4_RI_MIN_LENGTH (sizeof(BLOCK_HEADER))
#define MDF4_RI_LINK_COUNT 0

typedef struct riblock_data
{
uint8_t ri_data[1];
} RIBLOCK_DATA;

#define MDF4_SD_ID GENERATE_ID('S', 'D')
#define MDF4_SD_MIN_LENGTH (sizeof(BLOCK_HEADER))
#define MDF4_SD_LINK_COUNT 0

typedef struct sdblock_data
{
uint8_t sd_data[1];
} SDBLOCK_DATA;

#define MDF4_DL_ID GENERATE_ID('D', 'L')
#define MDF4_DL_MIN_LENGTH (sizeof(BLOCK_HEADER) + 3 * 8)
#define MDF4_DL_MIN_LINK_COUNT (sizeof(DLBLOCK_LINKS) / sizeof(mdf_link_t) - 1)

#define MDF4_DL_FLAG_EQUAL_LENGTH (1 << 0)

#define MDF4_DL_FLAG_TIME_VALUES (1 << 1)

#define MDF4_DL_FLAG_ANGLE_VALUES (1 << 2)

#define MDF4_DL_FLAG_DISTANCE_VALUES (1 << 3)

typedef struct dlblock_links
{
mdf_link_t dl_dl_next;
mdf_link_t dl_data[1];
} DLBLOCK_LINKS;

typedef struct dlblock_data
{
uint8_t dl_flags;
uint8_t dl_reserved[3];
uint32_t dl_count;
uint64_t dl_equal_length;

} DLBLOCK_DATA;

#define MDF4_LD_ID GENERATE_ID('L', 'D')
#define MDF4_LD_MIN_LENGTH (sizeof(BLOCK_HEADER) + 3 * 8)
#define MDF4_LD_MIN_LINK_COUNT (sizeof(LDBLOCK_LINKS) / sizeof(mdf_link_t) - 1)

#define MDF4_LD_FLAG_EQUAL_SAMPLE_COUNT MDF4_DL_FLAG_EQUAL_LENGTH
#define MDF4_LD_FLAG_TIME_VALUES MDF4_DL_FLAG_TIME_VALUES
#define MDF4_LD_FLAG_ANGLE_VALUES MDF4_DL_FLAG_ANGLE_VALUES
#define MDF4_LD_FLAG_DISTANCE_VALUES MDF4_DL_FLAG_DISTANCE_VALUES
#define MDF4_LD_FLAG_INVALID_DATA_LIST (1u << 31)

typedef struct ldblock_links
{
mdf_link_t ld_ld_next;
mdf_link_t ld_data[1];

} LDBLOCK_LINKS;

typedef struct ldblock_data
{
uint32_t ld_flags;
uint32_t ld_count;
uint64_t ld_equal_sample_count;

} LDBLOCK_DATA;

#define MDF4_DZ_ID GENERATE_ID('D', 'Z')
#define MDF4_DZ_MIN_LENGTH (sizeof(BLOCK_HEADER) + sizeof(DZBLOCK_DATA))
#define MDF4_DZ_LINK_COUNT 0

#define MDF4_ZIP_TYPE_DEFLATE 0
#define MDF4_ZIP_TYPE_TRANS_DEFLATE 1
#define MDF4_ZIP_TYPE_NONE 0xFF

#define MDF4_BLOCK_TYPE_DT ((uint16_t)('D') + 0x100 * ('T'))
#define MDF4_BLOCK_TYPE_SD ((uint16_t)('S') + 0x100 * ('D'))
#define MDF4_BLOCK_TYPE_RD ((uint16_t)('R') + 0x100 * ('D'))
#define MDF4_BLOCK_TYPE_DV ((uint16_t)('D') + 0x100 * ('V'))
#define MDF4_BLOCK_TYPE_DI ((uint16_t)('D') + 0x100 * ('I'))
#define MDF4_BLOCK_TYPE_RV ((uint16_t)('R') + 0x100 * ('V'))
#define MDF4_BLOCK_TYPE_RI ((uint16_t)('R') + 0x100 * ('I'))

typedef struct dzblock_data
{

uint16_t dz_org_block_type;
uint8_t dz_zip_type;
uint8_t dz_reserved;
uint32_t dz_zip_parameter;
uint64_t dz_org_data_length;
uint64_t dz_data_length;

} DZBLOCK_DATA;

#define MDF4_HL_ID GENERATE_ID('H', 'L')
#define MDF4_HL_MIN_LENGTH (sizeof(BLOCK_HEADER) + 2 * 8)
#define MDF4_HL_MIN_LINK_COUNT 1

#define MDF4_HL_FLAG_EQUAL_LENGTH MDF4_DL_FLAG_EQUAL_LENGTH
#define MDF4_HL_FLAG_TIME_VALUES MDF4_DL_FLAG_TIME_VALUES
#define MDF4_HL_FLAG_ANGLE_VALUES MDF4_DL_FLAG_ANGLE_VALUES
#define MDF4_HL_FLAG_DISTANCE_VALUES MDF4_DL_FLAG_DISTANCE_VALUES

typedef struct hlblock_links
{
mdf_link_t hl_dl_first;

} HLBLOCK_LINKS;

typedef struct hlblock_data
{
uint16_t hl_flags;
uint8_t hl_zip_type;
uint8_t hl_reserved[5];

} HLBLOCK_DATA;

#pragma pack(pop)

0 comments on commit 67f572b

Please sign in to comment.