47 #define TIME_IMMEDIATE ((sysinterval_t)0) 55 #define TIME_INFINITE ((sysinterval_t)-1) 60 #define TIME_MAX_INTERVAL ((sysinterval_t)-2) 65 #define TIME_MAX_SYSTIME ((systime_t)-1) 76 #if (CH_CFG_ST_RESOLUTION != 16) && (CH_CFG_ST_RESOLUTION != 32) && \ 77 (CH_CFG_ST_RESOLUTION != 64) 78 #error "invalid CH_CFG_ST_RESOLUTION specified, must be 16, 32 or 64" 81 #if CH_CFG_ST_FREQUENCY < 10 82 #error "invalid CH_CFG_ST_FREQUENCY specified, must be >= 10" 85 #if (CH_CFG_INTERVALS_SIZE != 16) && (CH_CFG_INTERVALS_SIZE != 32) && \ 86 (CH_CFG_INTERVALS_SIZE != 64) 87 #error "invalid CH_CFG_INTERVALS_SIZE specified, must be 16, 32 or 64" 90 #if (CH_CFG_TIME_TYPES_SIZE != 16) && (CH_CFG_TIME_TYPES_SIZE != 32) 91 #error "invalid CH_CFG_TIME_TYPES_SIZE specified, must be 16 or 32" 94 #if CH_CFG_INTERVALS_SIZE < CH_CFG_ST_RESOLUTION 95 #error "CH_CFG_INTERVALS_SIZE must be >= CH_CFG_ST_RESOLUTION" 106 #if (CH_CFG_ST_RESOLUTION == 64) || defined(__DOXYGEN__) 108 #elif CH_CFG_ST_RESOLUTION == 32 110 #elif CH_CFG_ST_RESOLUTION == 16 118 #if (CH_CFG_INTERVALS_SIZE == 64) || defined(__DOXYGEN__) 120 #elif CH_CFG_INTERVALS_SIZE == 32 122 #elif CH_CFG_INTERVALS_SIZE == 16 126 #if (CH_CFG_TIME_TYPES_SIZE == 32) || defined(__DOXYGEN__) 180 #define TIME_S2I(secs) \ 181 ((sysinterval_t)((time_conv_t)(secs) * (time_conv_t)CH_CFG_ST_FREQUENCY)) 196 #define TIME_MS2I(msecs) \ 197 ((sysinterval_t)((((time_conv_t)(msecs) * \ 198 (time_conv_t)CH_CFG_ST_FREQUENCY) + \ 199 (time_conv_t)999) / (time_conv_t)1000)) 214 #define TIME_US2I(usecs) \ 215 ((sysinterval_t)((((time_conv_t)(usecs) * \ 216 (time_conv_t)CH_CFG_ST_FREQUENCY) + \ 217 (time_conv_t)999999) / (time_conv_t)1000000)) 232 #define TIME_I2S(interval) \ 233 (time_secs_t)(((time_conv_t)(interval) + \ 234 (time_conv_t)CH_CFG_ST_FREQUENCY - \ 235 (time_conv_t)1) / (time_conv_t)CH_CFG_ST_FREQUENCY) 250 #define TIME_I2MS(interval) \ 251 (time_msecs_t)((((time_conv_t)(interval) * (time_conv_t)1000) + \ 252 (time_conv_t)CH_CFG_ST_FREQUENCY - (time_conv_t)1) / \ 253 (time_conv_t)CH_CFG_ST_FREQUENCY) 268 #define TIME_I2US(interval) \ 269 (time_msecs_t)((((time_conv_t)(interval) * (time_conv_t)1000000) + \ 270 (time_conv_t)CH_CFG_ST_FREQUENCY - (time_conv_t)1) / \ 271 (time_conv_t)CH_CFG_ST_FREQUENCY) 313 "conversion overflow");
335 "conversion overflow");
357 "conversion overflow");
380 "conversion overflow");
403 "conversion overflow");
426 "conversion overflow");
443 #if CH_CFG_ST_RESOLUTION != CH_CFG_INTERVALS_SIZE uint64_t systime_t
Type of system time.
uint32_t time_secs_t
Type of seconds.
uint64_t sysinterval_t
Type of time interval.
static sysinterval_t chTimeS2I(time_secs_t secs)
Seconds to time interval.
static sysinterval_t chTimeDiffX(systime_t start, systime_t end)
Subtracts two system times returning an interval.
static bool chTimeIsInRangeX(systime_t time, systime_t start, systime_t end)
Checks if the specified time is within the specified time range.
#define TIME_MAX_SYSTIME
Maximum system of system time before it wraps.
static sysinterval_t chTimeUS2I(time_usecs_t usec)
Microseconds to time interval.
uint64_t time_conv_t
Type of time conversion variable.
#define chDbgCheck(c)
Function parameters check.
static time_usecs_t chTimeI2US(sysinterval_t interval)
Time interval to microseconds.
static time_msecs_t chTimeI2MS(sysinterval_t interval)
Time interval to milliseconds.
uint32_t time_usecs_t
Type of microseconds.
uint32_t time_msecs_t
Type of milliseconds.
static sysinterval_t chTimeMS2I(time_msecs_t msec)
Milliseconds to time interval.
static time_secs_t chTimeI2S(sysinterval_t interval)
Time interval to seconds.
#define chDbgAssert(c, r)
Condition assertion.
static systime_t chTimeAddX(systime_t systime, sysinterval_t interval)
Adds an interval to a system time returning a system time.
#define CH_CFG_ST_FREQUENCY
System tick frequency.
#define TIME_MAX_INTERVAL
Maximum interval constant usable as timeout.