summaryrefslogtreecommitdiff
path: root/fw/fe310/eos/soc/timer.h
blob: 6e7750259f315b4c822d1641ef362e0639a7aa4b (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
#include <stdint.h>

#define EOS_TIMER_ETYPE_UI      1
#define EOS_TIMER_ETYPE_EVE     2
#define EOS_TIMER_ETYPE_ECP     3
#define EOS_TIMER_ETYPE_USR     4

#define EOS_TIMER_MAX_ETYPE     8

#define EOS_TIMER_NONE          -1
#define EOS_TIMER_RTC_FREQ      32768

typedef void (*eos_timer_handler_t) (unsigned char);

int eos_timer_init(uint8_t wakeup_cause);
void eos_timer_set_handler(unsigned char evt, eos_timer_handler_t handler);

uint32_t eos_timer_get(unsigned char evt);
void eos_timer_set(unsigned char evt, uint32_t msec);
void eos_timer_clear(unsigned char evt);

void eos_time_sleep(uint32_t msec);
uint64_t eos_time_get_tick(void);
uint32_t eos_time_delta_ms(uint32_t tick);