git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/kernel_3_dev@6174 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
parent
632d7d1985
commit
b4e2fca4a0
|
@ -190,6 +190,10 @@ typedef struct {
|
|||
/* Module macros. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @name Debug related macros
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @brief Condition assertion.
|
||||
* @details If the condition check fails then the OSAL panics with a
|
||||
|
@ -225,6 +229,7 @@ typedef struct {
|
|||
* @note Not implemented in this simplified OSAL.
|
||||
*/
|
||||
#define osalDbgCheckClassI() chDbgCheckClassI()
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @brief S-Class state check.
|
||||
|
@ -232,6 +237,10 @@ typedef struct {
|
|||
*/
|
||||
#define osalDbgCheckClassS() chDbgCheckClassS()
|
||||
|
||||
/**
|
||||
* @name IRQ service routines wrappers
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @brief IRQ prologue code.
|
||||
* @details This macro must be inserted at the start of all IRQ handlers.
|
||||
|
@ -251,6 +260,47 @@ typedef struct {
|
|||
* @param[in] id a vector name as defined in @p vectors.s
|
||||
*/
|
||||
#define OSAL_IRQ_HANDLER(id) CH_IRQ_HANDLER(id)
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name Time conversion utilities
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @brief Seconds to system ticks.
|
||||
* @details Converts from seconds to system ticks number.
|
||||
* @note The result is rounded upward to the next tick boundary.
|
||||
*
|
||||
* @param[in] sec number of seconds
|
||||
* @return The number of ticks.
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
#define OSAL_S2ST(sec) S2ST(sec)
|
||||
|
||||
/**
|
||||
* @brief Milliseconds to system ticks.
|
||||
* @details Converts from milliseconds to system ticks number.
|
||||
* @note The result is rounded upward to the next tick boundary.
|
||||
*
|
||||
* @param[in] msec number of milliseconds
|
||||
* @return The number of ticks.
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
#define OSAL_MS2ST(msec) MS2ST(msec)
|
||||
/**
|
||||
* @brief Microseconds to system ticks.
|
||||
* @details Converts from microseconds to system ticks number.
|
||||
* @note The result is rounded upward to the next tick boundary.
|
||||
*
|
||||
* @param[in] usec number of microseconds
|
||||
* @return The number of ticks.
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
#define OSAL_US2ST(usec) US2ST(usec)
|
||||
/** @} */
|
||||
|
||||
/*===========================================================================*/
|
||||
/* External declarations. */
|
||||
|
@ -375,6 +425,45 @@ static inline void osalOsRescheduleS(void) {
|
|||
chSchRescheduleS();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Current system time.
|
||||
* @details Returns the number of system ticks since the @p chSysInit()
|
||||
* invocation.
|
||||
* @note The counter can reach its maximum and then restart from zero.
|
||||
* @note This function can be called from any context but its atomicity
|
||||
* is not guaranteed on architectures whose word size is less than
|
||||
* @systime_t size.
|
||||
*
|
||||
* @return The system time in ticks.
|
||||
*
|
||||
* @xclass
|
||||
*/
|
||||
static inline systime_t osalOsGetSystemTimeX(void) {
|
||||
|
||||
return chVTGetSystemTimeX();
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 This function can be called from any context.
|
||||
*
|
||||
* @param[in] time the time to be verified
|
||||
* @param[in] start the start of the time window (inclusive)
|
||||
* @param[in] end the end of the time window (non inclusive)
|
||||
* @retval true current time within the specified time window.
|
||||
* @retval false current time not within the specified time window.
|
||||
*
|
||||
* @xclass
|
||||
*/
|
||||
static inline bool osalOsIsTimeWithinX(systime_t time,
|
||||
systime_t start,
|
||||
systime_t end) {
|
||||
|
||||
return chVTIsTimeWithinX(time, start, end);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Suspends the invoking thread for the specified time.
|
||||
*
|
||||
|
|
|
@ -114,7 +114,7 @@
|
|||
*
|
||||
* @api
|
||||
*/
|
||||
#define S2RTV(sec) (CH_CFG_RTC_FREQUENCY * (sec))
|
||||
#define S2RTC(sec) (CH_CFG_RTC_FREQUENCY * (sec))
|
||||
|
||||
/**
|
||||
* @brief Milliseconds to realtime counter.
|
||||
|
|
|
@ -71,8 +71,7 @@ void _vt_init(void) {
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief Checks if the current system time is within the specified time
|
||||
* window.
|
||||
* @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 This function can be called from any context.
|
||||
|
|
Loading…
Reference in New Issue