blob: b41aa35b1d77ce9c921ec71387061eee21af0c16 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
#pragma once
#include <stdint.h>
#define TIMER_MILLISECOND 1000ULL
#define TIMER_MICROSECOND 1000000ULL
#define TIMER_NANOSECOND 1000000000ULL
typedef int (*timer_callback)(uint64_t nanoseconds);
struct timer_callback_list
{
timer_callback func;
struct timer_callback_list *next;
};
struct timer_source
{
const char *name;
void (*init)(void);
void (*start)(void);
void (*stop)(void);
void (*set_frequency)(uint32_t frequency);
uint32_t (*get_frequency)(void);
int (*append_callback)(timer_callback func);
void (*delete_callback)(timer_callback func);
uint64_t (*nanoseconds_elapsed)(void);
uint64_t (*nanoseconds_delta)(void);
};
|