hpm_ioc_regs.h 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  1. /*
  2. * Copyright (c) 2021-2023 HPMicro
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. *
  6. */
  7. #ifndef HPM_IOC_H
  8. #define HPM_IOC_H
  9. typedef struct {
  10. struct {
  11. __RW uint32_t FUNC_CTL; /* 0x0: ALT SELECT */
  12. __RW uint32_t PAD_CTL; /* 0x4: PAD SETTINGS */
  13. } PAD[488];
  14. } IOC_Type;
  15. /* Bitfield definition for register of struct array PAD: FUNC_CTL */
  16. /*
  17. * LOOP_BACK (RW)
  18. *
  19. * force input on
  20. * 0: disable
  21. * 1: enable
  22. */
  23. #define IOC_PAD_FUNC_CTL_LOOP_BACK_MASK (0x10000UL)
  24. #define IOC_PAD_FUNC_CTL_LOOP_BACK_SHIFT (16U)
  25. #define IOC_PAD_FUNC_CTL_LOOP_BACK_SET(x) (((uint32_t)(x) << IOC_PAD_FUNC_CTL_LOOP_BACK_SHIFT) & IOC_PAD_FUNC_CTL_LOOP_BACK_MASK)
  26. #define IOC_PAD_FUNC_CTL_LOOP_BACK_GET(x) (((uint32_t)(x) & IOC_PAD_FUNC_CTL_LOOP_BACK_MASK) >> IOC_PAD_FUNC_CTL_LOOP_BACK_SHIFT)
  27. /*
  28. * ANALOG (RW)
  29. *
  30. * select analog pin in pad
  31. * 0: disable
  32. * 1: enable
  33. */
  34. #define IOC_PAD_FUNC_CTL_ANALOG_MASK (0x100U)
  35. #define IOC_PAD_FUNC_CTL_ANALOG_SHIFT (8U)
  36. #define IOC_PAD_FUNC_CTL_ANALOG_SET(x) (((uint32_t)(x) << IOC_PAD_FUNC_CTL_ANALOG_SHIFT) & IOC_PAD_FUNC_CTL_ANALOG_MASK)
  37. #define IOC_PAD_FUNC_CTL_ANALOG_GET(x) (((uint32_t)(x) & IOC_PAD_FUNC_CTL_ANALOG_MASK) >> IOC_PAD_FUNC_CTL_ANALOG_SHIFT)
  38. /*
  39. * ALT_SELECT (RW)
  40. *
  41. * alt select
  42. * 0: ALT0
  43. * 1: ALT1
  44. * …
  45. * 31:ALT31
  46. */
  47. #define IOC_PAD_FUNC_CTL_ALT_SELECT_MASK (0x1FU)
  48. #define IOC_PAD_FUNC_CTL_ALT_SELECT_SHIFT (0U)
  49. #define IOC_PAD_FUNC_CTL_ALT_SELECT_SET(x) (((uint32_t)(x) << IOC_PAD_FUNC_CTL_ALT_SELECT_SHIFT) & IOC_PAD_FUNC_CTL_ALT_SELECT_MASK)
  50. #define IOC_PAD_FUNC_CTL_ALT_SELECT_GET(x) (((uint32_t)(x) & IOC_PAD_FUNC_CTL_ALT_SELECT_MASK) >> IOC_PAD_FUNC_CTL_ALT_SELECT_SHIFT)
  51. /* Bitfield definition for register of struct array PAD: PAD_CTL */
  52. /*
  53. * HYS (RW)
  54. *
  55. * schmitt trigger enable
  56. * 0: disable
  57. * 1: enable
  58. */
  59. #define IOC_PAD_PAD_CTL_HYS_MASK (0x1000000UL)
  60. #define IOC_PAD_PAD_CTL_HYS_SHIFT (24U)
  61. #define IOC_PAD_PAD_CTL_HYS_SET(x) (((uint32_t)(x) << IOC_PAD_PAD_CTL_HYS_SHIFT) & IOC_PAD_PAD_CTL_HYS_MASK)
  62. #define IOC_PAD_PAD_CTL_HYS_GET(x) (((uint32_t)(x) & IOC_PAD_PAD_CTL_HYS_MASK) >> IOC_PAD_PAD_CTL_HYS_SHIFT)
  63. /*
  64. * PRS (RW)
  65. *
  66. * select pull up/down internal resistance strength:
  67. * For pull down, only have 100 Kohm resistance
  68. * For pull up:
  69. * 00: 100 KOhm
  70. * 01: 47 KOhm
  71. * 10: 22 KOhm
  72. * 11: 22 KOhm
  73. */
  74. #define IOC_PAD_PAD_CTL_PRS_MASK (0x300000UL)
  75. #define IOC_PAD_PAD_CTL_PRS_SHIFT (20U)
  76. #define IOC_PAD_PAD_CTL_PRS_SET(x) (((uint32_t)(x) << IOC_PAD_PAD_CTL_PRS_SHIFT) & IOC_PAD_PAD_CTL_PRS_MASK)
  77. #define IOC_PAD_PAD_CTL_PRS_GET(x) (((uint32_t)(x) & IOC_PAD_PAD_CTL_PRS_MASK) >> IOC_PAD_PAD_CTL_PRS_SHIFT)
  78. /*
  79. * PS (RW)
  80. *
  81. * pull select
  82. * 0: pull down
  83. * 1: pull up
  84. */
  85. #define IOC_PAD_PAD_CTL_PS_MASK (0x40000UL)
  86. #define IOC_PAD_PAD_CTL_PS_SHIFT (18U)
  87. #define IOC_PAD_PAD_CTL_PS_SET(x) (((uint32_t)(x) << IOC_PAD_PAD_CTL_PS_SHIFT) & IOC_PAD_PAD_CTL_PS_MASK)
  88. #define IOC_PAD_PAD_CTL_PS_GET(x) (((uint32_t)(x) & IOC_PAD_PAD_CTL_PS_MASK) >> IOC_PAD_PAD_CTL_PS_SHIFT)
  89. /*
  90. * PE (RW)
  91. *
  92. * pull enable
  93. * 0: pull disable
  94. * 1: pull enable
  95. */
  96. #define IOC_PAD_PAD_CTL_PE_MASK (0x20000UL)
  97. #define IOC_PAD_PAD_CTL_PE_SHIFT (17U)
  98. #define IOC_PAD_PAD_CTL_PE_SET(x) (((uint32_t)(x) << IOC_PAD_PAD_CTL_PE_SHIFT) & IOC_PAD_PAD_CTL_PE_MASK)
  99. #define IOC_PAD_PAD_CTL_PE_GET(x) (((uint32_t)(x) & IOC_PAD_PAD_CTL_PE_MASK) >> IOC_PAD_PAD_CTL_PE_SHIFT)
  100. /*
  101. * KE (RW)
  102. *
  103. * keeper capability enable
  104. * 0: keeper disable
  105. * 1: keeper enable
  106. */
  107. #define IOC_PAD_PAD_CTL_KE_MASK (0x10000UL)
  108. #define IOC_PAD_PAD_CTL_KE_SHIFT (16U)
  109. #define IOC_PAD_PAD_CTL_KE_SET(x) (((uint32_t)(x) << IOC_PAD_PAD_CTL_KE_SHIFT) & IOC_PAD_PAD_CTL_KE_MASK)
  110. #define IOC_PAD_PAD_CTL_KE_GET(x) (((uint32_t)(x) & IOC_PAD_PAD_CTL_KE_MASK) >> IOC_PAD_PAD_CTL_KE_SHIFT)
  111. /*
  112. * OD (RW)
  113. *
  114. * open drain
  115. * 0: open drain disable
  116. * 1: open drain enable
  117. */
  118. #define IOC_PAD_PAD_CTL_OD_MASK (0x100U)
  119. #define IOC_PAD_PAD_CTL_OD_SHIFT (8U)
  120. #define IOC_PAD_PAD_CTL_OD_SET(x) (((uint32_t)(x) << IOC_PAD_PAD_CTL_OD_SHIFT) & IOC_PAD_PAD_CTL_OD_MASK)
  121. #define IOC_PAD_PAD_CTL_OD_GET(x) (((uint32_t)(x) & IOC_PAD_PAD_CTL_OD_MASK) >> IOC_PAD_PAD_CTL_OD_SHIFT)
  122. /*
  123. * SR (RW)
  124. *
  125. * slew rate
  126. * 0: Slow slew rate
  127. * 1: Fast slew rate
  128. */
  129. #define IOC_PAD_PAD_CTL_SR_MASK (0x40U)
  130. #define IOC_PAD_PAD_CTL_SR_SHIFT (6U)
  131. #define IOC_PAD_PAD_CTL_SR_SET(x) (((uint32_t)(x) << IOC_PAD_PAD_CTL_SR_SHIFT) & IOC_PAD_PAD_CTL_SR_MASK)
  132. #define IOC_PAD_PAD_CTL_SR_GET(x) (((uint32_t)(x) & IOC_PAD_PAD_CTL_SR_MASK) >> IOC_PAD_PAD_CTL_SR_SHIFT)
  133. /*
  134. * SPD (RW)
  135. *
  136. * additional 2-bit slew rate to select IO cell operation frequency range with reduced switching noise
  137. * 00: Slow frequency slew rate(50Mhz)
  138. * 01: Medium frequency slew rate(100 Mhz)
  139. * 10: Fast frequency slew rate(150 Mhz)
  140. * 11: Max frequency slew rate(200Mhz)
  141. */
  142. #define IOC_PAD_PAD_CTL_SPD_MASK (0x30U)
  143. #define IOC_PAD_PAD_CTL_SPD_SHIFT (4U)
  144. #define IOC_PAD_PAD_CTL_SPD_SET(x) (((uint32_t)(x) << IOC_PAD_PAD_CTL_SPD_SHIFT) & IOC_PAD_PAD_CTL_SPD_MASK)
  145. #define IOC_PAD_PAD_CTL_SPD_GET(x) (((uint32_t)(x) & IOC_PAD_PAD_CTL_SPD_MASK) >> IOC_PAD_PAD_CTL_SPD_SHIFT)
  146. /*
  147. * DS (RW)
  148. *
  149. * drive strength
  150. * 1.8V Mode:
  151. * 000: 260 Ohm
  152. * 001: 260 Ohm
  153. * 010: 130 Ohm
  154. * 011: 88 Ohm
  155. * 100: 65 Ohm
  156. * 101: 52 Ohm
  157. * 110: 43 Ohm
  158. * 111: 37 Ohm
  159. * 3.3V Mode:
  160. * 000: 157 Ohm
  161. * 001: 157 Ohm
  162. * 010: 78 Ohm
  163. * 011: 53 Ohm
  164. * 100: 39 Ohm
  165. * 101: 32 Ohm
  166. * 110: 26 Ohm
  167. * 111: 23 Ohm
  168. */
  169. #define IOC_PAD_PAD_CTL_DS_MASK (0x7U)
  170. #define IOC_PAD_PAD_CTL_DS_SHIFT (0U)
  171. #define IOC_PAD_PAD_CTL_DS_SET(x) (((uint32_t)(x) << IOC_PAD_PAD_CTL_DS_SHIFT) & IOC_PAD_PAD_CTL_DS_MASK)
  172. #define IOC_PAD_PAD_CTL_DS_GET(x) (((uint32_t)(x) & IOC_PAD_PAD_CTL_DS_MASK) >> IOC_PAD_PAD_CTL_DS_SHIFT)
  173. /* PAD register group index macro definition */
  174. #define IOC_PAD_PA00 (0UL)
  175. #define IOC_PAD_PA01 (1UL)
  176. #define IOC_PAD_PA02 (2UL)
  177. #define IOC_PAD_PA03 (3UL)
  178. #define IOC_PAD_PA04 (4UL)
  179. #define IOC_PAD_PA05 (5UL)
  180. #define IOC_PAD_PA06 (6UL)
  181. #define IOC_PAD_PA07 (7UL)
  182. #define IOC_PAD_PA08 (8UL)
  183. #define IOC_PAD_PA09 (9UL)
  184. #define IOC_PAD_PA10 (10UL)
  185. #define IOC_PAD_PA11 (11UL)
  186. #define IOC_PAD_PA12 (12UL)
  187. #define IOC_PAD_PA13 (13UL)
  188. #define IOC_PAD_PA14 (14UL)
  189. #define IOC_PAD_PA15 (15UL)
  190. #define IOC_PAD_PA16 (16UL)
  191. #define IOC_PAD_PA17 (17UL)
  192. #define IOC_PAD_PA18 (18UL)
  193. #define IOC_PAD_PA19 (19UL)
  194. #define IOC_PAD_PA20 (20UL)
  195. #define IOC_PAD_PA21 (21UL)
  196. #define IOC_PAD_PA22 (22UL)
  197. #define IOC_PAD_PA23 (23UL)
  198. #define IOC_PAD_PA24 (24UL)
  199. #define IOC_PAD_PA25 (25UL)
  200. #define IOC_PAD_PA26 (26UL)
  201. #define IOC_PAD_PA27 (27UL)
  202. #define IOC_PAD_PA28 (28UL)
  203. #define IOC_PAD_PA29 (29UL)
  204. #define IOC_PAD_PA30 (30UL)
  205. #define IOC_PAD_PA31 (31UL)
  206. #define IOC_PAD_PB00 (32UL)
  207. #define IOC_PAD_PB01 (33UL)
  208. #define IOC_PAD_PB02 (34UL)
  209. #define IOC_PAD_PB03 (35UL)
  210. #define IOC_PAD_PB04 (36UL)
  211. #define IOC_PAD_PB05 (37UL)
  212. #define IOC_PAD_PB06 (38UL)
  213. #define IOC_PAD_PB07 (39UL)
  214. #define IOC_PAD_PB08 (40UL)
  215. #define IOC_PAD_PB09 (41UL)
  216. #define IOC_PAD_PB10 (42UL)
  217. #define IOC_PAD_PB11 (43UL)
  218. #define IOC_PAD_PB12 (44UL)
  219. #define IOC_PAD_PB13 (45UL)
  220. #define IOC_PAD_PB14 (46UL)
  221. #define IOC_PAD_PB15 (47UL)
  222. #define IOC_PAD_PB16 (48UL)
  223. #define IOC_PAD_PB17 (49UL)
  224. #define IOC_PAD_PB18 (50UL)
  225. #define IOC_PAD_PB19 (51UL)
  226. #define IOC_PAD_PB20 (52UL)
  227. #define IOC_PAD_PB21 (53UL)
  228. #define IOC_PAD_PB22 (54UL)
  229. #define IOC_PAD_PB23 (55UL)
  230. #define IOC_PAD_PB24 (56UL)
  231. #define IOC_PAD_PB25 (57UL)
  232. #define IOC_PAD_PB26 (58UL)
  233. #define IOC_PAD_PB27 (59UL)
  234. #define IOC_PAD_PB28 (60UL)
  235. #define IOC_PAD_PB29 (61UL)
  236. #define IOC_PAD_PB30 (62UL)
  237. #define IOC_PAD_PB31 (63UL)
  238. #define IOC_PAD_PC00 (64UL)
  239. #define IOC_PAD_PC01 (65UL)
  240. #define IOC_PAD_PC02 (66UL)
  241. #define IOC_PAD_PC03 (67UL)
  242. #define IOC_PAD_PC04 (68UL)
  243. #define IOC_PAD_PC05 (69UL)
  244. #define IOC_PAD_PC06 (70UL)
  245. #define IOC_PAD_PC07 (71UL)
  246. #define IOC_PAD_PC08 (72UL)
  247. #define IOC_PAD_PC09 (73UL)
  248. #define IOC_PAD_PC10 (74UL)
  249. #define IOC_PAD_PC11 (75UL)
  250. #define IOC_PAD_PC12 (76UL)
  251. #define IOC_PAD_PC13 (77UL)
  252. #define IOC_PAD_PC14 (78UL)
  253. #define IOC_PAD_PC15 (79UL)
  254. #define IOC_PAD_PC16 (80UL)
  255. #define IOC_PAD_PC17 (81UL)
  256. #define IOC_PAD_PC18 (82UL)
  257. #define IOC_PAD_PC19 (83UL)
  258. #define IOC_PAD_PC20 (84UL)
  259. #define IOC_PAD_PC21 (85UL)
  260. #define IOC_PAD_PC22 (86UL)
  261. #define IOC_PAD_PC23 (87UL)
  262. #define IOC_PAD_PC24 (88UL)
  263. #define IOC_PAD_PC25 (89UL)
  264. #define IOC_PAD_PC26 (90UL)
  265. #define IOC_PAD_PC27 (91UL)
  266. #define IOC_PAD_PX00 (416UL)
  267. #define IOC_PAD_PX01 (417UL)
  268. #define IOC_PAD_PX02 (418UL)
  269. #define IOC_PAD_PX03 (419UL)
  270. #define IOC_PAD_PX04 (420UL)
  271. #define IOC_PAD_PX05 (421UL)
  272. #define IOC_PAD_PX06 (422UL)
  273. #define IOC_PAD_PX07 (423UL)
  274. #define IOC_PAD_PY00 (448UL)
  275. #define IOC_PAD_PY01 (449UL)
  276. #define IOC_PAD_PY02 (450UL)
  277. #define IOC_PAD_PY03 (451UL)
  278. #define IOC_PAD_PY04 (452UL)
  279. #define IOC_PAD_PY05 (453UL)
  280. #define IOC_PAD_PY06 (454UL)
  281. #define IOC_PAD_PY07 (455UL)
  282. #define IOC_PAD_PZ00 (480UL)
  283. #define IOC_PAD_PZ01 (481UL)
  284. #define IOC_PAD_PZ02 (482UL)
  285. #define IOC_PAD_PZ03 (483UL)
  286. #define IOC_PAD_PZ04 (484UL)
  287. #define IOC_PAD_PZ05 (485UL)
  288. #define IOC_PAD_PZ06 (486UL)
  289. #define IOC_PAD_PZ07 (487UL)
  290. #endif /* HPM_IOC_H */