46#define TIME_IMMEDIATE ((sysinterval_t)0)
54#define TIME_INFINITE ((sysinterval_t)-1)
59#define TIME_MAX_INTERVAL ((sysinterval_t)-2)
64#define TIME_MAX_SYSTIME ((systime_t)-1)
75#if (CH_CFG_ST_RESOLUTION != 16) && (CH_CFG_ST_RESOLUTION != 32) && \
76 (CH_CFG_ST_RESOLUTION != 64)
77#error "invalid CH_CFG_ST_RESOLUTION specified, must be 16, 32 or 64"
80#if CH_CFG_ST_FREQUENCY < 10
81#error "invalid CH_CFG_ST_FREQUENCY specified, must be >= 10"
84#if (CH_CFG_INTERVALS_SIZE != 16) && (CH_CFG_INTERVALS_SIZE != 32) && \
85 (CH_CFG_INTERVALS_SIZE != 64)
86#error "invalid CH_CFG_INTERVALS_SIZE specified, must be 16, 32 or 64"
89#if (CH_CFG_TIME_TYPES_SIZE != 16) && (CH_CFG_TIME_TYPES_SIZE != 32)
90#error "invalid CH_CFG_TIME_TYPES_SIZE specified, must be 16 or 32"
93#if CH_CFG_INTERVALS_SIZE < CH_CFG_ST_RESOLUTION
94#error "CH_CFG_INTERVALS_SIZE must be >= CH_CFG_ST_RESOLUTION"
105#if (CH_CFG_ST_RESOLUTION == 64) || defined(__DOXYGEN__)
107#elif CH_CFG_ST_RESOLUTION == 32
109#elif CH_CFG_ST_RESOLUTION == 16
117#if (CH_CFG_INTERVALS_SIZE == 64) || defined(__DOXYGEN__)
119#elif CH_CFG_INTERVALS_SIZE == 32
121#elif CH_CFG_INTERVALS_SIZE == 16
130#if (CH_CFG_TIME_TYPES_SIZE == 32) || defined(__DOXYGEN__)
184#define TIME_S2I(secs) \
185 ((sysinterval_t)((time_conv_t)(secs) * (time_conv_t)CH_CFG_ST_FREQUENCY))
200#define TIME_MS2I(msecs) \
201 ((sysinterval_t)((((time_conv_t)(msecs) * \
202 (time_conv_t)CH_CFG_ST_FREQUENCY) + \
203 (time_conv_t)999) / (time_conv_t)1000))
218#define TIME_US2I(usecs) \
219 ((sysinterval_t)((((time_conv_t)(usecs) * \
220 (time_conv_t)CH_CFG_ST_FREQUENCY) + \
221 (time_conv_t)999999) / (time_conv_t)1000000))
236#define TIME_I2S(interval) \
237 (time_secs_t)(((time_conv_t)(interval) + \
238 (time_conv_t)CH_CFG_ST_FREQUENCY - \
239 (time_conv_t)1) / (time_conv_t)CH_CFG_ST_FREQUENCY)
254#define TIME_I2MS(interval) \
255 (time_msecs_t)((((time_conv_t)(interval) * (time_conv_t)1000) + \
256 (time_conv_t)CH_CFG_ST_FREQUENCY - (time_conv_t)1) / \
257 (time_conv_t)CH_CFG_ST_FREQUENCY)
272#define TIME_I2US(interval) \
273 (time_usecs_t)((((time_conv_t)(interval) * (time_conv_t)1000000) + \
274 (time_conv_t)CH_CFG_ST_FREQUENCY - (time_conv_t)1) / \
275 (time_conv_t)CH_CFG_ST_FREQUENCY)
314 "conversion overflow");
336 "conversion overflow");
358 "conversion overflow");
381 "conversion overflow");
404 "conversion overflow");
427 "conversion overflow");
444#if CH_CFG_ST_RESOLUTION != CH_CFG_INTERVALS_SIZE
526 "conversion overflow");
#define chDbgAssert(c, r)
Condition assertion.
#define chDbgCheck(c)
Function parameters check.
#define CH_CFG_ST_FREQUENCY
System tick frequency.
static sysinterval_t chTimeUS2I(time_usecs_t usec)
Microseconds to time interval.
static systimestamp_t chTimeStampAddX(systimestamp_t stamp, sysinterval_t interval)
Adds an interval to a time stamp returning a time stamp.
uint32_t time_secs_t
Type of seconds.
static sysinterval_t chTimeDiffX(systime_t start, systime_t end)
Subtracts two system times returning an interval.
static systime_t chTimeAddX(systime_t systime, sysinterval_t interval)
Adds an interval to a system time returning a system time.
static time_secs_t chTimeI2S(sysinterval_t interval)
Time interval to seconds.
static sysinterval_t chTimeS2I(time_secs_t secs)
Seconds to time interval.
uint64_t systime_t
Type of system time.
static sysinterval_t chTimeStampDiffX(systimestamp_t start, systimestamp_t end)
Subtracts two time stamps 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.
#define TIME_MAX_INTERVAL
Maximum interval constant usable as timeout.
uint64_t time_conv_t
Type of time conversion variable.
static time_msecs_t chTimeI2MS(sysinterval_t interval)
Time interval to milliseconds.
uint32_t time_usecs_t
Type of microseconds.
uint64_t sysinterval_t
Type of time interval.
static sysinterval_t chTimeMS2I(time_msecs_t msec)
Milliseconds to time interval.
static time_usecs_t chTimeI2US(sysinterval_t interval)
Time interval to microseconds.
uint64_t systimestamp_t
Type of a time stamp.
static bool chTimeStampIsInRangeX(systimestamp_t stamp, systimestamp_t start, systimestamp_t end)
Checks if the specified time stamp is within the specified time stamps range.
uint32_t time_msecs_t
Type of milliseconds.