ecor
Loading...
Searching...
No Matches
ecor::trnx_circular_buffer< T, N > Struct Template Reference

ISR-safe 4-cursor circular buffer for managing in-flight transactions. More...

#include <ecor.hpp>

Public Member Functions

T & deliver_front () noexcept
 
bool empty () const noexcept
 
bool full () const noexcept
 
bool has_deliver () const noexcept
 
bool has_rx () const noexcept
 
bool has_tx () const noexcept
 
void pop () noexcept
 
void push (T val) noexcept
 
void rx_done () noexcept
 
T & rx_front () noexcept
 
void tx_done () noexcept
 
T & tx_front () noexcept
 

Public Attributes

std::atomic< uint16_t > deliver = 0
 
std::atomic< uint16_t > enqueue = 0
 
std::atomic< uint16_t > rx = 0
 
std::atomic< uint16_t > tx = 0
 

Detailed Description

template<typename T, size_t N>
struct ecor::trnx_circular_buffer< T, N >

ISR-safe 4-cursor circular buffer for managing in-flight transactions.

Cursors are: enqueue -> tx -> rx -> deliver

  • enqueue - tx: Tasks ready to be transmitted (main loop pushes new entries here).
  • tx - rx: Transactions that have been transmitted and are awaiting a reply.
  • rx - deliver: Transactions that have received a reply and are awaiting to be taken out (main loop delivers completion to the receiver).

Cursors use std::atomic for safe cross-context access (main loop vs ISR).

  • T: Element type (must be trivial).
  • N: Buffer capacity (must be a power of 2, < 65536).

The documentation for this struct was generated from the following file: