bsp_timer.c 1.2 KB

12345678910111213141516171819202122
  1. #include "bsp_timer.h"
  2. #include "xinc_m0.h"
  3. #define __write_hw_reg32(reg,val) ((*reg) = (val))
  4. #define __read_hw_reg32(reg, val) ((val) = (*reg))
  5. #define CPR_BASE 0x40000000
  6. #define TIMER_BASE 0x40003000
  7. /*----------------------------------------------------------------------------------------------------
  8. INCLUDE HEADE FILES
  9. ----------------------------------------------------------------------------------------------------*/
  10. #define CPR_CTLAPBCLKEN_GRCTL ((volatile unsigned *)(CPR_BASE + 0x070))
  11. #define CPR_LP_CTL ((volatile unsigned *)(CPR_BASE + 0x118))
  12. //- TIMER
  13. #define CPR_TIMER_CLK_CTL(a) ((volatile unsigned *)(CPR_BASE + 0x58 + (a * 0x04)))
  14. #define TIMERx_TLC(a) ((volatile unsigned *)(TIMER_BASE + 0x00 + (a * 0x14)))
  15. #define TIMERx_TCV(a) ((volatile unsigned *)(TIMER_BASE + 0x04 + (a * 0x14)))
  16. #define TIMERx_TCR(a) ((volatile unsigned *)(TIMER_BASE + 0x08 + (a * 0x14)))
  17. #define TIMERx_TIC(a) ((volatile unsigned *)(TIMER_BASE + 0x0C + (a * 0x14)))
  18. #define TIMERx_TIS(a) ((volatile unsigned *)(TIMER_BASE + 0x10 + (a * 0x14)))