22 "the SPMC capacity must be a multiple of SPMC_CHUNK_NUM_FRAMES "
23 "to prevent DMA wraparound issues and fragmentation"
30 "SPMC_CHUNK_NUM_FRAMES must be divisible by SPMC_MINI_NUM_FRAMES "
31 "to allow mini chunk peeks for the ETH follower"
50 "32-bit loads and stores are atomic, this is required for the lock-free design to work"
bool SPMC_master_peek_chunk(SPMC_t *spmc, timestamped_frame_t **first_item)
Peeks at the next chunk for the master (SD logging) without committing the tail.
Definition spmc.c:100
void SPMC_master_advance_tail(SPMC_t *spmc)
Advances the master tail pointer by one chunk.
Definition spmc.c:131
void SPMC_init(SPMC_t *spmc)
Initializes the SPMC instance and configures CAN RX interrupts.
Definition spmc.c:41
size_t SPMC_follower_peek_minis(SPMC_t *spmc, timestamped_frame_t **first_item)
Peeks at the number of contiguous mini chunks available for the follower without lapping the master's...
Definition spmc.c:155
bool SPMC_enqueue_from_ISR(SPMC_t *spmc, const 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:65
static constexpr size_t SPMC_CHUNK_NUM_FRAMES
Definition spmc.h:17
void SPMC_follower_advance_tail(SPMC_t *spmc, size_t minis_consumed)
Advances the follower tail pointer by a given number of mini chunks.
Definition spmc.c:202
static constexpr size_t SPMC_BYTES_PER_CHUNK
Definition spmc.h:25
static constexpr size_t SPMC_FRAME_CAPACITY
Definition spmc.h:19
static constexpr size_t SPMC_CHUNK_CAPACITY
Definition spmc.h:18
static constexpr size_t SPMC_MINI_NUM_FRAMES
Definition spmc.h:27
SPMC_t g_spmc
Definition spmc.c:14
volatile uint32_t follower_drops
Definition spmc.h:42
volatile size_t master_tail
Definition spmc.h:37
volatile uint32_t overflows
Definition spmc.h:41
volatile size_t head
Definition spmc.h:36
volatile size_t follower_tail
Definition spmc.h:38
volatile bool is_full
Definition spmc.h:43
Definition timestamped_frame.h:13
Definition for timestamped CAN frames.