X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;ds=sidebyside;f=bertos%2Fcpu%2Fcortex-m3%2Fdrv%2Ftimer_lm3s.h;h=3d7c979fcd3a052834833d1eb8f3e6e543f9ed2d;hb=77958b8e9d27594aa22e76132b4bbb8d0335bfc2;hp=53fdd02ffa68f1b82bdfa3ac8a4feb10e35b51ac;hpb=73a7e9cb144007905b5b9de8e3086423e79b6d71;p=bertos.git diff --git a/bertos/cpu/cortex-m3/drv/timer_lm3s.h b/bertos/cpu/cortex-m3/drv/timer_lm3s.h index 53fdd02f..3d7c979f 100644 --- a/bertos/cpu/cortex-m3/drv/timer_lm3s.h +++ b/bertos/cpu/cortex-m3/drv/timer_lm3s.h @@ -38,6 +38,39 @@ #ifndef DRV_CORTEX_M3_TIMER_H #define DRV_CORTEX_M3_TIMER_H +#include + +/* Ticks frequency (HZ) */ +#define TIMER_TICKS_PER_SEC 1000 + +/* Frequency of the hardware high-precision timer. */ +#define TIMER_HW_HPTICKS_PER_SEC (CPU_FREQ) + +/* Maximum value of the high-precision hardware counter register */ +#define TIMER_HW_CNT (CPU_FREQ / TIMER_TICKS_PER_SEC) + +/** Type of time expressed in ticks of the hardware high-precision timer */ +typedef uint32_t hptime_t; +#define SIZEOF_HPTIME_T 4 + +/* Timer ISR prototype */ +ISR_PROTO_CONTEXT_SWITCH(timer_handler); +#define DEFINE_TIMER_ISR DECLARE_ISR_CONTEXT_SWITCH(timer_handler) + +INLINE void timer_hw_irq(void) +{ +} + +INLINE bool timer_hw_triggered(void) +{ + return true; +} + +INLINE hptime_t timer_hw_hpread(void) +{ + return HWREG(NVIC_ST_CURRENT); +} + void timer_hw_init(void); void timer_hw_exit(void);