77 size_t size,
size_t n,
bqnotify_t infy,
void *link) {
79 osalDbgCheck((ibqp != NULL) && (bp != NULL) && (size >= 2U));
86 ibqp->
btop = bp + ((size +
sizeof (size_t)) * n);
87 ibqp->
bsize = size +
sizeof (size_t);
137 return ibqp->
bwrptr +
sizeof (size_t);
156 *((
size_t *)ibqp->
bwrptr) = size;
240 ibqp->
ptr = ibqp->
brdptr +
sizeof (size_t);
285 if (ibqp->
notify != NULL) {
315 if (ibqp->
ptr == NULL) {
329 if (ibqp->
ptr >= ibqp->
top) {
370 if (ibqp->
ptr == NULL) {
384 size = (size_t)ibqp->
top - (
size_t)ibqp->
ptr;
385 if (size > (n - r)) {
393 memcpy(bp, ibqp->
ptr, 64U);
399 memcpy(bp, ibqp->
ptr, size);
406 if (ibqp->
ptr >= ibqp->
top) {
433 size_t size,
size_t n,
bqnotify_t onfy,
void *link) {
435 osalDbgCheck((obqp != NULL) && (bp != NULL) && (size >= 2U));
442 obqp->
btop = bp + ((size +
sizeof (size_t)) * n);
443 obqp->
bsize = size +
sizeof (size_t);
496 *sizep = *((
size_t *)obqp->
brdptr);
498 return obqp->
brdptr +
sizeof (size_t);
595 obqp->
ptr = obqp->
bwrptr +
sizeof (size_t);
633 *((
size_t *)obqp->
bwrptr) = size;
646 if (obqp->
notify != NULL) {
678 if (obqp->
ptr == NULL) {
692 if (obqp->
ptr >= obqp->
top) {
733 if (obqp->
ptr == NULL) {
747 size = (size_t)obqp->
top - (
size_t)obqp->
ptr;
748 if (size > (n - w)) {
756 memcpy(obqp->
ptr, bp, 64U);
762 memcpy(obqp->
ptr, bp, size);
769 if (obqp->
ptr >= obqp->
top) {
802 size_t size = (size_t)obqp->
ptr - ((
size_t)obqp->
bwrptr +
sizeof (size_t));
807 *((
size_t *)obqp->
bwrptr) = size;
837 if (obqp->
ptr != NULL) {
838 size_t size = ((size_t)obqp->
ptr - (
size_t)obqp->
bwrptr) -
sizeof (
size_t);
#define ibqIsFullI(ibqp)
Evaluates to true if the specified input buffers queue is full.
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.
void osalThreadDequeueAllI(threads_queue_t *tqp, msg_t msg)
Dequeues and wakes up all threads from the queue.
volatile size_t bcounter
Active buffers counter.
#define ibqIsEmptyI(ibqp)
Evaluates to true if the specified input buffers queue is empty.
msg_t ibqGetFullBufferTimeout(input_buffers_queue_t *ibqp, sysinterval_t timeout)
Gets the next filled buffer from the queue.
#define obqIsEmptyI(obqp)
Evaluates to true if the specified output buffers queue is empty.
#define osalDbgCheckClassI()
I-Class state check.
#define obqIsFullI(obqp)
Evaluates to true if the specified output buffers queue is full.
uint8_t * btop
Pointer to the buffers boundary.
void ibqResetI(input_buffers_queue_t *ibqp)
Resets an input buffers queue.
static void osalSysUnlock(void)
Leaves a critical zone from thread context.
void * link
Application defined field.
bqnotify_t notify
Data notification callback.
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.
#define osalDbgCheck(c)
Function parameters check.
uint8_t * buffers
Queue of buffer objects.
uint32_t sysinterval_t
Type of system time interval.
void osalThreadDequeueNextI(threads_queue_t *tqp, msg_t msg)
Dequeues and wakes up one thread from the queue, if any.
msg_t obqPutTimeout(output_buffers_queue_t *obqp, uint8_t b, sysinterval_t timeout)
Output queue write with timeout.
msg_t osalThreadEnqueueTimeoutS(threads_queue_t *tqp, sysinterval_t timeout)
Enqueues the caller thread.
size_t bsize
Size of buffers.
Structure of a generic buffers queue.
threads_queue_t waiting
Queue of waiting threads.
#define bqSizeX(bqp)
Returns the queue's number of buffers.
bool suspended
Queue suspended state flag.
static void osalSysLock(void)
Enters a critical zone from thread context.
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.
#define osalDbgCheckClassS()
S-Class state check.
#define osalDbgAssert(c, remark)
Condition assertion.
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.
static void osalThreadQueueObjectInit(threads_queue_t *tqp)
Initializes a threads queue object.
uint8_t * brdptr
Buffer read pointer.
void ibqReleaseEmptyBuffer(input_buffers_queue_t *ibqp)
Releases the buffer back in the queue.