From 22e22db0161126d1c58a07e2323662efc18d6c86 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 20 Jan 2009 16:26:48 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@649 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- src/chqueues.c | 89 +++++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 57 insertions(+), 32 deletions(-) (limited to 'src/chqueues.c') diff --git a/src/chqueues.c b/src/chqueues.c index f7cc10f42..ed0806c6d 100644 --- a/src/chqueues.c +++ b/src/chqueues.c @@ -27,8 +27,10 @@ #ifdef CH_USE_QUEUES /** - * Initializes an input queue. A Semaphore is internally initialized - * and works as a counter of the bytes contained in the queue. + * @brief Initializes an input queue. + * @details A Semaphore is internally initialized and works as a counter of + * 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 @@ -44,8 +46,9 @@ void chIQInit(Queue *qp, uint8_t *buffer, size_t size, qnotify_t inotify) { } /** - * Resets an input queue. All the data is lost and the waiting threads - * resumed. + * @brief Resets an input queue. + * @details All the data is lost and the waiting threads resumed. + * * @param qp pointer to a @p Queue structure */ void chIQReset(Queue *qp) { @@ -59,7 +62,8 @@ void chIQReset(Queue *qp) { } /** - * Inserts a byte into an input queue. + * @brief Inserts a byte into an input queue. + * * @param qp pointer to a @p Queue structure * @param b the byte value to be written * @retval Q_OK if the operation is successful. @@ -81,8 +85,10 @@ msg_t chIQPutI(Queue *qp, uint8_t b) { } /** - * Gets a byte from the input queue, if the queue is empty then the - * calling thread is suspended until a byte arrives in the queue. + * @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. + * * @param qp pointer to a @p Queue structure * @return A byte value from the queue. * @retval Q_RESET if the queue was reset. @@ -110,9 +116,10 @@ msg_t chIQGet(Queue *qp) { #if defined(CH_USE_QUEUES_TIMEOUT) && defined(CH_USE_SEMAPHORES_TIMEOUT) /** - * Gets a byte from the input queue, if the queue is empty then the - * calling thread is suspended until a byte arrives in the queue or the - * specified time expires. + * @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. + * * @param qp pointer to a @p Queue structure * @param time the number of ticks before the operation timouts * @return A byte value from the queue. @@ -145,8 +152,10 @@ msg_t chIQGetTimeout(Queue *qp, systime_t time) { #endif /* defined(CH_USE_QUEUES_TIMEOUT) && defined(CH_USE_SEMAPHORES_TIMEOUT) */ /** - * Reads some data from the input queue into the specified buffer. The function - * is non-blocking and can return zero if the queue is empty. + * @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. + * * @param qp pointer to a @p Queue structure * @param buffer the data buffer * @param n the maximum amount of data to be read @@ -187,8 +196,10 @@ size_t chIQRead(Queue *qp, uint8_t *buffer, size_t n) { } /** - * Initializes an output queue. A Semaphore is internally initialized - * and works as a counter of the free bytes in the queue. + * @brief Initializes an output queue. + * @details A Semaphore is internally initialized and works as a counter of the + * 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 @@ -204,8 +215,9 @@ void chOQInit(Queue *qp, uint8_t *buffer, size_t size, qnotify_t onotify) { } /** - * Resets an Output Queue. All the data is lost and the waiting threads - * resumed. + * @brief Resets an Output Queue. + * @details All the data is lost and the waiting threads resumed. + * * @param qp pointer to a @p Queue structure */ void chOQReset(Queue *qp) { @@ -219,8 +231,10 @@ void chOQReset(Queue *qp) { } /** - * Inserts a byte in the output queue, if the queue is full then the thread - * is suspended until the queue has free space available. + * @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. + * * @param qp pointer to a @p Queue structure * @param b the byte value to be written */ @@ -240,7 +254,8 @@ void chOQPut(Queue *qp, uint8_t b) { } /** - * Gets a byte from an output queue. + * @brief Gets a byte from an output queue. + * * @param qp pointer to a @p Queue structure * @return The byte value from the queue. * @retval Q_EMPTY if the queue is empty. @@ -262,8 +277,10 @@ msg_t chOQGetI(Queue *qp) { } /** - * Writes some data from the specified buffer into the queue. The function - * is non-blocking and can return zero if the queue is full. + * @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. + * * @param qp pointer to a @p Queue structure * @param buffer the data buffer * @param n the maximum amount of data to be written @@ -306,7 +323,8 @@ size_t chOQWrite(Queue *qp, uint8_t *buffer, size_t n) { #ifdef CH_USE_QUEUES_HALFDUPLEX /** - * Initializes an half duplex queue. + * @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 @@ -327,8 +345,10 @@ void chHDQInit(HalfDuplexQueue *qp, uint8_t *buffer, size_t size, } /** - * Reads a byte from the receive queue, if the queue is empty or is in - * transmission mode then the invoking thread is suspended. + * @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. + * * @param qp pointer to a @p HalfDuplexQueue structure * @return The byte value. * @retval Q_RESET if the queue was reset. @@ -360,8 +380,10 @@ msg_t chHDQGetReceive(HalfDuplexQueue *qp) { #if defined(CH_USE_QUEUES_TIMEOUT) && defined(CH_USE_SEMAPHORES_TIMEOUT) /** - * Reads a byte from the receive queue, if the queue is empty or is in - * transmission mode then the invoking thread is suspended. + * @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. + * * @param qp pointer to a @p HalfDuplexQueue structure * @param time the number of ticks before the operation timouts * @return The byte value. @@ -397,9 +419,10 @@ msg_t chHDQGetReceiveTimeout(HalfDuplexQueue *qp, systime_t time) { #endif /* defined(CH_USE_QUEUES_TIMEOUT) && defined(CH_USE_SEMAPHORES_TIMEOUT) */ /** - * Writes a byte into the transmit queue. If the buffer contains unread - * input data then the the buffer is cleared and the queue goes in - * transmission mode. + * @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. + * * @param qp pointer to a @p HalfDuplexQueue structure * @param b the byte value to be written */ @@ -430,7 +453,8 @@ void chHDQPutTransmit(HalfDuplexQueue *qp, uint8_t b) { } /** - * Gets a byte from the transmit queue. + * @brief Gets a byte from the transmit queue. + * * @param qp pointer to a @p HalfDuplexQueue structure * @return The byte value. * @retval Q_EMPTY if the transmit queue is empty (not in transmission mode). @@ -451,8 +475,9 @@ msg_t chHDQGetTransmitI(HalfDuplexQueue *qp) { } /** - * Writes a byte into the receive queue. If the queue is in transmission mode - * then the byte is lost. + * @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 * @retval Q_OK if the operation is successful. -- cgit v1.2.3