aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal
diff options
context:
space:
mode:
Diffstat (limited to 'os/hal')
-rw-r--r--os/hal/include/hal_queues.h10
-rw-r--r--os/hal/ports/AVR/serial_lld.c4
-rw-r--r--os/hal/ports/KINETIS/K20x/serial_lld.c6
-rw-r--r--os/hal/ports/KINETIS/KL2x/serial_lld.c6
-rw-r--r--os/hal/ports/LPC/LPC214x/serial_lld.c6
-rw-r--r--os/hal/ports/STM32/LLD/USARTv1/serial_lld.c2
-rw-r--r--os/hal/ports/STM32/LLD/USARTv2/serial_lld.c2
-rw-r--r--os/hal/src/hal_buffers.c4
-rw-r--r--os/hal/src/hal_queues.c156
-rw-r--r--os/hal/src/serial.c8
-rw-r--r--os/hal/src/serial_usb.c2
11 files changed, 144 insertions, 62 deletions
diff --git a/os/hal/include/hal_queues.h b/os/hal/include/hal_queues.h
index 144a4a123..e6b3b39c4 100644
--- a/os/hal/include/hal_queues.h
+++ b/os/hal/include/hal_queues.h
@@ -37,8 +37,8 @@
#define Q_OK MSG_OK /**< @brief Operation successful. */
#define Q_TIMEOUT MSG_TIMEOUT /**< @brief Timeout condition. */
#define Q_RESET MSG_RESET /**< @brief Queue has been reset. */
-#define Q_EMPTY (msg_t)-3 /**< @brief Queue empty. */
-#define Q_FULL (msg_t)-4 /**< @brief Queue full, */
+#define Q_EMPTY MSG_TIMEOUT /**< @brief Queue empty. */
+#define Q_FULL MSG_TIMEOUT /**< @brief Queue full, */
/** @} */
/**
@@ -187,7 +187,7 @@ typedef io_queue_t input_queue_t;
*
* @param[in] iqp pointer to an @p input_queue_t structure
* @return A byte value from the queue.
- * @retval Q_RESET if the queue has been reset.
+ * @retval MSG_RESET if the queue has been reset.
*
* @api
*/
@@ -268,8 +268,8 @@ typedef io_queue_t output_queue_t;
* @param[in] oqp pointer to an @p output_queue_t structure
* @param[in] b the byte value to be written in the queue
* @return The operation status.
- * @retval Q_OK if the operation succeeded.
- * @retval Q_RESET if the queue has been reset.
+ * @retval MSG_OK if the operation succeeded.
+ * @retval MSG_RESET if the queue has been reset.
*
* @api
*/
diff --git a/os/hal/ports/AVR/serial_lld.c b/os/hal/ports/AVR/serial_lld.c
index c8967b381..dfb0a889e 100644
--- a/os/hal/ports/AVR/serial_lld.c
+++ b/os/hal/ports/AVR/serial_lld.c
@@ -252,7 +252,7 @@ OSAL_IRQ_HANDLER(AVR_SD1_TX_VECT) {
osalSysLockFromISR();
b = sdRequestDataI(&SD1);
osalSysUnlockFromISR();
- if (b < Q_OK)
+ if (b < MSG_OK)
UCSR0B &= ~(1 << UDRIE0);
else
UDR0 = b;
@@ -295,7 +295,7 @@ OSAL_IRQ_HANDLER(AVR_SD2_TX_VECT) {
osalSysLockFromISR();
b = sdRequestDataI(&SD2);
osalSysUnlockFromISR();
- if (b < Q_OK)
+ if (b < MSG_OK)
UCSR1B &= ~(1 << UDRIE1);
else
UDR1 = b;
diff --git a/os/hal/ports/KINETIS/K20x/serial_lld.c b/os/hal/ports/KINETIS/K20x/serial_lld.c
index 009274710..3b5f053f3 100644
--- a/os/hal/ports/KINETIS/K20x/serial_lld.c
+++ b/os/hal/ports/KINETIS/K20x/serial_lld.c
@@ -84,7 +84,7 @@ static void serve_interrupt(SerialDriver *sdp) {
osalSysLockFromISR();
if (iqIsEmptyI(&sdp->iqueue))
chnAddFlagsI(sdp, CHN_INPUT_AVAILABLE);
- if (iqPutI(&sdp->iqueue, u->D) < Q_OK)
+ if (iqPutI(&sdp->iqueue, u->D) < MSG_OK)
chnAddFlagsI(sdp, SD_OVERRUN_ERROR);
osalSysUnlockFromISR();
}
@@ -96,7 +96,7 @@ static void serve_interrupt(SerialDriver *sdp) {
b = oqGetI(&sdp->oqueue);
osalSysUnlockFromISR();
- if (b < Q_OK) {
+ if (b < MSG_OK) {
osalSysLockFromISR();
chnAddFlagsI(sdp, CHN_OUTPUT_EMPTY);
osalSysUnlockFromISR();
@@ -115,7 +115,7 @@ static void preload(SerialDriver *sdp) {
if (u->S1 & UARTx_S1_TDRE) {
msg_t b = oqGetI(&sdp->oqueue);
- if (b < Q_OK) {
+ if (b < MSG_OK) {
chnAddFlagsI(sdp, CHN_OUTPUT_EMPTY);
return;
}
diff --git a/os/hal/ports/KINETIS/KL2x/serial_lld.c b/os/hal/ports/KINETIS/KL2x/serial_lld.c
index f0cbc46ac..981d8fbba 100644
--- a/os/hal/ports/KINETIS/KL2x/serial_lld.c
+++ b/os/hal/ports/KINETIS/KL2x/serial_lld.c
@@ -83,7 +83,7 @@ static void serve_interrupt(SerialDriver *sdp) {
osalSysLockFromISR();
if (iqIsEmptyI(&sdp->iqueue))
chnAddFlagsI(sdp, CHN_INPUT_AVAILABLE);
- if (iqPutI(&sdp->iqueue, u->D) < Q_OK)
+ if (iqPutI(&sdp->iqueue, u->D) < MSG_OK)
chnAddFlagsI(sdp, SD_OVERRUN_ERROR);
osalSysUnlockFromISR();
}
@@ -95,7 +95,7 @@ static void serve_interrupt(SerialDriver *sdp) {
b = oqGetI(&sdp->oqueue);
osalSysUnlockFromISR();
- if (b < Q_OK) {
+ if (b < MSG_OK) {
osalSysLockFromISR();
chnAddFlagsI(sdp, CHN_OUTPUT_EMPTY);
osalSysUnlockFromISR();
@@ -123,7 +123,7 @@ static void preload(SerialDriver *sdp) {
if (u->S1 & UARTx_S1_TDRE) {
msg_t b = oqGetI(&sdp->oqueue);
- if (b < Q_OK) {
+ if (b < MSG_OK) {
chnAddFlagsI(sdp, CHN_OUTPUT_EMPTY);
return;
}
diff --git a/os/hal/ports/LPC/LPC214x/serial_lld.c b/os/hal/ports/LPC/LPC214x/serial_lld.c
index d8154396e..c5dc356c8 100644
--- a/os/hal/ports/LPC/LPC214x/serial_lld.c
+++ b/os/hal/ports/LPC/LPC214x/serial_lld.c
@@ -141,7 +141,7 @@ static void serve_interrupt(SerialDriver *sdp) {
osalSysUnlockFromISR();
while (u->UART_LSR & LSR_RBR_FULL) {
osalSysLockFromISR();
- if (chIQPutI(&sdp->iqueue, u->UART_RBR) < Q_OK)
+ if (chIQPutI(&sdp->iqueue, u->UART_RBR) < MSG_OK)
chnAddFlagsI(sdp, SD_OVERRUN_ERROR);
osalSysUnlockFromISR();
}
@@ -155,7 +155,7 @@ static void serve_interrupt(SerialDriver *sdp) {
osalSysLockFromISR();
b = chOQGetI(&sdp->oqueue);
osalSysUnlockFromISR();
- if (b < Q_OK) {
+ if (b < MSG_OK) {
u->UART_IER &= ~IER_THRE;
osalSysLockFromISR();
chnAddFlagsI(sdp, CHN_OUTPUT_EMPTY);
@@ -183,7 +183,7 @@ static void preload(SerialDriver *sdp) {
int i = LPC214x_UART_FIFO_PRELOAD;
do {
msg_t b = chOQGetI(&sdp->oqueue);
- if (b < Q_OK) {
+ if (b < MSG_OK) {
chnAddFlagsI(sdp, CHN_OUTPUT_EMPTY);
return;
}
diff --git a/os/hal/ports/STM32/LLD/USARTv1/serial_lld.c b/os/hal/ports/STM32/LLD/USARTv1/serial_lld.c
index 801b4fa20..89baa94d0 100644
--- a/os/hal/ports/STM32/LLD/USARTv1/serial_lld.c
+++ b/os/hal/ports/STM32/LLD/USARTv1/serial_lld.c
@@ -194,7 +194,7 @@ static void serve_interrupt(SerialDriver *sdp) {
msg_t b;
osalSysLockFromISR();
b = oqGetI(&sdp->oqueue);
- if (b < Q_OK) {
+ if (b < MSG_OK) {
chnAddFlagsI(sdp, CHN_OUTPUT_EMPTY);
u->CR1 = (cr1 & ~USART_CR1_TXEIE) | USART_CR1_TCIE;
}
diff --git a/os/hal/ports/STM32/LLD/USARTv2/serial_lld.c b/os/hal/ports/STM32/LLD/USARTv2/serial_lld.c
index 88e05e26e..acfba3138 100644
--- a/os/hal/ports/STM32/LLD/USARTv2/serial_lld.c
+++ b/os/hal/ports/STM32/LLD/USARTv2/serial_lld.c
@@ -221,7 +221,7 @@ static void serve_interrupt(SerialDriver *sdp) {
msg_t b;
osalSysLockFromISR();
b = oqGetI(&sdp->oqueue);
- if (b < Q_OK) {
+ if (b < MSG_OK) {
chnAddFlagsI(sdp, CHN_OUTPUT_EMPTY);
u->CR1 = (cr1 & ~USART_CR1_TXEIE) | USART_CR1_TCIE;
}
diff --git a/os/hal/src/hal_buffers.c b/os/hal/src/hal_buffers.c
index e89147c9a..03e986eef 100644
--- a/os/hal/src/hal_buffers.c
+++ b/os/hal/src/hal_buffers.c
@@ -353,6 +353,8 @@ size_t ibqReadTimeout(input_buffers_queue_t *ibqp, uint8_t *bp,
size_t r = 0;
systime_t deadline;
+ osalDbgCheck(n > 0U);
+
osalSysLock();
/* Time window for the whole operation.*/
@@ -726,6 +728,8 @@ size_t obqWriteTimeout(output_buffers_queue_t *obqp, const uint8_t *bp,
size_t w = 0;
systime_t deadline;
+ osalDbgCheck(n > 0U);
+
osalSysLock();
/* Time window for the whole operation.*/
diff --git a/os/hal/src/hal_queues.c b/os/hal/src/hal_queues.c
index dfa8ac920..a54174b8e 100644
--- a/os/hal/src/hal_queues.c
+++ b/os/hal/src/hal_queues.c
@@ -71,7 +71,7 @@ void iqObjectInit(input_queue_t *iqp, uint8_t *bp, size_t size,
/**
* @brief Resets an input queue.
* @details All the data in the input queue is erased and lost, any waiting
- * thread is resumed with status @p Q_RESET.
+ * thread is resumed with status @p 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.
*
@@ -86,7 +86,7 @@ void iqResetI(input_queue_t *iqp) {
iqp->q_rdptr = iqp->q_buffer;
iqp->q_wrptr = iqp->q_buffer;
iqp->q_counter = 0;
- osalThreadDequeueAllI(&iqp->q_waiting, Q_RESET);
+ osalThreadDequeueAllI(&iqp->q_waiting, MSG_RESET);
}
/**
@@ -96,8 +96,8 @@ void iqResetI(input_queue_t *iqp) {
* @param[in] iqp pointer to an @p input_queue_t structure
* @param[in] b the byte value to be written in the queue
* @return The operation status.
- * @retval Q_OK if the operation has been completed with success.
- * @retval Q_FULL if the queue is full and the operation cannot be
+ * @retval MSG_OK if the operation has been completed with success.
+ * @retval MSG_TIMEOUT if the queue is full and the operation cannot be
* completed.
*
* @iclass
@@ -107,7 +107,7 @@ msg_t iqPutI(input_queue_t *iqp, uint8_t b) {
osalDbgCheckClassI();
if (iqIsFullI(iqp)) {
- return Q_FULL;
+ return MSG_TIMEOUT;
}
iqp->q_counter++;
@@ -116,9 +116,9 @@ msg_t iqPutI(input_queue_t *iqp, uint8_t b) {
iqp->q_wrptr = iqp->q_buffer;
}
- osalThreadDequeueNextI(&iqp->q_waiting, Q_OK);
+ osalThreadDequeueNextI(&iqp->q_waiting, MSG_OK);
- return Q_OK;
+ return MSG_OK;
}
/**
@@ -126,8 +126,8 @@ msg_t iqPutI(input_queue_t *iqp, uint8_t b) {
* @details 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 before reading the character from the
- * buffer or before entering the state @p THD_STATE_WTQUEUE.
+ * @note The callback is invoked after removing a character from the
+ * queue.
*
* @param[in] iqp pointer to an @p input_queue_t structure
* @param[in] timeout the number of ticks before the operation timeouts,
@@ -136,8 +136,8 @@ msg_t iqPutI(input_queue_t *iqp, uint8_t b) {
* - @a TIME_INFINITE no timeout.
* .
* @return A byte value from the queue.
- * @retval Q_TIMEOUT if the specified time expired.
- * @retval Q_RESET if the queue has been reset.
+ * @retval MSG_TIMEOUT if the specified time expired.
+ * @retval MSG_RESET if the queue has been reset.
*
* @api
*/
@@ -145,23 +145,28 @@ msg_t iqGetTimeout(input_queue_t *iqp, systime_t timeout) {
uint8_t b;
osalSysLock();
- if (iqp->q_notify != NULL) {
- iqp->q_notify(iqp);
- }
+ /* Waiting until there is a character available or a timeout occurs.*/
while (iqIsEmptyI(iqp)) {
msg_t msg = osalThreadEnqueueTimeoutS(&iqp->q_waiting, timeout);
- if (msg < Q_OK) {
+ if (msg < MSG_OK) {
osalSysUnlock();
return msg;
}
}
+ /* Getting the character from the queue.*/
iqp->q_counter--;
b = *iqp->q_rdptr++;
if (iqp->q_rdptr >= iqp->q_top) {
iqp->q_rdptr = iqp->q_buffer;
}
+
+ /* Inform the low side that the queue has at least one slot available.*/
+ if (iqp->q_notify != NULL) {
+ iqp->q_notify(iqp);
+ }
+
osalSysUnlock();
return (msg_t)b;
@@ -175,8 +180,8 @@ msg_t iqGetTimeout(input_queue_t *iqp, systime_t timeout) {
* 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.
- * @note The callback is invoked before reading each character from the
- * buffer or before entering the state @p THD_STATE_WTQUEUE.
+ * @note The callback is invoked after removing each character from the
+ * queue.
*
* @param[in] iqp pointer to an @p input_queue_t structure
* @param[out] bp pointer to the data buffer
@@ -193,30 +198,64 @@ msg_t iqGetTimeout(input_queue_t *iqp, systime_t timeout) {
*/
size_t iqReadTimeout(input_queue_t *iqp, uint8_t *bp,
size_t n, systime_t timeout) {
+ systime_t deadline;
qnotify_t nfy = iqp->q_notify;
size_t r = 0;
osalDbgCheck(n > 0U);
osalSysLock();
- while (true) {
- if (nfy != NULL) {
- nfy(iqp);
- }
+ /* Time deadline for the whole operation, note the result is invalid
+ when timeout is TIME_INFINITE or TIME_IMMEDIATE but in that case
+ the deadline is not used.*/
+ deadline = osalOsGetSystemTimeX() + timeout;
+
+ while (true) {
+ /* Waiting until there is a character available or a timeout occurs.*/
while (iqIsEmptyI(iqp)) {
- if (osalThreadEnqueueTimeoutS(&iqp->q_waiting, timeout) != Q_OK) {
+ msg_t msg;
+
+ /* TIME_INFINITE and TIME_IMMEDIATE are handled differently, no
+ deadline.*/
+ if ((timeout == TIME_INFINITE) || (timeout == TIME_IMMEDIATE)) {
+ msg = osalThreadEnqueueTimeoutS(&iqp->q_waiting, timeout);
+ }
+ else {
+ systime_t next_timeout = deadline - osalOsGetSystemTimeX();
+
+ /* Handling the case where the system time went past the deadline,
+ in this case next becomes a very high number because the system
+ time is an unsigned type.*/
+ if (next_timeout > timeout) {
+ osalSysUnlock();
+ return r;
+ }
+
+ msg = osalThreadEnqueueTimeoutS(&iqp->q_waiting, next_timeout);
+ }
+
+ /* Anything except MSG_OK causes the operation to stop.*/
+ if (msg != MSG_OK) {
osalSysUnlock();
return r;
}
}
+ /* Getting the character from the queue.*/
iqp->q_counter--;
*bp++ = *iqp->q_rdptr++;
if (iqp->q_rdptr >= iqp->q_top) {
iqp->q_rdptr = iqp->q_buffer;
}
- osalSysUnlock(); /* Gives a preemption chance in a controlled point.*/
+
+ /* Inform the low side that the queue has at least one slot available.*/
+ if (nfy != NULL) {
+ nfy(iqp);
+ }
+
+ /* Giving a preemption chance in a controlled point.*/
+ osalSysUnlock();
r++;
if (--n == 0U) {
@@ -258,7 +297,7 @@ void oqObjectInit(output_queue_t *oqp, uint8_t *bp, size_t size,
/**
* @brief Resets an output queue.
* @details All the data in the output queue is erased and lost, any waiting
- * thread is resumed with status @p Q_RESET.
+ * thread is resumed with status @p 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.
*
@@ -273,7 +312,7 @@ void oqResetI(output_queue_t *oqp) {
oqp->q_rdptr = oqp->q_buffer;
oqp->q_wrptr = oqp->q_buffer;
oqp->q_counter = qSizeX(oqp);
- osalThreadDequeueAllI(&oqp->q_waiting, Q_RESET);
+ osalThreadDequeueAllI(&oqp->q_waiting, MSG_RESET);
}
/**
@@ -281,8 +320,8 @@ void oqResetI(output_queue_t *oqp) {
* @details 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 writing the character into the
- * buffer.
+ * @note The callback is invoked after putting the character into the
+ * queue.
*
* @param[in] oqp pointer to an @p output_queue_t structure
* @param[in] b the byte value to be written in the queue
@@ -292,35 +331,40 @@ void oqResetI(output_queue_t *oqp) {
* - @a TIME_INFINITE no timeout.
* .
* @return The operation status.
- * @retval Q_OK if the operation succeeded.
- * @retval Q_TIMEOUT if the specified time expired.
- * @retval Q_RESET if the queue has been reset.
+ * @retval MSG_OK if the operation succeeded.
+ * @retval MSG_TIMEOUT if the specified time expired.
+ * @retval MSG_RESET if the queue has been reset.
*
* @api
*/
msg_t oqPutTimeout(output_queue_t *oqp, uint8_t b, systime_t timeout) {
osalSysLock();
+
+ /* Waiting until there is a slot available or a timeout occurs.*/
while (oqIsFullI(oqp)) {
msg_t msg = osalThreadEnqueueTimeoutS(&oqp->q_waiting, timeout);
- if (msg < Q_OK) {
+ if (msg < MSG_OK) {
osalSysUnlock();
return msg;
}
}
+ /* Putting the character into the queue.*/
oqp->q_counter--;
*oqp->q_wrptr++ = b;
if (oqp->q_wrptr >= oqp->q_top) {
oqp->q_wrptr = oqp->q_buffer;
}
+ /* Inform the low side that the queue has at least one character available.*/
if (oqp->q_notify != NULL) {
oqp->q_notify(oqp);
}
+
osalSysUnlock();
- return Q_OK;
+ return MSG_OK;
}
/**
@@ -329,7 +373,7 @@ msg_t oqPutTimeout(output_queue_t *oqp, uint8_t b, systime_t timeout) {
*
* @param[in] oqp pointer to an @p output_queue_t structure
* @return The byte value from the queue.
- * @retval Q_EMPTY if the queue is empty.
+ * @retval MSG_TIMEOUT if the queue is empty.
*
* @iclass
*/
@@ -339,7 +383,7 @@ msg_t oqGetI(output_queue_t *oqp) {
osalDbgCheckClassI();
if (oqIsEmptyI(oqp)) {
- return Q_EMPTY;
+ return MSG_TIMEOUT;
}
oqp->q_counter++;
@@ -348,7 +392,7 @@ msg_t oqGetI(output_queue_t *oqp) {
oqp->q_rdptr = oqp->q_buffer;
}
- osalThreadDequeueNextI(&oqp->q_waiting, Q_OK);
+ osalThreadDequeueNextI(&oqp->q_waiting, MSG_OK);
return (msg_t)b;
}
@@ -361,8 +405,8 @@ msg_t oqGetI(output_queue_t *oqp) {
* 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.
- * @note The callback is invoked after writing each character into the
- * buffer.
+ * @note The callback is invoked after putting each character into the
+ * queue.
*
* @param[in] oqp pointer to an @p output_queue_t structure
* @param[in] bp pointer to the data buffer
@@ -379,29 +423,63 @@ msg_t oqGetI(output_queue_t *oqp) {
*/
size_t oqWriteTimeout(output_queue_t *oqp, const uint8_t *bp,
size_t n, systime_t timeout) {
+ systime_t deadline;
qnotify_t nfy = oqp->q_notify;
size_t w = 0;
osalDbgCheck(n > 0U);
osalSysLock();
+
+ /* Time deadline for the whole operation, note the result is invalid
+ when timeout is TIME_INFINITE or TIME_IMMEDIATE but in that case
+ the deadline is not used.*/
+ deadline = osalOsGetSystemTimeX() + timeout;
+
while (true) {
+ msg_t msg;
+
while (oqIsFullI(oqp)) {
- if (osalThreadEnqueueTimeoutS(&oqp->q_waiting, timeout) != Q_OK) {
+ /* TIME_INFINITE and TIME_IMMEDIATE are handled differently, no
+ deadline.*/
+ if ((timeout == TIME_INFINITE) || (timeout == TIME_IMMEDIATE)) {
+ msg = osalThreadEnqueueTimeoutS(&oqp->q_waiting, timeout);
+ }
+ else {
+ systime_t next_timeout = deadline - osalOsGetSystemTimeX();
+
+ /* Handling the case where the system time went past the deadline,
+ in this case next becomes a very high number because the system
+ time is an unsigned type.*/
+ if (next_timeout > timeout) {
+ osalSysUnlock();
+ return w;
+ }
+
+ msg = osalThreadEnqueueTimeoutS(&oqp->q_waiting, next_timeout);
+ }
+
+ /* Anything except MSG_OK causes the operation to stop.*/
+ if (msg != MSG_OK) {
osalSysUnlock();
return w;
}
}
+
+ /* Putting the character into the queue.*/
oqp->q_counter--;
*oqp->q_wrptr++ = *bp++;
if (oqp->q_wrptr >= oqp->q_top) {
oqp->q_wrptr = oqp->q_buffer;
}
+ /* Inform the low side that the queue has at least one character available.*/
if (nfy != NULL) {
nfy(oqp);
}
- osalSysUnlock(); /* Gives a preemption chance in a controlled point.*/
+
+ /* Giving a preemption chance in a controlled point.*/
+ osalSysUnlock();
w++;
if (--n == 0U) {
diff --git a/os/hal/src/serial.c b/os/hal/src/serial.c
index 4b5ecf6e7..747988631 100644
--- a/os/hal/src/serial.c
+++ b/os/hal/src/serial.c
@@ -159,7 +159,7 @@ void sdStart(SerialDriver *sdp, const SerialConfig *config) {
/**
* @brief Stops the driver.
* @details Any thread waiting on the driver's queues will be awakened with
- * the message @p Q_RESET.
+ * the message @p MSG_RESET.
*
* @param[in] sdp pointer to a @p SerialDriver object
*
@@ -203,7 +203,7 @@ void sdIncomingDataI(SerialDriver *sdp, uint8_t b) {
if (iqIsEmptyI(&sdp->iqueue))
chnAddFlagsI(sdp, CHN_INPUT_AVAILABLE);
- if (iqPutI(&sdp->iqueue, b) < Q_OK)
+ if (iqPutI(&sdp->iqueue, b) < MSG_OK)
chnAddFlagsI(sdp, SD_OVERRUN_ERROR);
}
@@ -217,7 +217,7 @@ void sdIncomingDataI(SerialDriver *sdp, uint8_t b) {
*
* @param[in] sdp pointer to a @p SerialDriver structure
* @return The byte value read from the driver's output queue.
- * @retval Q_EMPTY if the queue is empty (the lower driver usually
+ * @retval MSG_TIMEOUT if the queue is empty (the lower driver usually
* disables the interrupt source when this happens).
*
* @iclass
@@ -229,7 +229,7 @@ msg_t sdRequestDataI(SerialDriver *sdp) {
osalDbgCheck(sdp != NULL);
b = oqGetI(&sdp->oqueue);
- if (b < Q_OK)
+ if (b < MSG_OK)
chnAddFlagsI(sdp, CHN_OUTPUT_EMPTY);
return b;
}
diff --git a/os/hal/src/serial_usb.c b/os/hal/src/serial_usb.c
index afa6679e4..754c5922c 100644
--- a/os/hal/src/serial_usb.c
+++ b/os/hal/src/serial_usb.c
@@ -252,7 +252,7 @@ void sduStart(SerialUSBDriver *sdup, const SerialUSBConfig *config) {
/**
* @brief Stops the driver.
* @details Any thread waiting on the driver's queues will be awakened with
- * the message @p Q_RESET.
+ * the message @p MSG_RESET.
*
* @param[in] sdup pointer to a @p SerialUSBDriver object
*