ChibiOS/HAL  6.1.0
I/O Bytes Queues
Collaboration diagram for I/O Bytes Queues:

Detailed Description

Queues are mostly used in serial-like device drivers. Serial device drivers are usually designed to have a lower side (lower driver, it is usually an interrupt service routine) and an upper side (upper driver, accessed by the application threads).
There are several kind of queues:

Queue functions returned status value

#define Q_OK   MSG_OK
 Operation successful. More...
 
#define Q_TIMEOUT   MSG_TIMEOUT
 Timeout condition. More...
 
#define Q_RESET   MSG_RESET
 Queue has been reset. More...
 
#define Q_EMPTY   MSG_TIMEOUT
 Queue empty. More...
 
#define Q_FULL   MSG_TIMEOUT
 Queue full,. More...
 

Macro Functions

#define qSizeX(qp)
 Returns the queue's buffer size. More...
 
#define qSpaceI(qp)   ((qp)->q_counter)
 Queue space. More...
 
#define qGetLink(qp)   ((qp)->q_link)
 Returns the queue application-defined link. More...
 
#define qSetLink(qp, lk)   ((qp)->q_link = lk)
 Sets the queue application-defined link. More...
 
#define iqGetFullI(iqp)   qSpaceI(iqp)
 Returns the filled space into an input queue. More...
 
#define iqGetEmptyI(iqp)   (qSizeX(iqp) - qSpaceI(iqp))
 Returns the empty space into an input queue. More...
 
#define iqIsEmptyI(iqp)   ((bool)(qSpaceI(iqp) == 0U))
 Evaluates to true if the specified input queue is empty. More...
 
#define iqIsFullI(iqp)
 Evaluates to true if the specified input queue is full. More...
 
#define iqGet(iqp)   iqGetTimeout(iqp, TIME_INFINITE)
 Input queue read. More...
 
#define oqGetFullI(oqp)   (qSizeX(oqp) - qSpaceI(oqp))
 Returns the filled space into an output queue. More...
 
#define oqGetEmptyI(oqp)   qSpaceI(oqp)
 Returns the empty space into an output queue. More...
 
#define oqIsEmptyI(oqp)
 Evaluates to true if the specified output queue is empty. More...
 
#define oqIsFullI(oqp)   ((bool)(qSpaceI(oqp) == 0U))
 Evaluates to true if the specified output queue is full. More...
 
#define oqPut(oqp, b)   oqPutTimeout(oqp, b, TIME_INFINITE)
 Output queue write. More...
 

Typedefs

typedef struct io_queue io_queue_t
 Type of a generic I/O queue structure. More...
 
typedef void(* qnotify_t) (io_queue_t *qp)
 Queue notification callback type. More...
 
typedef io_queue_t input_queue_t
 Type of an input queue structure. More...
 
typedef io_queue_t output_queue_t
 Type of an output queue structure. More...
 

Data Structures

struct  io_queue
 Generic I/O queue structure. More...
 

Functions

static size_t iq_read (input_queue_t *iqp, uint8_t *bp, size_t n)
 Non-blocking input queue read. More...
 
static size_t oq_write (output_queue_t *oqp, const uint8_t *bp, size_t n)
 Non-blocking output queue write. More...
 
void iqObjectInit (input_queue_t *iqp, uint8_t *bp, size_t size, qnotify_t infy, void *link)
 Initializes an input queue. More...
 
void iqResetI (input_queue_t *iqp)
 Resets an input queue. More...
 
msg_t iqPutI (input_queue_t *iqp, uint8_t b)
 Input queue write. More...
 
msg_t iqGetI (input_queue_t *iqp)
 Input queue non-blocking read. More...
 
msg_t iqGetTimeout (input_queue_t *iqp, sysinterval_t timeout)
 Input queue read with timeout. More...
 
size_t iqReadI (input_queue_t *iqp, uint8_t *bp, size_t n)
 Input queue non-blocking read. More...
 
size_t iqReadTimeout (input_queue_t *iqp, uint8_t *bp, size_t n, sysinterval_t timeout)
 Input queue read with timeout. More...
 
void oqObjectInit (output_queue_t *oqp, uint8_t *bp, size_t size, qnotify_t onfy, void *link)
 Initializes an output queue. More...
 
void oqResetI (output_queue_t *oqp)
 Resets an output queue. More...
 
msg_t oqPutI (output_queue_t *oqp, uint8_t b)
 Output queue non-blocking write. More...
 
msg_t oqPutTimeout (output_queue_t *oqp, uint8_t b, sysinterval_t timeout)
 Output queue write with timeout. More...
 
msg_t oqGetI (output_queue_t *oqp)
 Output queue read. More...
 
size_t oqWriteI (output_queue_t *oqp, const uint8_t *bp, size_t n)
 Output queue non-blocking write. More...
 
size_t oqWriteTimeout (output_queue_t *oqp, const uint8_t *bp, size_t n, sysinterval_t timeout)
 Output queue write with timeout. More...
 

Macro Definition Documentation

#define Q_OK   MSG_OK

Operation successful.

Definition at line 36 of file hal_queues.h.

#define Q_TIMEOUT   MSG_TIMEOUT

Timeout condition.

Definition at line 37 of file hal_queues.h.

#define Q_RESET   MSG_RESET

Queue has been reset.

Definition at line 38 of file hal_queues.h.

#define Q_EMPTY   MSG_TIMEOUT

Queue empty.

Definition at line 39 of file hal_queues.h.

#define Q_FULL   MSG_TIMEOUT

Queue full,.

Definition at line 40 of file hal_queues.h.

#define qSizeX (   qp)
Value:
/*lint -save -e9033 [10.8] The cast is safe.*/ \
((size_t)((qp)->q_top - (qp)->q_buffer)) \
/*lint -restore*/

Returns the queue's buffer size.

Parameters
[in]qppointer to a io_queue_t structure
Returns
The buffer size.
Function Class:This is an X-Class API, this function can be invoked from any context.

Definition at line 127 of file hal_queues.h.

Referenced by oqResetI().

#define qSpaceI (   qp)    ((qp)->q_counter)

Queue space.

Returns the used space if used on an input queue or the empty space if used on an output queue.

Parameters
[in]qppointer to a io_queue_t structure
Returns
The buffer space.
Function Class:This is an I-Class API, this function can be invoked from within a system lock zone by both threads and interrupt handlers.

Definition at line 142 of file hal_queues.h.

#define qGetLink (   qp)    ((qp)->q_link)

Returns the queue application-defined link.

Note
This function can be called in any context.
Parameters
[in]qppointer to a io_queue_t structure
Returns
The application-defined link.
Function Class:Special function, this function has special requirements see the notes.

Definition at line 153 of file hal_queues.h.

#define qSetLink (   qp,
  lk 
)    ((qp)->q_link = lk)

Sets the queue application-defined link.

Note
This function can be called in any context.
Parameters
[in]qppointer to a io_queue_t structure
[in]lkThe application-defined link.
Function Class:Special function, this function has special requirements see the notes.

Definition at line 164 of file hal_queues.h.

#define iqGetFullI (   iqp)    qSpaceI(iqp)

Returns the filled space into an input queue.

Parameters
[in]iqppointer to an input_queue_t structure
Returns
The number of full bytes in the queue.
Return values
0if the queue is empty.
Function Class:This is an I-Class API, this function can be invoked from within a system lock zone by both threads and interrupt handlers.

Definition at line 175 of file hal_queues.h.

Referenced by iq_read().

#define iqGetEmptyI (   iqp)    (qSizeX(iqp) - qSpaceI(iqp))

Returns the empty space into an input queue.

Parameters
[in]iqppointer to an input_queue_t structure
Returns
The number of empty bytes in the queue.
Return values
0if the queue is full.
Function Class:This is an I-Class API, this function can be invoked from within a system lock zone by both threads and interrupt handlers.

Definition at line 186 of file hal_queues.h.

#define iqIsEmptyI (   iqp)    ((bool)(qSpaceI(iqp) == 0U))

Evaluates to true if the specified input queue is empty.

Parameters
[in]iqppointer to an input_queue_t structure
Returns
The queue status.
Return values
falseif the queue is not empty.
trueif the queue is empty.
Function Class:This is an I-Class API, this function can be invoked from within a system lock zone by both threads and interrupt handlers.

Definition at line 198 of file hal_queues.h.

Referenced by iqGetI(), iqGetTimeout(), sdGetWouldBlock(), and sdIncomingDataI().

#define iqIsFullI (   iqp)
Value:
/*lint -save -e9007 [13.5] No side effects, a pointer is passed.*/ \
((bool)(((iqp)->q_wrptr == (iqp)->q_rdptr) && ((iqp)->q_counter != 0U))) \
/*lint -restore*/

Evaluates to true if the specified input queue is full.

Parameters
[in]iqppointer to an input_queue_t structure
Returns
The queue status.
Return values
falseif the queue is not full.
trueif the queue is full.
Function Class:This is an I-Class API, this function can be invoked from within a system lock zone by both threads and interrupt handlers.

Definition at line 210 of file hal_queues.h.

Referenced by iqPutI().

#define iqGet (   iqp)    iqGetTimeout(iqp, TIME_INFINITE)

Input queue read.

This function reads a byte value from an input queue. If the queue is empty then the calling thread is suspended until a byte arrives in the queue.

Parameters
[in]iqppointer to an input_queue_t structure
Returns
A byte value from the queue.
Return values
MSG_RESETif the queue has been reset.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 227 of file hal_queues.h.

#define oqGetFullI (   oqp)    (qSizeX(oqp) - qSpaceI(oqp))

Returns the filled space into an output queue.

Parameters
[in]oqppointer to an output_queue_t structure
Returns
The number of full bytes in the queue.
Return values
0if the queue is empty.
Function Class:This is an I-Class API, this function can be invoked from within a system lock zone by both threads and interrupt handlers.

Definition at line 238 of file hal_queues.h.

#define oqGetEmptyI (   oqp)    qSpaceI(oqp)

Returns the empty space into an output queue.

Parameters
[in]oqppointer to an output_queue_t structure
Returns
The number of empty bytes in the queue.
Return values
0if the queue is full.
Function Class:This is an I-Class API, this function can be invoked from within a system lock zone by both threads and interrupt handlers.

Definition at line 249 of file hal_queues.h.

Referenced by oq_write().

#define oqIsEmptyI (   oqp)
Value:
/*lint -save -e9007 [13.5] No side effects, a pointer is passed.*/ \
((bool)(((oqp)->q_wrptr == (oqp)->q_rdptr) && ((oqp)->q_counter != 0U))) \
/*lint -restore*/

Evaluates to true if the specified output queue is empty.

Parameters
[in]oqppointer to an output_queue_t structure
Returns
The queue status.
Return values
falseif the queue is not empty.
trueif the queue is empty.
Function Class:This is an I-Class API, this function can be invoked from within a system lock zone by both threads and interrupt handlers.

Definition at line 261 of file hal_queues.h.

Referenced by oqGetI().

#define oqIsFullI (   oqp)    ((bool)(qSpaceI(oqp) == 0U))

Evaluates to true if the specified output queue is full.

Parameters
[in]oqppointer to an output_queue_t structure
Returns
The queue status.
Return values
falseif the queue is not full.
trueif the queue is full.
Function Class:This is an I-Class API, this function can be invoked from within a system lock zone by both threads and interrupt handlers.

Definition at line 276 of file hal_queues.h.

Referenced by oqPutI(), oqPutTimeout(), and sdPutWouldBlock().

#define oqPut (   oqp,
 
)    oqPutTimeout(oqp, b, TIME_INFINITE)

Output queue write.

This function writes a byte value to an output queue. If the queue is full then the calling thread is suspended until there is space in the queue.

Parameters
[in]oqppointer to an output_queue_t structure
[in]bthe byte value to be written in the queue
Returns
The operation status.
Return values
MSG_OKif the operation succeeded.
MSG_RESETif the queue has been reset.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 292 of file hal_queues.h.

Typedef Documentation

typedef struct io_queue io_queue_t

Type of a generic I/O queue structure.

Definition at line 58 of file hal_queues.h.

typedef void(* qnotify_t) (io_queue_t *qp)

Queue notification callback type.

Parameters
[in]qpthe queue pointer

Definition at line 65 of file hal_queues.h.

Type of an input queue structure.

This structure represents a generic asymmetrical input queue. Writing to the queue is non-blocking and can be performed from interrupt handlers or from within a kernel lock zone. Reading the queue can be a blocking operation and is supposed to be performed by a system thread.

Definition at line 97 of file hal_queues.h.

Type of an output queue structure.

This structure represents a generic asymmetrical output queue. Reading from the queue is non-blocking and can be performed from interrupt handlers or from within a kernel lock zone. Writing the queue can be a blocking operation and is supposed to be performed by a system thread.

Definition at line 109 of file hal_queues.h.

Function Documentation

static size_t iq_read ( input_queue_t iqp,
uint8_t *  bp,
size_t  n 
)
static

Non-blocking input queue read.

The function reads data from an input queue into a buffer. The operation completes when the specified amount of data has been transferred or when the input queue has been emptied.

Parameters
[in]iqppointer to an input_queue_t structure
[out]bppointer to the data buffer
[in]nthe maximum amount of data to be transferred, the value 0 is reserved
Returns
The number of bytes effectively transferred.
Function Class:Not an API, this function is for internal use only.

Definition at line 60 of file hal_queues.c.

References iqGetFullI, osalDbgCheck, io_queue::q_buffer, io_queue::q_counter, io_queue::q_rdptr, and io_queue::q_top.

Referenced by iqReadI(), and iqReadTimeout().

static size_t oq_write ( output_queue_t oqp,
const uint8_t *  bp,
size_t  n 
)
static

Non-blocking output queue write.

The function writes data from a buffer to an output queue. The operation completes when the specified amount of data has been transferred or when the output queue has been filled.

Parameters
[in]oqppointer to an output_queue_t structure
[in]bppointer to the data buffer
[in]nthe maximum amount of data to be transferred, the value 0 is reserved
Returns
The number of bytes effectively transferred.
Function Class:Not an API, this function is for internal use only.

Definition at line 108 of file hal_queues.c.

References oqGetEmptyI, osalDbgCheck, io_queue::q_buffer, io_queue::q_counter, io_queue::q_top, and io_queue::q_wrptr.

Referenced by oqWriteI(), and oqWriteTimeout().

void iqObjectInit ( input_queue_t iqp,
uint8_t *  bp,
size_t  size,
qnotify_t  infy,
void *  link 
)

Initializes an input queue.

A Semaphore is internally initialized and works as a counter of the bytes contained in the queue.

Note
The callback is invoked from within the S-Locked system state.
Parameters
[out]iqppointer to an input_queue_t structure
[in]bppointer to a memory area allocated as queue buffer
[in]sizesize of the queue buffer
[in]infypointer to a callback function that is invoked when data is read from the queue. The value can be NULL.
[in]linkapplication defined pointer
Function Class:Initializer, this function just initializes an object and can be invoked before the kernel is initialized.

Definition at line 177 of file hal_queues.c.

References osalThreadQueueObjectInit(), io_queue::q_buffer, io_queue::q_counter, io_queue::q_link, io_queue::q_notify, io_queue::q_rdptr, io_queue::q_top, io_queue::q_waiting, and io_queue::q_wrptr.

Referenced by sdObjectInit().

Here is the call graph for this function:

void iqResetI ( input_queue_t iqp)

Resets an input queue.

All the data in the input queue is erased and lost, any waiting thread is resumed with status MSG_RESET.

Note
A reset operation can be used by a low level driver in order to obtain immediate attention from the high level layers.
Parameters
[in]iqppointer to an input_queue_t structure
Function Class:This is an I-Class API, this function can be invoked from within a system lock zone by both threads and interrupt handlers.

Definition at line 201 of file hal_queues.c.

References osalDbgCheckClassI, osalThreadDequeueAllI(), io_queue::q_buffer, io_queue::q_counter, io_queue::q_rdptr, io_queue::q_waiting, and io_queue::q_wrptr.

Referenced by sdStop().

Here is the call graph for this function:

msg_t iqPutI ( input_queue_t iqp,
uint8_t  b 
)

Input queue write.

A byte value is written into the low end of an input queue. The operation completes immediately.

Parameters
[in]iqppointer to an input_queue_t structure
[in]bthe byte value to be written in the queue
Returns
The operation status.
Return values
MSG_OKif the operation has been completed with success.
MSG_TIMEOUTif the queue is full.
Function Class:This is an I-Class API, this function can be invoked from within a system lock zone by both threads and interrupt handlers.

Definition at line 224 of file hal_queues.c.

References iqIsFullI, osalDbgCheckClassI, osalThreadDequeueNextI(), io_queue::q_buffer, io_queue::q_counter, io_queue::q_top, io_queue::q_waiting, and io_queue::q_wrptr.

Referenced by sdIncomingDataI().

Here is the call graph for this function:

msg_t iqGetI ( input_queue_t iqp)

Input queue non-blocking read.

This function reads a byte value from an input queue. The operation completes immediately.

Note
The callback is invoked after removing a character from the queue.
Parameters
[in]iqppointer to an input_queue_t structure
Returns
A byte value from the queue.
Return values
MSG_TIMEOUTif the queue is empty.
MSG_RESETif the queue has been reset.
Function Class:This is an I-Class API, this function can be invoked from within a system lock zone by both threads and interrupt handlers.

Definition at line 258 of file hal_queues.c.

References iqIsEmptyI, osalDbgCheckClassI, io_queue::q_buffer, io_queue::q_counter, io_queue::q_notify, io_queue::q_rdptr, and io_queue::q_top.

msg_t iqGetTimeout ( input_queue_t iqp,
sysinterval_t  timeout 
)

Input queue read with timeout.

This function reads a byte value from an input queue. If the queue is empty then the calling thread is suspended until a byte arrives in the queue or a timeout occurs.

Note
The callback is invoked after removing a character from the queue.
Parameters
[in]iqppointer to an input_queue_t structure
[in]timeoutthe number of ticks before the operation timeouts, the following special values are allowed:
  • TIME_IMMEDIATE immediate timeout.
  • TIME_INFINITE no timeout.
Returns
A byte value from the queue.
Return values
MSG_TIMEOUTif the specified time expired.
MSG_RESETif the queue has been reset.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 304 of file hal_queues.c.

References iqIsEmptyI, osalSysLock(), osalSysUnlock(), osalThreadEnqueueTimeoutS(), io_queue::q_buffer, io_queue::q_counter, io_queue::q_notify, io_queue::q_rdptr, io_queue::q_top, and io_queue::q_waiting.

Here is the call graph for this function:

size_t iqReadI ( input_queue_t iqp,
uint8_t *  bp,
size_t  n 
)

Input queue non-blocking read.

The function reads data from an input queue into a buffer. The operation completes immediately.

Parameters
[in]iqppointer to an input_queue_t structure
[out]bppointer to the data buffer
[in]nthe maximum amount of data to be transferred, the value 0 is reserved
Returns
The number of bytes effectively transferred.
Function Class:This is an I-Class API, this function can be invoked from within a system lock zone by both threads and interrupt handlers.

Definition at line 348 of file hal_queues.c.

References iq_read(), osalDbgCheckClassI, and io_queue::q_notify.

Here is the call graph for this function:

size_t iqReadTimeout ( input_queue_t iqp,
uint8_t *  bp,
size_t  n,
sysinterval_t  timeout 
)

Input queue read with timeout.

The function reads data from an input queue into a buffer. The operation completes when the specified amount of data has been transferred or after the specified timeout or if the queue has been reset.

Note
The function is not atomic, if you need atomicity it is suggested to use a semaphore or a mutex for mutual exclusion.
The callback is invoked after removing each character from the queue.
Parameters
[in]iqppointer to an input_queue_t structure
[out]bppointer to the data buffer
[in]nthe maximum amount of data to be transferred, the value 0 is reserved
[in]timeoutthe number of ticks before the operation timeouts, the following special values are allowed:
  • TIME_IMMEDIATE immediate timeout.
  • TIME_INFINITE no timeout.
Returns
The number of bytes effectively transferred.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 389 of file hal_queues.c.

References iq_read(), osalDbgCheck, osalSysLock(), osalSysUnlock(), osalThreadEnqueueTimeoutS(), io_queue::q_notify, and io_queue::q_waiting.

Here is the call graph for this function:

void oqObjectInit ( output_queue_t oqp,
uint8_t *  bp,
size_t  size,
qnotify_t  onfy,
void *  link 
)

Initializes an output queue.

A Semaphore is internally initialized and works as a counter of the free bytes in the queue.

Note
The callback is invoked from within the S-Locked system state.
Parameters
[out]oqppointer to an output_queue_t structure
[in]bppointer to a memory area allocated as queue buffer
[in]sizesize of the queue buffer
[in]onfypointer to a callback function that is invoked when data is written to the queue. The value can be NULL.
[in]linkapplication defined pointer
Function Class:Initializer, this function just initializes an object and can be invoked before the kernel is initialized.

Definition at line 446 of file hal_queues.c.

References osalThreadQueueObjectInit(), io_queue::q_buffer, io_queue::q_counter, io_queue::q_link, io_queue::q_notify, io_queue::q_rdptr, io_queue::q_top, io_queue::q_waiting, and io_queue::q_wrptr.

Referenced by sdObjectInit().

Here is the call graph for this function:

void oqResetI ( output_queue_t oqp)

Resets an output queue.

All the data in the output queue is erased and lost, any waiting thread is resumed with status MSG_RESET.

Note
A reset operation can be used by a low level driver in order to obtain immediate attention from the high level layers.
Parameters
[in]oqppointer to an output_queue_t structure
Function Class:This is an I-Class API, this function can be invoked from within a system lock zone by both threads and interrupt handlers.

Definition at line 470 of file hal_queues.c.

References osalDbgCheckClassI, osalThreadDequeueAllI(), io_queue::q_buffer, io_queue::q_counter, io_queue::q_rdptr, io_queue::q_waiting, io_queue::q_wrptr, and qSizeX.

Referenced by sdStop().

Here is the call graph for this function:

msg_t oqPutI ( output_queue_t oqp,
uint8_t  b 
)

Output queue non-blocking write.

This function writes a byte value to an output queue. The operation completes immediately.

Parameters
[in]oqppointer to an output_queue_t structure
[in]bthe byte value to be written in the queue
Returns
The operation status.
Return values
MSG_OKif the operation succeeded.
MSG_TIMEOUTif the queue is full.
MSG_RESETif the queue has been reset.
Function Class:This is an I-Class API, this function can be invoked from within a system lock zone by both threads and interrupt handlers.

Definition at line 494 of file hal_queues.c.

References oqIsFullI, osalDbgCheckClassI, io_queue::q_buffer, io_queue::q_counter, io_queue::q_notify, io_queue::q_top, and io_queue::q_wrptr.

msg_t oqPutTimeout ( output_queue_t oqp,
uint8_t  b,
sysinterval_t  timeout 
)

Output queue write with timeout.

This function writes a byte value to an output queue. If the queue is full then the calling thread is suspended until there is space in the queue or a timeout occurs.

Note
The callback is invoked after putting the character into the queue.
Parameters
[in]oqppointer to an output_queue_t structure
[in]bthe byte value to be written in the queue
[in]timeoutthe number of ticks before the operation timeouts, the following special values are allowed:
  • TIME_IMMEDIATE immediate timeout.
  • TIME_INFINITE no timeout.
Returns
The operation status.
Return values
MSG_OKif the operation succeeded.
MSG_TIMEOUTif the specified time expired.
MSG_RESETif the queue has been reset.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 540 of file hal_queues.c.

References oqIsFullI, osalSysLock(), osalSysUnlock(), osalThreadEnqueueTimeoutS(), io_queue::q_buffer, io_queue::q_counter, io_queue::q_notify, io_queue::q_top, io_queue::q_waiting, and io_queue::q_wrptr.

Here is the call graph for this function:

msg_t oqGetI ( output_queue_t oqp)

Output queue read.

A byte value is read from the low end of an output queue. The operation completes immediately.

Parameters
[in]oqppointer to an output_queue_t structure
Returns
The byte value from the queue.
Return values
MSG_TIMEOUTif the queue is empty.
Function Class:This is an I-Class API, this function can be invoked from within a system lock zone by both threads and interrupt handlers.

Definition at line 581 of file hal_queues.c.

References oqIsEmptyI, osalDbgCheckClassI, osalThreadDequeueNextI(), io_queue::q_buffer, io_queue::q_counter, io_queue::q_rdptr, io_queue::q_top, and io_queue::q_waiting.

Referenced by sdRequestDataI().

Here is the call graph for this function:

size_t oqWriteI ( output_queue_t oqp,
const uint8_t *  bp,
size_t  n 
)

Output queue non-blocking write.

The function writes data from a buffer to an output queue. The operation completes immediately.

Parameters
[in]oqppointer to an output_queue_t structure
[in]bppointer to the data buffer
[in]nthe maximum amount of data to be transferred, the value 0 is reserved
Returns
The number of bytes effectively transferred.
Function Class:This is an I-Class API, this function can be invoked from within a system lock zone by both threads and interrupt handlers.

Definition at line 617 of file hal_queues.c.

References oq_write(), osalDbgCheckClassI, and io_queue::q_notify.

Here is the call graph for this function:

size_t oqWriteTimeout ( output_queue_t oqp,
const uint8_t *  bp,
size_t  n,
sysinterval_t  timeout 
)

Output queue write with timeout.

The function writes data from a buffer to an output queue. The operation completes when the specified amount of data has been transferred or after the specified timeout or if the queue has been reset.

Note
The function is not atomic, if you need atomicity it is suggested to use a semaphore or a mutex for mutual exclusion.
The callback is invoked after putting each character into the queue.
Parameters
[in]oqppointer to an output_queue_t structure
[in]bppointer to the data buffer
[in]nthe maximum amount of data to be transferred, the value 0 is reserved
[in]timeoutthe number of ticks before the operation timeouts, the following special values are allowed:
  • TIME_IMMEDIATE immediate timeout.
  • TIME_INFINITE no timeout.
Returns
The number of bytes effectively transferred.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 658 of file hal_queues.c.

References oq_write(), osalDbgCheck, osalSysLock(), osalSysUnlock(), osalThreadEnqueueTimeoutS(), io_queue::q_notify, and io_queue::q_waiting.

Here is the call graph for this function: