fpioa.h 51 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035
  1. /* Copyright 2018 Canaan Inc.
  2. *
  3. * Licensed under the Apache License, Version 2.0 (the "License");
  4. * you may not use this file except in compliance with the License.
  5. * You may obtain a copy of the License at
  6. *
  7. * http://www.apache.org/licenses/LICENSE-2.0
  8. *
  9. * Unless required by applicable law or agreed to in writing, software
  10. * distributed under the License is distributed on an "AS IS" BASIS,
  11. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. * See the License for the specific language governing permissions and
  13. * limitations under the License.
  14. */
  15. /**
  16. * @file
  17. * @brief Field Programmable GPIO Array (FPIOA)
  18. *
  19. * The FPIOA peripheral supports the following features:
  20. *
  21. * - 48 IO with 256 functions
  22. *
  23. * - Schmitt trigger
  24. *
  25. * - Invert input and output
  26. *
  27. * - Pull up and pull down
  28. *
  29. * - Driving selector
  30. *
  31. * - Static input and output
  32. *
  33. */
  34. #ifndef _DRIVER_FPIOA_H
  35. #define _DRIVER_FPIOA_H
  36. #include <stdint.h>
  37. #include "platform.h"
  38. #ifdef __cplusplus
  39. extern "C" {
  40. #endif
  41. /* clang-format off */
  42. /* Pad number settings */
  43. #define FPIOA_NUM_IO (48)
  44. /* clang-format on */
  45. /**
  46. * @brief FPIOA IO functions
  47. *
  48. * @note FPIOA pin function table
  49. *
  50. * | Function | Name | Description |
  51. * |-----------|------------------|-----------------------------------|
  52. * | 0 | JTAG_TCLK | JTAG Test Clock |
  53. * | 1 | JTAG_TDI | JTAG Test Data In |
  54. * | 2 | JTAG_TMS | JTAG Test Mode Select |
  55. * | 3 | JTAG_TDO | JTAG Test Data Out |
  56. * | 4 | SPI0_D0 | SPI0 Data 0 |
  57. * | 5 | SPI0_D1 | SPI0 Data 1 |
  58. * | 6 | SPI0_D2 | SPI0 Data 2 |
  59. * | 7 | SPI0_D3 | SPI0 Data 3 |
  60. * | 8 | SPI0_D4 | SPI0 Data 4 |
  61. * | 9 | SPI0_D5 | SPI0 Data 5 |
  62. * | 10 | SPI0_D6 | SPI0 Data 6 |
  63. * | 11 | SPI0_D7 | SPI0 Data 7 |
  64. * | 12 | SPI0_SS0 | SPI0 Chip Select 0 |
  65. * | 13 | SPI0_SS1 | SPI0 Chip Select 1 |
  66. * | 14 | SPI0_SS2 | SPI0 Chip Select 2 |
  67. * | 15 | SPI0_SS3 | SPI0 Chip Select 3 |
  68. * | 16 | SPI0_ARB | SPI0 Arbitration |
  69. * | 17 | SPI0_SCLK | SPI0 Serial Clock |
  70. * | 18 | UARTHS_RX | UART High speed Receiver |
  71. * | 19 | UARTHS_TX | UART High speed Transmitter |
  72. * | 20 | RESV6 | Reserved function |
  73. * | 21 | RESV7 | Reserved function |
  74. * | 22 | CLK_SPI1 | Clock SPI1 |
  75. * | 23 | CLK_I2C1 | Clock I2C1 |
  76. * | 24 | GPIOHS0 | GPIO High speed 0 |
  77. * | 25 | GPIOHS1 | GPIO High speed 1 |
  78. * | 26 | GPIOHS2 | GPIO High speed 2 |
  79. * | 27 | GPIOHS3 | GPIO High speed 3 |
  80. * | 28 | GPIOHS4 | GPIO High speed 4 |
  81. * | 29 | GPIOHS5 | GPIO High speed 5 |
  82. * | 30 | GPIOHS6 | GPIO High speed 6 |
  83. * | 31 | GPIOHS7 | GPIO High speed 7 |
  84. * | 32 | GPIOHS8 | GPIO High speed 8 |
  85. * | 33 | GPIOHS9 | GPIO High speed 9 |
  86. * | 34 | GPIOHS10 | GPIO High speed 10 |
  87. * | 35 | GPIOHS11 | GPIO High speed 11 |
  88. * | 36 | GPIOHS12 | GPIO High speed 12 |
  89. * | 37 | GPIOHS13 | GPIO High speed 13 |
  90. * | 38 | GPIOHS14 | GPIO High speed 14 |
  91. * | 39 | GPIOHS15 | GPIO High speed 15 |
  92. * | 40 | GPIOHS16 | GPIO High speed 16 |
  93. * | 41 | GPIOHS17 | GPIO High speed 17 |
  94. * | 42 | GPIOHS18 | GPIO High speed 18 |
  95. * | 43 | GPIOHS19 | GPIO High speed 19 |
  96. * | 44 | GPIOHS20 | GPIO High speed 20 |
  97. * | 45 | GPIOHS21 | GPIO High speed 21 |
  98. * | 46 | GPIOHS22 | GPIO High speed 22 |
  99. * | 47 | GPIOHS23 | GPIO High speed 23 |
  100. * | 48 | GPIOHS24 | GPIO High speed 24 |
  101. * | 49 | GPIOHS25 | GPIO High speed 25 |
  102. * | 50 | GPIOHS26 | GPIO High speed 26 |
  103. * | 51 | GPIOHS27 | GPIO High speed 27 |
  104. * | 52 | GPIOHS28 | GPIO High speed 28 |
  105. * | 53 | GPIOHS29 | GPIO High speed 29 |
  106. * | 54 | GPIOHS30 | GPIO High speed 30 |
  107. * | 55 | GPIOHS31 | GPIO High speed 31 |
  108. * | 56 | GPIO0 | GPIO pin 0 |
  109. * | 57 | GPIO1 | GPIO pin 1 |
  110. * | 58 | GPIO2 | GPIO pin 2 |
  111. * | 59 | GPIO3 | GPIO pin 3 |
  112. * | 60 | GPIO4 | GPIO pin 4 |
  113. * | 61 | GPIO5 | GPIO pin 5 |
  114. * | 62 | GPIO6 | GPIO pin 6 |
  115. * | 63 | GPIO7 | GPIO pin 7 |
  116. * | 64 | UART1_RX | UART1 Receiver |
  117. * | 65 | UART1_TX | UART1 Transmitter |
  118. * | 66 | UART2_RX | UART2 Receiver |
  119. * | 67 | UART2_TX | UART2 Transmitter |
  120. * | 68 | UART3_RX | UART3 Receiver |
  121. * | 69 | UART3_TX | UART3 Transmitter |
  122. * | 70 | SPI1_D0 | SPI1 Data 0 |
  123. * | 71 | SPI1_D1 | SPI1 Data 1 |
  124. * | 72 | SPI1_D2 | SPI1 Data 2 |
  125. * | 73 | SPI1_D3 | SPI1 Data 3 |
  126. * | 74 | SPI1_D4 | SPI1 Data 4 |
  127. * | 75 | SPI1_D5 | SPI1 Data 5 |
  128. * | 76 | SPI1_D6 | SPI1 Data 6 |
  129. * | 77 | SPI1_D7 | SPI1 Data 7 |
  130. * | 78 | SPI1_SS0 | SPI1 Chip Select 0 |
  131. * | 79 | SPI1_SS1 | SPI1 Chip Select 1 |
  132. * | 80 | SPI1_SS2 | SPI1 Chip Select 2 |
  133. * | 81 | SPI1_SS3 | SPI1 Chip Select 3 |
  134. * | 82 | SPI1_ARB | SPI1 Arbitration |
  135. * | 83 | SPI1_SCLK | SPI1 Serial Clock |
  136. * | 84 | SPI_SLAVE_D0 | SPI Slave Data 0 |
  137. * | 85 | SPI_SLAVE_SS | SPI Slave Select |
  138. * | 86 | SPI_SLAVE_SCLK | SPI Slave Serial Clock |
  139. * | 87 | I2S0_MCLK | I2S0 Master Clock |
  140. * | 88 | I2S0_SCLK | I2S0 Serial Clock(BCLK) |
  141. * | 89 | I2S0_WS | I2S0 Word Select(LRCLK) |
  142. * | 90 | I2S0_IN_D0 | I2S0 Serial Data Input 0 |
  143. * | 91 | I2S0_IN_D1 | I2S0 Serial Data Input 1 |
  144. * | 92 | I2S0_IN_D2 | I2S0 Serial Data Input 2 |
  145. * | 93 | I2S0_IN_D3 | I2S0 Serial Data Input 3 |
  146. * | 94 | I2S0_OUT_D0 | I2S0 Serial Data Output 0 |
  147. * | 95 | I2S0_OUT_D1 | I2S0 Serial Data Output 1 |
  148. * | 96 | I2S0_OUT_D2 | I2S0 Serial Data Output 2 |
  149. * | 97 | I2S0_OUT_D3 | I2S0 Serial Data Output 3 |
  150. * | 98 | I2S1_MCLK | I2S1 Master Clock |
  151. * | 99 | I2S1_SCLK | I2S1 Serial Clock(BCLK) |
  152. * | 100 | I2S1_WS | I2S1 Word Select(LRCLK) |
  153. * | 101 | I2S1_IN_D0 | I2S1 Serial Data Input 0 |
  154. * | 102 | I2S1_IN_D1 | I2S1 Serial Data Input 1 |
  155. * | 103 | I2S1_IN_D2 | I2S1 Serial Data Input 2 |
  156. * | 104 | I2S1_IN_D3 | I2S1 Serial Data Input 3 |
  157. * | 105 | I2S1_OUT_D0 | I2S1 Serial Data Output 0 |
  158. * | 106 | I2S1_OUT_D1 | I2S1 Serial Data Output 1 |
  159. * | 107 | I2S1_OUT_D2 | I2S1 Serial Data Output 2 |
  160. * | 108 | I2S1_OUT_D3 | I2S1 Serial Data Output 3 |
  161. * | 109 | I2S2_MCLK | I2S2 Master Clock |
  162. * | 110 | I2S2_SCLK | I2S2 Serial Clock(BCLK) |
  163. * | 111 | I2S2_WS | I2S2 Word Select(LRCLK) |
  164. * | 112 | I2S2_IN_D0 | I2S2 Serial Data Input 0 |
  165. * | 113 | I2S2_IN_D1 | I2S2 Serial Data Input 1 |
  166. * | 114 | I2S2_IN_D2 | I2S2 Serial Data Input 2 |
  167. * | 115 | I2S2_IN_D3 | I2S2 Serial Data Input 3 |
  168. * | 116 | I2S2_OUT_D0 | I2S2 Serial Data Output 0 |
  169. * | 117 | I2S2_OUT_D1 | I2S2 Serial Data Output 1 |
  170. * | 118 | I2S2_OUT_D2 | I2S2 Serial Data Output 2 |
  171. * | 119 | I2S2_OUT_D3 | I2S2 Serial Data Output 3 |
  172. * | 120 | RESV0 | Reserved function |
  173. * | 121 | RESV1 | Reserved function |
  174. * | 122 | RESV2 | Reserved function |
  175. * | 123 | RESV3 | Reserved function |
  176. * | 124 | RESV4 | Reserved function |
  177. * | 125 | RESV5 | Reserved function |
  178. * | 126 | I2C0_SCLK | I2C0 Serial Clock |
  179. * | 127 | I2C0_SDA | I2C0 Serial Data |
  180. * | 128 | I2C1_SCLK | I2C1 Serial Clock |
  181. * | 129 | I2C1_SDA | I2C1 Serial Data |
  182. * | 130 | I2C2_SCLK | I2C2 Serial Clock |
  183. * | 131 | I2C2_SDA | I2C2 Serial Data |
  184. * | 132 | CMOS_XCLK | DVP System Clock |
  185. * | 133 | CMOS_RST | DVP System Reset |
  186. * | 134 | CMOS_PWDN | DVP Power Down Mode |
  187. * | 135 | CMOS_VSYNC | DVP Vertical Sync |
  188. * | 136 | CMOS_HREF | DVP Horizontal Reference output |
  189. * | 137 | CMOS_PCLK | Pixel Clock |
  190. * | 138 | CMOS_D0 | Data Bit 0 |
  191. * | 139 | CMOS_D1 | Data Bit 1 |
  192. * | 140 | CMOS_D2 | Data Bit 2 |
  193. * | 141 | CMOS_D3 | Data Bit 3 |
  194. * | 142 | CMOS_D4 | Data Bit 4 |
  195. * | 143 | CMOS_D5 | Data Bit 5 |
  196. * | 144 | CMOS_D6 | Data Bit 6 |
  197. * | 145 | CMOS_D7 | Data Bit 7 |
  198. * | 146 | SCCB_SCLK | SCCB Serial Clock |
  199. * | 147 | SCCB_SDA | SCCB Serial Data |
  200. * | 148 | UART1_CTS | UART1 Clear To Send |
  201. * | 149 | UART1_DSR | UART1 Data Set Ready |
  202. * | 150 | UART1_DCD | UART1 Data Carrier Detect |
  203. * | 151 | UART1_RI | UART1 Ring Indicator |
  204. * | 152 | UART1_SIR_IN | UART1 Serial Infrared Input |
  205. * | 153 | UART1_DTR | UART1 Data Terminal Ready |
  206. * | 154 | UART1_RTS | UART1 Request To Send |
  207. * | 155 | UART1_OUT2 | UART1 User-designated Output 2 |
  208. * | 156 | UART1_OUT1 | UART1 User-designated Output 1 |
  209. * | 157 | UART1_SIR_OUT | UART1 Serial Infrared Output |
  210. * | 158 | UART1_BAUD | UART1 Transmit Clock Output |
  211. * | 159 | UART1_RE | UART1 Receiver Output Enable |
  212. * | 160 | UART1_DE | UART1 Driver Output Enable |
  213. * | 161 | UART1_RS485_EN | UART1 RS485 Enable |
  214. * | 162 | UART2_CTS | UART2 Clear To Send |
  215. * | 163 | UART2_DSR | UART2 Data Set Ready |
  216. * | 164 | UART2_DCD | UART2 Data Carrier Detect |
  217. * | 165 | UART2_RI | UART2 Ring Indicator |
  218. * | 166 | UART2_SIR_IN | UART2 Serial Infrared Input |
  219. * | 167 | UART2_DTR | UART2 Data Terminal Ready |
  220. * | 168 | UART2_RTS | UART2 Request To Send |
  221. * | 169 | UART2_OUT2 | UART2 User-designated Output 2 |
  222. * | 170 | UART2_OUT1 | UART2 User-designated Output 1 |
  223. * | 171 | UART2_SIR_OUT | UART2 Serial Infrared Output |
  224. * | 172 | UART2_BAUD | UART2 Transmit Clock Output |
  225. * | 173 | UART2_RE | UART2 Receiver Output Enable |
  226. * | 174 | UART2_DE | UART2 Driver Output Enable |
  227. * | 175 | UART2_RS485_EN | UART2 RS485 Enable |
  228. * | 176 | UART3_CTS | UART3 Clear To Send |
  229. * | 177 | UART3_DSR | UART3 Data Set Ready |
  230. * | 178 | UART3_DCD | UART3 Data Carrier Detect |
  231. * | 179 | UART3_RI | UART3 Ring Indicator |
  232. * | 180 | UART3_SIR_IN | UART3 Serial Infrared Input |
  233. * | 181 | UART3_DTR | UART3 Data Terminal Ready |
  234. * | 182 | UART3_RTS | UART3 Request To Send |
  235. * | 183 | UART3_OUT2 | UART3 User-designated Output 2 |
  236. * | 184 | UART3_OUT1 | UART3 User-designated Output 1 |
  237. * | 185 | UART3_SIR_OUT | UART3 Serial Infrared Output |
  238. * | 186 | UART3_BAUD | UART3 Transmit Clock Output |
  239. * | 187 | UART3_RE | UART3 Receiver Output Enable |
  240. * | 188 | UART3_DE | UART3 Driver Output Enable |
  241. * | 189 | UART3_RS485_EN | UART3 RS485 Enable |
  242. * | 190 | TIMER0_TOGGLE1 | TIMER0 Toggle Output 1 |
  243. * | 191 | TIMER0_TOGGLE2 | TIMER0 Toggle Output 2 |
  244. * | 192 | TIMER0_TOGGLE3 | TIMER0 Toggle Output 3 |
  245. * | 193 | TIMER0_TOGGLE4 | TIMER0 Toggle Output 4 |
  246. * | 194 | TIMER1_TOGGLE1 | TIMER1 Toggle Output 1 |
  247. * | 195 | TIMER1_TOGGLE2 | TIMER1 Toggle Output 2 |
  248. * | 196 | TIMER1_TOGGLE3 | TIMER1 Toggle Output 3 |
  249. * | 197 | TIMER1_TOGGLE4 | TIMER1 Toggle Output 4 |
  250. * | 198 | TIMER2_TOGGLE1 | TIMER2 Toggle Output 1 |
  251. * | 199 | TIMER2_TOGGLE2 | TIMER2 Toggle Output 2 |
  252. * | 200 | TIMER2_TOGGLE3 | TIMER2 Toggle Output 3 |
  253. * | 201 | TIMER2_TOGGLE4 | TIMER2 Toggle Output 4 |
  254. * | 202 | CLK_SPI2 | Clock SPI2 |
  255. * | 203 | CLK_I2C2 | Clock I2C2 |
  256. * | 204 | INTERNAL0 | Internal function signal 0 |
  257. * | 205 | INTERNAL1 | Internal function signal 1 |
  258. * | 206 | INTERNAL2 | Internal function signal 2 |
  259. * | 207 | INTERNAL3 | Internal function signal 3 |
  260. * | 208 | INTERNAL4 | Internal function signal 4 |
  261. * | 209 | INTERNAL5 | Internal function signal 5 |
  262. * | 210 | INTERNAL6 | Internal function signal 6 |
  263. * | 211 | INTERNAL7 | Internal function signal 7 |
  264. * | 212 | INTERNAL8 | Internal function signal 8 |
  265. * | 213 | INTERNAL9 | Internal function signal 9 |
  266. * | 214 | INTERNAL10 | Internal function signal 10 |
  267. * | 215 | INTERNAL11 | Internal function signal 11 |
  268. * | 216 | INTERNAL12 | Internal function signal 12 |
  269. * | 217 | INTERNAL13 | Internal function signal 13 |
  270. * | 218 | INTERNAL14 | Internal function signal 14 |
  271. * | 219 | INTERNAL15 | Internal function signal 15 |
  272. * | 220 | INTERNAL16 | Internal function signal 16 |
  273. * | 221 | INTERNAL17 | Internal function signal 17 |
  274. * | 222 | CONSTANT | Constant function |
  275. * | 223 | INTERNAL18 | Internal function signal 18 |
  276. * | 224 | DEBUG0 | Debug function 0 |
  277. * | 225 | DEBUG1 | Debug function 1 |
  278. * | 226 | DEBUG2 | Debug function 2 |
  279. * | 227 | DEBUG3 | Debug function 3 |
  280. * | 228 | DEBUG4 | Debug function 4 |
  281. * | 229 | DEBUG5 | Debug function 5 |
  282. * | 230 | DEBUG6 | Debug function 6 |
  283. * | 231 | DEBUG7 | Debug function 7 |
  284. * | 232 | DEBUG8 | Debug function 8 |
  285. * | 233 | DEBUG9 | Debug function 9 |
  286. * | 234 | DEBUG10 | Debug function 10 |
  287. * | 235 | DEBUG11 | Debug function 11 |
  288. * | 236 | DEBUG12 | Debug function 12 |
  289. * | 237 | DEBUG13 | Debug function 13 |
  290. * | 238 | DEBUG14 | Debug function 14 |
  291. * | 239 | DEBUG15 | Debug function 15 |
  292. * | 240 | DEBUG16 | Debug function 16 |
  293. * | 241 | DEBUG17 | Debug function 17 |
  294. * | 242 | DEBUG18 | Debug function 18 |
  295. * | 243 | DEBUG19 | Debug function 19 |
  296. * | 244 | DEBUG20 | Debug function 20 |
  297. * | 245 | DEBUG21 | Debug function 21 |
  298. * | 246 | DEBUG22 | Debug function 22 |
  299. * | 247 | DEBUG23 | Debug function 23 |
  300. * | 248 | DEBUG24 | Debug function 24 |
  301. * | 249 | DEBUG25 | Debug function 25 |
  302. * | 250 | DEBUG26 | Debug function 26 |
  303. * | 251 | DEBUG27 | Debug function 27 |
  304. * | 252 | DEBUG28 | Debug function 28 |
  305. * | 253 | DEBUG29 | Debug function 29 |
  306. * | 254 | DEBUG30 | Debug function 30 |
  307. * | 255 | DEBUG31 | Debug function 31 |
  308. *
  309. * Any IO of FPIOA have 256 functions, it is a IO-function matrix.
  310. * All IO have default reset function, after reset, re-configure
  311. * IO function is required.
  312. */
  313. /* clang-format off */
  314. typedef enum _fpioa_function
  315. {
  316. FUNC_JTAG_TCLK = 0, /*!< JTAG Test Clock */
  317. FUNC_JTAG_TDI = 1, /*!< JTAG Test Data In */
  318. FUNC_JTAG_TMS = 2, /*!< JTAG Test Mode Select */
  319. FUNC_JTAG_TDO = 3, /*!< JTAG Test Data Out */
  320. FUNC_SPI0_D0 = 4, /*!< SPI0 Data 0 */
  321. FUNC_SPI0_D1 = 5, /*!< SPI0 Data 1 */
  322. FUNC_SPI0_D2 = 6, /*!< SPI0 Data 2 */
  323. FUNC_SPI0_D3 = 7, /*!< SPI0 Data 3 */
  324. FUNC_SPI0_D4 = 8, /*!< SPI0 Data 4 */
  325. FUNC_SPI0_D5 = 9, /*!< SPI0 Data 5 */
  326. FUNC_SPI0_D6 = 10, /*!< SPI0 Data 6 */
  327. FUNC_SPI0_D7 = 11, /*!< SPI0 Data 7 */
  328. FUNC_SPI0_SS0 = 12, /*!< SPI0 Chip Select 0 */
  329. FUNC_SPI0_SS1 = 13, /*!< SPI0 Chip Select 1 */
  330. FUNC_SPI0_SS2 = 14, /*!< SPI0 Chip Select 2 */
  331. FUNC_SPI0_SS3 = 15, /*!< SPI0 Chip Select 3 */
  332. FUNC_SPI0_ARB = 16, /*!< SPI0 Arbitration */
  333. FUNC_SPI0_SCLK = 17, /*!< SPI0 Serial Clock */
  334. FUNC_UARTHS_RX = 18, /*!< UART High speed Receiver */
  335. FUNC_UARTHS_TX = 19, /*!< UART High speed Transmitter */
  336. FUNC_RESV6 = 20, /*!< Reserved function */
  337. FUNC_RESV7 = 21, /*!< Reserved function */
  338. FUNC_CLK_SPI1 = 22, /*!< Clock SPI1 */
  339. FUNC_CLK_I2C1 = 23, /*!< Clock I2C1 */
  340. FUNC_GPIOHS0 = 24, /*!< GPIO High speed 0 */
  341. FUNC_GPIOHS1 = 25, /*!< GPIO High speed 1 */
  342. FUNC_GPIOHS2 = 26, /*!< GPIO High speed 2 */
  343. FUNC_GPIOHS3 = 27, /*!< GPIO High speed 3 */
  344. FUNC_GPIOHS4 = 28, /*!< GPIO High speed 4 */
  345. FUNC_GPIOHS5 = 29, /*!< GPIO High speed 5 */
  346. FUNC_GPIOHS6 = 30, /*!< GPIO High speed 6 */
  347. FUNC_GPIOHS7 = 31, /*!< GPIO High speed 7 */
  348. FUNC_GPIOHS8 = 32, /*!< GPIO High speed 8 */
  349. FUNC_GPIOHS9 = 33, /*!< GPIO High speed 9 */
  350. FUNC_GPIOHS10 = 34, /*!< GPIO High speed 10 */
  351. FUNC_GPIOHS11 = 35, /*!< GPIO High speed 11 */
  352. FUNC_GPIOHS12 = 36, /*!< GPIO High speed 12 */
  353. FUNC_GPIOHS13 = 37, /*!< GPIO High speed 13 */
  354. FUNC_GPIOHS14 = 38, /*!< GPIO High speed 14 */
  355. FUNC_GPIOHS15 = 39, /*!< GPIO High speed 15 */
  356. FUNC_GPIOHS16 = 40, /*!< GPIO High speed 16 */
  357. FUNC_GPIOHS17 = 41, /*!< GPIO High speed 17 */
  358. FUNC_GPIOHS18 = 42, /*!< GPIO High speed 18 */
  359. FUNC_GPIOHS19 = 43, /*!< GPIO High speed 19 */
  360. FUNC_GPIOHS20 = 44, /*!< GPIO High speed 20 */
  361. FUNC_GPIOHS21 = 45, /*!< GPIO High speed 21 */
  362. FUNC_GPIOHS22 = 46, /*!< GPIO High speed 22 */
  363. FUNC_GPIOHS23 = 47, /*!< GPIO High speed 23 */
  364. FUNC_GPIOHS24 = 48, /*!< GPIO High speed 24 */
  365. FUNC_GPIOHS25 = 49, /*!< GPIO High speed 25 */
  366. FUNC_GPIOHS26 = 50, /*!< GPIO High speed 26 */
  367. FUNC_GPIOHS27 = 51, /*!< GPIO High speed 27 */
  368. FUNC_GPIOHS28 = 52, /*!< GPIO High speed 28 */
  369. FUNC_GPIOHS29 = 53, /*!< GPIO High speed 29 */
  370. FUNC_GPIOHS30 = 54, /*!< GPIO High speed 30 */
  371. FUNC_GPIOHS31 = 55, /*!< GPIO High speed 31 */
  372. FUNC_GPIO0 = 56, /*!< GPIO pin 0 */
  373. FUNC_GPIO1 = 57, /*!< GPIO pin 1 */
  374. FUNC_GPIO2 = 58, /*!< GPIO pin 2 */
  375. FUNC_GPIO3 = 59, /*!< GPIO pin 3 */
  376. FUNC_GPIO4 = 60, /*!< GPIO pin 4 */
  377. FUNC_GPIO5 = 61, /*!< GPIO pin 5 */
  378. FUNC_GPIO6 = 62, /*!< GPIO pin 6 */
  379. FUNC_GPIO7 = 63, /*!< GPIO pin 7 */
  380. FUNC_UART1_RX = 64, /*!< UART1 Receiver */
  381. FUNC_UART1_TX = 65, /*!< UART1 Transmitter */
  382. FUNC_UART2_RX = 66, /*!< UART2 Receiver */
  383. FUNC_UART2_TX = 67, /*!< UART2 Transmitter */
  384. FUNC_UART3_RX = 68, /*!< UART3 Receiver */
  385. FUNC_UART3_TX = 69, /*!< UART3 Transmitter */
  386. FUNC_SPI1_D0 = 70, /*!< SPI1 Data 0 */
  387. FUNC_SPI1_D1 = 71, /*!< SPI1 Data 1 */
  388. FUNC_SPI1_D2 = 72, /*!< SPI1 Data 2 */
  389. FUNC_SPI1_D3 = 73, /*!< SPI1 Data 3 */
  390. FUNC_SPI1_D4 = 74, /*!< SPI1 Data 4 */
  391. FUNC_SPI1_D5 = 75, /*!< SPI1 Data 5 */
  392. FUNC_SPI1_D6 = 76, /*!< SPI1 Data 6 */
  393. FUNC_SPI1_D7 = 77, /*!< SPI1 Data 7 */
  394. FUNC_SPI1_SS0 = 78, /*!< SPI1 Chip Select 0 */
  395. FUNC_SPI1_SS1 = 79, /*!< SPI1 Chip Select 1 */
  396. FUNC_SPI1_SS2 = 80, /*!< SPI1 Chip Select 2 */
  397. FUNC_SPI1_SS3 = 81, /*!< SPI1 Chip Select 3 */
  398. FUNC_SPI1_ARB = 82, /*!< SPI1 Arbitration */
  399. FUNC_SPI1_SCLK = 83, /*!< SPI1 Serial Clock */
  400. FUNC_SPI_SLAVE_D0 = 84, /*!< SPI Slave Data 0 */
  401. FUNC_SPI_SLAVE_SS = 85, /*!< SPI Slave Select */
  402. FUNC_SPI_SLAVE_SCLK = 86, /*!< SPI Slave Serial Clock */
  403. FUNC_I2S0_MCLK = 87, /*!< I2S0 Master Clock */
  404. FUNC_I2S0_SCLK = 88, /*!< I2S0 Serial Clock(BCLK) */
  405. FUNC_I2S0_WS = 89, /*!< I2S0 Word Select(LRCLK) */
  406. FUNC_I2S0_IN_D0 = 90, /*!< I2S0 Serial Data Input 0 */
  407. FUNC_I2S0_IN_D1 = 91, /*!< I2S0 Serial Data Input 1 */
  408. FUNC_I2S0_IN_D2 = 92, /*!< I2S0 Serial Data Input 2 */
  409. FUNC_I2S0_IN_D3 = 93, /*!< I2S0 Serial Data Input 3 */
  410. FUNC_I2S0_OUT_D0 = 94, /*!< I2S0 Serial Data Output 0 */
  411. FUNC_I2S0_OUT_D1 = 95, /*!< I2S0 Serial Data Output 1 */
  412. FUNC_I2S0_OUT_D2 = 96, /*!< I2S0 Serial Data Output 2 */
  413. FUNC_I2S0_OUT_D3 = 97, /*!< I2S0 Serial Data Output 3 */
  414. FUNC_I2S1_MCLK = 98, /*!< I2S1 Master Clock */
  415. FUNC_I2S1_SCLK = 99, /*!< I2S1 Serial Clock(BCLK) */
  416. FUNC_I2S1_WS = 100, /*!< I2S1 Word Select(LRCLK) */
  417. FUNC_I2S1_IN_D0 = 101, /*!< I2S1 Serial Data Input 0 */
  418. FUNC_I2S1_IN_D1 = 102, /*!< I2S1 Serial Data Input 1 */
  419. FUNC_I2S1_IN_D2 = 103, /*!< I2S1 Serial Data Input 2 */
  420. FUNC_I2S1_IN_D3 = 104, /*!< I2S1 Serial Data Input 3 */
  421. FUNC_I2S1_OUT_D0 = 105, /*!< I2S1 Serial Data Output 0 */
  422. FUNC_I2S1_OUT_D1 = 106, /*!< I2S1 Serial Data Output 1 */
  423. FUNC_I2S1_OUT_D2 = 107, /*!< I2S1 Serial Data Output 2 */
  424. FUNC_I2S1_OUT_D3 = 108, /*!< I2S1 Serial Data Output 3 */
  425. FUNC_I2S2_MCLK = 109, /*!< I2S2 Master Clock */
  426. FUNC_I2S2_SCLK = 110, /*!< I2S2 Serial Clock(BCLK) */
  427. FUNC_I2S2_WS = 111, /*!< I2S2 Word Select(LRCLK) */
  428. FUNC_I2S2_IN_D0 = 112, /*!< I2S2 Serial Data Input 0 */
  429. FUNC_I2S2_IN_D1 = 113, /*!< I2S2 Serial Data Input 1 */
  430. FUNC_I2S2_IN_D2 = 114, /*!< I2S2 Serial Data Input 2 */
  431. FUNC_I2S2_IN_D3 = 115, /*!< I2S2 Serial Data Input 3 */
  432. FUNC_I2S2_OUT_D0 = 116, /*!< I2S2 Serial Data Output 0 */
  433. FUNC_I2S2_OUT_D1 = 117, /*!< I2S2 Serial Data Output 1 */
  434. FUNC_I2S2_OUT_D2 = 118, /*!< I2S2 Serial Data Output 2 */
  435. FUNC_I2S2_OUT_D3 = 119, /*!< I2S2 Serial Data Output 3 */
  436. FUNC_RESV0 = 120, /*!< Reserved function */
  437. FUNC_RESV1 = 121, /*!< Reserved function */
  438. FUNC_RESV2 = 122, /*!< Reserved function */
  439. FUNC_RESV3 = 123, /*!< Reserved function */
  440. FUNC_RESV4 = 124, /*!< Reserved function */
  441. FUNC_RESV5 = 125, /*!< Reserved function */
  442. FUNC_I2C0_SCLK = 126, /*!< I2C0 Serial Clock */
  443. FUNC_I2C0_SDA = 127, /*!< I2C0 Serial Data */
  444. FUNC_I2C1_SCLK = 128, /*!< I2C1 Serial Clock */
  445. FUNC_I2C1_SDA = 129, /*!< I2C1 Serial Data */
  446. FUNC_I2C2_SCLK = 130, /*!< I2C2 Serial Clock */
  447. FUNC_I2C2_SDA = 131, /*!< I2C2 Serial Data */
  448. FUNC_CMOS_XCLK = 132, /*!< DVP System Clock */
  449. FUNC_CMOS_RST = 133, /*!< DVP System Reset */
  450. FUNC_CMOS_PWDN = 134, /*!< DVP Power Down Mode */
  451. FUNC_CMOS_VSYNC = 135, /*!< DVP Vertical Sync */
  452. FUNC_CMOS_HREF = 136, /*!< DVP Horizontal Reference output */
  453. FUNC_CMOS_PCLK = 137, /*!< Pixel Clock */
  454. FUNC_CMOS_D0 = 138, /*!< Data Bit 0 */
  455. FUNC_CMOS_D1 = 139, /*!< Data Bit 1 */
  456. FUNC_CMOS_D2 = 140, /*!< Data Bit 2 */
  457. FUNC_CMOS_D3 = 141, /*!< Data Bit 3 */
  458. FUNC_CMOS_D4 = 142, /*!< Data Bit 4 */
  459. FUNC_CMOS_D5 = 143, /*!< Data Bit 5 */
  460. FUNC_CMOS_D6 = 144, /*!< Data Bit 6 */
  461. FUNC_CMOS_D7 = 145, /*!< Data Bit 7 */
  462. FUNC_SCCB_SCLK = 146, /*!< SCCB Serial Clock */
  463. FUNC_SCCB_SDA = 147, /*!< SCCB Serial Data */
  464. FUNC_UART1_CTS = 148, /*!< UART1 Clear To Send */
  465. FUNC_UART1_DSR = 149, /*!< UART1 Data Set Ready */
  466. FUNC_UART1_DCD = 150, /*!< UART1 Data Carrier Detect */
  467. FUNC_UART1_RI = 151, /*!< UART1 Ring Indicator */
  468. FUNC_UART1_SIR_IN = 152, /*!< UART1 Serial Infrared Input */
  469. FUNC_UART1_DTR = 153, /*!< UART1 Data Terminal Ready */
  470. FUNC_UART1_RTS = 154, /*!< UART1 Request To Send */
  471. FUNC_UART1_OUT2 = 155, /*!< UART1 User-designated Output 2 */
  472. FUNC_UART1_OUT1 = 156, /*!< UART1 User-designated Output 1 */
  473. FUNC_UART1_SIR_OUT = 157, /*!< UART1 Serial Infrared Output */
  474. FUNC_UART1_BAUD = 158, /*!< UART1 Transmit Clock Output */
  475. FUNC_UART1_RE = 159, /*!< UART1 Receiver Output Enable */
  476. FUNC_UART1_DE = 160, /*!< UART1 Driver Output Enable */
  477. FUNC_UART1_RS485_EN = 161, /*!< UART1 RS485 Enable */
  478. FUNC_UART2_CTS = 162, /*!< UART2 Clear To Send */
  479. FUNC_UART2_DSR = 163, /*!< UART2 Data Set Ready */
  480. FUNC_UART2_DCD = 164, /*!< UART2 Data Carrier Detect */
  481. FUNC_UART2_RI = 165, /*!< UART2 Ring Indicator */
  482. FUNC_UART2_SIR_IN = 166, /*!< UART2 Serial Infrared Input */
  483. FUNC_UART2_DTR = 167, /*!< UART2 Data Terminal Ready */
  484. FUNC_UART2_RTS = 168, /*!< UART2 Request To Send */
  485. FUNC_UART2_OUT2 = 169, /*!< UART2 User-designated Output 2 */
  486. FUNC_UART2_OUT1 = 170, /*!< UART2 User-designated Output 1 */
  487. FUNC_UART2_SIR_OUT = 171, /*!< UART2 Serial Infrared Output */
  488. FUNC_UART2_BAUD = 172, /*!< UART2 Transmit Clock Output */
  489. FUNC_UART2_RE = 173, /*!< UART2 Receiver Output Enable */
  490. FUNC_UART2_DE = 174, /*!< UART2 Driver Output Enable */
  491. FUNC_UART2_RS485_EN = 175, /*!< UART2 RS485 Enable */
  492. FUNC_UART3_CTS = 176, /*!< UART3 Clear To Send */
  493. FUNC_UART3_DSR = 177, /*!< UART3 Data Set Ready */
  494. FUNC_UART3_DCD = 178, /*!< UART3 Data Carrier Detect */
  495. FUNC_UART3_RI = 179, /*!< UART3 Ring Indicator */
  496. FUNC_UART3_SIR_IN = 180, /*!< UART3 Serial Infrared Input */
  497. FUNC_UART3_DTR = 181, /*!< UART3 Data Terminal Ready */
  498. FUNC_UART3_RTS = 182, /*!< UART3 Request To Send */
  499. FUNC_UART3_OUT2 = 183, /*!< UART3 User-designated Output 2 */
  500. FUNC_UART3_OUT1 = 184, /*!< UART3 User-designated Output 1 */
  501. FUNC_UART3_SIR_OUT = 185, /*!< UART3 Serial Infrared Output */
  502. FUNC_UART3_BAUD = 186, /*!< UART3 Transmit Clock Output */
  503. FUNC_UART3_RE = 187, /*!< UART3 Receiver Output Enable */
  504. FUNC_UART3_DE = 188, /*!< UART3 Driver Output Enable */
  505. FUNC_UART3_RS485_EN = 189, /*!< UART3 RS485 Enable */
  506. FUNC_TIMER0_TOGGLE1 = 190, /*!< TIMER0 Toggle Output 1 */
  507. FUNC_TIMER0_TOGGLE2 = 191, /*!< TIMER0 Toggle Output 2 */
  508. FUNC_TIMER0_TOGGLE3 = 192, /*!< TIMER0 Toggle Output 3 */
  509. FUNC_TIMER0_TOGGLE4 = 193, /*!< TIMER0 Toggle Output 4 */
  510. FUNC_TIMER1_TOGGLE1 = 194, /*!< TIMER1 Toggle Output 1 */
  511. FUNC_TIMER1_TOGGLE2 = 195, /*!< TIMER1 Toggle Output 2 */
  512. FUNC_TIMER1_TOGGLE3 = 196, /*!< TIMER1 Toggle Output 3 */
  513. FUNC_TIMER1_TOGGLE4 = 197, /*!< TIMER1 Toggle Output 4 */
  514. FUNC_TIMER2_TOGGLE1 = 198, /*!< TIMER2 Toggle Output 1 */
  515. FUNC_TIMER2_TOGGLE2 = 199, /*!< TIMER2 Toggle Output 2 */
  516. FUNC_TIMER2_TOGGLE3 = 200, /*!< TIMER2 Toggle Output 3 */
  517. FUNC_TIMER2_TOGGLE4 = 201, /*!< TIMER2 Toggle Output 4 */
  518. FUNC_CLK_SPI2 = 202, /*!< Clock SPI2 */
  519. FUNC_CLK_I2C2 = 203, /*!< Clock I2C2 */
  520. FUNC_INTERNAL0 = 204, /*!< Internal function signal 0 */
  521. FUNC_INTERNAL1 = 205, /*!< Internal function signal 1 */
  522. FUNC_INTERNAL2 = 206, /*!< Internal function signal 2 */
  523. FUNC_INTERNAL3 = 207, /*!< Internal function signal 3 */
  524. FUNC_INTERNAL4 = 208, /*!< Internal function signal 4 */
  525. FUNC_INTERNAL5 = 209, /*!< Internal function signal 5 */
  526. FUNC_INTERNAL6 = 210, /*!< Internal function signal 6 */
  527. FUNC_INTERNAL7 = 211, /*!< Internal function signal 7 */
  528. FUNC_INTERNAL8 = 212, /*!< Internal function signal 8 */
  529. FUNC_INTERNAL9 = 213, /*!< Internal function signal 9 */
  530. FUNC_INTERNAL10 = 214, /*!< Internal function signal 10 */
  531. FUNC_INTERNAL11 = 215, /*!< Internal function signal 11 */
  532. FUNC_INTERNAL12 = 216, /*!< Internal function signal 12 */
  533. FUNC_INTERNAL13 = 217, /*!< Internal function signal 13 */
  534. FUNC_INTERNAL14 = 218, /*!< Internal function signal 14 */
  535. FUNC_INTERNAL15 = 219, /*!< Internal function signal 15 */
  536. FUNC_INTERNAL16 = 220, /*!< Internal function signal 16 */
  537. FUNC_INTERNAL17 = 221, /*!< Internal function signal 17 */
  538. FUNC_CONSTANT = 222, /*!< Constant function */
  539. FUNC_INTERNAL18 = 223, /*!< Internal function signal 18 */
  540. FUNC_DEBUG0 = 224, /*!< Debug function 0 */
  541. FUNC_DEBUG1 = 225, /*!< Debug function 1 */
  542. FUNC_DEBUG2 = 226, /*!< Debug function 2 */
  543. FUNC_DEBUG3 = 227, /*!< Debug function 3 */
  544. FUNC_DEBUG4 = 228, /*!< Debug function 4 */
  545. FUNC_DEBUG5 = 229, /*!< Debug function 5 */
  546. FUNC_DEBUG6 = 230, /*!< Debug function 6 */
  547. FUNC_DEBUG7 = 231, /*!< Debug function 7 */
  548. FUNC_DEBUG8 = 232, /*!< Debug function 8 */
  549. FUNC_DEBUG9 = 233, /*!< Debug function 9 */
  550. FUNC_DEBUG10 = 234, /*!< Debug function 10 */
  551. FUNC_DEBUG11 = 235, /*!< Debug function 11 */
  552. FUNC_DEBUG12 = 236, /*!< Debug function 12 */
  553. FUNC_DEBUG13 = 237, /*!< Debug function 13 */
  554. FUNC_DEBUG14 = 238, /*!< Debug function 14 */
  555. FUNC_DEBUG15 = 239, /*!< Debug function 15 */
  556. FUNC_DEBUG16 = 240, /*!< Debug function 16 */
  557. FUNC_DEBUG17 = 241, /*!< Debug function 17 */
  558. FUNC_DEBUG18 = 242, /*!< Debug function 18 */
  559. FUNC_DEBUG19 = 243, /*!< Debug function 19 */
  560. FUNC_DEBUG20 = 244, /*!< Debug function 20 */
  561. FUNC_DEBUG21 = 245, /*!< Debug function 21 */
  562. FUNC_DEBUG22 = 246, /*!< Debug function 22 */
  563. FUNC_DEBUG23 = 247, /*!< Debug function 23 */
  564. FUNC_DEBUG24 = 248, /*!< Debug function 24 */
  565. FUNC_DEBUG25 = 249, /*!< Debug function 25 */
  566. FUNC_DEBUG26 = 250, /*!< Debug function 26 */
  567. FUNC_DEBUG27 = 251, /*!< Debug function 27 */
  568. FUNC_DEBUG28 = 252, /*!< Debug function 28 */
  569. FUNC_DEBUG29 = 253, /*!< Debug function 29 */
  570. FUNC_DEBUG30 = 254, /*!< Debug function 30 */
  571. FUNC_DEBUG31 = 255, /*!< Debug function 31 */
  572. FUNC_MAX = 256, /*!< Function numbers */
  573. } fpioa_function_t;
  574. /* clang-format on */
  575. /**
  576. * @brief FPIOA pull settings
  577. *
  578. * @note FPIOA pull settings description
  579. *
  580. * | PU | PD | Description |
  581. * |-----|-----|-----------------------------------|
  582. * | 0 | 0 | No Pull |
  583. * | 0 | 1 | Pull Down |
  584. * | 1 | 0 | Pull Up |
  585. * | 1 | 1 | Undefined |
  586. *
  587. */
  588. /* clang-format off */
  589. typedef enum _fpioa_pull
  590. {
  591. FPIOA_PULL_NONE, /*!< No Pull */
  592. FPIOA_PULL_DOWN, /*!< Pull Down */
  593. FPIOA_PULL_UP, /*!< Pull Up */
  594. FPIOA_PULL_MAX /*!< Count of pull settings */
  595. } fpioa_pull_t;
  596. /* clang-format on */
  597. /**
  598. * @brief FPIOA driving settings
  599. *
  600. * @note FPIOA driving settings description
  601. * There are 16 kinds of driving settings
  602. *
  603. * @note Low Level Output Current
  604. *
  605. * |DS[3:0] |Min(mA)|Typ(mA)|Max(mA)|
  606. * |--------|-------|-------|-------|
  607. * |0000 |3.2 |5.4 |8.3 |
  608. * |0001 |4.7 |8.0 |12.3 |
  609. * |0010 |6.3 |10.7 |16.4 |
  610. * |0011 |7.8 |13.2 |20.2 |
  611. * |0100 |9.4 |15.9 |24.2 |
  612. * |0101 |10.9 |18.4 |28.1 |
  613. * |0110 |12.4 |20.9 |31.8 |
  614. * |0111 |13.9 |23.4 |35.5 |
  615. *
  616. * @note High Level Output Current
  617. *
  618. * |DS[3:0] |Min(mA)|Typ(mA)|Max(mA)|
  619. * |--------|-------|-------|-------|
  620. * |0000 |5.0 |7.6 |11.2 |
  621. * |0001 |7.5 |11.4 |16.8 |
  622. * |0010 |10.0 |15.2 |22.3 |
  623. * |0011 |12.4 |18.9 |27.8 |
  624. * |0100 |14.9 |22.6 |33.3 |
  625. * |0101 |17.4 |26.3 |38.7 |
  626. * |0110 |19.8 |30.0 |44.1 |
  627. * |0111 |22.3 |33.7 |49.5 |
  628. *
  629. */
  630. /* clang-format off */
  631. typedef enum _fpioa_driving
  632. {
  633. FPIOA_DRIVING_0, /*!< 0000 */
  634. FPIOA_DRIVING_1, /*!< 0001 */
  635. FPIOA_DRIVING_2, /*!< 0010 */
  636. FPIOA_DRIVING_3, /*!< 0011 */
  637. FPIOA_DRIVING_4, /*!< 0100 */
  638. FPIOA_DRIVING_5, /*!< 0101 */
  639. FPIOA_DRIVING_6, /*!< 0110 */
  640. FPIOA_DRIVING_7, /*!< 0111 */
  641. FPIOA_DRIVING_8, /*!< 1000 */
  642. FPIOA_DRIVING_9, /*!< 1001 */
  643. FPIOA_DRIVING_10, /*!< 1010 */
  644. FPIOA_DRIVING_11, /*!< 1011 */
  645. FPIOA_DRIVING_12, /*!< 1100 */
  646. FPIOA_DRIVING_13, /*!< 1101 */
  647. FPIOA_DRIVING_14, /*!< 1110 */
  648. FPIOA_DRIVING_15, /*!< 1111 */
  649. FPIOA_DRIVING_MAX /*!< Count of driving settings */
  650. } fpioa_driving_t;
  651. /* clang-format on */
  652. /**
  653. * @brief FPIOA IO
  654. *
  655. * FPIOA IO is the specific pin of the chip package. Every IO
  656. * has a 32bit width register that can independently implement
  657. * schmitt trigger, invert input, invert output, strong pull
  658. * up, driving selector, static input and static output. And more,
  659. * it can implement any pin of any peripheral devices.
  660. *
  661. * @note FPIOA IO's register bits Layout
  662. *
  663. * | Bits | Name |Description |
  664. * |-----------|----------|---------------------------------------------------|
  665. * | 31 | PAD_DI | Read current IO's data input. |
  666. * | 30:24 | NA | Reserved bits. |
  667. * | 23 | ST | Schmitt trigger. |
  668. * | 22 | DI_INV | Invert Data input. |
  669. * | 21 | IE_INV | Invert the input enable signal. |
  670. * | 20 | IE_EN | Input enable. It can disable or enable IO input. |
  671. * | 19 | SL | Slew rate control enable. |
  672. * | 18 | SPU | Strong pull up. |
  673. * | 17 | PD | Pull select: 0 for pull down, 1 for pull up. |
  674. * | 16 | PU | Pull enable. |
  675. * | 15 | DO_INV | Invert the result of data output select (DO_SEL). |
  676. * | 14 | DO_SEL | Data output select: 0 for DO, 1 for OE. |
  677. * | 13 | OE_INV | Invert the output enable signal. |
  678. * | 12 | OE_EN | Output enable.It can disable or enable IO output. |
  679. * | 11:8 | DS | Driving selector. |
  680. * | 7:0 | CH_SEL | Channel select from 256 input. |
  681. *
  682. */
  683. typedef struct _fpioa_io_config
  684. {
  685. uint32_t ch_sel : 8;
  686. /*!< Channel select from 256 input. */
  687. uint32_t ds : 4;
  688. /*!< Driving selector. */
  689. uint32_t oe_en : 1;
  690. /*!< Static output enable, will AND with OE_INV. */
  691. uint32_t oe_inv : 1;
  692. /*!< Invert output enable. */
  693. uint32_t do_sel : 1;
  694. /*!< Data output select: 0 for DO, 1 for OE. */
  695. uint32_t do_inv : 1;
  696. /*!< Invert the result of data output select (DO_SEL). */
  697. uint32_t pu : 1;
  698. /*!< Pull up enable. 0 for nothing, 1 for pull up. */
  699. uint32_t pd : 1;
  700. /*!< Pull down enable. 0 for nothing, 1 for pull down. */
  701. uint32_t resv0 : 1;
  702. /*!< Reserved bits. */
  703. uint32_t sl : 1;
  704. /*!< Slew rate control enable. */
  705. uint32_t ie_en : 1;
  706. /*!< Static input enable, will AND with IE_INV. */
  707. uint32_t ie_inv : 1;
  708. /*!< Invert input enable. */
  709. uint32_t di_inv : 1;
  710. /*!< Invert Data input. */
  711. uint32_t st : 1;
  712. /*!< Schmitt trigger. */
  713. uint32_t resv1 : 7;
  714. /*!< Reserved bits. */
  715. uint32_t pad_di : 1;
  716. /*!< Read current IO's data input. */
  717. } __attribute__((packed, aligned(4))) fpioa_io_config_t;
  718. /**
  719. * @brief FPIOA tie setting
  720. *
  721. * FPIOA Object have 48 IO pin object and 256 bit input tie bits.
  722. * All SPI arbitration signal will tie high by default.
  723. *
  724. * @note FPIOA function tie bits RAM Layout
  725. *
  726. * | Address | Name |Description |
  727. * |-----------|------------------|----------------------------------|
  728. * | 0x000 | TIE_EN[31:0] | Input tie enable bits [31:0] |
  729. * | 0x004 | TIE_EN[63:32] | Input tie enable bits [63:32] |
  730. * | 0x008 | TIE_EN[95:64] | Input tie enable bits [95:64] |
  731. * | 0x00C | TIE_EN[127:96] | Input tie enable bits [127:96] |
  732. * | 0x010 | TIE_EN[159:128] | Input tie enable bits [159:128] |
  733. * | 0x014 | TIE_EN[191:160] | Input tie enable bits [191:160] |
  734. * | 0x018 | TIE_EN[223:192] | Input tie enable bits [223:192] |
  735. * | 0x01C | TIE_EN[255:224] | Input tie enable bits [255:224] |
  736. * | 0x020 | TIE_VAL[31:0] | Input tie value bits [31:0] |
  737. * | 0x024 | TIE_VAL[63:32] | Input tie value bits [63:32] |
  738. * | 0x028 | TIE_VAL[95:64] | Input tie value bits [95:64] |
  739. * | 0x02C | TIE_VAL[127:96] | Input tie value bits [127:96] |
  740. * | 0x030 | TIE_VAL[159:128] | Input tie value bits [159:128] |
  741. * | 0x034 | TIE_VAL[191:160] | Input tie value bits [191:160] |
  742. * | 0x038 | TIE_VAL[223:192] | Input tie value bits [223:192] |
  743. * | 0x03C | TIE_VAL[255:224] | Input tie value bits [255:224] |
  744. *
  745. * @note Function which input tie high by default
  746. *
  747. * | Name |Description |
  748. * |---------------|---------------------------------------|
  749. * | SPI0_ARB | Arbitration function of SPI master 0 |
  750. * | SPI1_ARB | Arbitration function of SPI master 1 |
  751. *
  752. * Tie high means the SPI Arbitration input is 1
  753. *
  754. */
  755. typedef struct _fpioa_tie
  756. {
  757. uint32_t en[FUNC_MAX / 32];
  758. /*!< FPIOA GPIO multiplexer tie enable array */
  759. uint32_t val[FUNC_MAX / 32];
  760. /*!< FPIOA GPIO multiplexer tie value array */
  761. } __attribute__((packed, aligned(4))) fpioa_tie_t;
  762. /**
  763. * @brief FPIOA Object
  764. *
  765. * FPIOA Object have 48 IO pin object and 256 bit input tie bits.
  766. * All SPI arbitration signal will tie high by default.
  767. *
  768. * @note FPIOA IO Pin RAM Layout
  769. *
  770. * | Address | Name |Description |
  771. * |-----------|----------|--------------------------------|
  772. * | 0x000 | PAD0 | FPIOA GPIO multiplexer io 0 |
  773. * | 0x004 | PAD1 | FPIOA GPIO multiplexer io 1 |
  774. * | 0x008 | PAD2 | FPIOA GPIO multiplexer io 2 |
  775. * | 0x00C | PAD3 | FPIOA GPIO multiplexer io 3 |
  776. * | 0x010 | PAD4 | FPIOA GPIO multiplexer io 4 |
  777. * | 0x014 | PAD5 | FPIOA GPIO multiplexer io 5 |
  778. * | 0x018 | PAD6 | FPIOA GPIO multiplexer io 6 |
  779. * | 0x01C | PAD7 | FPIOA GPIO multiplexer io 7 |
  780. * | 0x020 | PAD8 | FPIOA GPIO multiplexer io 8 |
  781. * | 0x024 | PAD9 | FPIOA GPIO multiplexer io 9 |
  782. * | 0x028 | PAD10 | FPIOA GPIO multiplexer io 10 |
  783. * | 0x02C | PAD11 | FPIOA GPIO multiplexer io 11 |
  784. * | 0x030 | PAD12 | FPIOA GPIO multiplexer io 12 |
  785. * | 0x034 | PAD13 | FPIOA GPIO multiplexer io 13 |
  786. * | 0x038 | PAD14 | FPIOA GPIO multiplexer io 14 |
  787. * | 0x03C | PAD15 | FPIOA GPIO multiplexer io 15 |
  788. * | 0x040 | PAD16 | FPIOA GPIO multiplexer io 16 |
  789. * | 0x044 | PAD17 | FPIOA GPIO multiplexer io 17 |
  790. * | 0x048 | PAD18 | FPIOA GPIO multiplexer io 18 |
  791. * | 0x04C | PAD19 | FPIOA GPIO multiplexer io 19 |
  792. * | 0x050 | PAD20 | FPIOA GPIO multiplexer io 20 |
  793. * | 0x054 | PAD21 | FPIOA GPIO multiplexer io 21 |
  794. * | 0x058 | PAD22 | FPIOA GPIO multiplexer io 22 |
  795. * | 0x05C | PAD23 | FPIOA GPIO multiplexer io 23 |
  796. * | 0x060 | PAD24 | FPIOA GPIO multiplexer io 24 |
  797. * | 0x064 | PAD25 | FPIOA GPIO multiplexer io 25 |
  798. * | 0x068 | PAD26 | FPIOA GPIO multiplexer io 26 |
  799. * | 0x06C | PAD27 | FPIOA GPIO multiplexer io 27 |
  800. * | 0x070 | PAD28 | FPIOA GPIO multiplexer io 28 |
  801. * | 0x074 | PAD29 | FPIOA GPIO multiplexer io 29 |
  802. * | 0x078 | PAD30 | FPIOA GPIO multiplexer io 30 |
  803. * | 0x07C | PAD31 | FPIOA GPIO multiplexer io 31 |
  804. * | 0x080 | PAD32 | FPIOA GPIO multiplexer io 32 |
  805. * | 0x084 | PAD33 | FPIOA GPIO multiplexer io 33 |
  806. * | 0x088 | PAD34 | FPIOA GPIO multiplexer io 34 |
  807. * | 0x08C | PAD35 | FPIOA GPIO multiplexer io 35 |
  808. * | 0x090 | PAD36 | FPIOA GPIO multiplexer io 36 |
  809. * | 0x094 | PAD37 | FPIOA GPIO multiplexer io 37 |
  810. * | 0x098 | PAD38 | FPIOA GPIO multiplexer io 38 |
  811. * | 0x09C | PAD39 | FPIOA GPIO multiplexer io 39 |
  812. * | 0x0A0 | PAD40 | FPIOA GPIO multiplexer io 40 |
  813. * | 0x0A4 | PAD41 | FPIOA GPIO multiplexer io 41 |
  814. * | 0x0A8 | PAD42 | FPIOA GPIO multiplexer io 42 |
  815. * | 0x0AC | PAD43 | FPIOA GPIO multiplexer io 43 |
  816. * | 0x0B0 | PAD44 | FPIOA GPIO multiplexer io 44 |
  817. * | 0x0B4 | PAD45 | FPIOA GPIO multiplexer io 45 |
  818. * | 0x0B8 | PAD46 | FPIOA GPIO multiplexer io 46 |
  819. * | 0x0BC | PAD47 | FPIOA GPIO multiplexer io 47 |
  820. *
  821. */
  822. typedef struct _fpioa
  823. {
  824. fpioa_io_config_t io[FPIOA_NUM_IO];
  825. /*!< FPIOA GPIO multiplexer io array */
  826. fpioa_tie_t tie;
  827. /*!< FPIOA GPIO multiplexer tie */
  828. } __attribute__((packed, aligned(4))) fpioa_t;
  829. /**
  830. * @brief FPIOA object instanse
  831. */
  832. extern volatile fpioa_t *const fpioa;
  833. /**
  834. * @brief Initialize FPIOA user custom default settings
  835. *
  836. * @note This function will set all FPIOA pad registers to user-defined
  837. * values from kconfig
  838. *
  839. * @return result
  840. * - 0 Success
  841. * - Other Fail
  842. */
  843. int fpioa_init(void);
  844. /**
  845. * @brief Get IO configuration
  846. *
  847. * @param[in] number The IO number
  848. * @param cfg Pointer to struct of IO configuration for specified IO
  849. *
  850. * @return result
  851. * - 0 Success
  852. * - Other Fail
  853. */
  854. int fpioa_get_io(int number, fpioa_io_config_t *cfg);
  855. /**
  856. * @brief Set IO configuration
  857. *
  858. * @param[in] number The IO number
  859. * @param[in] cfg Pointer to struct of IO configuration for specified IO
  860. *
  861. * @return result
  862. * - 0 Success
  863. * - Other Fail
  864. */
  865. int fpioa_set_io(int number, fpioa_io_config_t *cfg);
  866. /**
  867. * @brief Set IO configuration with function number
  868. *
  869. * @note The default IO configuration which bind to function number will
  870. * set automatically
  871. *
  872. * @param[in] number The IO number
  873. * @param[in] function The function enum number
  874. *
  875. * @return result
  876. * - 0 Success
  877. * - Other Fail
  878. */
  879. int fpioa_set_function_raw(int number, fpioa_function_t function);
  880. /**
  881. * @brief Set only IO configuration with function number
  882. *
  883. * @note The default IO configuration which bind to function number will
  884. * set automatically
  885. *
  886. * @param[in] number The IO number
  887. * @param[in] function The function enum number
  888. *
  889. * @return result
  890. * - 0 Success
  891. * - Other Fail
  892. */
  893. int fpioa_set_function(int number, fpioa_function_t function);
  894. /**
  895. * @brief Set tie enable to function
  896. *
  897. * @param[in] function The function enum number
  898. * @param[in] enable Tie enable to set, 1 is enable, 0 is disable
  899. *
  900. * @return result
  901. * - 0 Success
  902. * - Other Fail
  903. */
  904. int fpioa_set_tie_enable(fpioa_function_t function, int enable);
  905. /**
  906. * @brief Set tie value to function
  907. *
  908. * @param[in] function The function enum number
  909. * @param[in] value Tie value to set, 1 is HIGH, 0 is LOW
  910. *
  911. * @return result
  912. * - 0 Success
  913. * - Other Fail
  914. */
  915. int fpioa_set_tie_value(fpioa_function_t function, int value);
  916. /**
  917. * @brief Set IO pull function
  918. *
  919. * @param[in] number The IO number
  920. * @param[in] pull The pull enum number
  921. *
  922. * @return result
  923. * - 0 Success
  924. * - Other Fail
  925. */
  926. int fpioa_set_io_pull(int number, fpioa_pull_t pull);
  927. /**
  928. * @brief Get IO pull function
  929. *
  930. * @param[in] number The IO number
  931. *
  932. * @return result
  933. * - -1 Fail
  934. * - Other The pull enum number
  935. */
  936. int fpioa_get_io_pull(int number);
  937. /**
  938. * @brief Set IO driving
  939. *
  940. * @param[in] number The IO number
  941. * @param[in] driving The driving enum number
  942. *
  943. * @return result
  944. * - 0 Success
  945. * - Other Fail
  946. */
  947. int fpioa_set_io_driving(int number, fpioa_driving_t driving);
  948. /**
  949. * @brief Get IO driving
  950. *
  951. * @param[in] number The IO number
  952. *
  953. * @return result
  954. * - -1 Fail
  955. * - Other The driving enum number
  956. */
  957. int fpioa_get_io_driving(int number);
  958. /**
  959. * @brief Get IO by function
  960. *
  961. * @param[in] function The function enum number
  962. *
  963. * @return result
  964. * - -1 Fail
  965. * - Other The IO number
  966. */
  967. int fpioa_get_io_by_function(fpioa_function_t function);
  968. /**
  969. * @brief Set IO slew rate control
  970. *
  971. * @param[in] number The IO number
  972. * @param[in] sl_value Enable slew rate. 0: disable 1:enable
  973. *
  974. * @return result
  975. * - 0 Success
  976. * - Other Fail
  977. */
  978. int fpioa_set_sl(int number, uint8_t sl_enable);
  979. /**
  980. * @brief Set IO schmitt trigger
  981. *
  982. * @param[in] number The IO number
  983. * @param[in] st_enable Enable schmitt trigger. 0: disable 1:enable
  984. *
  985. * @return result
  986. * - 0 Success
  987. * - Other Fail
  988. */
  989. int fpioa_set_st(int number, uint8_t st_enable);
  990. /**
  991. * @brief Set IO output invert enable
  992. *
  993. * @param[in] number The IO number
  994. * @param[in] inv_enable Enable output invert. 0: disable 1:enable
  995. *
  996. * @return result
  997. * - 0 Success
  998. * - Other Fail
  999. */
  1000. int fpioa_set_oe_inv(int number, uint8_t inv_enable);
  1001. #ifdef __cplusplus
  1002. }
  1003. #endif
  1004. #endif /* _DRIVER_FPIOA_H */