Zephyr API Documentation  2.7.0-rc2
A Scalable Open Source RTOS
sys_clock.h File Reference

Variables needed for system clock. More...

#include <sys/util.h>
#include <sys/dlist.h>
#include <toolchain.h>
#include <zephyr/types.h>
#include <sys/time_units.h>

Go to the source code of this file.

Data Structures

struct  k_timeout_t
 Kernel timeout type. More...
 

Macros

#define K_TICKS_FOREVER   ((k_ticks_t) -1)
 
#define K_TIMEOUT_EQ(a, b)   ((a).ticks == (b).ticks)
 Compare timeouts for equality. More...
 
#define NSEC_PER_USEC   1000U
 
#define USEC_PER_MSEC   1000U
 
#define MSEC_PER_SEC   1000U
 
#define USEC_PER_SEC   ((USEC_PER_MSEC) * (MSEC_PER_SEC))
 
#define NSEC_PER_SEC   ((NSEC_PER_USEC) * (USEC_PER_MSEC) * (MSEC_PER_SEC))
 
#define SYS_CLOCK_HW_CYCLES_TO_NS_AVG(X, NCYCLES)    (uint32_t)(k_cyc_to_ns_floor64(X) / NCYCLES)
 

Typedefs

typedef uint32_t k_ticks_t
 Tick precision used in timeout APIs. More...
 

Functions

uint32_t sys_clock_tick_get_32 (void)
 Return the lower part of the current system tick count. More...
 
int64_t sys_clock_tick_get (void)
 Return the current system tick count. More...
 
uint64_t sys_clock_timeout_end_calc (k_timeout_t timeout)
 

Detailed Description

Variables needed for system clock.

Declare variables used by both system timer device driver and kernel components that use timer functionality.

Macro Definition Documentation

◆ MSEC_PER_SEC

#define MSEC_PER_SEC   1000U

◆ NSEC_PER_SEC

#define NSEC_PER_SEC   ((NSEC_PER_USEC) * (USEC_PER_MSEC) * (MSEC_PER_SEC))

◆ NSEC_PER_USEC

#define NSEC_PER_USEC   1000U

◆ SYS_CLOCK_HW_CYCLES_TO_NS_AVG

#define SYS_CLOCK_HW_CYCLES_TO_NS_AVG (   X,
  NCYCLES 
)     (uint32_t)(k_cyc_to_ns_floor64(X) / NCYCLES)

◆ USEC_PER_MSEC

#define USEC_PER_MSEC   1000U

◆ USEC_PER_SEC

#define USEC_PER_SEC   ((USEC_PER_MSEC) * (MSEC_PER_SEC))

Function Documentation

◆ sys_clock_tick_get()

int64_t sys_clock_tick_get ( void  )

Return the current system tick count.

Returns
the current system tick count

◆ sys_clock_tick_get_32()

uint32_t sys_clock_tick_get_32 ( void  )

Return the lower part of the current system tick count.

Returns
the current system tick count

◆ sys_clock_timeout_end_calc()

uint64_t sys_clock_timeout_end_calc ( k_timeout_t  timeout)