42#if !defined(BUFFERS_CHUNKS_SIZE) || defined(__DOXYGEN__)
43#define BUFFERS_CHUNKS_SIZE 64
51#if (BUFFERS_CHUNKS_SIZE & (BUFFERS_CHUNKS_SIZE - 1)) != 0
53#error "BUFFERS_CHUNKS_SIZE must be a power of two"
154#define BQ_BUFFER_SIZE(n, size) \
155 (((size_t)(size) + sizeof (size_t)) * (size_t)(n))
169#define bqSizeX(bqp) ((bqp)->bn)
181#define bqSpaceI(bqp) ((bqp)->bcounter)
191#define bqGetLinkX(bqp) ((bqp)->link)
201#define bqSetLinkX(bqp, lk) ((bqp)->link = lk)
213#define bqIsSuspendedX(bqp) ((bqp)->suspended)
229#define bqSuspendI(bqp) { \
230 (bqp)->suspended = true; \
231 osalThreadDequeueAllI(&(bqp)->waiting, MSG_RESET); \
241#define bqResumeX(bqp) { \
242 (bqp)->suspended = false; \
255#define ibqIsEmptyI(ibqp) ((bool)(bqSpaceI(ibqp) == 0U))
267#define ibqIsFullI(ibqp) \
269 ((bool)(((ibqp)->bwrptr == (ibqp)->brdptr) && ((ibqp)->bcounter != 0U))) \
282#define obqIsEmptyI(obqp) \
284 ((bool)(((obqp)->bwrptr == (obqp)->brdptr) && ((obqp)->bcounter != 0U))) \
297#define obqIsFullI(obqp) ((bool)(bqSpaceI(obqp) == 0U))
308 size_t size,
size_t n,
bqnotify_t infy,
void *link);
322 size_t size,
size_t n,
bqnotify_t onfy,
void *link);
uint8_t * ibqGetEmptyBufferI(input_buffers_queue_t *ibqp)
Gets the next empty buffer from the queue.
io_buffers_queue_t input_buffers_queue_t
Type of an input buffers queue.
void obqPostFullBuffer(output_buffers_queue_t *obqp, size_t size)
Posts a new filled buffer to the queue.
void obqFlush(output_buffers_queue_t *obqp)
Flushes the current, partially filled, buffer to the queue.
void ibqPostFullBufferI(input_buffers_queue_t *ibqp, size_t size)
Posts a new filled buffer to the queue.
uint8_t * obqGetFullBufferI(output_buffers_queue_t *obqp, size_t *sizep)
Gets the next filled buffer from the queue.
io_buffers_queue_t output_buffers_queue_t
Type of an output buffers queue.
bool obqTryFlushI(output_buffers_queue_t *obqp)
Flushes the current, partially filled, buffer to the queue.
msg_t ibqGetFullBufferTimeout(input_buffers_queue_t *ibqp, sysinterval_t timeout)
Gets the next filled buffer from the queue.
msg_t obqGetEmptyBufferTimeoutS(output_buffers_queue_t *obqp, sysinterval_t timeout)
Gets the next empty buffer from the queue.
void obqObjectInit(output_buffers_queue_t *obqp, bool suspended, uint8_t *bp, size_t size, size_t n, bqnotify_t onfy, void *link)
Initializes an output buffers queue object.
size_t obqWriteTimeout(output_buffers_queue_t *obqp, const uint8_t *bp, size_t n, sysinterval_t timeout)
Output queue write with timeout.
void obqReleaseEmptyBufferI(output_buffers_queue_t *obqp)
Releases the next filled buffer back in the queue.
struct io_buffers_queue io_buffers_queue_t
Type of a generic queue of buffers.
void obqPostFullBufferS(output_buffers_queue_t *obqp, size_t size)
Posts a new filled buffer to the queue.
void(* bqnotify_t)(io_buffers_queue_t *bqp)
Double buffer notification callback type.
void ibqObjectInit(input_buffers_queue_t *ibqp, bool suspended, uint8_t *bp, size_t size, size_t n, bqnotify_t infy, void *link)
Initializes an input buffers queue object.
void ibqReleaseEmptyBufferS(input_buffers_queue_t *ibqp)
Releases the buffer back in the queue.
msg_t ibqGetTimeout(input_buffers_queue_t *ibqp, sysinterval_t timeout)
Input queue read with timeout.
size_t ibqReadTimeout(input_buffers_queue_t *ibqp, uint8_t *bp, size_t n, sysinterval_t timeout)
Input queue read with timeout.
msg_t ibqGetFullBufferTimeoutS(input_buffers_queue_t *ibqp, sysinterval_t timeout)
Gets the next filled buffer from the queue.
void ibqResetI(input_buffers_queue_t *ibqp)
Resets an input buffers queue.
msg_t obqGetEmptyBufferTimeout(output_buffers_queue_t *obqp, sysinterval_t timeout)
Gets the next empty buffer from the queue.
void obqResetI(output_buffers_queue_t *obqp)
Resets an output buffers queue.
void ibqReleaseEmptyBuffer(input_buffers_queue_t *ibqp)
Releases the buffer back in the queue.
msg_t obqPutTimeout(output_buffers_queue_t *obqp, uint8_t b, sysinterval_t timeout)
Output queue write with timeout.
int32_t msg_t
Type of a message.
uint32_t sysinterval_t
Type of system time interval.
Structure of a generic buffers queue.
uint8_t * brdptr
Buffer read pointer.
bqnotify_t notify
Data notification callback.
size_t bn
Number of buffers.
uint8_t * buffers
Queue of buffer objects.
uint8_t * btop
Pointer to the buffers boundary.
bool suspended
Queue suspended state flag.
size_t bsize
Size of buffers.
void * link
Application defined field.
uint8_t * bwrptr
Buffer write pointer.
volatile size_t bcounter
Active buffers counter.
threads_queue_t waiting
Queue of waiting threads.
uint8_t * top
Boundary for R/W sequential access.
uint8_t * ptr
Pointer for R/W sequential access.