diff options
author | Egor Ananyin <ananinegor@gmail.com> | 2020-06-24 20:19:35 +0300 |
---|---|---|
committer | Egor Ananyin <ananinegor@gmail.com> | 2020-06-24 20:19:35 +0300 |
commit | ea1fc9a0c36fea36cc5eced2316b321735ed1aa5 (patch) | |
tree | 1f66b69d27f626151c57b852a9cc649eaf13c56d /arm7/lib/include | |
parent | ce09e79eb9ca2b384fb1c64f0946661b30ae75ea (diff) |
OS_tick done
Diffstat (limited to 'arm7/lib/include')
-rw-r--r-- | arm7/lib/include/OS_tick.h | 11 | ||||
-rw-r--r-- | arm7/lib/include/OS_timer.h | 32 |
2 files changed, 43 insertions, 0 deletions
diff --git a/arm7/lib/include/OS_tick.h b/arm7/lib/include/OS_tick.h new file mode 100644 index 00000000..892e0499 --- /dev/null +++ b/arm7/lib/include/OS_tick.h @@ -0,0 +1,11 @@ +#ifndef POKEDIAMOND_OS_TICK_H +#define POKEDIAMOND_OS_TICK_H + +#include "OS_timer.h" + +void OS_InitTick(void); +u16 OS_IsTickAvailable(void); +void OSi_CountUpTick(void); +u64 OS_GetTick(void); + +#endif diff --git a/arm7/lib/include/OS_timer.h b/arm7/lib/include/OS_timer.h new file mode 100644 index 00000000..697842fe --- /dev/null +++ b/arm7/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
\ No newline at end of file |