138 #define BQ_BUFFER_SIZE(n, size) \ 139 (((size_t)(size) + sizeof (size_t)) * (size_t)(n)) 153 #define bqSizeX(bqp) ((bqp)->bn) 165 #define bqSpaceI(bqp) ((bqp)->bcounter) 175 #define bqGetLinkX(bqp) ((bqp)->link) 187 #define bqIsSuspendedX(bqp) ((bqp)->suspended) 203 #define bqSuspendI(bqp) { \ 204 (bqp)->suspended = true; \ 205 osalThreadDequeueAllI(&(bqp)->waiting, MSG_RESET); \ 215 #define bqResumeX(bqp) { \ 216 (bqp)->suspended = false; \ 229 #define ibqIsEmptyI(ibqp) ((bool)(bqSpaceI(ibqp) == 0U)) 241 #define ibqIsFullI(ibqp) \ 243 ((bool)(((ibqp)->bwrptr == (ibqp)->brdptr) && ((ibqp)->bcounter != 0U))) \ 256 #define obqIsEmptyI(obqp) \ 258 ((bool)(((obqp)->bwrptr == (obqp)->brdptr) && ((obqp)->bcounter != 0U))) \ 271 #define obqIsFullI(obqp) ((bool)(bqSpaceI(obqp) == 0U)) 296 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.