timer_defs.h 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  1. #ifndef __timer_defs_h
  2. #define __timer_defs_h
  3. /*
  4. * This file is autogenerated from
  5. * file: timer.r
  6. *
  7. * by ../../../tools/rdesc/bin/rdes2c -outfile timer_defs.h timer.r
  8. * Any changes here will be lost.
  9. *
  10. * -*- buffer-read-only: t -*-
  11. */
  12. /* Main access macros */
  13. #ifndef REG_RD
  14. #define REG_RD( scope, inst, reg ) \
  15. REG_READ( reg_##scope##_##reg, \
  16. (inst) + REG_RD_ADDR_##scope##_##reg )
  17. #endif
  18. #ifndef REG_WR
  19. #define REG_WR( scope, inst, reg, val ) \
  20. REG_WRITE( reg_##scope##_##reg, \
  21. (inst) + REG_WR_ADDR_##scope##_##reg, (val) )
  22. #endif
  23. #ifndef REG_RD_VECT
  24. #define REG_RD_VECT( scope, inst, reg, index ) \
  25. REG_READ( reg_##scope##_##reg, \
  26. (inst) + REG_RD_ADDR_##scope##_##reg + \
  27. (index) * STRIDE_##scope##_##reg )
  28. #endif
  29. #ifndef REG_WR_VECT
  30. #define REG_WR_VECT( scope, inst, reg, index, val ) \
  31. REG_WRITE( reg_##scope##_##reg, \
  32. (inst) + REG_WR_ADDR_##scope##_##reg + \
  33. (index) * STRIDE_##scope##_##reg, (val) )
  34. #endif
  35. #ifndef REG_RD_INT
  36. #define REG_RD_INT( scope, inst, reg ) \
  37. REG_READ( int, (inst) + REG_RD_ADDR_##scope##_##reg )
  38. #endif
  39. #ifndef REG_WR_INT
  40. #define REG_WR_INT( scope, inst, reg, val ) \
  41. REG_WRITE( int, (inst) + REG_WR_ADDR_##scope##_##reg, (val) )
  42. #endif
  43. #ifndef REG_RD_INT_VECT
  44. #define REG_RD_INT_VECT( scope, inst, reg, index ) \
  45. REG_READ( int, (inst) + REG_RD_ADDR_##scope##_##reg + \
  46. (index) * STRIDE_##scope##_##reg )
  47. #endif
  48. #ifndef REG_WR_INT_VECT
  49. #define REG_WR_INT_VECT( scope, inst, reg, index, val ) \
  50. REG_WRITE( int, (inst) + REG_WR_ADDR_##scope##_##reg + \
  51. (index) * STRIDE_##scope##_##reg, (val) )
  52. #endif
  53. #ifndef REG_TYPE_CONV
  54. #define REG_TYPE_CONV( type, orgtype, val ) \
  55. ( { union { orgtype o; type n; } r; r.o = val; r.n; } )
  56. #endif
  57. #ifndef reg_page_size
  58. #define reg_page_size 8192
  59. #endif
  60. #ifndef REG_ADDR
  61. #define REG_ADDR( scope, inst, reg ) \
  62. ( (inst) + REG_RD_ADDR_##scope##_##reg )
  63. #endif
  64. #ifndef REG_ADDR_VECT
  65. #define REG_ADDR_VECT( scope, inst, reg, index ) \
  66. ( (inst) + REG_RD_ADDR_##scope##_##reg + \
  67. (index) * STRIDE_##scope##_##reg )
  68. #endif
  69. /* C-code for register scope timer */
  70. /* Register rw_tmr0_div, scope timer, type rw */
  71. typedef unsigned int reg_timer_rw_tmr0_div;
  72. #define REG_RD_ADDR_timer_rw_tmr0_div 0
  73. #define REG_WR_ADDR_timer_rw_tmr0_div 0
  74. /* Register r_tmr0_data, scope timer, type r */
  75. typedef unsigned int reg_timer_r_tmr0_data;
  76. #define REG_RD_ADDR_timer_r_tmr0_data 4
  77. /* Register rw_tmr0_ctrl, scope timer, type rw */
  78. typedef struct {
  79. unsigned int op : 2;
  80. unsigned int freq : 3;
  81. unsigned int dummy1 : 27;
  82. } reg_timer_rw_tmr0_ctrl;
  83. #define REG_RD_ADDR_timer_rw_tmr0_ctrl 8
  84. #define REG_WR_ADDR_timer_rw_tmr0_ctrl 8
  85. /* Register rw_tmr1_div, scope timer, type rw */
  86. typedef unsigned int reg_timer_rw_tmr1_div;
  87. #define REG_RD_ADDR_timer_rw_tmr1_div 16
  88. #define REG_WR_ADDR_timer_rw_tmr1_div 16
  89. /* Register r_tmr1_data, scope timer, type r */
  90. typedef unsigned int reg_timer_r_tmr1_data;
  91. #define REG_RD_ADDR_timer_r_tmr1_data 20
  92. /* Register rw_tmr1_ctrl, scope timer, type rw */
  93. typedef struct {
  94. unsigned int op : 2;
  95. unsigned int freq : 3;
  96. unsigned int dummy1 : 27;
  97. } reg_timer_rw_tmr1_ctrl;
  98. #define REG_RD_ADDR_timer_rw_tmr1_ctrl 24
  99. #define REG_WR_ADDR_timer_rw_tmr1_ctrl 24
  100. /* Register rs_cnt_data, scope timer, type rs */
  101. typedef struct {
  102. unsigned int tmr : 24;
  103. unsigned int cnt : 8;
  104. } reg_timer_rs_cnt_data;
  105. #define REG_RD_ADDR_timer_rs_cnt_data 32
  106. /* Register r_cnt_data, scope timer, type r */
  107. typedef struct {
  108. unsigned int tmr : 24;
  109. unsigned int cnt : 8;
  110. } reg_timer_r_cnt_data;
  111. #define REG_RD_ADDR_timer_r_cnt_data 36
  112. /* Register rw_cnt_cfg, scope timer, type rw */
  113. typedef struct {
  114. unsigned int clk : 2;
  115. unsigned int dummy1 : 30;
  116. } reg_timer_rw_cnt_cfg;
  117. #define REG_RD_ADDR_timer_rw_cnt_cfg 40
  118. #define REG_WR_ADDR_timer_rw_cnt_cfg 40
  119. /* Register rw_trig, scope timer, type rw */
  120. typedef unsigned int reg_timer_rw_trig;
  121. #define REG_RD_ADDR_timer_rw_trig 48
  122. #define REG_WR_ADDR_timer_rw_trig 48
  123. /* Register rw_trig_cfg, scope timer, type rw */
  124. typedef struct {
  125. unsigned int tmr : 2;
  126. unsigned int dummy1 : 30;
  127. } reg_timer_rw_trig_cfg;
  128. #define REG_RD_ADDR_timer_rw_trig_cfg 52
  129. #define REG_WR_ADDR_timer_rw_trig_cfg 52
  130. /* Register r_time, scope timer, type r */
  131. typedef unsigned int reg_timer_r_time;
  132. #define REG_RD_ADDR_timer_r_time 56
  133. /* Register rw_out, scope timer, type rw */
  134. typedef struct {
  135. unsigned int tmr : 2;
  136. unsigned int dummy1 : 30;
  137. } reg_timer_rw_out;
  138. #define REG_RD_ADDR_timer_rw_out 60
  139. #define REG_WR_ADDR_timer_rw_out 60
  140. /* Register rw_wd_ctrl, scope timer, type rw */
  141. typedef struct {
  142. unsigned int cnt : 8;
  143. unsigned int cmd : 1;
  144. unsigned int key : 7;
  145. unsigned int dummy1 : 16;
  146. } reg_timer_rw_wd_ctrl;
  147. #define REG_RD_ADDR_timer_rw_wd_ctrl 64
  148. #define REG_WR_ADDR_timer_rw_wd_ctrl 64
  149. /* Register r_wd_stat, scope timer, type r */
  150. typedef struct {
  151. unsigned int cnt : 8;
  152. unsigned int cmd : 1;
  153. unsigned int dummy1 : 23;
  154. } reg_timer_r_wd_stat;
  155. #define REG_RD_ADDR_timer_r_wd_stat 68
  156. /* Register rw_intr_mask, scope timer, type rw */
  157. typedef struct {
  158. unsigned int tmr0 : 1;
  159. unsigned int tmr1 : 1;
  160. unsigned int cnt : 1;
  161. unsigned int trig : 1;
  162. unsigned int dummy1 : 28;
  163. } reg_timer_rw_intr_mask;
  164. #define REG_RD_ADDR_timer_rw_intr_mask 72
  165. #define REG_WR_ADDR_timer_rw_intr_mask 72
  166. /* Register rw_ack_intr, scope timer, type rw */
  167. typedef struct {
  168. unsigned int tmr0 : 1;
  169. unsigned int tmr1 : 1;
  170. unsigned int cnt : 1;
  171. unsigned int trig : 1;
  172. unsigned int dummy1 : 28;
  173. } reg_timer_rw_ack_intr;
  174. #define REG_RD_ADDR_timer_rw_ack_intr 76
  175. #define REG_WR_ADDR_timer_rw_ack_intr 76
  176. /* Register r_intr, scope timer, type r */
  177. typedef struct {
  178. unsigned int tmr0 : 1;
  179. unsigned int tmr1 : 1;
  180. unsigned int cnt : 1;
  181. unsigned int trig : 1;
  182. unsigned int dummy1 : 28;
  183. } reg_timer_r_intr;
  184. #define REG_RD_ADDR_timer_r_intr 80
  185. /* Register r_masked_intr, scope timer, type r */
  186. typedef struct {
  187. unsigned int tmr0 : 1;
  188. unsigned int tmr1 : 1;
  189. unsigned int cnt : 1;
  190. unsigned int trig : 1;
  191. unsigned int dummy1 : 28;
  192. } reg_timer_r_masked_intr;
  193. #define REG_RD_ADDR_timer_r_masked_intr 84
  194. /* Register rw_test, scope timer, type rw */
  195. typedef struct {
  196. unsigned int dis : 1;
  197. unsigned int en : 1;
  198. unsigned int dummy1 : 30;
  199. } reg_timer_rw_test;
  200. #define REG_RD_ADDR_timer_rw_test 88
  201. #define REG_WR_ADDR_timer_rw_test 88
  202. /* Constants */
  203. enum {
  204. regk_timer_ext = 0x00000001,
  205. regk_timer_f100 = 0x00000007,
  206. regk_timer_f29_493 = 0x00000004,
  207. regk_timer_f32 = 0x00000005,
  208. regk_timer_f32_768 = 0x00000006,
  209. regk_timer_f90 = 0x00000003,
  210. regk_timer_hold = 0x00000001,
  211. regk_timer_ld = 0x00000000,
  212. regk_timer_no = 0x00000000,
  213. regk_timer_off = 0x00000000,
  214. regk_timer_run = 0x00000002,
  215. regk_timer_rw_cnt_cfg_default = 0x00000000,
  216. regk_timer_rw_intr_mask_default = 0x00000000,
  217. regk_timer_rw_out_default = 0x00000000,
  218. regk_timer_rw_test_default = 0x00000000,
  219. regk_timer_rw_tmr0_ctrl_default = 0x00000000,
  220. regk_timer_rw_tmr1_ctrl_default = 0x00000000,
  221. regk_timer_rw_trig_cfg_default = 0x00000000,
  222. regk_timer_start = 0x00000001,
  223. regk_timer_stop = 0x00000000,
  224. regk_timer_time = 0x00000001,
  225. regk_timer_tmr0 = 0x00000002,
  226. regk_timer_tmr1 = 0x00000003,
  227. regk_timer_vclk = 0x00000002,
  228. regk_timer_yes = 0x00000001
  229. };
  230. #endif /* __timer_defs_h */