HAL queues updated.

git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/kernel_3_dev@6113 35acf78f-673a-0410-8e92-d51de3d6d3f4
master
gdisirio 2013-08-09 13:56:40 +00:00
parent 7b51712449
commit 44f6cc6308
3 changed files with 55 additions and 55 deletions

View File

@ -290,7 +290,7 @@
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_QUEUES) || defined(__DOXYGEN__) #if !defined(CH_CFG_USE_QUEUES) || defined(__DOXYGEN__)
#define CH_CFG_USE_QUEUES TRUE #define CH_CFG_USE_QUEUES FALSE
#endif #endif
/** /**

View File

@ -47,10 +47,10 @@
/** /**
* @brief Type of a generic I/O queue structure. * @brief Type of a generic I/O queue structure.
*/ */
typedef struct GenericQueue GenericQueue; typedef struct io_queue_t io_queue_t;
/** @brief Queue notification callback type.*/ /** @brief Queue notification callback type.*/
typedef void (*qnotify_t)(GenericQueue *qp); typedef void (*qnotify_t)(io_queue_t *qp);
/** /**
* @brief Generic I/O queue structure. * @brief Generic I/O queue structure.
@ -61,7 +61,7 @@ typedef void (*qnotify_t)(GenericQueue *qp);
* lock zone (see <b>I-Locked</b> and <b>S-Locked</b> states in * lock zone (see <b>I-Locked</b> and <b>S-Locked</b> states in
* @ref system_states) and is non-blocking. * @ref system_states) and is non-blocking.
*/ */
struct GenericQueue { struct io_queue_t {
threads_queue_t q_waiting; /**< @brief Waiting thread. */ threads_queue_t q_waiting; /**< @brief Waiting thread. */
size_t q_counter; /**< @brief Resources counter. */ size_t q_counter; /**< @brief Resources counter. */
uint8_t *q_buffer; /**< @brief Pointer to the queue buffer.*/ uint8_t *q_buffer; /**< @brief Pointer to the queue buffer.*/
@ -80,7 +80,7 @@ struct GenericQueue {
/** /**
* @brief Returns the queue's buffer size. * @brief Returns the queue's buffer size.
* *
* @param[in] qp pointer to a @p GenericQueue structure. * @param[in] qp pointer to a @p io_queue_t structure.
* @return The buffer size. * @return The buffer size.
* *
* @iclass * @iclass
@ -92,7 +92,7 @@ struct GenericQueue {
* @details Returns the used space if used on an input queue or the empty * @details Returns the used space if used on an input queue or the empty
* space if used on an output queue. * space if used on an output queue.
* *
* @param[in] qp pointer to a @p GenericQueue structure. * @param[in] qp pointer to a @p io_queue_t structure.
* @return The buffer space. * @return The buffer space.
* *
* @iclass * @iclass
@ -103,7 +103,7 @@ struct GenericQueue {
* @brief Returns the queue application-defined link. * @brief Returns the queue application-defined link.
* @note This function can be called in any context. * @note This function can be called in any context.
* *
* @param[in] qp pointer to a @p GenericQueue structure. * @param[in] qp pointer to a @p io_queue_t structure.
* @return The application-defined link. * @return The application-defined link.
* *
* @special * @special
@ -112,7 +112,7 @@ struct GenericQueue {
/** @} */ /** @} */
/** /**
* @extends GenericQueue * @extends io_queue_t
* *
* @brief Type of an input queue structure. * @brief Type of an input queue structure.
* @details This structure represents a generic asymmetrical input queue. * @details This structure represents a generic asymmetrical input queue.
@ -122,7 +122,7 @@ struct GenericQueue {
* Reading the queue can be a blocking operation and is supposed to * Reading the queue can be a blocking operation and is supposed to
* be performed by a system thread. * be performed by a system thread.
*/ */
typedef GenericQueue InputQueue; typedef io_queue_t input_queue_t;
/** /**
* @name Macro Functions * @name Macro Functions
@ -131,7 +131,7 @@ typedef GenericQueue InputQueue;
/** /**
* @brief Returns the filled space into an input queue. * @brief Returns the filled space into an input queue.
* *
* @param[in] iqp pointer to an @p InputQueue structure * @param[in] iqp pointer to an @p input_queue_t structure
* @return The number of full bytes in the queue. * @return The number of full bytes in the queue.
* @retval 0 if the queue is empty. * @retval 0 if the queue is empty.
* *
@ -142,7 +142,7 @@ typedef GenericQueue InputQueue;
/** /**
* @brief Returns the empty space into an input queue. * @brief Returns the empty space into an input queue.
* *
* @param[in] iqp pointer to an @p InputQueue structure * @param[in] iqp pointer to an @p input_queue_t structure
* @return The number of empty bytes in the queue. * @return The number of empty bytes in the queue.
* @retval 0 if the queue is full. * @retval 0 if the queue is full.
* *
@ -153,7 +153,7 @@ typedef GenericQueue InputQueue;
/** /**
* @brief Evaluates to @p TRUE if the specified input queue is empty. * @brief Evaluates to @p TRUE if the specified input queue is empty.
* *
* @param[in] iqp pointer to an @p InputQueue structure. * @param[in] iqp pointer to an @p input_queue_t structure.
* @return The queue status. * @return The queue status.
* @retval FALSE if the queue is not empty. * @retval FALSE if the queue is not empty.
* @retval TRUE if the queue is empty. * @retval TRUE if the queue is empty.
@ -165,7 +165,7 @@ typedef GenericQueue InputQueue;
/** /**
* @brief Evaluates to @p TRUE if the specified input queue is full. * @brief Evaluates to @p TRUE if the specified input queue is full.
* *
* @param[in] iqp pointer to an @p InputQueue structure. * @param[in] iqp pointer to an @p input_queue_t structure.
* @return The queue status. * @return The queue status.
* @retval FALSE if the queue is not full. * @retval FALSE if the queue is not full.
* @retval TRUE if the queue is full. * @retval TRUE if the queue is full.
@ -181,7 +181,7 @@ typedef GenericQueue InputQueue;
* is empty then the calling thread is suspended until a byte arrives * is empty then the calling thread is suspended until a byte arrives
* in the queue. * in the queue.
* *
* @param[in] iqp pointer to an @p InputQueue structure * @param[in] iqp pointer to an @p input_queue_t structure
* @return A byte value from the queue. * @return A byte value from the queue.
* @retval Q_RESET if the queue has been reset. * @retval Q_RESET if the queue has been reset.
* *
@ -224,10 +224,10 @@ typedef GenericQueue InputQueue;
* @param[in] link application defined pointer * @param[in] link application defined pointer
*/ */
#define INPUTQUEUE_DECL(name, buffer, size, inotify, link) \ #define INPUTQUEUE_DECL(name, buffer, size, inotify, link) \
InputQueue name = _INPUTQUEUE_DATA(name, buffer, size, inotify, link) input_queue_t name = _INPUTQUEUE_DATA(name, buffer, size, inotify, link)
/** /**
* @extends GenericQueue * @extends io_queue_t
* *
* @brief Type of an output queue structure. * @brief Type of an output queue structure.
* @details This structure represents a generic asymmetrical output queue. * @details This structure represents a generic asymmetrical output queue.
@ -237,7 +237,7 @@ typedef GenericQueue InputQueue;
* Writing the queue can be a blocking operation and is supposed to * Writing the queue can be a blocking operation and is supposed to
* be performed by a system thread. * be performed by a system thread.
*/ */
typedef GenericQueue OutputQueue; typedef io_queue_t output_queue_t;
/** /**
* @name Macro Functions * @name Macro Functions
@ -246,7 +246,7 @@ typedef GenericQueue OutputQueue;
/** /**
* @brief Returns the filled space into an output queue. * @brief Returns the filled space into an output queue.
* *
* @param[in] oqp pointer to an @p OutputQueue structure * @param[in] oqp pointer to an @p output_queue_t structure
* @return The number of full bytes in the queue. * @return The number of full bytes in the queue.
* @retval 0 if the queue is empty. * @retval 0 if the queue is empty.
* *
@ -257,7 +257,7 @@ typedef GenericQueue OutputQueue;
/** /**
* @brief Returns the empty space into an output queue. * @brief Returns the empty space into an output queue.
* *
* @param[in] oqp pointer to an @p OutputQueue structure * @param[in] oqp pointer to an @p output_queue_t structure
* @return The number of empty bytes in the queue. * @return The number of empty bytes in the queue.
* @retval 0 if the queue is full. * @retval 0 if the queue is full.
* *
@ -268,7 +268,7 @@ typedef GenericQueue OutputQueue;
/** /**
* @brief Evaluates to @p TRUE if the specified output queue is empty. * @brief Evaluates to @p TRUE if the specified output queue is empty.
* *
* @param[in] oqp pointer to an @p OutputQueue structure. * @param[in] oqp pointer to an @p output_queue_t structure.
* @return The queue status. * @return The queue status.
* @retval FALSE if the queue is not empty. * @retval FALSE if the queue is not empty.
* @retval TRUE if the queue is empty. * @retval TRUE if the queue is empty.
@ -281,7 +281,7 @@ typedef GenericQueue OutputQueue;
/** /**
* @brief Evaluates to @p TRUE if the specified output queue is full. * @brief Evaluates to @p TRUE if the specified output queue is full.
* *
* @param[in] oqp pointer to an @p OutputQueue structure. * @param[in] oqp pointer to an @p output_queue_t structure.
* @return The queue status. * @return The queue status.
* @retval FALSE if the queue is not full. * @retval FALSE if the queue is not full.
* @retval TRUE if the queue is full. * @retval TRUE if the queue is full.
@ -296,7 +296,7 @@ typedef GenericQueue OutputQueue;
* is full then the calling thread is suspended until there is space * is full then the calling thread is suspended until there is space
* in the queue. * in the queue.
* *
* @param[in] oqp pointer to an @p OutputQueue structure * @param[in] oqp pointer to an @p output_queue_t structure
* @param[in] b the byte value to be written in the queue * @param[in] b the byte value to be written in the queue
* @return The operation status. * @return The operation status.
* @retval Q_OK if the operation succeeded. * @retval Q_OK if the operation succeeded.
@ -341,25 +341,25 @@ typedef GenericQueue OutputQueue;
* @param[in] link application defined pointer * @param[in] link application defined pointer
*/ */
#define OUTPUTQUEUE_DECL(name, buffer, size, onotify, link) \ #define OUTPUTQUEUE_DECL(name, buffer, size, onotify, link) \
OutputQueue name = _OUTPUTQUEUE_DATA(name, buffer, size, onotify, link) output_queue_t name = _OUTPUTQUEUE_DATA(name, buffer, size, onotify, link)
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
void iqObjectInit(InputQueue *iqp, uint8_t *bp, size_t size, void iqObjectInit(input_queue_t *iqp, uint8_t *bp, size_t size,
qnotify_t infy, void *link); qnotify_t infy, void *link);
void iqResetI(InputQueue *iqp); void iqResetI(input_queue_t *iqp);
msg_t iqPutI(InputQueue *iqp, uint8_t b); msg_t iqPutI(input_queue_t *iqp, uint8_t b);
msg_t iqGetTimeout(InputQueue *iqp, systime_t time); msg_t iqGetTimeout(input_queue_t *iqp, systime_t time);
size_t iqReadTimeout(InputQueue *iqp, uint8_t *bp, size_t iqReadTimeout(input_queue_t *iqp, uint8_t *bp,
size_t n, systime_t time); size_t n, systime_t time);
void oqObjectInit(OutputQueue *oqp, uint8_t *bp, size_t size, void oqObjectInit(output_queue_t *oqp, uint8_t *bp, size_t size,
qnotify_t onfy, void *link); qnotify_t onfy, void *link);
void oqResetI(OutputQueue *oqp); void oqResetI(output_queue_t *oqp);
msg_t oqPutTimeout(OutputQueue *oqp, uint8_t b, systime_t time); msg_t oqPutTimeout(output_queue_t *oqp, uint8_t b, systime_t time);
msg_t oqGetI(OutputQueue *oqp); msg_t oqGetI(output_queue_t *oqp);
size_t oqWriteTimeout(OutputQueue *oqp, const uint8_t *bp, size_t oqWriteTimeout(output_queue_t *oqp, const uint8_t *bp,
size_t n, systime_t time); size_t n, systime_t time);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -50,7 +50,7 @@
* @note The callback is invoked from within the S-Locked system state, * @note The callback is invoked from within the S-Locked system state,
* see @ref system_states. * see @ref system_states.
* *
* @param[out] iqp pointer to an @p InputQueue structure * @param[out] iqp pointer to an @p input_queue_t structure
* @param[in] bp pointer to a memory area allocated as queue buffer * @param[in] bp pointer to a memory area allocated as queue buffer
* @param[in] size size of the queue buffer * @param[in] size size of the queue buffer
* @param[in] infy pointer to a callback function that is invoked when * @param[in] infy pointer to a callback function that is invoked when
@ -59,7 +59,7 @@
* *
* @init * @init
*/ */
void iqObjectInit(InputQueue *iqp, uint8_t *bp, size_t size, void iqObjectInit(input_queue_t *iqp, uint8_t *bp, size_t size,
qnotify_t infy, void *link) { qnotify_t infy, void *link) {
osalQueueObjectInit(&iqp->q_waiting); osalQueueObjectInit(&iqp->q_waiting);
@ -77,11 +77,11 @@ void iqObjectInit(InputQueue *iqp, uint8_t *bp, size_t size,
* @note A reset operation can be used by a low level driver in order to * @note A reset operation can be used by a low level driver in order to
* obtain immediate attention from the high level layers. * obtain immediate attention from the high level layers.
* *
* @param[in] iqp pointer to an @p InputQueue structure * @param[in] iqp pointer to an @p input_queue_t structure
* *
* @iclass * @iclass
*/ */
void iqResetI(InputQueue *iqp) { void iqResetI(input_queue_t *iqp) {
osalDbgCheckClassI(); osalDbgCheckClassI();
@ -94,7 +94,7 @@ void iqResetI(InputQueue *iqp) {
* @brief Input queue write. * @brief Input queue write.
* @details A byte value is written into the low end of an input queue. * @details A byte value is written into the low end of an input queue.
* *
* @param[in] iqp pointer to an @p InputQueue structure * @param[in] iqp pointer to an @p input_queue_t structure
* @param[in] b the byte value to be written in the queue * @param[in] b the byte value to be written in the queue
* @return The operation status. * @return The operation status.
* @retval Q_OK if the operation has been completed with success. * @retval Q_OK if the operation has been completed with success.
@ -103,7 +103,7 @@ void iqResetI(InputQueue *iqp) {
* *
* @iclass * @iclass
*/ */
msg_t iqPutI(InputQueue *iqp, uint8_t b) { msg_t iqPutI(input_queue_t *iqp, uint8_t b) {
osalDbgCheckClassI(); osalDbgCheckClassI();
@ -128,7 +128,7 @@ msg_t iqPutI(InputQueue *iqp, uint8_t b) {
* @note The callback is invoked before reading the character from the * @note The callback is invoked before reading the character from the
* buffer or before entering the state @p THD_STATE_WTQUEUE. * buffer or before entering the state @p THD_STATE_WTQUEUE.
* *
* @param[in] iqp pointer to an @p InputQueue structure * @param[in] iqp pointer to an @p input_queue_t structure
* @param[in] time the number of ticks before the operation timeouts, * @param[in] time the number of ticks before the operation timeouts,
* the following special values are allowed: * the following special values are allowed:
* - @a TIME_IMMEDIATE immediate timeout. * - @a TIME_IMMEDIATE immediate timeout.
@ -140,7 +140,7 @@ msg_t iqPutI(InputQueue *iqp, uint8_t b) {
* *
* @api * @api
*/ */
msg_t iqGetTimeout(InputQueue *iqp, systime_t time) { msg_t iqGetTimeout(input_queue_t *iqp, systime_t time) {
uint8_t b; uint8_t b;
osalSysLock(); osalSysLock();
@ -175,7 +175,7 @@ msg_t iqGetTimeout(InputQueue *iqp, systime_t time) {
* @note The callback is invoked before reading each character from the * @note The callback is invoked before reading each character from the
* buffer or before entering the state @p THD_STATE_WTQUEUE. * buffer or before entering the state @p THD_STATE_WTQUEUE.
* *
* @param[in] iqp pointer to an @p InputQueue structure * @param[in] iqp pointer to an @p input_queue_t structure
* @param[out] bp pointer to the data buffer * @param[out] bp pointer to the data buffer
* @param[in] n the maximum amount of data to be transferred, the * @param[in] n the maximum amount of data to be transferred, the
* value 0 is reserved * value 0 is reserved
@ -188,7 +188,7 @@ msg_t iqGetTimeout(InputQueue *iqp, systime_t time) {
* *
* @api * @api
*/ */
size_t iqReadTimeout(InputQueue *iqp, uint8_t *bp, size_t iqReadTimeout(input_queue_t *iqp, uint8_t *bp,
size_t n, systime_t time) { size_t n, systime_t time) {
qnotify_t nfy = iqp->q_notify; qnotify_t nfy = iqp->q_notify;
size_t r = 0; size_t r = 0;
@ -228,7 +228,7 @@ size_t iqReadTimeout(InputQueue *iqp, uint8_t *bp,
* @note The callback is invoked from within the S-Locked system state, * @note The callback is invoked from within the S-Locked system state,
* see @ref system_states. * see @ref system_states.
* *
* @param[out] oqp pointer to an @p OutputQueue structure * @param[out] oqp pointer to an @p output_queue_t structure
* @param[in] bp pointer to a memory area allocated as queue buffer * @param[in] bp pointer to a memory area allocated as queue buffer
* @param[in] size size of the queue buffer * @param[in] size size of the queue buffer
* @param[in] onfy pointer to a callback function that is invoked when * @param[in] onfy pointer to a callback function that is invoked when
@ -237,7 +237,7 @@ size_t iqReadTimeout(InputQueue *iqp, uint8_t *bp,
* *
* @init * @init
*/ */
void oqObjectInit(OutputQueue *oqp, uint8_t *bp, size_t size, void oqObjectInit(output_queue_t *oqp, uint8_t *bp, size_t size,
qnotify_t onfy, void *link) { qnotify_t onfy, void *link) {
osalQueueObjectInit(&oqp->q_waiting); osalQueueObjectInit(&oqp->q_waiting);
@ -255,11 +255,11 @@ void oqObjectInit(OutputQueue *oqp, uint8_t *bp, size_t size,
* @note A reset operation can be used by a low level driver in order to * @note A reset operation can be used by a low level driver in order to
* obtain immediate attention from the high level layers. * obtain immediate attention from the high level layers.
* *
* @param[in] oqp pointer to an @p OutputQueue structure * @param[in] oqp pointer to an @p output_queue_t structure
* *
* @iclass * @iclass
*/ */
void oqResetI(OutputQueue *oqp) { void oqResetI(output_queue_t *oqp) {
osalDbgCheckClassI(); osalDbgCheckClassI();
@ -276,7 +276,7 @@ void oqResetI(OutputQueue *oqp) {
* @note The callback is invoked after writing the character into the * @note The callback is invoked after writing the character into the
* buffer. * buffer.
* *
* @param[in] oqp pointer to an @p OutputQueue structure * @param[in] oqp pointer to an @p output_queue_t structure
* @param[in] b the byte value to be written in the queue * @param[in] b the byte value to be written in the queue
* @param[in] time the number of ticks before the operation timeouts, * @param[in] time the number of ticks before the operation timeouts,
* the following special values are allowed: * the following special values are allowed:
@ -290,7 +290,7 @@ void oqResetI(OutputQueue *oqp) {
* *
* @api * @api
*/ */
msg_t oqPutTimeout(OutputQueue *oqp, uint8_t b, systime_t time) { msg_t oqPutTimeout(output_queue_t *oqp, uint8_t b, systime_t time) {
osalSysLock(); osalSysLock();
while (oqIsFullI(oqp)) { while (oqIsFullI(oqp)) {
@ -318,13 +318,13 @@ msg_t oqPutTimeout(OutputQueue *oqp, uint8_t b, systime_t time) {
* @brief Output queue read. * @brief Output queue read.
* @details A byte value is read from the low end of an output queue. * @details A byte value is read from the low end of an output queue.
* *
* @param[in] oqp pointer to an @p OutputQueue structure * @param[in] oqp pointer to an @p output_queue_t structure
* @return The byte value from the queue. * @return The byte value from the queue.
* @retval Q_EMPTY if the queue is empty. * @retval Q_EMPTY if the queue is empty.
* *
* @iclass * @iclass
*/ */
msg_t oqGetI(OutputQueue *oqp) { msg_t oqGetI(output_queue_t *oqp) {
uint8_t b; uint8_t b;
osalDbgCheckClassI(); osalDbgCheckClassI();
@ -353,7 +353,7 @@ msg_t oqGetI(OutputQueue *oqp) {
* @note The callback is invoked after writing each character into the * @note The callback is invoked after writing each character into the
* buffer. * buffer.
* *
* @param[in] oqp pointer to an @p OutputQueue structure * @param[in] oqp pointer to an @p output_queue_t structure
* @param[out] bp pointer to the data buffer * @param[out] bp pointer to the data buffer
* @param[in] n the maximum amount of data to be transferred, the * @param[in] n the maximum amount of data to be transferred, the
* value 0 is reserved * value 0 is reserved
@ -366,7 +366,7 @@ msg_t oqGetI(OutputQueue *oqp) {
* *
* @api * @api
*/ */
size_t oqWriteTimeout(OutputQueue *oqp, const uint8_t *bp, size_t oqWriteTimeout(output_queue_t *oqp, const uint8_t *bp,
size_t n, systime_t time) { size_t n, systime_t time) {
qnotify_t nfy = oqp->q_notify; qnotify_t nfy = oqp->q_notify;
size_t w = 0; size_t w = 0;