diff options
Diffstat (limited to 'os/kernel/include/vt.h')
-rw-r--r-- | os/kernel/include/vt.h | 83 |
1 files changed, 52 insertions, 31 deletions
diff --git a/os/kernel/include/vt.h b/os/kernel/include/vt.h index 455545cc6..23396e594 100644 --- a/os/kernel/include/vt.h +++ b/os/kernel/include/vt.h @@ -18,8 +18,9 @@ */
/**
- * @file vt.h
- * @brief Time macros and structures.
+ * @file vt.h
+ * @brief Time macros and structures.
+ *
* @addtogroup time
* @{
*/
@@ -28,58 +29,73 @@ #define _VT_H_
/**
- * Time conversion utility. Converts from seconds to system ticks number.
+ * @brief Time conversion utility.
+ * @details Converts from seconds to system ticks number.
+ * @note The result is rounded upward to the next tick boundary.
*/
#define S2ST(sec) ((systime_t)((sec) * CH_FREQUENCY))
/**
- * Time conversion utility. Converts from milliseconds to system ticks number.
- * @note The result is rounded upward to the next tick boundary.
+ * @brief Time conversion utility.
+ * @details Converts from milliseconds to system ticks number.
+ * @note The result is rounded upward to the next tick boundary.
*/
#define MS2ST(msec) ((systime_t)(((((msec) - 1L) * CH_FREQUENCY) / 1000L) + 1L))
/**
- * Time conversion utility. Converts from microseconds to system ticks number.
- * @note The result is rounded upward to the next tick boundary.
+ * @brief Time conversion utility.
+ * @details Converts from microseconds to system ticks number.
+ * @note The result is rounded upward to the next tick boundary.
*/
#define US2ST(usec) ((systime_t)(((((usec) - 1L) * CH_FREQUENCY) / 1000000L) + 1L))
-/** Virtual Timer callback function.*/
+/**
+ * @brief Virtual Timer callback function.
+ */
typedef void (*vtfunc_t)(void *);
+/**
+ * @brief Virtual Timer structure type. + */
typedef struct VirtualTimer VirtualTimer;
/**
- * @brief Virtual Timer descriptor structure.
* @extends DeltaList
+ *
+ * @brief Virtual Timer descriptor structure.
*/
struct VirtualTimer {
- VirtualTimer *vt_next; /**< Next timer in the delta list.*/
- VirtualTimer *vt_prev; /**< Previous timer in the delta list.*/
- systime_t vt_time; /**< Time delta before timeout.*/
- vtfunc_t vt_func; /**< Timer callback function pointer.
- The pointer is reset to zero after
- the callback is invoked.*/
- void *vt_par; /**< Timer callback function
- parameter.*/
+ VirtualTimer *vt_next; /**< @brief Next timer in the delta
+ list. */
+ VirtualTimer *vt_prev; /**< @brief Previous timer in the delta
+ list. */
+ systime_t vt_time; /**< @brief Time delta before timeout. */
+ vtfunc_t vt_func; /**< @brief Timer callback function
+ pointer. */
+ void *vt_par; /**< @brief Timer callback function
+ parameter. */
};
/**
- * @brief Virtual timers list header.
- * @note The delta list is implemented as a double link bidirectional list in
- * order to make the unlink time constant, the reset of a virtual timer
- * is often used in the code.
+ * @brief Virtual timers list header.
+ * @note The delta list is implemented as a double link bidirectional list
+ * in order to make the unlink time constant, the reset of a virtual
+ * timer is often used in the code.
*/
typedef struct {
- VirtualTimer *vt_next; /**< Next timer in the delta list (the
- one that will be triggered next).*/
- VirtualTimer *vt_prev; /**< Last timer in the delta list.*/
- systime_t vt_time; /**< Must be initialized to -1.*/
- volatile systime_t vt_systime; /**< System Time counter.*/
+ VirtualTimer *vt_next; /**< @brief Next timer in the delta
+ list. */
+ VirtualTimer *vt_prev; /**< @brief Last timer in the delta
+ list. */
+ systime_t vt_time; /**< @brief Must be initialized to -1. */
+ volatile systime_t vt_systime; /**< @brief System Time counter. */
} VTList;
extern VTList vtlist;
+/**
+ * @brief Virtual timers sticker. + */
#define chVTDoTickI() { \
vtlist.vt_systime++; \
if (&vtlist != (VTList *)vtlist.vt_next) { \
@@ -110,14 +126,19 @@ extern "C" { }
#endif
-/** Returns TRUE if the speciified timer is armed.*/
+/**
+ * @brief Returns TRUE if the speciified timer is armed.
+ */
#define chVTIsArmedI(vtp) ((vtp)->vt_func != NULL)
/**
- * Returns the number of system ticks since the @p chSysInit() invocation.
- * @return the system ticks number
- * @note The counter can reach its maximum and then returns to zero.
- * @note This function is designed to work with the @p chThdSleepUntil().
+ * @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 is designed to work with the @p chThdSleepUntil().
+ *
+ * @return The system time in ticks.r
*/
#define chTimeNow() (vtlist.vt_systime)
|