mt_timer.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. /*
  2. * Copyright (c) 2020-2022, MediaTek Inc. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #ifndef MT_TIMER_H
  7. #define MT_TIMER_H
  8. #define SYSTIMER_BASE (0x10017000)
  9. #define CNTCR_REG (SYSTIMER_BASE + 0x0)
  10. #define CNTSR_REG (SYSTIMER_BASE + 0x4)
  11. #define CNTSYS_L_REG (SYSTIMER_BASE + 0x8)
  12. #define CNTSYS_H_REG (SYSTIMER_BASE + 0xc)
  13. #define CNTWACR_REG (SYSTIMER_BASE + 0x10)
  14. #define CNTRACR_REG (SYSTIMER_BASE + 0x14)
  15. #define TIEO_EN (1 << 3)
  16. #define COMP_15_EN (1 << 10)
  17. #define COMP_20_EN (1 << 11)
  18. #define COMP_25_EN (1 << 12)
  19. #define COMP_FEATURE_MASK (COMP_15_EN | COMP_20_EN | COMP_25_EN | TIEO_EN)
  20. #define COMP_15_MASK (COMP_15_EN)
  21. #define COMP_20_MASK (COMP_20_EN | TIEO_EN)
  22. #define COMP_25_MASK (COMP_20_EN | COMP_25_EN)
  23. #define CNT_WRITE_ACCESS_CTL_MASK (0x3FFFFF0U)
  24. #define CNT_READ_ACCESS_CTL_MASK (0x3FFFFFFU)
  25. void sched_clock_init(uint64_t normal_base, uint64_t atf_base);
  26. uint64_t sched_clock(void);
  27. int mt_systimer_init(void);
  28. #endif /* MT_TIMER_H */