aboutsummaryrefslogtreecommitdiffstats
path: root/src/chqueues.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/chqueues.c')
-rw-r--r--src/chqueues.c106
1 files changed, 55 insertions, 51 deletions
diff --git a/src/chqueues.c b/src/chqueues.c
index 6dcc61af6..b7e14e69d 100644
--- a/src/chqueues.c
+++ b/src/chqueues.c
@@ -31,13 +31,14 @@
/**
* @brief Initializes an input queue.
* @details A Semaphore is internally initialized and works as a counter of
- * the bytes contained in the queue.
+ * the bytes contained in the queue.
*
- * @param qp pointer to a @p Queue structure
- * @param buffer pointer to a memory area allocated as queue buffer
- * @param size size of the queue buffer
- * @param inotify pointer to a callback function that is invoked when
- * some data is read from the Queue. The value can be @p NULL.
+ * @param[out] qp pointer to a @p Queue structure
+ * @param[in] buffer pointer to a memory area allocated as queue buffer
+ * @param[in] size size of the queue buffer
+ * @param[in] inotify pointer to a callback function that is invoked when
+ * some data is read from the Queue. The value can be
+* @p NULL.
*/
void chIQInit(Queue *qp, uint8_t *buffer, size_t size, qnotify_t inotify) {
@@ -51,7 +52,7 @@ void chIQInit(Queue *qp, uint8_t *buffer, size_t size, qnotify_t inotify) {
* @brief Resets an input queue.
* @details All the data is lost and the waiting threads resumed.
*
- * @param qp pointer to a @p Queue structure
+ * @param[in] qp pointer to a @p Queue structure
*/
void chIQReset(Queue *qp) {
@@ -66,8 +67,8 @@ void chIQReset(Queue *qp) {
/**
* @brief Inserts a byte into an input queue.
*
- * @param qp pointer to a @p Queue structure
- * @param b the byte value to be written
+ * @param[in] qp pointer to a @p Queue structure
+ * @param[in] b the byte value to be written
* @retval Q_OK if the operation is successful.
* @retval Q_FULL if the queue is full.
* @note This function is the lower side endpoint of the Input Queue.
@@ -89,9 +90,9 @@ msg_t chIQPutI(Queue *qp, uint8_t b) {
/**
* @brief Gets a byte from the input queue.
* @details If the queue is empty then the calling thread is suspended until
- * a byte arrives in the queue.
+ * a byte arrives in the queue.
*
- * @param qp pointer to a @p Queue structure
+ * @param[in] qp pointer to a @p Queue structure
* @return A byte value from the queue.
* @retval Q_RESET if the queue was reset.
*/
@@ -120,10 +121,10 @@ msg_t chIQGet(Queue *qp) {
/**
* @brief Gets a byte from the input queue.
* @details If the queue is empty then the calling thread is suspended until
- * a byte arrives in the queue or the specified time expires.
+ * a byte arrives in the queue or the specified time expires.
*
- * @param qp pointer to a @p Queue structure
- * @param time the number of ticks before the operation timeouts
+ * @param[in] qp pointer to a @p Queue structure
+ * @param[in] time the number of ticks before the operation timeouts
* @return A byte value from the queue.
* @retval Q_TIMEOUT if the specified time expired.
* @retval Q_RESET if the queue was reset.
@@ -156,11 +157,11 @@ msg_t chIQGetTimeout(Queue *qp, systime_t time) {
/**
* @brief Reads some data from the input queue into the specified buffer.
* @details The function is non-blocking and can return zero if the queue is
- * empty.
+ * empty.
*
- * @param qp pointer to a @p Queue structure
- * @param buffer the data buffer
- * @param n the maximum amount of data to be read
+ * @param[in] qp pointer to a @p Queue structure
+ * @param[out] buffer the data buffer
+ * @param[in] n the maximum amount of data to be read
* @return The number of bytes read.
* @note This function is the upper side endpoint of the input queue.
* @note The function is not atomic, if you need atomicity it is suggested
@@ -200,13 +201,14 @@ size_t chIQRead(Queue *qp, uint8_t *buffer, size_t n) {
/**
* @brief Initializes an output queue.
* @details A Semaphore is internally initialized and works as a counter of the
- * free bytes in the queue.
+ * free bytes in the queue.
*
- * @param qp pointer to a @p Queue structure
- * @param buffer pointer to a memory area allocated as queue buffer
- * @param size size of the queue buffer
- * @param onotify pointer to a callback function that is invoked when
- * some data is written in the Queue. The value can be @p NULL.
+ * @param[out] qp pointer to a @p Queue structure
+ * @param[in] buffer pointer to a memory area allocated as queue buffer
+ * @param[in] size size of the queue buffer
+ * @param[in] onotify pointer to a callback function that is invoked when
+ * some data is written in the Queue. The value can be
+ * @p NULL.
*/
void chOQInit(Queue *qp, uint8_t *buffer, size_t size, qnotify_t onotify) {
@@ -220,7 +222,7 @@ void chOQInit(Queue *qp, uint8_t *buffer, size_t size, qnotify_t onotify) {
* @brief Resets an Output Queue.
* @details All the data is lost and the waiting threads resumed.
*
- * @param qp pointer to a @p Queue structure
+ * @param[in] qp pointer to a @p Queue structure
*/
void chOQReset(Queue *qp) {
@@ -235,10 +237,10 @@ void chOQReset(Queue *qp) {
/**
* @brief Inserts a byte in the output queue.
* @details If the queue is full then the thread is suspended until the queue
- * has free space available.
+ * has free space available.
*
- * @param qp pointer to a @p Queue structure
- * @param b the byte value to be written
+ * @param[in] qp pointer to a @p Queue structure
+ * @param[in] b the byte value to be written
*/
void chOQPut(Queue *qp, uint8_t b) {
@@ -258,7 +260,7 @@ void chOQPut(Queue *qp, uint8_t b) {
/**
* @brief Gets a byte from an output queue.
*
- * @param qp pointer to a @p Queue structure
+ * @param[in] qp pointer to a @p Queue structure
* @return The byte value from the queue.
* @retval Q_EMPTY if the queue is empty.
* @note This function is the lower side endpoint of the output queue.
@@ -281,11 +283,11 @@ msg_t chOQGetI(Queue *qp) {
/**
* @brief Writes some data from the specified buffer into the queue.
* @details The function is non-blocking and can return zero if the queue is
- * full.
+ * full.
*
- * @param qp pointer to a @p Queue structure
- * @param buffer the data buffer
- * @param n the maximum amount of data to be written
+ * @param[in] qp pointer to a @p Queue structure
+ * @param[in] buffer the data buffer
+ * @param[in] n the maximum amount of data to be written
* @return The number of written bytes.
* @note This function is the upper side endpoint of the output queue.
* @note The function is not atomic, if you need atomicity it is suggested
@@ -327,13 +329,15 @@ size_t chOQWrite(Queue *qp, uint8_t *buffer, size_t n) {
/**
* @brief Initializes an half duplex queue.
*
- * @param qp pointer to the @p HalfDuplexQueue structure
- * @param buffer pointer to a memory area allocated as buffer for the queue
- * @param size the size of the queue buffer
- * @param inotify pointer to a callback function that is invoked when
- * some data is read from the queue. The value can be @p NULL.
- * @param onotify pointer to a callback function that is invoked when
- * some data is written to the queue. The value can be @p NULL.
+ * @param[out] qp pointer to the @p HalfDuplexQueue structure
+ * @param[in] buffer pointer to a memory area allocated as buffer for the queue
+ * @param[in] size the size of the queue buffer
+ * @param[in] inotify pointer to a callback function that is invoked when
+ * some data is read from the queue. The value can be
+ * @p NULL.
+ * @param[in] onotify pointer to a callback function that is invoked when
+ * some data is written to the queue. The value can be
+ * @p NULL.
*/
void chHDQInit(HalfDuplexQueue *qp, uint8_t *buffer, size_t size,
qnotify_t inotify, qnotify_t onotify) {
@@ -349,9 +353,9 @@ void chHDQInit(HalfDuplexQueue *qp, uint8_t *buffer, size_t size,
/**
* @brief Reads a byte from the receive queue.
* @details If the queue is empty or is in transmission mode then the invoking
- * thread is suspended.
+ * thread is suspended.
*
- * @param qp pointer to a @p HalfDuplexQueue structure
+ * @param[in] qp pointer to a @p HalfDuplexQueue structure
* @return The byte value.
* @retval Q_RESET if the queue was reset.
*/
@@ -384,10 +388,10 @@ msg_t chHDQGetReceive(HalfDuplexQueue *qp) {
/**
* @brief Reads a byte from the receive queue.
* @details If the queue is empty or is in transmission mode then the invoking
- * thread is suspended.
+ * thread is suspended.
*
- * @param qp pointer to a @p HalfDuplexQueue structure
- * @param time the number of ticks before the operation timouts
+ * @param[in] qp pointer to a @p HalfDuplexQueue structure
+ * @param[in] time the number of ticks before the operation timouts
* @return The byte value.
* @retval Q_TIMEOUT if a timeout occurs.
* @note The function is available only if the @p CH_USE_QUEUES_TIMEOUT and
@@ -423,10 +427,10 @@ msg_t chHDQGetReceiveTimeout(HalfDuplexQueue *qp, systime_t time) {
/**
* @brief Writes a byte into the transmit queue.
* @details If the buffer contains unread input data then the the buffer is
- * cleared and the queue goes in transmission mode.
+ * cleared and the queue goes in transmission mode.
*
- * @param qp pointer to a @p HalfDuplexQueue structure
- * @param b the byte value to be written
+ * @param[in] qp pointer to a @p HalfDuplexQueue structure
+ * @param[in] b the byte value to be written
*/
void chHDQPutTransmit(HalfDuplexQueue *qp, uint8_t b) {
@@ -457,7 +461,7 @@ void chHDQPutTransmit(HalfDuplexQueue *qp, uint8_t b) {
/**
* @brief Gets a byte from the transmit queue.
*
- * @param qp pointer to a @p HalfDuplexQueue structure
+ * @param[in] qp pointer to a @p HalfDuplexQueue structure
* @return The byte value.
* @retval Q_EMPTY if the transmit queue is empty (not in transmission mode).
* @note This function must be called with interrupts disabled or from an
@@ -480,8 +484,8 @@ msg_t chHDQGetTransmitI(HalfDuplexQueue *qp) {
* @brief Writes a byte into the receive queue.
* @details If the queue is in transmission mode then the byte is lost.
*
- * @param qp pointer to a @p HalfDuplexQueue structure
- * @param b the byte value to be written
+ * @param[in] qp pointer to a @p HalfDuplexQueue structure
+ * @param[in] b the byte value to be written
* @retval Q_OK if the operation is successful.
* @retval Q_FULL if the driver is in transmit mode or the receive queue is full.
* @note This function must be called with interrupts disabled or from an