diff options
author | red031000 <rubenru09@aol.com> | 2020-06-13 17:59:30 +0100 |
---|---|---|
committer | red031000 <rubenru09@aol.com> | 2020-06-13 18:00:14 +0100 |
commit | 339366f19680e505d5ff9763375f0fc159b5baed (patch) | |
tree | 8793acb7d216df9adba3b87aed39b54f177b7b9a /arm9/lib/include/OS_timer.h | |
parent | c4263506fa96acc210d1cf356023a3ffde805a0b (diff) |
arm9 OS_tick
Diffstat (limited to 'arm9/lib/include/OS_timer.h')
-rw-r--r-- | arm9/lib/include/OS_timer.h | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/arm9/lib/include/OS_timer.h b/arm9/lib/include/OS_timer.h new file mode 100644 index 00000000..8b2a97a9 --- /dev/null +++ b/arm9/lib/include/OS_timer.h @@ -0,0 +1,32 @@ +#ifndef POKEDIAMOND_OS_TIMER_H +#define POKEDIAMOND_OS_TIMER_H + +#include "consts.h" + +typedef enum +{ + OS_TIMER_PRESCALER_1 = (0UL << REG_OS_TM0CNT_H_PS_SHIFT), + OS_TIMER_PRESCALER_64 = (1UL << REG_OS_TM0CNT_H_PS_SHIFT), + OS_TIMER_PRESCALER_256 = (2UL << REG_OS_TM0CNT_H_PS_SHIFT), + OS_TIMER_PRESCALER_1024 = (3UL << REG_OS_TM0CNT_H_PS_SHIFT) +} OSTimerPrescaler; + +typedef enum +{ + OS_TIMER_0 = 0, + OS_TIMER_1 = 1, + OS_TIMER_2 = 2, + OS_TIMER_3 = 3 +} OSTimer; + +static inline void OS_SetTimerCount(OSTimer id, u16 count) +{ + *((REGType16 *)((u32)®_OS_TM0CNT_L + id * 4)) = count; +} + +static inline void OS_SetTimerControl(OSTimer id, u16 control) +{ + *((REGType16 *)((u32)®_OS_TM0CNT_H + id * 4)) = control; +} + +#endif //POKEDIAMOND_OS_TIMER_H |