Subsections of Modules

Application Callbacks

Functions that the client model must implement with C linkage.

Called serially in foreground, never from an interrupt. Simulation implementations may forward these entry points to dynamically bound models.

Contents

Functions

Function Description
CDX_app_system_init Initialize application resources once during CM4 startup.
CDX_app_model_period_us_get Return the fixed execution period after application system setup.
CDX_app_model_init Initialize the model before the runtime publishes READY.
CDX_app_model_step Execute one due model step after queued RX callbacks.
CDX_app_can_rx_handle Process one received CAN/FD frame before the next model step.

Functions

CDX_app_system_init

Initialize application resources once during CM4 startup.

1CDX_STATUS CDX_app_system_init(void)

retval

  • CDX_STATUS_OK: Application setup succeeded.

Returns

Any other status faults the runtime before period/model initialization and prevents READY. A model without system setup must return CDX_STATUS_OK.

Note: Called after platform setup, runtime binding and IPC validation, before CDX_app_model_period_us_get and CDX_app_model_init. Time and memory APIs are available; TX enqueue remains offline. Do not initialize runtime-owned MU, PIT, cache or shared IPC resources here. A CM4 reset/reload calls it again.

Parameters

  • void

Location: cdx_app_functions.h:45

CDX_app_model_period_us_get

Return the fixed execution period after application system setup.

1uint32_t CDX_app_model_period_us_get(void)

Returns

Period in microseconds, in the range 1..INT32_MAX.

Note: Called after CDX_app_system_init and before CDX_app_model_init. The runtime is bound; configuration loaded by system initialization may be used.

Parameters

  • void

Location: cdx_app_functions.h:52

CDX_app_model_init

Initialize the model before the runtime publishes READY.

1CDX_STATUS CDX_app_model_init(void)

retval

  • CDX_STATUS_OK: Initialization succeeded.

Returns

Any other status faults the model and prevents RUNNING.

Note: System initialization and period validation have succeeded before this call. The runtime is bound; TX enqueue remains offline.

Parameters

  • void

Location: cdx_app_functions.h:60

CDX_app_model_step

Execute one due model step after queued RX callbacks.

1CDX_STATUS CDX_app_model_step(void)

retval

  • CDX_STATUS_OK: Step completed successfully.

Returns

Any other status faults the model and discards queued TX frames.

Note: Called only while RUNNING; missed periods are counted, not replayed.

Parameters

  • void

Location: cdx_app_functions.h:67

CDX_app_can_rx_handle

Process one received CAN/FD frame before the next model step.

1CDX_STATUS CDX_app_can_rx_handle(CDX_CAN_FRAME const *frame)

retval

  • CDX_STATUS_OK: Frame handled.
  • CDX_STATUS_MESSAGE_IGNORED: Frame intentionally ignored.
  • CDX_STATUS_MULTIPLEX_IGNORED: Multiplexed frame not selected.
  • CDX_STATUS_NO_DATA: No applicable data.

Returns

Any other status faults the model; implement an ignored result if the application does not handle received frames. Copy data to retain it.

Parameters

Location: cdx_app_functions.h:78

CDX DBC Signal Copying

The same internal start-LSB offset is used in both buffers. Bit zero is the first byte’s least significant bit. Intel signals continue into increasing byte indices; Motorola signals continue into decreasing indices. Motorola offsets are not the external DBC start-MSB notation. Buffers may overlap: the complete signal is read before any destination bits change.

Contents

Functions

Function Description
CDX_dbc_copy_u32_le Copy a little-endian signal of up to 32 bits.
CDX_dbc_copy_u64_le Copy a little-endian signal of up to 64 bits.
CDX_dbc_copy_u32_be Copy a big-endian signal of up to 32 bits.
CDX_dbc_copy_u64_be Copy a big-endian signal of up to 64 bits.

Functions

CDX_dbc_copy_u32_le

Copy a little-endian signal of up to 32 bits.

1CDX_STATUS CDX_dbc_copy_u32_le(void *dst, uint32_t dst_size, void const *src, uint32_t src_size, uint16_t offset, uint8_t bits)

retval

  • CDX_STATUS_OK: Signal copied; surrounding destination bits preserved.
  • CDX_STATUS_BAD_PARAM: Invalid pointer, width or range; nothing written.

Parameters

  • void * dst: Nonnull writable destination buffer.
  • uint32_t dst_size: Destination size in bytes.
  • void const * src: Nonnull source buffer.
  • uint32_t src_size: Source size in bytes.
  • uint16_t offset: Internal least significant bit position in both buffers.
  • uint8_t bits: Signal width, 1 through 32; must fit in both buffers.

Location: cdx_dbc_copy.h:49

CDX_dbc_copy_u64_le

Copy a little-endian signal of up to 64 bits.

1CDX_STATUS CDX_dbc_copy_u64_le(void *dst, uint32_t dst_size, void const *src, uint32_t src_size, uint16_t offset, uint8_t bits)

retval

  • CDX_STATUS_OK: Signal copied; surrounding destination bits preserved.
  • CDX_STATUS_BAD_PARAM: Invalid pointer, width or range; nothing written.

Parameters

  • void * dst: Nonnull writable destination buffer.
  • uint32_t dst_size: Destination size in bytes.
  • void const * src: Nonnull source buffer.
  • uint32_t src_size: Source size in bytes.
  • uint16_t offset: Internal least significant bit position in both buffers.
  • uint8_t bits: Signal width, 1 through 64; must fit in both buffers.

Location: cdx_dbc_copy.h:61

CDX_dbc_copy_u32_be

Copy a big-endian signal of up to 32 bits.

1CDX_STATUS CDX_dbc_copy_u32_be(void *dst, uint32_t dst_size, void const *src, uint32_t src_size, uint16_t offset, uint8_t bits)

retval

  • CDX_STATUS_OK: Signal copied; surrounding destination bits preserved.
  • CDX_STATUS_BAD_PARAM: Invalid pointer, width or range; nothing written.

Parameters

  • void * dst: Nonnull writable destination buffer.
  • uint32_t dst_size: Destination size in bytes.
  • void const * src: Nonnull source buffer.
  • uint32_t src_size: Source size in bytes.
  • uint16_t offset: Internal start-LSB position, not external Motorola start-MSB.
  • uint8_t bits: Signal width, 1 through 32; must fit in both buffers.

Location: cdx_dbc_copy.h:73

CDX_dbc_copy_u64_be

Copy a big-endian signal of up to 64 bits.

1CDX_STATUS CDX_dbc_copy_u64_be(void *dst, uint32_t dst_size, void const *src, uint32_t src_size, uint16_t offset, uint8_t bits)

retval

  • CDX_STATUS_OK: Signal copied; surrounding destination bits preserved.
  • CDX_STATUS_BAD_PARAM: Invalid pointer, width or range; nothing written.

Parameters

  • void * dst: Nonnull writable destination buffer.
  • uint32_t dst_size: Destination size in bytes.
  • void const * src: Nonnull source buffer.
  • uint32_t src_size: Source size in bytes.
  • uint16_t offset: Internal start-LSB position, not external Motorola start-MSB.
  • uint8_t bits: Signal width, 1 through 64; must fit in both buffers.

Location: cdx_dbc_copy.h:85

CDX DBC Signal Packing

Offsets identify the signal’s least significant bit using the internal DBC numbering: bit zero is the first byte’s least significant bit. Intel signals continue into increasing byte indices; Motorola signals continue into decreasing byte indices. Motorola offsets are not the DBC file’s external start-MSB notation. Surrounding bits are preserved.

Contents

Functions

Function Description
CDX_dbc_pack_u32_le Pack an unsigned, little-endian signal of up to 32 bits.
CDX_dbc_pack_u64_le Pack an unsigned, little-endian signal of up to 64 bits.
CDX_dbc_pack_u32_be Pack an unsigned, big-endian signal of up to 32 bits.
CDX_dbc_pack_u64_be Pack an unsigned, big-endian signal of up to 64 bits.

Functions

CDX_dbc_pack_u32_le

Pack an unsigned, little-endian signal of up to 32 bits.

1CDX_STATUS CDX_dbc_pack_u32_le(void *buffer, uint32_t size, uint16_t offset, uint8_t bits, uint32_t value)

retval

  • CDX_STATUS_OK: Signal packed without modifying other bits.
  • CDX_STATUS_BAD_PARAM: Invalid pointer, width or range; no data changed.

Parameters

  • void * buffer: Writable destination; must be nonnull.
  • uint32_t size: Destination size in bytes, including CAN-FD data if present.
  • uint16_t offset: Least significant bit position in internal DBC numbering.
  • uint8_t bits: Signal width, 1 through 32; the entire signal must fit.
  • uint32_t value: Raw value; only its least significant bits are written.

Location: cdx_dbc_pack.h:48

CDX_dbc_pack_u64_le

Pack an unsigned, little-endian signal of up to 64 bits.

1CDX_STATUS CDX_dbc_pack_u64_le(void *buffer, uint32_t size, uint16_t offset, uint8_t bits, uint64_t value)

retval

  • CDX_STATUS_OK: Signal packed without modifying other bits.
  • CDX_STATUS_BAD_PARAM: Invalid pointer, width or range; no data changed.

Parameters

  • void * buffer: Writable destination; must be nonnull.
  • uint32_t size: Destination size in bytes.
  • uint16_t offset: Least significant bit position in internal DBC numbering.
  • uint8_t bits: Signal width, 1 through 64; the entire signal must fit.
  • uint64_t value: Raw value; only its least significant bits are written.

Location: cdx_dbc_pack.h:59

CDX_dbc_pack_u32_be

Pack an unsigned, big-endian signal of up to 32 bits.

1CDX_STATUS CDX_dbc_pack_u32_be(void *buffer, uint32_t size, uint16_t offset, uint8_t bits, uint32_t value)

retval

  • CDX_STATUS_OK: Signal packed without modifying other bits.
  • CDX_STATUS_BAD_PARAM: Invalid pointer, width or range; no data changed.

Parameters

  • void * buffer: Writable destination; must be nonnull.
  • uint32_t size: Destination size in bytes.
  • uint16_t offset: Internal start-LSB position, not external Motorola start-MSB.
  • uint8_t bits: Signal width, 1 through 32; the entire signal must fit.
  • uint32_t value: Raw value; only its least significant bits are written.

Location: cdx_dbc_pack.h:70

CDX_dbc_pack_u64_be

Pack an unsigned, big-endian signal of up to 64 bits.

1CDX_STATUS CDX_dbc_pack_u64_be(void *buffer, uint32_t size, uint16_t offset, uint8_t bits, uint64_t value)

retval

  • CDX_STATUS_OK: Signal packed without modifying other bits.
  • CDX_STATUS_BAD_PARAM: Invalid pointer, width or range; no data changed.

Parameters

  • void * buffer: Writable destination; must be nonnull.
  • uint32_t size: Destination size in bytes.
  • uint16_t offset: Internal start-LSB position, not external Motorola start-MSB.
  • uint8_t bits: Signal width, 1 through 64; the entire signal must fit.
  • uint64_t value: Raw value; only its least significant bits are written.

Location: cdx_dbc_pack.h:81

CDX DBC Signal Unpacking

Results are raw unsigned values without scaling or sign extension. Bit zero is the first byte’s least significant bit. Intel signals continue into increasing byte indices; Motorola signals continue into decreasing byte indices. Use internal start-LSB offsets, not external Motorola start-MSB.

Contents

Functions

Function Description
CDX_dbc_unpack_u32_le Read an unsigned, little-endian signal of up to 32 bits.
CDX_dbc_unpack_u64_le Read an unsigned, little-endian signal of up to 64 bits.
CDX_dbc_unpack_u32_be Read an unsigned, big-endian signal of up to 32 bits.
CDX_dbc_unpack_u64_be Read an unsigned, big-endian signal of up to 64 bits.

Functions

CDX_dbc_unpack_u32_le

Read an unsigned, little-endian signal of up to 32 bits.

1uint32_t CDX_dbc_unpack_u32_le(void const *buffer, uint32_t size, uint16_t offset, uint8_t bits)

Returns

Raw value, or zero for an invalid pointer, width or range.

Note: Invalid input is indistinguishable from a valid zero-valued signal.

Parameters

  • void const * buffer: Nonnull source buffer; never modified.
  • uint32_t size: Source size in bytes, including CAN-FD data if present.
  • uint16_t offset: Least significant bit position in internal DBC numbering.
  • uint8_t bits: Signal width, 1 through 32; the entire signal must fit.

Location: cdx_dbc_unpack.h:46

CDX_dbc_unpack_u64_le

Read an unsigned, little-endian signal of up to 64 bits.

1uint64_t CDX_dbc_unpack_u64_le(void const *buffer, uint32_t size, uint16_t offset, uint8_t bits)

Returns

Raw value, or zero for an invalid pointer, width or range.

Parameters

  • void const * buffer: Nonnull source buffer; never modified.
  • uint32_t size: Source size in bytes.
  • uint16_t offset: Least significant bit position in internal DBC numbering.
  • uint8_t bits: Signal width, 1 through 64; the entire signal must fit.

Location: cdx_dbc_unpack.h:55

CDX_dbc_unpack_u32_be

Read an unsigned, big-endian signal of up to 32 bits.

1uint32_t CDX_dbc_unpack_u32_be(void const *buffer, uint32_t size, uint16_t offset, uint8_t bits)

Returns

Raw value, or zero for an invalid pointer, width or range.

Parameters

  • void const * buffer: Nonnull source buffer; never modified.
  • uint32_t size: Source size in bytes.
  • uint16_t offset: Internal start-LSB position, not external Motorola start-MSB.
  • uint8_t bits: Signal width, 1 through 32; the entire signal must fit.

Location: cdx_dbc_unpack.h:64

CDX_dbc_unpack_u64_be

Read an unsigned, big-endian signal of up to 64 bits.

1uint64_t CDX_dbc_unpack_u64_be(void const *buffer, uint32_t size, uint16_t offset, uint8_t bits)

Returns

Raw value, or zero for an invalid pointer, width or range.

Parameters

  • void const * buffer: Nonnull source buffer; never modified.
  • uint32_t size: Source size in bytes.
  • uint16_t offset: Internal start-LSB position, not external Motorola start-MSB.
  • uint8_t bits: Signal width, 1 through 64; the entire signal must fit.

Location: cdx_dbc_unpack.h:73

CDX Model CAN API

Foreground-only access to the model’s sole logical IPC bus.

IPC maps to CM7’s Model IPC/CAN3 port, not a physical CM4 CAN controller. Call from model callbacks, not interrupts or concurrent threads.

Contents

Typedefs

Typedef Description
CDX_DATA_64 Aligned eight-byte payload chunk with unsigned access views.
CDX_CAN_FRAME_FLAGS CDX flags; these values are not the Model IPC wire flag encoding.
CDX_CAN_FRAME Received frame; the frame and data are valid only during RX callback.
CDX_CAN_TX_PARAMS TX request copied during enqueue; zero-initialize before filling it.

Functions

Function Description
CDX_can_frame_flags_is_std Test for a classic standard-ID frame.
CDX_can_frame_flags_is_ext Test for a classic extended-ID frame.
CDX_can_frame_flags_is_fd_std Test for a CAN-FD standard-ID frame.
CDX_can_frame_flags_is_fd_ext Test for a CAN-FD extended-ID frame.
CDX_can_tx_enqueue_copy Copy a TX request and payload into the nonblocking Model IPC queue.
CDX_can_is_timed_out_ms Test elapsed local milliseconds using unsigned wrap-safe subtraction.
CDX_can_read_signal_u32_le Read an unsigned, little-endian signal of up to 32 bits.
CDX_can_read_signal_u64_le Read an unsigned, little-endian signal of up to 64 bits.
CDX_can_read_signal_u32_be Read an unsigned, big-endian signal of up to 32 bits.
CDX_can_read_signal_u64_be Read an unsigned, big-endian signal of up to 64 bits.

Macros

Macro Description
CDX_CAN_FRAME_FLAG_NONE Classic frame with a standard 11-bit identifier.
CDX_CAN_FRAME_FLAG_IDE Extended 29-bit identifier.
CDX_CAN_FRAME_FLAG_EDL CAN-FD payload, up to 64 bytes instead of the classic 8-byte limit.
CDX_CAN_FRAME_FLAG_BRS CAN-FD bit-rate switch; valid only with EDL.
CDX_CAN_FRAME_FLAG_DISABLE_DEADLINE Ignore deadline_ticks when enqueueing and publishing this TX frame.

Typedefs

CDX_DATA_64

Aligned eight-byte payload chunk with unsigned access views.

1typedef union CDX_DATA_64_UNION CDX_DATA_64

CDX_CAN_FRAME_FLAGS

CDX flags; these values are not the Model IPC wire flag encoding.

1typedef uint16_t CDX_CAN_FRAME_FLAGS

CDX_CAN_FRAME

Received frame; the frame and data are valid only during RX callback.

1typedef struct CDX_CAN_FRAME_STRUCT CDX_CAN_FRAME

CDX_CAN_TX_PARAMS

TX request copied during enqueue; zero-initialize before filling it.

1typedef struct CDX_CAN_TX_PARAMS_STRUCT CDX_CAN_TX_PARAMS

Functions

CDX_can_frame_flags_is_std

Test for a classic standard-ID frame.

1int CDX_can_frame_flags_is_std(CDX_CAN_FRAME_FLAGS flags)

Returns

Nonzero if both IDE and EDL are clear.

Parameters

Location: cdx_can.h:101

CDX_can_frame_flags_is_ext

Test for a classic extended-ID frame.

1int CDX_can_frame_flags_is_ext(CDX_CAN_FRAME_FLAGS flags)

Returns

Nonzero if IDE is set and EDL is clear.

Parameters

Location: cdx_can.h:109

CDX_can_frame_flags_is_fd_std

Test for a CAN-FD standard-ID frame.

1int CDX_can_frame_flags_is_fd_std(CDX_CAN_FRAME_FLAGS flags)

Returns

Nonzero if EDL is set and IDE is clear.

Parameters

Location: cdx_can.h:117

CDX_can_frame_flags_is_fd_ext

Test for a CAN-FD extended-ID frame.

1int CDX_can_frame_flags_is_fd_ext(CDX_CAN_FRAME_FLAGS flags)

Returns

Nonzero if both IDE and EDL are set.

Parameters

Location: cdx_can.h:125

CDX_can_tx_enqueue_copy

Copy a TX request and payload into the nonblocking Model IPC queue.

1CDX_STATUS CDX_can_tx_enqueue_copy(CDX_CAN_BUS_ID bus, CDX_CAN_TX_PARAMS const *params, CDX_DATA_64 const *data)

retval

  • CDX_STATUS_OK: Copied and accepted; not yet delivered to the peer.
  • CDX_STATUS_BAD_PARAM: Invalid bus, pointer, flags, ID or length.
  • CDX_STATUS_IPC_OFFLINE: No bound RUNNING runtime or IPC session lost.
  • CDX_STATUS_TIMEOUT: Nonzero, enabled deadline has already expired.
  • CDX_STATUS_QUEUE_FULL: Newest frame rejected; runtime drop count rises.

Note: There are no TX completion callbacks. Acceptance does not guarantee publication, physical CAN delivery or model execution. Queued frames may expire or be discarded on IPC fault. Published batches remain owned by the peer until acknowledgement; they cannot be cancelled by expiry.

Parameters

  • CDX_CAN_BUS_ID bus: Sole logical bus: CDX_CAN_BUS_ID_IPC (legacy CAN1 is an alias).
  • CDX_CAN_TX_PARAMS const * params: Nonnull request, with supported flags, ID and byte length.
  • CDX_DATA_64 const * data: Aligned payload chunks containing length_bytes bytes; may be NULL only for an empty payload. Storage may be reused after this call.

Location: cdx_can.h:150

CDX_can_is_timed_out_ms

Test elapsed local milliseconds using unsigned wrap-safe subtraction.

1int CDX_can_is_timed_out_ms(CDX_MILLISEC_32 received_ms, CDX_MILLISEC_32 timeout_ms)

Returns

Nonzero if elapsed milliseconds are at least timeout_ms.

Note: The timestamp must be less than one millisecond-counter wrap old.

Parameters

  • CDX_MILLISEC_32 received_ms: Recent past timestamp from the local millisecond clock.
  • CDX_MILLISEC_32 timeout_ms: Timeout interval; zero always times out.

Location: cdx_can.h:159

CDX_can_read_signal_u32_le

Read an unsigned, little-endian signal of up to 32 bits.

1uint32_t CDX_can_read_signal_u32_le(void const *buffer, uint32_t size, uint16_t offset, uint8_t bits)

Returns

Raw value, or zero for an invalid pointer, width or range.

Note: Invalid input is indistinguishable from a valid zero-valued signal.

Parameters

  • void const * buffer: Nonnull source buffer; never modified.
  • uint32_t size: Source size in bytes, including CAN-FD data if present.
  • uint16_t offset: Least significant bit position in internal DBC numbering.
  • uint8_t bits: Signal width, 1 through 32; the entire signal must fit.

Location: cdx_can.h:163

CDX_can_read_signal_u64_le

Read an unsigned, little-endian signal of up to 64 bits.

1uint64_t CDX_can_read_signal_u64_le(void const *buffer, uint32_t size, uint16_t offset, uint8_t bits)

Returns

Raw value, or zero for an invalid pointer, width or range.

Parameters

  • void const * buffer: Nonnull source buffer; never modified.
  • uint32_t size: Source size in bytes.
  • uint16_t offset: Least significant bit position in internal DBC numbering.
  • uint8_t bits: Signal width, 1 through 64; the entire signal must fit.

Location: cdx_can.h:167

CDX_can_read_signal_u32_be

Read an unsigned, big-endian signal of up to 32 bits.

1uint32_t CDX_can_read_signal_u32_be(void const *buffer, uint32_t size, uint16_t offset, uint8_t bits)

Returns

Raw value, or zero for an invalid pointer, width or range.

Parameters

  • void const * buffer: Nonnull source buffer; never modified.
  • uint32_t size: Source size in bytes.
  • uint16_t offset: Internal start-LSB position, not external Motorola start-MSB.
  • uint8_t bits: Signal width, 1 through 32; the entire signal must fit.

Location: cdx_can.h:171

CDX_can_read_signal_u64_be

Read an unsigned, big-endian signal of up to 64 bits.

1uint64_t CDX_can_read_signal_u64_be(void const *buffer, uint32_t size, uint16_t offset, uint8_t bits)

Returns

Raw value, or zero for an invalid pointer, width or range.

Parameters

  • void const * buffer: Nonnull source buffer; never modified.
  • uint32_t size: Source size in bytes.
  • uint16_t offset: Internal start-LSB position, not external Motorola start-MSB.
  • uint8_t bits: Signal width, 1 through 64; the entire signal must fit.

Location: cdx_can.h:175

Macros

CDX_CAN_FRAME_FLAG_NONE

1#define CDX_CAN_FRAME_FLAG_NONE 0u

Classic frame with a standard 11-bit identifier.

CDX_CAN_FRAME_FLAG_IDE

1#define CDX_CAN_FRAME_FLAG_IDE 0x0001u

Extended 29-bit identifier.

CDX_CAN_FRAME_FLAG_EDL

1#define CDX_CAN_FRAME_FLAG_EDL 0x0008u

CAN-FD payload, up to 64 bytes instead of the classic 8-byte limit.

CDX_CAN_FRAME_FLAG_BRS

1#define CDX_CAN_FRAME_FLAG_BRS 0x0010u

CAN-FD bit-rate switch; valid only with EDL.

CDX_CAN_FRAME_FLAG_DISABLE_DEADLINE

1#define CDX_CAN_FRAME_FLAG_DISABLE_DEADLINE 0x0100u

Ignore deadline_ticks when enqueueing and publishing this TX frame.

Subsections of CDX Model CAN API

CDX_CAN_FRAME_STRUCT

Received frame; the frame and data are valid only during RX callback.

Contents

Public Attributes

Attribute Description
id Raw 11-bit or 29-bit CAN identifier.
bus CDX_CAN_BUS_ID_IPC for Model IPC.
error_type Zero; error frames are not supported.
flags IDE, EDL and BRS frame attributes.
timestamp_ticks Receiver-local arrival microseconds.
hw_timestamp Zero; no physical CAN timestamp.
length_bytes Payload bytes: classic 0..8, FD 0..64.
data_chunks Number of chunks, ceil(length_bytes/8).
reserved Zero; reserved for future API use.
data Borrowed aligned chunks; copy to retain.

Public Attributes

Field: id

Raw 11-bit or 29-bit CAN identifier.

1uint32_t id

Field: bus

CDX_CAN_BUS_ID_IPC for Model IPC.

1CDX_CAN_BUS_ID bus

Field: error_type

Zero; error frames are not supported.

1uint8_t error_type

Field: flags

IDE, EDL and BRS frame attributes.

1CDX_CAN_FRAME_FLAGS flags

Field: timestamp_ticks

Receiver-local arrival microseconds.

1CDX_TICKS_32 timestamp_ticks

Field: hw_timestamp

Zero; no physical CAN timestamp.

1uint32_t hw_timestamp

Field: length_bytes

Payload bytes: classic 0..8, FD 0..64.

1uint16_t length_bytes

Field: data_chunks

Number of chunks, ceil(length_bytes/8).

1uint8_t data_chunks

Field: reserved

Zero; reserved for future API use.

1uint8_t reserved

Field: data

Borrowed aligned chunks; copy to retain.

1CDX_DATA_64 const  * data

CDX_CAN_TX_PARAMS_STRUCT

TX request copied during enqueue; zero-initialize before filling it.

Contents

Public Attributes

Attribute Description
id Raw 11-bit or 29-bit CAN identifier.
flags Frame attributes and TX policy flags.
length_bytes Payload bytes: classic 0..8, FD 0..64.
deadline_ticks Absolute local ticks; zero disables expiry.

Public Attributes

Field: id

Raw 11-bit or 29-bit CAN identifier.

1uint32_t id

Field: flags

Frame attributes and TX policy flags.

1CDX_CAN_FRAME_FLAGS flags

Field: length_bytes

Payload bytes: classic 0..8, FD 0..64.

1uint16_t length_bytes

Field: deadline_ticks

Absolute local ticks; zero disables expiry.

1CDX_TICKS_32 deadline_ticks

CDX_DATA_64_UNION

Aligned eight-byte payload chunk with unsigned access views.

Contents

Public Attributes

Attribute Description
u64 Native-endian 64-bit view of the chunk.
u32 Two native-endian 32-bit words in storage order.
u16 Four native-endian 16-bit words in storage order.
u8 Eight bytes in payload order; u8[0] is first.

Public Attributes

Field: u64

Native-endian 64-bit view of the chunk.

1uint64_t u64

Field: u32

Two native-endian 32-bit words in storage order.

1uint32_t u32

Field: u16

Four native-endian 16-bit words in storage order.

1uint16_t u16

Field: u8

Eight bytes in payload order; u8[0] is first.

1uint8_t u8

CDX Model Memory Access

Foreground-only access to at most eight registered model regions.

Register only model-owned storage, not peripherals or IPC buffers. The caller is responsible for pointer validity and storage lifetime. Registration is reset when the runtime is bound, not by model stepping.

Contents

Functions

Function Description
CDX_memory_region_register Register a non-overlapping model memory region during initialization.
CDX_memory_read Copy bytes from one registered region to caller-owned storage.
CDX_memory_write Copy bytes into one registered, writable model region.
CDX_memory_read_u8 Read an 8-bit scalar through address extension zero.
CDX_memory_read_u16 Read a 16-bit scalar through address extension zero.
CDX_memory_read_u32 Read a 32-bit scalar through address extension zero.
CDX_memory_read_u64 Read a 64-bit scalar through address extension zero.
CDX_memory_write_u8 Write an 8-bit scalar through address extension zero.
CDX_memory_write_u16 Write a 16-bit scalar through address extension zero.
CDX_memory_write_u32 Write a 32-bit scalar through address extension zero.
CDX_memory_write_u64 Write a 64-bit scalar through address extension zero.

Functions

CDX_memory_region_register

Register a non-overlapping model memory region during initialization.

1CDX_STATUS CDX_memory_region_register(uint32_t address, void *data, uint32_t size, int writable)

retval

  • CDX_STATUS_OK: Region registered.
  • CDX_STATUS_BAD_PARAM: Null storage, zero size, overlap or address overflow.
  • CDX_STATUS_QUEUE_FULL: All eight registration slots are in use.

Parameters

  • uint32_t address: Logical 32-bit base address exposed through this API.
  • void * data: Backing storage; must remain valid until runtime rebinding.
  • uint32_t size: Region length in bytes; must be nonzero and not overflow address.
  • int writable: Nonzero permits writes; zero makes the region read-only.

Location: cdx_memory.h:47

CDX_memory_read

Copy bytes from one registered region to caller-owned storage.

1CDX_STATUS CDX_memory_read(uint32_t address, uint8_t extension, uint32_t size, void *data)

retval

  • CDX_STATUS_OK: Bytes copied.
  • CDX_STATUS_BAD_PARAM: Unsupported extension, null data or invalid range.

Parameters

  • uint32_t address: Logical starting address of the bytes to read.
  • uint8_t extension: Address extension; only zero is supported.
  • uint32_t size: Byte count; the entire range must fit in a single region.
  • void * data: Nonnull destination with room for size bytes; overlap is permitted.

Location: cdx_memory.h:57

CDX_memory_write

Copy bytes into one registered, writable model region.

1CDX_STATUS CDX_memory_write(uint32_t address, uint8_t extension, uint32_t size, void const *data)

retval

  • CDX_STATUS_OK: Bytes copied.
  • CDX_STATUS_BAD_PARAM: Invalid extension, source, range or write permission.

Parameters

  • uint32_t address: Logical starting address of the bytes to write.
  • uint8_t extension: Address extension; only zero is supported.
  • uint32_t size: Byte count; the entire range must fit in a single region.
  • void const * data: Nonnull source containing size bytes; overlap is permitted.

Location: cdx_memory.h:67

CDX_memory_read_u8

Read an 8-bit scalar through address extension zero.

1uint8_t CDX_memory_read_u8(uint32_t address)

Returns

Native-endian value, or zero on failure; use CDX_memory_read for status.

Parameters

  • uint32_t address: Logical address in a registered region; no alignment required.

Location: cdx_memory.h:73

CDX_memory_read_u16

Read a 16-bit scalar through address extension zero.

1uint16_t CDX_memory_read_u16(uint32_t address)

Returns

Native-endian value, or zero on failure; use CDX_memory_read for status.

Parameters

  • uint32_t address: Logical address in a registered region; no alignment required.

Location: cdx_memory.h:79

CDX_memory_read_u32

Read a 32-bit scalar through address extension zero.

1uint32_t CDX_memory_read_u32(uint32_t address)

Returns

Native-endian value, or zero on failure; use CDX_memory_read for status.

Parameters

  • uint32_t address: Logical address in a registered region; no alignment required.

Location: cdx_memory.h:85

CDX_memory_read_u64

Read a 64-bit scalar through address extension zero.

1uint64_t CDX_memory_read_u64(uint32_t address)

Returns

Native-endian value, or zero on failure; use CDX_memory_read for status.

Parameters

  • uint32_t address: Logical address in a registered region; no alignment required.

Location: cdx_memory.h:91

CDX_memory_write_u8

Write an 8-bit scalar through address extension zero.

1CDX_STATUS CDX_memory_write_u8(uint32_t address, uint8_t value)

Returns

CDX_STATUS_OK on success, CDX_STATUS_BAD_PARAM on invalid range/permission.

Parameters

  • uint32_t address: Logical address in a registered writable region.
  • uint8_t value: Native-endian value to store; no alignment is required.

Location: cdx_memory.h:98

CDX_memory_write_u16

Write a 16-bit scalar through address extension zero.

1CDX_STATUS CDX_memory_write_u16(uint32_t address, uint16_t value)

Returns

CDX_STATUS_OK on success, CDX_STATUS_BAD_PARAM on invalid range/permission.

Parameters

  • uint32_t address: Logical address in a registered writable region.
  • uint16_t value: Native-endian value to store; no alignment is required.

Location: cdx_memory.h:105

CDX_memory_write_u32

Write a 32-bit scalar through address extension zero.

1CDX_STATUS CDX_memory_write_u32(uint32_t address, uint32_t value)

Returns

CDX_STATUS_OK on success, CDX_STATUS_BAD_PARAM on invalid range/permission.

Parameters

  • uint32_t address: Logical address in a registered writable region.
  • uint32_t value: Native-endian value to store; no alignment is required.

Location: cdx_memory.h:112

CDX_memory_write_u64

Write a 64-bit scalar through address extension zero.

1CDX_STATUS CDX_memory_write_u64(uint32_t address, uint64_t value)

Returns

CDX_STATUS_OK on success, CDX_STATUS_BAD_PARAM on invalid range/permission.

Parameters

  • uint32_t address: Logical address in a registered writable region.
  • uint64_t value: Native-endian value to store; no alignment is required.

Location: cdx_memory.h:119

CDX Numeric Utilities

Contents

Typedefs

Typedef Description
bool8_t 8-bit boolean type.
real32_t Ginmake-facing IEEE-754 binary32 scalar.
real64_t Ginmake-facing IEEE-754 binary64 scalar.

Functions

Function Description
CDX_byteswap16 Reverse the byte order of a 16-bit integer.
CDX_byteswap32 Reverse the byte order of a 32-bit integer.
CDX_byteswap64 Reverse the byte order of a 64-bit integer.
CDX_reinterpret_cast_u32 Return the IEEE-754 binary32 representation of a float.
CDX_reinterpret_cast_u64 Return the IEEE-754 binary64 representation of a double.
CDX_reinterpret_cast_f32 Interpret an unsigned 32-bit integer as IEEE-754 binary32 bits.
CDX_reinterpret_cast_f64 Interpret an unsigned 64-bit integer as IEEE-754 binary64 bits.
CDX_sign_extend_u8 Sign-extend a raw signal to an 8-bit signed integer.
CDX_sign_extend_u16 Sign-extend a raw signal to a 16-bit signed integer.
CDX_sign_extend_u32 Sign-extend a raw signal to a 32-bit signed integer.
CDX_sign_extend_u64 Sign-extend a raw signal to a 64-bit signed integer.
CDX_f32_rounds_to_zero Test whether rounding to the nearest integer gives zero.

Typedefs

bool8_t

8-bit boolean type.

1typedef uint8_t bool8_t

real32_t

Ginmake-facing IEEE-754 binary32 scalar.

1typedef float real32_t

real64_t

Ginmake-facing IEEE-754 binary64 scalar.

1typedef double real64_t

Functions

CDX_byteswap16

Reverse the byte order of a 16-bit integer.

1uint16_t CDX_byteswap16(uint16_t value)

Returns

Integer with its bytes reversed.

Parameters

  • uint16_t value: Integer to convert.

Location: cdx_utils.h:50

CDX_byteswap32

Reverse the byte order of a 32-bit integer.

1uint32_t CDX_byteswap32(uint32_t value)

Returns

Integer with its bytes reversed.

Parameters

  • uint32_t value: Integer to convert.

Location: cdx_utils.h:58

CDX_byteswap64

Reverse the byte order of a 64-bit integer.

1uint64_t CDX_byteswap64(uint64_t value)

Returns

Integer with its bytes reversed.

Parameters

  • uint64_t value: Integer to convert.

Location: cdx_utils.h:67

CDX_reinterpret_cast_u32

Return the IEEE-754 binary32 representation of a float.

1uint32_t CDX_reinterpret_cast_u32(float value)

Returns

The same bit pattern as an unsigned 32-bit integer.

Parameters

  • float value: Floating-point value; no numeric conversion is performed.

Location: cdx_utils.h:76

CDX_reinterpret_cast_u64

Return the IEEE-754 binary64 representation of a double.

1uint64_t CDX_reinterpret_cast_u64(double value)

Returns

The same bit pattern as an unsigned 64-bit integer.

Parameters

  • double value: Floating-point value; no numeric conversion is performed.

Location: cdx_utils.h:86

CDX_reinterpret_cast_f32

Interpret an unsigned 32-bit integer as IEEE-754 binary32 bits.

1float CDX_reinterpret_cast_f32(uint32_t value)

Returns

The float with that bit pattern, including NaNs and infinities.

Parameters

  • uint32_t value: Bit pattern; no numeric conversion is performed.

Location: cdx_utils.h:96

CDX_reinterpret_cast_f64

Interpret an unsigned 64-bit integer as IEEE-754 binary64 bits.

1double CDX_reinterpret_cast_f64(uint64_t value)

Returns

The double with that bit pattern, including NaNs and infinities.

Parameters

  • uint64_t value: Bit pattern; no numeric conversion is performed.

Location: cdx_utils.h:106

CDX_sign_extend_u8

Sign-extend a raw signal to an 8-bit signed integer.

1int8_t CDX_sign_extend_u8(uint8_t bits, uint8_t value)

Returns

Signed value using the selected width’s most significant bit as sign.

Parameters

  • uint8_t bits: Signal width; zero returns zero, widths above 8 are clamped to 8.
  • uint8_t value: Raw signal; bits above the selected width are discarded.

Location: cdx_utils.h:121

CDX_sign_extend_u16

Sign-extend a raw signal to a 16-bit signed integer.

1int16_t CDX_sign_extend_u16(uint8_t bits, uint16_t value)

Returns

Signed value using the selected width’s most significant bit as sign.

Parameters

  • uint8_t bits: Signal width; zero returns zero, widths above 16 are clamped to 16.
  • uint16_t value: Raw signal; bits above the selected width are discarded.

Location: cdx_utils.h:128

CDX_sign_extend_u32

Sign-extend a raw signal to a 32-bit signed integer.

1int32_t CDX_sign_extend_u32(uint8_t bits, uint32_t value)

Returns

Signed value using the selected width’s most significant bit as sign.

Parameters

  • uint8_t bits: Signal width; zero returns zero, widths above 32 are clamped to 32.
  • uint32_t value: Raw signal; bits above the selected width are discarded.

Location: cdx_utils.h:135

CDX_sign_extend_u64

Sign-extend a raw signal to a 64-bit signed integer.

1int64_t CDX_sign_extend_u64(uint8_t bits, uint64_t value)

Returns

Signed value using the selected width’s most significant bit as sign.

Parameters

  • uint8_t bits: Signal width; zero returns zero, widths above 64 are clamped to 64.
  • uint64_t value: Raw signal; bits above the selected width are discarded.

Location: cdx_utils.h:142

CDX_f32_rounds_to_zero

Test whether rounding to the nearest integer gives zero.

1uint8_t CDX_f32_rounds_to_zero(float value)

Returns

Nonzero only for -0.5 < value < 0.5; false for NaN and either boundary.

Note: Half-way values are treated as rounding away from zero.

Parameters

  • float value: Floating-point value to test.

Location: cdx_utils.h:149

CDX Runtime Time

Foreground time helpers; CM4 and CM7 clocks are not synchronized.

The runtime must poll at least once per 32-bit microsecond wrap (about 71 minutes) to extend time correctly. Deadline comparisons require intervals within the half-range limit. These APIs are not ISR-safe.

Contents

Functions

Function Description
CDX_ticks_now Read the current wrapping microsecond tick counter.
CDX_microsec_32_now Read the local microsecond counter modulo 2^32.
CDX_microsec_64_now Read local microseconds with foreground-maintained wrap extension.
CDX_millisec_32_now Read local milliseconds modulo 2^32.
CDX_millisec_32_from_ticks Convert a recent past microsecond timestamp to local milliseconds.
CDX_microsec_deadline_remain Calculate microseconds remaining to a local absolute deadline.
CDX_ticks_deadline_from_millisec Form a nonzero CAN deadline relative to the current local ticks.

Functions

CDX_ticks_now

Read the current wrapping microsecond tick counter.

1CDX_TICKS_32 CDX_ticks_now(void)

Returns

Local ticks, or zero when no runtime clock is bound.

Parameters

  • void

Location: cdx_time.h:56

CDX_microsec_32_now

Read the local microsecond counter modulo 2^32.

1CDX_MICROSEC_32 CDX_microsec_32_now(void)

Returns

Local microseconds, or zero when no runtime clock is bound.

Parameters

  • void

Location: cdx_time.h:61

CDX_microsec_64_now

Read local microseconds with foreground-maintained wrap extension.

1CDX_MICROSEC_64 CDX_microsec_64_now(void)

Returns

Extended microsecond count, or zero when no runtime is bound.

Parameters

  • void

Location: cdx_time.h:66

CDX_millisec_32_now

Read local milliseconds modulo 2^32.

1CDX_MILLISEC_32 CDX_millisec_32_now(void)

Returns

Extended microseconds divided by 1000, truncated to 32 bits.

Parameters

  • void

Location: cdx_time.h:71

CDX_millisec_32_from_ticks

Convert a recent past microsecond timestamp to local milliseconds.

1CDX_MILLISEC_32 CDX_millisec_32_from_ticks(CDX_TICKS_32 ticks)

Returns

Timestamp in wrapping milliseconds, accounting for a recent tick wrap.

Parameters

  • CDX_TICKS_32 ticks: Past local timestamp less than one microsecond-counter wrap old.

Location: cdx_time.h:77

CDX_microsec_deadline_remain

Calculate microseconds remaining to a local absolute deadline.

1CDX_MICROSEC_32 CDX_microsec_deadline_remain(CDX_MICROSEC_32 deadline)

Returns

Remaining microseconds, or zero if due, expired or beyond half-range.

Note: This helper does not interpret zero as a disabled CAN deadline.

Parameters

  • CDX_MICROSEC_32 deadline: Wrapping microsecond deadline within the half-range limit.

Location: cdx_time.h:84

CDX_ticks_deadline_from_millisec

Form a nonzero CAN deadline relative to the current local ticks.

1CDX_TICKS_32 CDX_ticks_deadline_from_millisec(CDX_MILLISEC_32 interval_ms)

Returns

Absolute wrapping deadline; a computed zero is changed to one tick.

Note: Zero in CDX_CAN_TX_PARAMS means no deadline, so this result avoids zero.

Parameters

  • CDX_MILLISEC_32 interval_ms: Milliseconds ahead; clamped to the half-range limit / 1000.

Location: cdx_time.h:91