16#define SPMC_BUS_ID_Pos (31U)
17#define SPMC_IS_EXTID_Pos (30U)
33 "timestamped_frame_t must be 16 bytes for optimal access patterns"
37static constexpr size_t SPMC_CAPACITY = 512;
38static constexpr size_t SD_WRITE_THRESHOLD = 32;
40 SPMC_CAPACITY % SD_WRITE_THRESHOLD == 0,
41 "the SPMC capacity must be a multiple of SD_WRITE_THRESHOLD "
42 "to prevent DMA wraparound issues"
45static constexpr size_t SPMC_ALLOCATED_CAPACITY = SPMC_CAPACITY + 1;
50 volatile size_t master_tail;
51 volatile size_t follower_tail;
52 volatile uint32_t overflows;
void SPMC_master_commit_tail(SPMC_t *spmc, size_t num_consumed)
Commits the specified number of consumed frames by advancing the master tail pointer.
Definition spmc.c:107
size_t SPMC_master_peek_all(SPMC_t *spmc, timestamped_frame_t **first_item, size_t *total_unread)
Peeks at the next batch of frames available for processing by the master (SD logging) without committ...
Definition spmc.c:82
SPMC_status_t SPMC_follower_pop(SPMC_t *spmc, timestamped_frame_t **out, uint32_t *consecutive_items)
Pops a single frame for the follower (Ethernet transmission) and advances the follower tail pointer....
Definition spmc.c:130
SPMC_status_t SPMC_enqueue_from_ISR(SPMC_t *spmc, timestamped_frame_t *incoming_frame)
Enqueues a received CAN message into the SPMC buffer from an ISR context. ! the two producer ISRs mus...
Definition spmc.c:49
void SPMC_init(SPMC_t *spmc)
Initializes the SPMC instance and configures CAN RX interrupts.
Definition spmc.c:26