Custom SPMC designed for high throughput handling of CAN message streams.
More...
#include "spmc.h"
#include "stm32f407xx.h"
#include "common/freertos/freertos.h"
|
| void | SPMC_init (SPMC_t *spmc) |
| | Initializes the SPMC instance and configures CAN RX interrupts.
|
| |
| bool | 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 must have the same NVIC priority to prevent preemption of each other in the middle of a write.
|
| |
| 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.
|
| |
| void | SPMC_master_advance_tail (SPMC_t *spmc) |
| | Advances the master tail pointer by one chunk.
|
| |
| 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 tail without committing the tail.
|
| |
|
void | SPMC_follower_advance_tail (SPMC_t *spmc, size_t minis_consumed) |
| | Advances the follower tail pointer by a given number of mini chunks.
|
| |
Custom SPMC designed for high throughput handling of CAN message streams.
- Author
- Irving Wang (irvin.nosp@m.gw@p.nosp@m.urdue.nosp@m..edu)
◆ SPMC_enqueue_from_ISR()
Enqueues a received CAN message into the SPMC buffer from an ISR context. ! the two producer ISRs must have the same NVIC priority to prevent preemption of each other in the middle of a write.
- Parameters
-
| spmc | Pointer to the SPMC instance. |
| incoming_frame | Pointer to the timestamped_frame_t containing the received CAN message. |
- Returns
- true if the frame was enqueued successfully, or false if the buffer is full and the frame was dropped.
◆ SPMC_follower_peek_minis()
Peeks at the number of contiguous mini chunks available for the follower without lapping the master's tail without committing the tail.
- Returns
- The number of contiguous mini chunks available.
◆ SPMC_init()
| void SPMC_init |
( |
SPMC_t * | spmc | ) |
|
Initializes the SPMC instance and configures CAN RX interrupts.
- Parameters
-
| spmc | Pointer to the SPMC instance to initialize. |
◆ SPMC_master_advance_tail()
| void SPMC_master_advance_tail |
( |
SPMC_t * | spmc | ) |
|
Advances the master tail pointer by one chunk.
- Warning
- this function should only be called by the master consumer context
- Parameters
-
| spmc | Pointer to the SPMC instance. |
◆ SPMC_master_peek_chunk()
Peeks at the next chunk for the master (SD logging) without committing the tail.
- Parameters
-
| spmc | Pointer to the SPMC instance. |
| first_item | Output pointer that will point to the first item in the chunk if available, or NULL if no items are available. |
- Returns
- true if a chunk is available, false if no items/not enough are available