From ff109ac9e64f0f107a21343cd82d603b04c35aaf Mon Sep 17 00:00:00 2001 From: Giovanni Di Sirio Date: Sat, 10 Feb 2018 11:25:29 +0000 Subject: [PATCH] MISRA-related changes. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@11473 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/osal/nil/osal.h | 2 +- os/hal/osal/os-less/ARMCMx/osal.c | 8 ++++---- os/hal/osal/os-less/ARMCMx/osal.h | 8 ++++---- os/hal/osal/rt/osal.h | 2 +- os/hal/ports/STM32/LLD/I2Cv1/hal_i2c_lld.c | 4 ++-- os/hal/ports/STM32/LLD/I2Cv1/hal_i2c_lld.h | 4 ++-- os/hal/ports/STM32/LLD/I2Cv2/hal_i2c_lld.c | 4 ++-- os/hal/ports/STM32/LLD/I2Cv2/hal_i2c_lld.h | 4 ++-- os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.c | 4 ++-- os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.h | 4 ++-- os/hal/src/hal_buffers.c | 14 ++++++++------ os/hal/src/hal_pal.c | 8 ++++---- os/hal/src/hal_queues.c | 20 ++++++++++++-------- os/hal/src/hal_serial.c | 11 +++++++---- os/hal/src/hal_serial_usb.c | 8 +++++--- os/hal/templates/hal_i2c_lld.c | 4 ++-- os/hal/templates/hal_i2c_lld.h | 4 ++-- os/hal/templates/hal_spi_lld.h | 2 ++ os/hal/templates/osal/osal.c | 8 ++++---- os/hal/templates/osal/osal.h | 8 ++++---- 20 files changed, 72 insertions(+), 59 deletions(-) diff --git a/os/hal/osal/nil/osal.h b/os/hal/osal/nil/osal.h index 9fd0b4192..6cc0325d9 100644 --- a/os/hal/osal/nil/osal.h +++ b/os/hal/osal/nil/osal.h @@ -162,7 +162,7 @@ typedef uint32_t systime_t; #if 0 /** - * @brief Type of system time counter. + * @brief Type of system time interval. */ typedef uint32_t sysinterval_t; #endif diff --git a/os/hal/osal/os-less/ARMCMx/osal.c b/os/hal/osal/os-less/ARMCMx/osal.c index 3f8a7ea62..5c62069e4 100644 --- a/os/hal/osal/os-less/ARMCMx/osal.c +++ b/os/hal/osal/os-less/ARMCMx/osal.c @@ -162,7 +162,7 @@ systime_t osalOsGetSystemTimeX(void) { * * @sclass */ -void osalThreadSleepS(systime_t time) { +void osalThreadSleepS(sysinterval_t time) { virtual_timer_t vt; thread_reference_t tr; @@ -183,7 +183,7 @@ void osalThreadSleepS(systime_t time) { * * @api */ -void osalThreadSleep(systime_t time) { +void osalThreadSleep(sysinterval_t time) { osalSysLock(); osalThreadSleepS(time); @@ -236,7 +236,7 @@ msg_t osalThreadSuspendS(thread_reference_t *trp) { * * @sclass */ -msg_t osalThreadSuspendTimeoutS(thread_reference_t *trp, systime_t timeout) { +msg_t osalThreadSuspendTimeoutS(thread_reference_t *trp, sysinterval_t timeout) { msg_t msg; virtual_timer_t vt; @@ -316,7 +316,7 @@ void osalThreadResumeS(thread_reference_t *trp, msg_t msg) { * * @sclass */ -msg_t osalThreadEnqueueTimeoutS(threads_queue_t *tqp, systime_t timeout) { +msg_t osalThreadEnqueueTimeoutS(threads_queue_t *tqp, sysinterval_t timeout) { msg_t msg; virtual_timer_t vt; diff --git a/os/hal/osal/os-less/ARMCMx/osal.h b/os/hal/osal/os-less/ARMCMx/osal.h index 1bf98ab32..248af8831 100644 --- a/os/hal/osal/os-less/ARMCMx/osal.h +++ b/os/hal/osal/os-less/ARMCMx/osal.h @@ -177,7 +177,7 @@ typedef int32_t msg_t; typedef uint32_t systime_t; /** - * @brief Type of system time counter. + * @brief Type of system time interval. */ typedef uint32_t sysinterval_t; @@ -366,7 +366,7 @@ typedef struct { * @api */ #define OSAL_S2I(secs) \ - ((systime_t)((uint32_t)(secs) * (uint32_t)OSAL_ST_FREQUENCY)) + ((sysinterval_t)((uint32_t)(secs) * (uint32_t)OSAL_ST_FREQUENCY)) /** * @brief Milliseconds to system ticks. @@ -379,7 +379,7 @@ typedef struct { * @api */ #define OSAL_MS2I(msecs) \ - ((systime_t)((((((uint32_t)(msecs)) * \ + ((sysinterval_t)((((((uint32_t)(msecs)) * \ ((uint32_t)OSAL_ST_FREQUENCY)) - 1UL) / 1000UL) + 1UL)) /** @@ -393,7 +393,7 @@ typedef struct { * @api */ #define OSAL_US2I(usecs) \ - ((systime_t)((((((uint32_t)(usecs)) * \ + ((sysinterval_t)((((((uint32_t)(usecs)) * \ ((uint32_t)OSAL_ST_FREQUENCY)) - 1UL) / 1000000UL) + 1UL)) /** @} */ diff --git a/os/hal/osal/rt/osal.h b/os/hal/osal/rt/osal.h index 75dc19c45..73e8e3fa9 100644 --- a/os/hal/osal/rt/osal.h +++ b/os/hal/osal/rt/osal.h @@ -150,7 +150,7 @@ typedef uint32_t systime_t; #if 0 /** - * @brief Type of system time counter. + * @brief Type of system time interval. */ typedef uint32_t sysinterval_t; #endif diff --git a/os/hal/ports/STM32/LLD/I2Cv1/hal_i2c_lld.c b/os/hal/ports/STM32/LLD/I2Cv1/hal_i2c_lld.c index 99540fd32..6ade22660 100644 --- a/os/hal/ports/STM32/LLD/I2Cv1/hal_i2c_lld.c +++ b/os/hal/ports/STM32/LLD/I2Cv1/hal_i2c_lld.c @@ -713,7 +713,7 @@ void i2c_lld_stop(I2CDriver *i2cp) { */ msg_t i2c_lld_master_receive_timeout(I2CDriver *i2cp, i2caddr_t addr, uint8_t *rxbuf, size_t rxbytes, - systime_t timeout) { + sysinterval_t timeout) { I2C_TypeDef *dp = i2cp->i2c; systime_t start, end; @@ -793,7 +793,7 @@ msg_t i2c_lld_master_receive_timeout(I2CDriver *i2cp, i2caddr_t addr, msg_t i2c_lld_master_transmit_timeout(I2CDriver *i2cp, i2caddr_t addr, const uint8_t *txbuf, size_t txbytes, uint8_t *rxbuf, size_t rxbytes, - systime_t timeout) { + sysinterval_t timeout) { I2C_TypeDef *dp = i2cp->i2c; systime_t start, end; diff --git a/os/hal/ports/STM32/LLD/I2Cv1/hal_i2c_lld.h b/os/hal/ports/STM32/LLD/I2Cv1/hal_i2c_lld.h index 8fca92eed..1328d4768 100644 --- a/os/hal/ports/STM32/LLD/I2Cv1/hal_i2c_lld.h +++ b/os/hal/ports/STM32/LLD/I2Cv1/hal_i2c_lld.h @@ -498,10 +498,10 @@ extern "C" { msg_t i2c_lld_master_transmit_timeout(I2CDriver *i2cp, i2caddr_t addr, const uint8_t *txbuf, size_t txbytes, uint8_t *rxbuf, size_t rxbytes, - systime_t timeout); + sysinterval_t timeout); msg_t i2c_lld_master_receive_timeout(I2CDriver *i2cp, i2caddr_t addr, uint8_t *rxbuf, size_t rxbytes, - systime_t timeout); + sysinterval_t timeout); #ifdef __cplusplus } #endif diff --git a/os/hal/ports/STM32/LLD/I2Cv2/hal_i2c_lld.c b/os/hal/ports/STM32/LLD/I2Cv2/hal_i2c_lld.c index 9263ea7a0..f8aab4a5a 100644 --- a/os/hal/ports/STM32/LLD/I2Cv2/hal_i2c_lld.c +++ b/os/hal/ports/STM32/LLD/I2Cv2/hal_i2c_lld.c @@ -961,7 +961,7 @@ void i2c_lld_stop(I2CDriver *i2cp) { */ msg_t i2c_lld_master_receive_timeout(I2CDriver *i2cp, i2caddr_t addr, uint8_t *rxbuf, size_t rxbytes, - systime_t timeout) { + sysinterval_t timeout) { msg_t msg; I2C_TypeDef *dp = i2cp->i2c; systime_t start, end; @@ -1064,7 +1064,7 @@ msg_t i2c_lld_master_receive_timeout(I2CDriver *i2cp, i2caddr_t addr, msg_t i2c_lld_master_transmit_timeout(I2CDriver *i2cp, i2caddr_t addr, const uint8_t *txbuf, size_t txbytes, uint8_t *rxbuf, size_t rxbytes, - systime_t timeout) { + sysinterval_t timeout) { msg_t msg; I2C_TypeDef *dp = i2cp->i2c; systime_t start, end; diff --git a/os/hal/ports/STM32/LLD/I2Cv2/hal_i2c_lld.h b/os/hal/ports/STM32/LLD/I2Cv2/hal_i2c_lld.h index 4e835c5e9..d216c1460 100644 --- a/os/hal/ports/STM32/LLD/I2Cv2/hal_i2c_lld.h +++ b/os/hal/ports/STM32/LLD/I2Cv2/hal_i2c_lld.h @@ -487,10 +487,10 @@ extern "C" { msg_t i2c_lld_master_transmit_timeout(I2CDriver *i2cp, i2caddr_t addr, const uint8_t *txbuf, size_t txbytes, uint8_t *rxbuf, size_t rxbytes, - systime_t timeout); + sysinterval_t timeout); msg_t i2c_lld_master_receive_timeout(I2CDriver *i2cp, i2caddr_t addr, uint8_t *rxbuf, size_t rxbytes, - systime_t timeout); + sysinterval_t timeout); #ifdef __cplusplus } #endif diff --git a/os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.c b/os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.c index ca25f4a22..a7e0f589b 100644 --- a/os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.c +++ b/os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.c @@ -1037,7 +1037,7 @@ void i2c_lld_stop(I2CDriver *i2cp) { */ msg_t i2c_lld_master_receive_timeout(I2CDriver *i2cp, i2caddr_t addr, uint8_t *rxbuf, size_t rxbytes, - systime_t timeout) { + sysinterval_t timeout) { msg_t msg; I2C_TypeDef *dp = i2cp->i2c; systime_t start, end; @@ -1160,7 +1160,7 @@ msg_t i2c_lld_master_receive_timeout(I2CDriver *i2cp, i2caddr_t addr, msg_t i2c_lld_master_transmit_timeout(I2CDriver *i2cp, i2caddr_t addr, const uint8_t *txbuf, size_t txbytes, uint8_t *rxbuf, size_t rxbytes, - systime_t timeout) { + sysinterval_t timeout) { msg_t msg; I2C_TypeDef *dp = i2cp->i2c; systime_t start, end; diff --git a/os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.h b/os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.h index 7dfb23844..97f7359c0 100644 --- a/os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.h +++ b/os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.h @@ -553,10 +553,10 @@ extern "C" { msg_t i2c_lld_master_transmit_timeout(I2CDriver *i2cp, i2caddr_t addr, const uint8_t *txbuf, size_t txbytes, uint8_t *rxbuf, size_t rxbytes, - systime_t timeout); + sysinterval_t timeout); msg_t i2c_lld_master_receive_timeout(I2CDriver *i2cp, i2caddr_t addr, uint8_t *rxbuf, size_t rxbytes, - systime_t timeout); + sysinterval_t timeout); #ifdef __cplusplus } #endif diff --git a/os/hal/src/hal_buffers.c b/os/hal/src/hal_buffers.c index 599c9517b..c85be601c 100644 --- a/os/hal/src/hal_buffers.c +++ b/os/hal/src/hal_buffers.c @@ -358,14 +358,14 @@ msg_t ibqGetTimeout(input_buffers_queue_t *ibqp, sysinterval_t timeout) { size_t ibqReadTimeout(input_buffers_queue_t *ibqp, uint8_t *bp, size_t n, sysinterval_t timeout) { size_t r = 0; - sysinterval_t deadline; + systime_t deadline; osalDbgCheck(n > 0U); osalSysLock(); /* Time window for the whole operation.*/ - deadline = osalOsGetSystemTimeX() + timeout; + deadline = osalTimeAddX(osalOsGetSystemTimeX(), timeout); while (true) { size_t size; @@ -380,7 +380,8 @@ size_t ibqReadTimeout(input_buffers_queue_t *ibqp, uint8_t *bp, msg = ibqGetFullBufferTimeoutS(ibqp, timeout); } else { - sysinterval_t next_timeout = deadline - osalOsGetSystemTimeX(); + sysinterval_t next_timeout = osalTimeDiffX(osalOsGetSystemTimeX(), + deadline); /* Handling the case where the system time went past the deadline, in this case next becomes a very high number because the system @@ -740,14 +741,14 @@ msg_t obqPutTimeout(output_buffers_queue_t *obqp, uint8_t b, size_t obqWriteTimeout(output_buffers_queue_t *obqp, const uint8_t *bp, size_t n, sysinterval_t timeout) { size_t w = 0; - sysinterval_t deadline; + systime_t deadline; osalDbgCheck(n > 0U); osalSysLock(); /* Time window for the whole operation.*/ - deadline = osalOsGetSystemTimeX() + timeout; + deadline = osalTimeAddX(osalOsGetSystemTimeX(), timeout); while (true) { size_t size; @@ -762,7 +763,8 @@ size_t obqWriteTimeout(output_buffers_queue_t *obqp, const uint8_t *bp, msg = obqGetEmptyBufferTimeoutS(obqp, timeout); } else { - sysinterval_t next_timeout = deadline - osalOsGetSystemTimeX(); + sysinterval_t next_timeout = osalTimeDiffX(osalOsGetSystemTimeX(), + deadline); /* Handling the case where the system time went past the deadline, in this case next becomes a very high number because the system diff --git a/os/hal/src/hal_pal.c b/os/hal/src/hal_pal.c index c6f562c16..573ca2ff8 100644 --- a/os/hal/src/hal_pal.c +++ b/os/hal/src/hal_pal.c @@ -117,7 +117,7 @@ void palSetBusMode(IOBus *bus, iomode_t mode) { palSetGroupMode(bus->portid, bus->mask, bus->offset, mode); } -#if PAL_USE_CALLBACKS || defined(__DOXYGEN__) +#if (PAL_USE_CALLBACKS == TRUE) || defined(__DOXYGEN__) /** * @brief Associates a callback to a port/pad. * @@ -151,9 +151,9 @@ void palSetLineCallbackI(ioline_t line, palcallback_t cb, void *arg) { pep->cb = cb; pep->arg = arg; } -#endif /* PAL_USE_CALLBACKS */ +#endif /* PAL_USE_CALLBACKS == TRUE */ -#if PAL_USE_WAIT || defined(__DOXYGEN__) +#if (PAL_USE_WAIT == TRUE) || defined(__DOXYGEN__) /** * @brief Waits for an edge on the specified port/pad. * @@ -194,7 +194,7 @@ msg_t palWaitLineTimeoutS(ioline_t line, palevent_t *pep = pal_lld_get_line_event(line); return osalThreadEnqueueTimeoutS(&pep->threads, timeout); } -#endif /* PAL_USE_WAIT */ +#endif /* PAL_USE_WAIT == TRUE */ #endif /* HAL_USE_PAL == TRUE */ diff --git a/os/hal/src/hal_queues.c b/os/hal/src/hal_queues.c index 4ec84c1b3..1e2386c2a 100644 --- a/os/hal/src/hal_queues.c +++ b/os/hal/src/hal_queues.c @@ -68,7 +68,9 @@ static size_t iq_read(input_queue_t *iqp, uint8_t *bp, size_t n) { } /* Number of bytes before buffer limit.*/ - s1 = iqp->q_top - iqp->q_rdptr; + /*lint -save -e9033 [10.8] Checked to be safe.*/ + s1 = (size_t)(iqp->q_top - iqp->q_rdptr); + /*lint -restore*/ if (n < s1) { memcpy((void *)bp, (void *)iqp->q_rdptr, n); iqp->q_rdptr += n; @@ -114,20 +116,22 @@ static size_t oq_write(output_queue_t *oqp, const uint8_t *bp, size_t n) { } /* Number of bytes before buffer limit.*/ - s1 = oqp->q_top - oqp->q_wrptr; + /*lint -save -e9033 [10.8] Checked to be safe.*/ + s1 = (size_t)(oqp->q_top - oqp->q_wrptr); + /*lint -restore*/ if (n < s1) { - memcpy((void *)oqp->q_wrptr, (void *)bp, n); + memcpy((void *)oqp->q_wrptr, (const void *)bp, n); oqp->q_wrptr += n; } else if (n > s1) { - memcpy((void *)oqp->q_wrptr, (void *)bp, s1); + memcpy((void *)oqp->q_wrptr, (const void *)bp, s1); bp += s1; s2 = n - s1; - memcpy((void *)oqp->q_buffer, (void *)bp, s2); + memcpy((void *)oqp->q_buffer, (const void *)bp, s2); oqp->q_wrptr = oqp->q_buffer + s2; } else { /* n == s1 */ - memcpy((void *)oqp->q_wrptr, (void *)bp, n); + memcpy((void *)oqp->q_wrptr, (const void *)bp, n); oqp->q_wrptr = oqp->q_buffer; } @@ -395,7 +399,7 @@ size_t iqReadTimeout(input_queue_t *iqp, uint8_t *bp, size_t done; done = iq_read(iqp, bp, n); - if (done == 0) { + if (done == (size_t)0) { msg_t msg = osalThreadEnqueueTimeoutS(&iqp->q_waiting, timeout); /* Anything except MSG_OK causes the operation to stop.*/ @@ -664,7 +668,7 @@ size_t oqWriteTimeout(output_queue_t *oqp, const uint8_t *bp, size_t done; done = oq_write(oqp, bp, n); - if (done == 0) { + if (done == (size_t)0) { msg_t msg = osalThreadEnqueueTimeoutS(&oqp->q_waiting, timeout); /* Anything except MSG_OK causes the operation to stop.*/ diff --git a/os/hal/src/hal_serial.c b/os/hal/src/hal_serial.c index ee2b9ad55..734316877 100644 --- a/os/hal/src/hal_serial.c +++ b/os/hal/src/hal_serial.c @@ -100,13 +100,16 @@ static msg_t _ctl(void *ip, unsigned int operation, void *arg) { case CHN_CTL_NOP: osalDbgCheck(arg == NULL); break; - default: -#if defined(SD_LLD_IMPLEMENTS_CTL) - return sd_lld_control(sdp, operation, arg); -#endif case CHN_CTL_INVALID: osalDbgAssert(false, "invalid CTL operation"); break; + default: +#if defined(SD_LLD_IMPLEMENTS_CTL) + /* Delegating to the LLD if supported.*/ + return sd_lld_control(sdp, operation, arg); +#else + break; +#endif } return MSG_OK; } diff --git a/os/hal/src/hal_serial_usb.c b/os/hal/src/hal_serial_usb.c index 0e63a386c..02a61d09b 100644 --- a/os/hal/src/hal_serial_usb.c +++ b/os/hal/src/hal_serial_usb.c @@ -135,6 +135,9 @@ static msg_t _ctl(void *ip, unsigned int operation, void *arg) { case CHN_CTL_NOP: osalDbgCheck(arg == NULL); break; + case CHN_CTL_INVALID: + osalDbgAssert(false, "invalid CTL operation"); + break; default: #if defined(SDU_LLD_IMPLEMENTS_CTL) /* The SDU driver does not have a LLD but the application can use this @@ -143,10 +146,9 @@ static msg_t _ctl(void *ip, unsigned int operation, void *arg) { unsigned int operation, void *arg); return sdu_lld_control(sdup, operation, arg); -#endif - case CHN_CTL_INVALID: - osalDbgAssert(false, "invalid CTL operation"); +#else break; +#endif } return MSG_OK; } diff --git a/os/hal/templates/hal_i2c_lld.c b/os/hal/templates/hal_i2c_lld.c index 819ff7a9f..b7f2e9944 100644 --- a/os/hal/templates/hal_i2c_lld.c +++ b/os/hal/templates/hal_i2c_lld.c @@ -132,7 +132,7 @@ void i2c_lld_stop(I2CDriver *i2cp) { */ msg_t i2c_lld_master_receive_timeout(I2CDriver *i2cp, i2caddr_t addr, uint8_t *rxbuf, size_t rxbytes, - systime_t timeout) { + sysinterval_t timeout) { (void)i2cp; (void)addr; @@ -169,7 +169,7 @@ msg_t i2c_lld_master_receive_timeout(I2CDriver *i2cp, i2caddr_t addr, msg_t i2c_lld_master_transmit_timeout(I2CDriver *i2cp, i2caddr_t addr, const uint8_t *txbuf, size_t txbytes, uint8_t *rxbuf, size_t rxbytes, - systime_t timeout) { + sysinterval_t timeout) { (void)i2cp; (void)addr; diff --git a/os/hal/templates/hal_i2c_lld.h b/os/hal/templates/hal_i2c_lld.h index 5015bf502..a1148062c 100644 --- a/os/hal/templates/hal_i2c_lld.h +++ b/os/hal/templates/hal_i2c_lld.h @@ -137,10 +137,10 @@ extern "C" { msg_t i2c_lld_master_transmit_timeout(I2CDriver *i2cp, i2caddr_t addr, const uint8_t *txbuf, size_t txbytes, uint8_t *rxbuf, size_t rxbytes, - systime_t timeout); + sysinterval_t timeout); msg_t i2c_lld_master_receive_timeout(I2CDriver *i2cp, i2caddr_t addr, uint8_t *rxbuf, size_t rxbytes, - systime_t timeout); + sysinterval_t timeout); #ifdef __cplusplus } #endif diff --git a/os/hal/templates/hal_spi_lld.h b/os/hal/templates/hal_spi_lld.h index 0355cb914..e939c3955 100644 --- a/os/hal/templates/hal_spi_lld.h +++ b/os/hal/templates/hal_spi_lld.h @@ -174,6 +174,8 @@ extern "C" { void spi_lld_select(SPIDriver *spip); void spi_lld_unselect(SPIDriver *spip); #endif + void spi_lld_select(SPIDriver *spip); + void spi_lld_unselect(SPIDriver *spip); void spi_lld_ignore(SPIDriver *spip, size_t n); void spi_lld_exchange(SPIDriver *spip, size_t n, const void *txbuf, void *rxbuf); diff --git a/os/hal/templates/osal/osal.c b/os/hal/templates/osal/osal.c index e83ebcabd..5ec0bae59 100644 --- a/os/hal/templates/osal/osal.c +++ b/os/hal/templates/osal/osal.c @@ -150,7 +150,7 @@ systime_t osalOsGetSystemTimeX(void) { * * @sclass */ -void osalThreadSleepS(systime_t time) { +void osalThreadSleepS(sysinterval_t time) { (void)time; } @@ -167,7 +167,7 @@ void osalThreadSleepS(systime_t time) { * * @api */ -void osalThreadSleep(systime_t time) { +void osalThreadSleep(sysinterval_t time) { (void)time; } @@ -208,7 +208,7 @@ msg_t osalThreadSuspendS(thread_reference_t *trp) { * * @sclass */ -msg_t osalThreadSuspendTimeoutS(thread_reference_t *trp, systime_t timeout) { +msg_t osalThreadSuspendTimeoutS(thread_reference_t *trp, sysinterval_t timeout) { osalDbgCheck(trp != NULL); @@ -274,7 +274,7 @@ void osalThreadResumeS(thread_reference_t *trp, msg_t msg) { * * @sclass */ -msg_t osalThreadEnqueueTimeoutS(threads_queue_t *tqp, systime_t timeout) { +msg_t osalThreadEnqueueTimeoutS(threads_queue_t *tqp, sysinterval_t timeout) { osalDbgCheck(tqp != NULL); diff --git a/os/hal/templates/osal/osal.h b/os/hal/templates/osal/osal.h index bbaaf69df..620d5fb27 100644 --- a/os/hal/templates/osal/osal.h +++ b/os/hal/templates/osal/osal.h @@ -165,7 +165,7 @@ typedef int32_t msg_t; typedef uint32_t systime_t; /** - * @brief Type of system time counter. + * @brief Type of system time interval. */ typedef uint32_t sysinterval_t; @@ -344,7 +344,7 @@ typedef struct { * @api */ #define OSAL_S2I(secs) \ - ((systime_t)((uint32_t)(secs) * (uint32_t)OSAL_ST_FREQUENCY)) + ((sysinterval_t)((uint32_t)(secs) * (uint32_t)OSAL_ST_FREQUENCY)) /** * @brief Milliseconds to system ticks. @@ -357,7 +357,7 @@ typedef struct { * @api */ #define OSAL_MS2I(msecs) \ - ((systime_t)((((((uint32_t)(msecs)) * \ + ((sysinterval_t)((((((uint32_t)(msecs)) * \ ((uint32_t)OSAL_ST_FREQUENCY)) - 1UL) / 1000UL) + 1UL)) /** @@ -371,7 +371,7 @@ typedef struct { * @api */ #define OSAL_US2I(usecs) \ - ((systime_t)((((((uint32_t)(usecs)) * \ + ((sysinterval_t)((((((uint32_t)(usecs)) * \ ((uint32_t)OSAL_ST_FREQUENCY)) - 1UL) / 1000000UL) + 1UL)) /** @} */