doc: Add descriptions for clock-related helper macros

Also fixes up Kernel Primer examples to use these macros.

Change-Id: Ib1bc9e3f85ab75f81986bc3930fb287266a886b5
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
This commit is contained in:
Allan Stephens 2016-11-17 12:24:22 -05:00 committed by Anas Nashif
commit c2f15a4525
7 changed files with 107 additions and 31 deletions

View file

@ -88,8 +88,28 @@ extern int sys_clock_hw_cycles_per_tick;
#define SYS_CLOCK_HW_CYCLES_TO_NS_AVG(X, NCYCLES) \
(uint32_t)(SYS_CLOCK_HW_CYCLES_TO_NS64(X) / NCYCLES)
/**
* @defgroup clock_apis Kernel Clock APIs
* @ingroup kernel_apis
* @{
*/
/**
* @brief Compute nanoseconds from hardware clock cycles.
*
* This macro converts a time duration expressed in hardware clock cycles
* to the equivalent duration expressed in nanoseconds.
*
* @param X Duration in hardware clock cycles.
*
* @return Duration in nanoseconds.
*/
#define SYS_CLOCK_HW_CYCLES_TO_NS(X) (uint32_t)(SYS_CLOCK_HW_CYCLES_TO_NS64(X))
/**
* @} end defgroup clock_apis
*/
extern int64_t _sys_clock_tick_count;
/*