soc_timer.h 794 B

12345678910111213141516171819202122232425262728293031323334353637
  1. /*
  2. * Copyright (c) 2019 Actions Semiconductor Co., Ltd
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. /**
  7. * @file timer for Actions SoC
  8. */
  9. #ifndef SOC_TIMER_H_
  10. #define SOC_TIMER_H_
  11. #define T0_CTL_EN 5
  12. #define T0_CTL_RELO 2
  13. #define T0_CTL_ZIEN 1
  14. #define T0_CTL_ZIPD 0
  15. #define TIMER_MAX_CYCLES_VALUE 0xfffffffful
  16. typedef struct {
  17. volatile uint32_t ctl;
  18. volatile uint32_t val;
  19. volatile uint32_t cnt;
  20. } timer_register_t;
  21. static inline void timer_reg_wait(void)
  22. {
  23. volatile int i;
  24. for (i = 0; i < 10; i++)
  25. ;
  26. }
  27. #endif /* SOC_TIMER_H_ */