61 #ifndef _INCLUDE_CLOCK_H 64 #define _INCLUDE_CLOCK_H 70 #include <tinyara/config.h> 74 #include <tinyara/compiler.h> 95 #undef __HAVE_KERNEL_GLOBALS 96 #if defined(CONFIG_SCHED_TICKLESS) 99 #elif defined(CONFIG_BUILD_PROTECTED) && defined(__KERNEL__) 102 #define __HAVE_KERNEL_GLOBALS 1 104 #elif defined(CONFIG_BUILD_KERNEL) && defined(__KERNEL__) 107 #define __HAVE_KERNEL_GLOBALS 1 109 #elif defined(CONFIG_LIB_SYSCALL) 115 #define __HAVE_KERNEL_GLOBALS 1 122 #ifndef CONFIG_HAVE_LONG_LONG 123 #undef CONFIG_SYSTEM_TIME64 128 #define NSEC_PER_SEC 1000000000 129 #define USEC_PER_SEC 1000000 130 #define MSEC_PER_SEC 1000 131 #define DSEC_PER_SEC 10 132 #define NSEC_PER_DSEC 100000000 133 #define USEC_PER_DSEC 100000 134 #define MSEC_PER_DSEC 100 135 #define NSEC_PER_MSEC 1000000 136 #define USEC_PER_MSEC 1000 137 #define NSEC_PER_USEC 1000 153 #ifdef CONFIG_USEC_PER_TICK 154 #define USEC_PER_TICK (CONFIG_USEC_PER_TICK) 156 #define USEC_PER_TICK (10000) 164 #define TICK_PER_DSEC (USEC_PER_DSEC / USEC_PER_TICK) 165 #define TICK_PER_SEC (USEC_PER_SEC / USEC_PER_TICK) 166 #define TICK_PER_MSEC (USEC_PER_MSEC / USEC_PER_TICK) 167 #define MSEC_PER_TICK (USEC_PER_TICK / USEC_PER_MSEC) 168 #define NSEC_PER_TICK (USEC_PER_TICK * NSEC_PER_USEC) 170 #define NSEC2TICK(nsec) (((nsec)+(NSEC_PER_TICK/2))/NSEC_PER_TICK) 171 #define USEC2TICK(usec) (((usec)+(USEC_PER_TICK/2))/USEC_PER_TICK) 173 #if (MSEC_PER_TICK * USEC_PER_MSEC) == USEC_PER_TICK 174 #define MSEC2TICK(msec) (((msec)+(MSEC_PER_TICK/2))/MSEC_PER_TICK) 176 #define MSEC2TICK(msec) USEC2TICK((msec) * USEC_PER_MSEC) 179 #define DSEC2TICK(dsec) MSEC2TICK((dsec) * MSEC_PER_DSEC) 180 #define SEC2TICK(sec) MSEC2TICK((sec) * MSEC_PER_SEC) 182 #define TICK2NSEC(tick) ((tick) * NSEC_PER_TICK) 183 #define TICK2USEC(tick) ((tick) * USEC_PER_TICK) 185 #if (MSEC_PER_TICK * USEC_PER_MSEC) == USEC_PER_TICK 186 #define TICK2MSEC(tick) ((tick)*MSEC_PER_TICK) 188 #define TICK2MSEC(tick) (((tick)*USEC_PER_TICK)/USEC_PER_MSEC) 191 #define TICK2DSEC(tick) (((tick)+(TICK_PER_DSEC/2))/TICK_PER_DSEC) 192 #define TICK2SEC(tick) (((tick)+(TICK_PER_SEC/2))/TICK_PER_SEC) 199 #ifdef CONFIG_SCHED_CPULOAD 201 volatile uint32_t total;
202 volatile uint32_t active;
208 #ifdef CONFIG_SYSTEM_TIME64 219 #define EXTERN extern "C" 222 #define EXTERN extern 232 #ifdef __HAVE_KERNEL_GLOBALS 235 #ifndef CONFIG_SYSTEM_TIME64 236 #define clock_systimer() g_system_timer 277 void clock_synchronize(
void);
305 #if !defined(__HAVE_KERNEL_GLOBALS) || defined(CONFIG_SYSTEM_TIME64) 337 int clock_systimespec(FAR
struct timespec *ts);
361 #ifdef CONFIG_SCHED_CPULOAD 366 int clock_cpuload(
int pid, FAR
struct cpuload_s *cpuload);
EXTERN volatile systime_t g_system_timer
structure represents an elapsed time