From 4866bfadb67f115b0b17ebcc3ab47e0e4ff75d67 Mon Sep 17 00:00:00 2001 From: Giovanni Di Sirio Date: Sat, 21 Dec 2019 11:08:35 +0000 Subject: [PATCH] Reverted bug #1060. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@13220 27425a3e-05d8-49a3-a47f-9c15f0e5edd8 --- os/hal/osal/os-less/ARMCMx/osal.h | 8 ++++---- os/hal/osal/os-less/AVR/osal.h | 4 ++-- os/hal/templates/osal/osal.h | 8 ++++---- os/nil/include/ch.h | 4 ++-- os/nil/src/ch.c | 16 ++++++++-------- os/rt/include/chtime.h | 8 ++++---- os/rt/src/chsys.c | 8 ++++---- readme.txt | 2 -- 8 files changed, 28 insertions(+), 30 deletions(-) diff --git a/os/hal/osal/os-less/ARMCMx/osal.h b/os/hal/osal/os-less/ARMCMx/osal.h index cb6195b06..362a30c66 100644 --- a/os/hal/osal/os-less/ARMCMx/osal.h +++ b/os/hal/osal/os-less/ARMCMx/osal.h @@ -687,8 +687,8 @@ static inline sysinterval_t osalTimeDiffX(systime_t start, systime_t end) { /** * @brief Checks if the specified time is within the specified time window. - * @note When start==end then the function returns always true because the - * whole time range is specified. + * @note When start==end then the function returns always false because the + * time window has zero size. * @note This function can be called from any context. * * @param[in] time the time to be verified @@ -703,8 +703,8 @@ static inline bool osalTimeIsInRangeX(systime_t time, systime_t start, systime_t end) { - return (bool)((systime_t)((systime_t)time - (systime_t)start) <= - (systime_t)((systime_t)end - (systime_t)start - (systime_t)1)); + return (bool)((systime_t)((systime_t)time - (systime_t)start) < + (systime_t)((systime_t)end - (systime_t)start)); } /** diff --git a/os/hal/osal/os-less/AVR/osal.h b/os/hal/osal/os-less/AVR/osal.h index aed6ed513..79b40467b 100644 --- a/os/hal/osal/os-less/AVR/osal.h +++ b/os/hal/osal/os-less/AVR/osal.h @@ -609,8 +609,8 @@ static inline void osalSysRestoreStatusX(syssts_t sts) { /** * @brief Checks if the specified time is within the specified time window. - * @note When start==end then the function returns always true because the - * whole time range is specified. + * @note When start==end then the function returns always false because the + * time window has zero size. * @note This function can be called from any context. * * @param[in] time the time to be verified diff --git a/os/hal/templates/osal/osal.h b/os/hal/templates/osal/osal.h index 93e97f25f..5c38c21c4 100644 --- a/os/hal/templates/osal/osal.h +++ b/os/hal/templates/osal/osal.h @@ -623,8 +623,8 @@ static inline sysinterval_t osalTimeDiffX(systime_t start, systime_t end) { /** * @brief Checks if the specified time is within the specified time window. - * @note When start==end then the function returns always true because the - * whole time range is specified. + * @note When start==end then the function returns always false because the + * time window has zero size. * @note This function can be called from any context. * * @param[in] time the time to be verified @@ -639,8 +639,8 @@ static inline bool osalTimeIsInRangeX(systime_t time, systime_t start, systime_t end) { - return (bool)((systime_t)((systime_t)time - (systime_t)start) <= - (systime_t)((systime_t)end - (systime_t)start - (systime_t)1)); + return (bool)((systime_t)((systime_t)time - (systime_t)start) < + (systime_t)((systime_t)end - (systime_t)start)); } /** diff --git a/os/nil/include/ch.h b/os/nil/include/ch.h index a41c804e0..766bda006 100644 --- a/os/nil/include/ch.h +++ b/os/nil/include/ch.h @@ -1241,8 +1241,8 @@ struct nil_system { /** * @brief Checks if the current system time is within the specified time * window. - * @note When start==end then the function returns always true because the - * whole time range is specified. + * @note When start==end then the function returns always false because the + * time window has zero size. * * @param[in] start the start of the time window (inclusive) * @param[in] end the end of the time window (non inclusive) diff --git a/os/nil/src/ch.c b/os/nil/src/ch.c index e3a9c2c5a..47edce802 100644 --- a/os/nil/src/ch.c +++ b/os/nil/src/ch.c @@ -527,8 +527,8 @@ void chSysRestoreStatusX(syssts_t sts) { * @details This function verifies if the current realtime counter value * lies within the specified range or not. The test takes care * of the realtime counter wrapping to zero on overflow. - * @note When start==end then the function returns always true because the - * whole time range is specified. + * @note When start==end then the function returns always false because a + * null time range is specified. * @note This function is only available if the port layer supports the * option @p PORT_SUPPORTS_RT. * @@ -542,8 +542,8 @@ void chSysRestoreStatusX(syssts_t sts) { */ bool chSysIsCounterWithinX(rtcnt_t cnt, rtcnt_t start, rtcnt_t end) { - return (bool)(((rtcnt_t)cnt - (rtcnt_t)start) <= - ((rtcnt_t)end - (rtcnt_t)start - (rtcnt_t)1)); + return (bool)(((rtcnt_t)cnt - (rtcnt_t)start) < + ((rtcnt_t)end - (rtcnt_t)start)); } /** @@ -725,8 +725,8 @@ msg_t chSchGoSleepTimeoutS(tstate_t newstate, sysinterval_t timeout) { /** * @brief Checks if the specified time is within the specified time range. - * @note When start==end then the function returns always true because the - * whole time range is specified. + * @note When start==end then the function returns always false because the + * time window has zero size. * * @param[in] time the time to be verified * @param[in] start the start of the time window (inclusive) @@ -738,8 +738,8 @@ msg_t chSchGoSleepTimeoutS(tstate_t newstate, sysinterval_t timeout) { */ bool chTimeIsInRangeX(systime_t time, systime_t start, systime_t end) { - return (bool)((systime_t)((systime_t)(time) - (systime_t)(start)) <= - (systime_t)((systime_t)(end) - (systime_t)(start) - (systime_t)1)); + return (bool)((systime_t)((systime_t)(time) - (systime_t)(start)) < + (systime_t)((systime_t)(end) - (systime_t)(start))); } /** diff --git a/os/rt/include/chtime.h b/os/rt/include/chtime.h index f1034c57d..8964992d5 100644 --- a/os/rt/include/chtime.h +++ b/os/rt/include/chtime.h @@ -466,8 +466,8 @@ static inline sysinterval_t chTimeDiffX(systime_t start, systime_t end) { /** * @brief Checks if the specified time is within the specified time range. - * @note When start==end then the function returns always true because the - * whole time range is specified. + * @note When start==end then the function returns always false because the + * time window has zero size. * * @param[in] time the time to be verified * @param[in] start the start of the time window (inclusive) @@ -481,8 +481,8 @@ static inline bool chTimeIsInRangeX(systime_t time, systime_t start, systime_t end) { - return (bool)((systime_t)((systime_t)time - (systime_t)start) <= - (systime_t)((systime_t)end - (systime_t)start - (systime_t)1)); + return (bool)((systime_t)((systime_t)time - (systime_t)start) < + (systime_t)((systime_t)end - (systime_t)start)); } /** @} */ diff --git a/os/rt/src/chsys.c b/os/rt/src/chsys.c index aefa4cb9c..47c8fd283 100644 --- a/os/rt/src/chsys.c +++ b/os/rt/src/chsys.c @@ -403,8 +403,8 @@ void chSysRestoreStatusX(syssts_t sts) { * @details This function verifies if the current realtime counter value * lies within the specified range or not. The test takes care * of the realtime counter wrapping to zero on overflow. - * @note When start==end then the function returns always true because the - * whole time range is specified. + * @note When start==end then the function returns always false because a + * null time range is specified. * @note This function is only available if the port layer supports the * option @p PORT_SUPPORTS_RT. * @@ -418,8 +418,8 @@ void chSysRestoreStatusX(syssts_t sts) { */ bool chSysIsCounterWithinX(rtcnt_t cnt, rtcnt_t start, rtcnt_t end) { - return (bool)(((rtcnt_t)cnt - (rtcnt_t)start) <= - ((rtcnt_t)end - (rtcnt_t)start - (rtcnt_t)1)); + return (bool)(((rtcnt_t)cnt - (rtcnt_t)start) < + ((rtcnt_t)end - (rtcnt_t)start)); } /** diff --git a/readme.txt b/readme.txt index 0e9f1ec62..38716e6ed 100644 --- a/readme.txt +++ b/readme.txt @@ -145,8 +145,6 @@ - NIL: Integrated NIL 4.0. - FIX: Fixed I2C fallback driver broken (bug #1061) (backported to 19.1.4)(backported to 18.2.3). -- FIX: Fixed bug in chVTGetSystemTimeX() (bug #1060) - (backported to 19.1.4)(backported to 18.2.3). - FIX: Fixed STM32 ADC1 sample time macros (bug #1059) (backported to 19.1.4)(backported to 18.2.3). - FIX: Fixed STM32 ADCv1 error callback disabled on some devices (bug #1058)