timer_ap.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. /* Copyright (C) 2018 RDA Technologies Limited and/or its affiliates("RDA").
  2. * All rights reserved.
  3. *
  4. * This software is supplied "AS IS" without any warranties.
  5. * RDA assumes no responsibility or liability for the use of the software,
  6. * conveys no license or title under any patent, copyright, or mask work
  7. * right to the product. RDA reserves the right to make changes in the
  8. * software without notification. RDA also make no representation or
  9. * warranty that such application will be suitable for the specified use
  10. * without further testing or modification.
  11. */
  12. #ifndef _TIMER_AP_H_
  13. #define _TIMER_AP_H_
  14. // Auto generated by dtools(see dtools.txt for its version).
  15. // Don't edit it manually!
  16. #define REG_TIMER2_BASE (0x04806000)
  17. #define REG_TIMER4_BASE (0x14007000)
  18. #define REG_TIMER5_BASE (0x04806800)
  19. typedef volatile struct
  20. {
  21. uint32_t ostimer_loadval_l; // 0x00000000
  22. uint32_t ostimer_ctrl; // 0x00000004
  23. uint32_t ostimer_curval_l; // 0x00000008
  24. uint32_t ostimer_curval_h; // 0x0000000c
  25. uint32_t ostimer_lockval_l; // 0x00000010
  26. uint32_t ostimer_lockval_h; // 0x00000014
  27. uint32_t hwtimer_ctrl; // 0x00000018
  28. uint32_t hwtimer_curval_l; // 0x0000001c
  29. uint32_t hwtimer_curval_h; // 0x00000020
  30. uint32_t hwtimer_lockval_l; // 0x00000024
  31. uint32_t hwtimer_lockval_h; // 0x00000028
  32. uint32_t timer_irq_mask_set; // 0x0000002c
  33. uint32_t timer_irq_mask_clr; // 0x00000030
  34. uint32_t timer_irq_clr; // 0x00000034
  35. uint32_t timer_irq_cause; // 0x00000038
  36. } HWP_TIMER_AP_T;
  37. #define hwp_timer2 ((HWP_TIMER_AP_T *)REG_ACCESS_ADDRESS(REG_TIMER2_BASE))
  38. #define hwp_timer4 ((HWP_TIMER_AP_T *)REG_ACCESS_ADDRESS(REG_TIMER4_BASE))
  39. #define hwp_timer5 ((HWP_TIMER_AP_T *)REG_ACCESS_ADDRESS(REG_TIMER5_BASE))
  40. // ostimer_ctrl
  41. typedef union {
  42. uint32_t v;
  43. struct
  44. {
  45. uint32_t loadval_h : 24; // [23:0]
  46. uint32_t enable : 1; // [24]
  47. uint32_t enabled : 1; // [25], read only
  48. uint32_t cleared : 1; // [26], read only
  49. uint32_t __27_27 : 1; // [27]
  50. uint32_t repeat : 1; // [28]
  51. uint32_t wrap : 1; // [29]
  52. uint32_t load : 1; // [30]
  53. uint32_t __31_31 : 1; // [31]
  54. } b;
  55. } REG_TIMER_AP_OSTIMER_CTRL_T;
  56. // hwtimer_ctrl
  57. typedef union {
  58. uint32_t v;
  59. struct
  60. {
  61. uint32_t interval : 2; // [1:0]
  62. uint32_t __7_2 : 6; // [7:2]
  63. uint32_t interval_en : 1; // [8]
  64. uint32_t __31_9 : 23; // [31:9]
  65. } b;
  66. } REG_TIMER_AP_HWTIMER_CTRL_T;
  67. // timer_irq_mask_set
  68. typedef union {
  69. uint32_t v;
  70. struct
  71. {
  72. uint32_t ostimer_mask : 1; // [0], write set
  73. uint32_t hwtimer_wrap_mask : 1; // [1], write set
  74. uint32_t hwtimer_itv_mask : 1; // [2], write set
  75. uint32_t __31_3 : 29; // [31:3]
  76. } b;
  77. } REG_TIMER_AP_TIMER_IRQ_MASK_SET_T;
  78. // timer_irq_mask_clr
  79. typedef union {
  80. uint32_t v;
  81. struct
  82. {
  83. uint32_t ostimer_mask : 1; // [0], write clear
  84. uint32_t hwtimer_wrap_mask : 1; // [1], write clear
  85. uint32_t hwtimer_itv_mask : 1; // [2], write clear
  86. uint32_t __31_3 : 29; // [31:3]
  87. } b;
  88. } REG_TIMER_AP_TIMER_IRQ_MASK_CLR_T;
  89. // timer_irq_clr
  90. typedef union {
  91. uint32_t v;
  92. struct
  93. {
  94. uint32_t ostimer_clr : 1; // [0], write clear
  95. uint32_t hwtimer_wrap_clr : 1; // [1], write clear
  96. uint32_t hwtimer_itv_clr : 1; // [2], write clear
  97. uint32_t __31_3 : 29; // [31:3]
  98. } b;
  99. } REG_TIMER_AP_TIMER_IRQ_CLR_T;
  100. // timer_irq_cause
  101. typedef union {
  102. uint32_t v;
  103. struct
  104. {
  105. uint32_t ostimer_cause : 1; // [0], read only
  106. uint32_t hwtimer_wrap_cause : 1; // [1], read only
  107. uint32_t hwtimer_itv_cause : 1; // [2], read only
  108. uint32_t __15_3 : 13; // [15:3]
  109. uint32_t ostimer_status : 1; // [16], read only
  110. uint32_t hwtimer_wrap_status : 1; // [17], read only
  111. uint32_t hwtimer_itv_status : 1; // [18], read only
  112. uint32_t __31_19 : 13; // [31:19]
  113. } b;
  114. } REG_TIMER_AP_TIMER_IRQ_CAUSE_T;
  115. // ostimer_ctrl
  116. #define TIMER_AP_LOADVAL_H(n) (((n)&0xffffff) << 0)
  117. #define TIMER_AP_ENABLE (1 << 24)
  118. #define TIMER_AP_ENABLED (1 << 25)
  119. #define TIMER_AP_CLEARED (1 << 26)
  120. #define TIMER_AP_REPEAT (1 << 28)
  121. #define TIMER_AP_WRAP (1 << 29)
  122. #define TIMER_AP_LOAD (1 << 30)
  123. // hwtimer_ctrl
  124. #define TIMER_AP_INTERVAL(n) (((n)&0x3) << 0)
  125. #define TIMER_AP_INTERVAL_EN (1 << 8)
  126. // timer_irq_mask_set
  127. #define TIMER_AP_OSTIMER_MASK (1 << 0)
  128. #define TIMER_AP_HWTIMER_WRAP_MASK (1 << 1)
  129. #define TIMER_AP_HWTIMER_ITV_MASK (1 << 2)
  130. // timer_irq_mask_clr
  131. #define TIMER_AP_OSTIMER_MASK (1 << 0)
  132. #define TIMER_AP_HWTIMER_WRAP_MASK (1 << 1)
  133. #define TIMER_AP_HWTIMER_ITV_MASK (1 << 2)
  134. // timer_irq_clr
  135. #define TIMER_AP_OSTIMER_CLR (1 << 0)
  136. #define TIMER_AP_HWTIMER_WRAP_CLR (1 << 1)
  137. #define TIMER_AP_HWTIMER_ITV_CLR (1 << 2)
  138. // timer_irq_cause
  139. #define TIMER_AP_OTHER_TIMS_IRQ(n) (((n)&0x3) << 1)
  140. #define TIMER_AP_OSTIMER_CAUSE (1 << 0)
  141. #define TIMER_AP_HWTIMER_WRAP_CAUSE (1 << 1)
  142. #define TIMER_AP_HWTIMER_ITV_CAUSE (1 << 2)
  143. #define TIMER_AP_OSTIMER_STATUS (1 << 16)
  144. #define TIMER_AP_HWTIMER_WRAP_STATUS (1 << 17)
  145. #define TIMER_AP_HWTIMER_ITV_STATUS (1 << 18)
  146. #endif // _TIMER_AP_H_