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)) 322 size_t size,
size_t n,
bqnotify_t onfy,
void *link);
void obqFlush(output_buffers_queue_t *obqp)
Flushes the current, partially filled, buffer to the queue.
uint8_t * ibqGetEmptyBufferI(input_buffers_queue_t *ibqp)
Gets the next empty buffer from the queue.
uint8_t * obqGetFullBufferI(output_buffers_queue_t *obqp, size_t *sizep)
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 obqReleaseEmptyBufferI(output_buffers_queue_t *obqp)
Releases the next filled buffer back in the queue.
io_buffers_queue_t output_buffers_queue_t
Type of an output buffers queue.
volatile size_t bcounter
Active buffers counter.
msg_t ibqGetFullBufferTimeout(input_buffers_queue_t *ibqp, sysinterval_t timeout)
Gets the next filled buffer from the queue.
uint8_t * btop
Pointer to the buffers boundary.
void ibqResetI(input_buffers_queue_t *ibqp)
Resets an input buffers queue.
void * link
Application defined field.
bqnotify_t notify
Data notification callback.
io_buffers_queue_t input_buffers_queue_t
Type of an input buffers queue.
void obqPostFullBufferS(output_buffers_queue_t *obqp, size_t size)
Posts a new filled buffer to the queue.
uint8_t * ptr
Pointer for R/W sequential access.
int32_t msg_t
Type of a message.
size_t ibqReadTimeout(input_buffers_queue_t *ibqp, uint8_t *bp, size_t n, sysinterval_t timeout)
Input queue read with timeout.
uint8_t * bwrptr
Buffer write pointer.
void obqPostFullBuffer(output_buffers_queue_t *obqp, size_t size)
Posts a new filled buffer to the queue.
size_t bn
Number of buffers.
void ibqPostFullBufferI(input_buffers_queue_t *ibqp, size_t size)
Posts a new filled buffer to the queue.
msg_t ibqGetFullBufferTimeoutS(input_buffers_queue_t *ibqp, sysinterval_t timeout)
Gets the next filled buffer from the queue.
size_t obqWriteTimeout(output_buffers_queue_t *obqp, const uint8_t *bp, size_t n, sysinterval_t timeout)
Output queue write with timeout.
bool obqTryFlushI(output_buffers_queue_t *obqp)
Flushes the current, partially filled, buffer to the queue.
void(* bqnotify_t)(io_buffers_queue_t *bqp)
Double buffer notification callback type.
msg_t obqGetEmptyBufferTimeout(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.
uint8_t * buffers
Queue of buffer objects.
uint32_t sysinterval_t
Type of system time interval.
msg_t obqPutTimeout(output_buffers_queue_t *obqp, uint8_t b, sysinterval_t timeout)
Output queue write with timeout.
size_t bsize
Size of buffers.
Structure of a generic buffers queue.
threads_queue_t waiting
Queue of waiting threads.
bool suspended
Queue suspended state flag.
msg_t ibqGetTimeout(input_buffers_queue_t *ibqp, sysinterval_t timeout)
Input queue read with timeout.
void obqResetI(output_buffers_queue_t *obqp)
Resets an output buffers queue.
uint8_t * top
Boundary for R/W sequential access.
void ibqReleaseEmptyBufferS(input_buffers_queue_t *ibqp)
Releases the buffer back in the queue.
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.
uint8_t * brdptr
Buffer read pointer.
void ibqReleaseEmptyBuffer(input_buffers_queue_t *ibqp)
Releases the buffer back in the queue.