17#ifndef KERNEL_DEVICES_TIMER_H
18#define KERNEL_DEVICES_TIMER_H
21#include <kernel/types.h>
24#define SEC_TO_TICKS(_time) SEC((_time) * TICKS_PER_SECOND)
25#define MS_TO_TICKS(_time) MS_TO_SEC(SEC_TO_TICKS(_time))
26#define US_TO_TICKS(_time) US_TO_SEC(SEC_TO_TICKS(_time))
27#define NS_TO_TICKS(_time) NS_TO_SEC(SEC_TO_TICKS(_time))
31#define TICKS_TO_SEC(_ticks) SEC((_ticks) / TICKS_PER_SECOND)
32#define TICKS_TO_MS(_ticks) MS(TICKS_TO_SEC(_ticks))
33#define TICKS_TO_US(_ticks) US(TICKS_TO_SEC(_ticks))
34#define TICKS_TO_NS(_ticks) NS(TICKS_TO_SEC(_ticks))
101 time->tv_nsec = ns %
NS(1);
118void timer_delay_ms(time_t);
void timer_wait_ms(time_t)
Wait a certain amount of miliseconds.
Definition: timer.c:12
#define TICKS_TO_MS(_ticks)
Convert a number of ticks into a regular time unit.
Definition: timer.h:32
static time_t timer_get_ms(void)
Definition: timer.h:74
volatile clock_t timer_ticks_counter
This is where we keep track of the number of intervals reported by the timer.
Definition: timer.c:27
void timer_start(u32 frequency)
Start the global timekeeping timer.
Definition: timer.c:39
static clock_t timer_gettick(void)
Definition: timer.h:57
static time_t timer_get_ns(void)
Definition: timer.h:86
static time_t timer_get_us(void)
Definition: timer.h:80
#define TICKS_TO_NS(_ticks)
Convert a number of ticks into a regular time unit.
Definition: timer.h:34
volatile u32 timer_kernel_frequency
Frequency of the global timekeeping timer.
Definition: timer.c:28
#define TICKS_TO_US(_ticks)
Convert a number of ticks into a regular time unit.
Definition: timer.h:33
static void clock_get_time(struct timespec *time)
Fill a timespec structure with the current time of the day.
Definition: timer.h:96
static bool timer_tick(void)
Increment the timekeeping timer's tick count.
Definition: timer.h:66
#define NS(_s)
Used for conversions from seconds to another time unit.
Definition: time.h:24
#define NS_TO_SEC(_s)
Used for conversions to seconds from another time unit.
Definition: time.h:31