sfr.h 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758
  1. #ifndef _XBOX_SFR_
  2. #define _XBOX_SFR_
  3. #ifndef __ASSEMBLER__
  4. #define SFR_RO *(volatile unsigned long const *)
  5. #define SFR_WO *(volatile unsigned long*)
  6. #define SFR_RW *(volatile unsigned long*)
  7. #define LPSFR_RO *(volatile unsigned long const *)
  8. #define LPSFR_WO *(volatile unsigned long*)
  9. #define LPSFR_RW *(volatile unsigned long*)
  10. #define SWINT() asm(".long 0xb0030057")
  11. #define EEBREAKINT() asm(".long 0xb0040057")
  12. #else
  13. #define SFR_RO
  14. #define SFR_WO
  15. #define SFR_RW
  16. #define SWINT .long 0xb0030057
  17. #define EEBREAKINT .long 0xb0040057
  18. #endif
  19. #define SFR_BASE 0x00000100 // address 0~255 is reserved
  20. #define SFR0_BASE (SFR_BASE + 0x000)
  21. #define SFR1_BASE (SFR_BASE + 0x100)
  22. #define SFR2_BASE (SFR_BASE + 0x200)
  23. #define SFR3_BASE (SFR_BASE + 0x300)
  24. #define SFR4_BASE (SFR_BASE + 0x400)
  25. #define SFR5_BASE (SFR_BASE + 0x500)
  26. #define SFR6_BASE (SFR_BASE + 0x600)
  27. #define SFR7_BASE (SFR_BASE + 0x700)
  28. #define SFR8_BASE (SFR_BASE + 0x800)
  29. #define SFR9_BASE (SFR_BASE + 0x900)
  30. #define SFR10_BASE (SFR_BASE + 0xa00)
  31. #define SFR11_BASE (SFR_BASE + 0xb00)
  32. #define SFR12_BASE (SFR_BASE + 0xc00)
  33. #define SFR13_BASE (SFR_BASE + 0xd00)
  34. #define SFR14_BASE (SFR_BASE + 0xe00)
  35. #define SFR15_BASE (SFR_BASE + 0xf00)
  36. //------------------------- SFR Group0 ---------------------------------------//
  37. #define TICK0CON SFR_RW (SFR0_BASE + 0x01*4)
  38. #define TICK0CPND SFR_RW (SFR0_BASE + 0x02*4)
  39. #define TICK0CNT SFR_RW (SFR0_BASE + 0x03*4)
  40. #define TICK0PR SFR_RW (SFR0_BASE + 0x04*4)
  41. #define TICK1CON SFR_RW (SFR0_BASE + 0x05*4)
  42. #define TICK1CPND SFR_RW (SFR0_BASE + 0x06*4)
  43. #define TICK1CNT SFR_RW (SFR0_BASE + 0x0a*4)
  44. #define TICK1PR SFR_RW (SFR0_BASE + 0x0b*4)
  45. #define CPDATA SFR_RW (SFR0_BASE + 0x0c*4)
  46. #define SPMODE SFR_RW (SFR0_BASE + 0x0d*4)
  47. #define DEVICEID SFR_RW (SFR0_BASE + 0x0e*4)
  48. #define VERSIONID SFR_RW (SFR0_BASE + 0x0f*4)
  49. #define UART0CON SFR_RW (SFR0_BASE + 0x10*4)
  50. #define UART0CPND SFR_WO (SFR0_BASE + 0x11*4)
  51. #define UART0BAUD SFR_RW (SFR0_BASE + 0x12*4)
  52. #define UART0DATA SFR_RW (SFR0_BASE + 0x13*4)
  53. #define TMR0CON SFR_RW (SFR0_BASE + 0x14*4)
  54. #define TMR0CPND SFR_RW (SFR0_BASE + 0x15*4)
  55. #define TMR0CNT SFR_RW (SFR0_BASE + 0x16*4)
  56. #define TMR0PR SFR_RW (SFR0_BASE + 0x17*4)
  57. #define CRSTPND SFR_RW (SFR0_BASE + 0x18*4)
  58. #define WDTCON SFR_RW (SFR0_BASE + 0x1a*4)
  59. #define RTCCON SFR_RW (SFR0_BASE + 0x1b*4)
  60. #define VBRSTCON SFR_RW (SFR0_BASE + 0x1c*4)
  61. #define RTCCPND SFR_WO (SFR0_BASE + 0x1e*4)
  62. #define U0KEYCON SFR_RW (SFR0_BASE + 0x1f*4)
  63. #define SD0CON SFR_RW (SFR0_BASE + 0x20*4)
  64. #define SD0CPND SFR_WO (SFR0_BASE + 0x21*4)
  65. #define SD0BAUD SFR_RW (SFR0_BASE + 0x22*4)
  66. #define SD0CMD SFR_RW (SFR0_BASE + 0x23*4)
  67. #define SD0ARG3 SFR_RW (SFR0_BASE + 0x24*4)
  68. #define SD0ARG2 SFR_RW (SFR0_BASE + 0x25*4)
  69. #define SD0ARG1 SFR_RW (SFR0_BASE + 0x26*4)
  70. #define SD0ARG0 SFR_RW (SFR0_BASE + 0x27*4)
  71. #define SD0DMAADR SFR_RW (SFR0_BASE + 0x28*4)
  72. #define SD0DMACNT SFR_RW (SFR0_BASE + 0x29*4)
  73. #define SPI0CON SFR_RW (SFR0_BASE + 0x2a*4)
  74. #define SPI0BUF SFR_RW (SFR0_BASE + 0x2b*4)
  75. #define SPI0BAUD SFR_RW (SFR0_BASE + 0x2c*4)
  76. #define SPI0CPND SFR_RW (SFR0_BASE + 0x2d*4)
  77. #define SPI0DMACNT SFR_RW (SFR0_BASE + 0x2e*4)
  78. #define SPI0DMAADR SFR_RW (SFR0_BASE + 0x2f*4)
  79. #define TMR1CON SFR_RW (SFR0_BASE + 0x35*4)
  80. #define TMR1CPND SFR_RW (SFR0_BASE + 0x36*4)
  81. #define TMR1CNT SFR_RW (SFR0_BASE + 0x37*4)
  82. #define TMR1PR SFR_RW (SFR0_BASE + 0x38*4)
  83. #define TMR2CON SFR_RW (SFR0_BASE + 0x3a*4)
  84. #define TMR2CPND SFR_RW (SFR0_BASE + 0x3b*4)
  85. #define TMR2CNT SFR_RW (SFR0_BASE + 0x3c*4)
  86. #define TMR2PR SFR_RW (SFR0_BASE + 0x3d*4)
  87. //------------------------- SFR Group1 ---------------------------------------//
  88. #define CLKCON0 SFR_RW (SFR1_BASE + 0x00*4)
  89. #define CLKCON1 SFR_RW (SFR1_BASE + 0x01*4)
  90. #define CLKCON2 SFR_RW (SFR1_BASE + 0x02*4)
  91. #define CLKCON3 SFR_RW (SFR1_BASE + 0x03*4)
  92. #define CLKCON4 SFR_RW (SFR1_BASE + 0x04*4)
  93. #define CLKDIVCON0 SFR_RW (SFR1_BASE + 0x05*4)
  94. #define CLKDIVCON1 SFR_RW (SFR1_BASE + 0x06*4)
  95. #define CLKDIVCON2 SFR_RW (SFR1_BASE + 0x07*4)
  96. #define CLKGAT0 SFR_RW (SFR1_BASE + 0x0a*4)
  97. #define CLKGAT1 SFR_RW (SFR1_BASE + 0x0b*4)
  98. #define CLKGAT2 SFR_RW (SFR1_BASE + 0x0c*4)
  99. #define CLKGAT3 SFR_RW (SFR1_BASE + 0x0d*4)
  100. #define PLL0CON SFR_RW (SFR1_BASE + 0x20*4)
  101. #define PLL0CON1 SFR_RW (SFR1_BASE + 0x21*4)
  102. #define PLL0DIV SFR_RW (SFR1_BASE + 0x22*4)
  103. #define XOSCCON SFR_RW (SFR1_BASE + 0x2f*4)
  104. #define RSTCON0 SFR_RW (SFR1_BASE + 0x30*4)
  105. #define LVDCON SFR_RW (SFR1_BASE + 0x31*4)
  106. #define PWRCON0 SFR_RW (SFR1_BASE + 0x32*4)
  107. #define PWRCON1 SFR_RW (SFR1_BASE + 0x33*4)
  108. #define PWRCON2 SFR_RW (SFR1_BASE + 0x34*4)
  109. #define LPMCON SFR_RW (SFR1_BASE + 0x35*4)
  110. #define MEMCON SFR_RW (SFR1_BASE + 0x3a*4)
  111. #define MEMCON1 SFR_RW (SFR1_BASE + 0x3b*4)
  112. #define MEMCON2 SFR_RW (SFR1_BASE + 0x3c*4)
  113. #define PROTCON0 SFR_RW (SFR1_BASE + 0x3e*4)
  114. #define PROTCON1 SFR_RW (SFR1_BASE + 0x3f*4)
  115. //------------------------- SFR Group2 ---------------------------------------//
  116. #define UFADDR SFR_RW (SFR2_BASE + 0x00*4)
  117. #define UPOWER SFR_RW (SFR2_BASE + 0x01*4)
  118. #define UINTRTX1 SFR_RW (SFR2_BASE + 0x02*4)
  119. #define UINTRTX2 SFR_RW (SFR2_BASE + 0x03*4)
  120. #define UINTRRX1 SFR_RW (SFR2_BASE + 0x04*4)
  121. #define UINTRRX2 SFR_RW (SFR2_BASE + 0x05*4)
  122. #define UINTRUSB SFR_RW (SFR2_BASE + 0x06*4)
  123. #define UINTRTX1E SFR_RW (SFR2_BASE + 0x07*4)
  124. #define UINTRTX2E SFR_RW (SFR2_BASE + 0x08*4)
  125. #define UINTRRX1E SFR_RW (SFR2_BASE + 0x09*4)
  126. #define UINTRRX2E SFR_RW (SFR2_BASE + 0x0a*4)
  127. #define UINTRUSBE SFR_RW (SFR2_BASE + 0x0b*4)
  128. #define UFRAME1 SFR_RW (SFR2_BASE + 0x0c*4)
  129. #define UFRAME2 SFR_RW (SFR2_BASE + 0x0d*4)
  130. #define UINDEX SFR_RW (SFR2_BASE + 0x0e*4)
  131. #define UDEVCTL SFR_RW (SFR2_BASE + 0x0f*4)
  132. #define UTXMAXP SFR_RW (SFR2_BASE + 0x10*4)
  133. #define UCSR0 SFR_RW (SFR2_BASE + 0x11*4)
  134. #define UTXCSR1 SFR_RW (SFR2_BASE + 0x11*4)
  135. #define UTXCSR2 SFR_RW (SFR2_BASE + 0x12*4)
  136. #define URXMAXP SFR_RW (SFR2_BASE + 0x13*4)
  137. #define URXCSR1 SFR_RW (SFR2_BASE + 0x14*4)
  138. #define URXCSR2 SFR_RW (SFR2_BASE + 0x15*4)
  139. #define UCOUNT0 SFR_RW (SFR2_BASE + 0x16*4)
  140. #define URXCOUNT1 SFR_RW (SFR2_BASE + 0x16*4)
  141. #define URXCOUNT2 SFR_RW (SFR2_BASE + 0x17*4)
  142. #define UTXTYPE SFR_RW (SFR2_BASE + 0x18*4)
  143. #define UTXINTERVAL SFR_RW (SFR2_BASE + 0x19*4)
  144. #define URXTYPE SFR_RW (SFR2_BASE + 0x1a*4)
  145. #define URXINTERVAL SFR_RW (SFR2_BASE + 0x1b*4)
  146. #define UFIFO0 SFR_RW (SFR2_BASE + 0x20*4)
  147. #define UFIFO1 SFR_RW (SFR2_BASE + 0x21*4)
  148. #define UFIFO2 SFR_RW (SFR2_BASE + 0x22*4)
  149. #define UFIFO3 SFR_RW (SFR2_BASE + 0x23*4)
  150. #define UFIFO4 SFR_RW (SFR2_BASE + 0x24*4)
  151. #define UFIFO5 SFR_RW (SFR2_BASE + 0x25*4)
  152. #define UFIFO6 SFR_RW (SFR2_BASE + 0x26*4)
  153. #define UFIFO7 SFR_RW (SFR2_BASE + 0x27*4)
  154. #define UFIFO8 SFR_RW (SFR2_BASE + 0x28*4)
  155. #define UFIFO9 SFR_RW (SFR2_BASE + 0x29*4)
  156. #define UFIFO10 SFR_RW (SFR2_BASE + 0x2a*4)
  157. #define UFIFO11 SFR_RW (SFR2_BASE + 0x2b*4)
  158. #define UFIFO12 SFR_RW (SFR2_BASE + 0x2c*4)
  159. #define UFIFO13 SFR_RW (SFR2_BASE + 0x2d*4)
  160. #define UFIFO14 SFR_RW (SFR2_BASE + 0x2e*4)
  161. #define UFIFO15 SFR_RW (SFR2_BASE + 0x2f*4)
  162. //------------------------- SFR Group3 ---------------------------------------//
  163. #define USBCON0 SFR_RW (SFR3_BASE + 0x00*4)
  164. #define USBCON1 SFR_RW (SFR3_BASE + 0x01*4)
  165. #define USBCON2 SFR_RW (SFR3_BASE + 0x02*4)
  166. #define USBCON3 SFR_RW (SFR3_BASE + 0x03*4)
  167. #define USBCON4 SFR_RW (SFR3_BASE + 0x04*4)
  168. #define USBEP0ADR SFR_RW (SFR3_BASE + 0x05*4)
  169. #define USBEP1RXADR SFR_RW (SFR3_BASE + 0x06*4)
  170. #define USBEP1TXADR SFR_RW (SFR3_BASE + 0x07*4)
  171. #define USBEP2RXADR SFR_RW (SFR3_BASE + 0x08*4)
  172. #define USBEP2TXADR SFR_RW (SFR3_BASE + 0x09*4)
  173. #define USBEP3RXADR SFR_RW (SFR3_BASE + 0x0a*4)
  174. #define USBEP3TXADR SFR_RW (SFR3_BASE + 0x0b*4)
  175. #define BTPHYTSCON SFR_RW (SFR3_BASE + 0x0c*4)
  176. #define DBGCON1 SFR_RW (SFR3_BASE + 0x0e*4)
  177. #define DBGCON SFR_RW (SFR3_BASE + 0x0f*4)
  178. #define CRCDAT SFR_RW (SFR3_BASE + 0x10*4)
  179. #define CRCRES SFR_RW (SFR3_BASE + 0x11*4)
  180. #define LFSRRES SFR_RW (SFR3_BASE + 0x12*4)
  181. #define TESTDATA LFSRRES
  182. #define LFCRCCON SFR_RW (SFR3_BASE + 0x13*4)
  183. #define BTDMAADR SFR_RW (SFR3_BASE + 0x14*4)
  184. #define BTRFDMACON SFR_RW (SFR3_BASE + 0x18*4)
  185. #define BTADDMACNT SFR_RW (SFR3_BASE + 0x19*4)
  186. #define BTADDMAADR SFR_RW (SFR3_BASE + 0x1a*4)
  187. #define BTDADMACNT SFR_RW (SFR3_BASE + 0x1b*4)
  188. #define BTDADMAADR SFR_RW (SFR3_BASE + 0x1c*4)
  189. #define CRC1DAT SFR_RW (SFR3_BASE + 0x20*4)
  190. #define CRC1RES SFR_RW (SFR3_BASE + 0x21*4)
  191. #define HSUT0CON SFR_RW (SFR3_BASE + 0x30*4)
  192. #define HSUT0CPND SFR_RW (SFR3_BASE + 0x31*4)
  193. #define HSUT0BAUD SFR_RW (SFR3_BASE + 0x32*4)
  194. #define HSUT0DATA SFR_RW (SFR3_BASE + 0x33*4)
  195. #define HSUT0TXCNT SFR_RW (SFR3_BASE + 0x34*4)
  196. #define HSUT0TXADR SFR_RW (SFR3_BASE + 0x35*4)
  197. #define HSUT0RXCNT SFR_RW (SFR3_BASE + 0x36*4)
  198. #define BTCON3 SFR_RW (SFR3_BASE + 0x37*4)
  199. #define BTCON4 SFR_RW (SFR3_BASE + 0x38*4)
  200. #define HSUT0RXADR SFR_RW (SFR3_BASE + 0x39*4)
  201. #define HSUT0FIFOCNT SFR_RW (SFR3_BASE + 0x3a*4)
  202. #define HSUT0FIFO SFR_RW (SFR3_BASE + 0x3b*4)
  203. #define HSUT0FIFOADR SFR_RW (SFR3_BASE + 0x3c*4)
  204. #define HSUT0TMRCNT SFR_RW (SFR3_BASE + 0x3d*4)
  205. #define HSUT0FCCON SFR_RW (SFR3_BASE + 0x3e*4)
  206. //------------------------- SFR Group4 ---------------------------------------//
  207. //0x00~0x3f reserve for CPU
  208. #define EXCEPTPND SFR_RO (SFR4_BASE + 0x00*4)
  209. #define EXCEPTCPND SFR_WO (SFR4_BASE + 0x01*4)
  210. #define NMICON SFR_RW (SFR4_BASE + 0x02*4)
  211. #define BP0ADR SFR_RW (SFR4_BASE + 0x03*4)
  212. #define BP1ADR SFR_RW (SFR4_BASE + 0x04*4)
  213. #define BP2ADR SFR_RW (SFR4_BASE + 0x05*4)
  214. #define BP3ADR SFR_RW (SFR4_BASE + 0x06*4)
  215. #define BP4ADR SFR_RW (SFR4_BASE + 0x07*4)
  216. #define BP5ADR SFR_RW (SFR4_BASE + 0x08*4)
  217. #define BP6ADR SFR_RW (SFR4_BASE + 0x09*4)
  218. #define ICLOCK1 SFR_RW (SFR4_BASE + 0x0a*4)
  219. #define ICVAL1 SFR_RW (SFR4_BASE + 0x0b*4)
  220. #define PICCONCLR SFR_WO (SFR4_BASE + 0x0c*4)
  221. #define PICCONSET SFR_WO (SFR4_BASE + 0x0d*4)
  222. #define PICENCLR SFR_WO (SFR4_BASE + 0x0e*4)
  223. #define PICENSET SFR_WO (SFR4_BASE + 0x0f*4)
  224. #define PICCON SFR_RW (SFR4_BASE + 0x10*4)
  225. #define PICEN SFR_RW (SFR4_BASE + 0x11*4)
  226. #define PICPR SFR_RW (SFR4_BASE + 0x12*4)
  227. #define PICADR SFR_RW (SFR4_BASE + 0x13*4)
  228. #define PICPND SFR_RW (SFR4_BASE + 0x14*4)
  229. #define CACHCON0 SFR_RW (SFR4_BASE + 0x15*4)
  230. #define CACHCON1 SFR_RW (SFR4_BASE + 0x16*4)
  231. #define ICTAG SFR_RW (SFR4_BASE + 0x17*4)
  232. #define ICINDEX SFR_RW (SFR4_BASE + 0x18*4)
  233. #define ICADRMS SFR_RW (SFR4_BASE + 0x19*4)
  234. #define ICLOCK SFR_RW (SFR4_BASE + 0x1a*4)
  235. #define ICVAL SFR_RW (SFR4_BASE + 0x1b*4)
  236. #define SWBK SFR_RW (SFR4_BASE + 0x1d*4)
  237. #define EPICCON SFR_RW (SFR4_BASE + 0x1e*4)
  238. #define EPC SFR_RW (SFR4_BASE + 0x1f*4)
  239. #define BP7ADR SFR_RW (SFR4_BASE + 0x20*4)
  240. #define BP8ADR SFR_RW (SFR4_BASE + 0x21*4)
  241. #define BP9ADR SFR_RW (SFR4_BASE + 0x22*4)
  242. #define BP10ADR SFR_RW (SFR4_BASE + 0x23*4)
  243. #define BP11ADR SFR_RW (SFR4_BASE + 0x24*4)
  244. #define BP12ADR SFR_RW (SFR4_BASE + 0x25*4)
  245. #define BP13ADR SFR_RW (SFR4_BASE + 0x26*4)
  246. #define BP14ADR SFR_RW (SFR4_BASE + 0x27*4)
  247. #define BP15ADR SFR_RW (SFR4_BASE + 0x28*4)
  248. #define PICPR1 SFR_RW (SFR4_BASE + 0x29*4)
  249. #define PCERR SFR_RW (SFR4_BASE + 0x2e*4)
  250. #define PCST SFR_RW (SFR4_BASE + 0x2f*4)
  251. //------------------------- SFR Group5 ---------------------------------------//
  252. #define IICCON0 SFR_RW (SFR5_BASE + 0x07*4)
  253. #define IICCON1 SFR_RW (SFR5_BASE + 0x08*4)
  254. #define IICCMDA SFR_RW (SFR5_BASE + 0x09*4)
  255. #define IICDATA SFR_RW (SFR5_BASE + 0x0a*4)
  256. #define IICDMAADR SFR_RW (SFR5_BASE + 0x0b*4)
  257. #define IICDMACNT SFR_RW (SFR5_BASE + 0x0c*4)
  258. #define IICSSTS SFR_RW (SFR5_BASE + 0x0d*4)
  259. #define SADCDAT0 SFR_RO (SFR5_BASE + 0x20*4)
  260. #define SADCDAT1 SFR_RO (SFR5_BASE + 0x21*4)
  261. #define SADCDAT2 SFR_RO (SFR5_BASE + 0x22*4)
  262. #define SADCDAT3 SFR_RO (SFR5_BASE + 0x23*4)
  263. #define SADCDAT4 SFR_RO (SFR5_BASE + 0x24*4)
  264. #define SADCDAT5 SFR_RO (SFR5_BASE + 0x25*4)
  265. #define SADCDAT6 SFR_RO (SFR5_BASE + 0x26*4)
  266. #define SADCDAT7 SFR_RO (SFR5_BASE + 0x27*4)
  267. #define SADCDAT8 SFR_RO (SFR5_BASE + 0x28*4)
  268. #define SADCDAT9 SFR_RO (SFR5_BASE + 0x29*4)
  269. #define SADCDAT10 SFR_RO (SFR5_BASE + 0x2a*4)
  270. #define SADCDAT11 SFR_RO (SFR5_BASE + 0x2b*4)
  271. #define SADCDAT12 SFR_RO (SFR5_BASE + 0x2c*4)
  272. #define SADCDAT13 SFR_RO (SFR5_BASE + 0x2d*4)
  273. #define SADCDAT14 SFR_RO (SFR5_BASE + 0x2e*4)
  274. #define SADCDAT15 SFR_RO (SFR5_BASE + 0x2f*4)
  275. #define SADCCON SFR_RW (SFR5_BASE + 0x30*4)
  276. #define SADCCH SFR_RW (SFR5_BASE + 0x31*4)
  277. #define SADCST SFR_WO (SFR5_BASE + 0x32*4)
  278. #define SADCBAUD SFR_WO (SFR5_BASE + 0x33*4)
  279. #define MBISTCON SFR_RW (SFR5_BASE + 0x34*4)
  280. #define MBISTEADR SFR_WO (SFR5_BASE + 0x35*4)
  281. #define MBISTBADR SFR_WO (SFR5_BASE + 0x36*4)
  282. #define MBISTCRC SFR_RW (SFR5_BASE + 0x37*4)
  283. #define MBISTERR SFR_RO (SFR5_BASE + 0x38*4)
  284. #define SADCCHIE SFR_RW (SFR5_BASE + 0x39*4)
  285. #define SADCCHPND SFR_RW (SFR5_BASE + 0x3a*4)
  286. #define EFCON0 SFR_RW (SFR5_BASE + 0x3d*4)
  287. #define EFCON1 SFR_WO (SFR5_BASE + 0x3e*4)
  288. #define EFDAT SFR_RW (SFR5_BASE + 0x3f*4)
  289. //------------------------- SFR Group6 ---------------------------------------//
  290. #define GPIOASET SFR_RW (SFR6_BASE + 0x00*4)
  291. #define GPIOACLR SFR_RW (SFR6_BASE + 0x01*4)
  292. #define GPIOA SFR_RW (SFR6_BASE + 0x02*4)
  293. #define GPIOADIR SFR_RW (SFR6_BASE + 0x03*4)
  294. #define GPIOADE SFR_RW (SFR6_BASE + 0x04*4)
  295. #define GPIOAFEN SFR_RW (SFR6_BASE + 0x05*4)
  296. #define GPIOAFDIREN SFR_RW (SFR6_BASE + 0x06*4)
  297. #define GPIOADRV SFR_RW (SFR6_BASE + 0x07*4)
  298. #define GPIOAPU SFR_RW (SFR6_BASE + 0x08*4)
  299. #define GPIOAPD SFR_RW (SFR6_BASE + 0x09*4)
  300. #define GPIOAPU200K SFR_RW (SFR6_BASE + 0x0a*4)
  301. #define GPIOAPD200K SFR_RW (SFR6_BASE + 0x0b*4)
  302. #define GPIOAPU300 SFR_RW (SFR6_BASE + 0x0c*4)
  303. #define GPIOAPD300 SFR_RW (SFR6_BASE + 0x0d*4)
  304. #define GPIOBSET SFR_RW (SFR6_BASE + 0x10*4)
  305. #define GPIOBCLR SFR_RW (SFR6_BASE + 0x11*4)
  306. #define GPIOB SFR_RW (SFR6_BASE + 0x12*4)
  307. #define GPIOBDIR SFR_RW (SFR6_BASE + 0x13*4)
  308. #define GPIOBDE SFR_RW (SFR6_BASE + 0x14*4)
  309. #define GPIOBFEN SFR_RW (SFR6_BASE + 0x15*4)
  310. #define GPIOBFDIREN SFR_RW (SFR6_BASE + 0x16*4)
  311. #define GPIOBDRV SFR_RW (SFR6_BASE + 0x17*4)
  312. #define GPIOBPU SFR_RW (SFR6_BASE + 0x18*4)
  313. #define GPIOBPD SFR_RW (SFR6_BASE + 0x19*4)
  314. #define GPIOBPU200K SFR_RW (SFR6_BASE + 0x1a*4)
  315. #define GPIOBPD200K SFR_RW (SFR6_BASE + 0x1b*4)
  316. #define GPIOBPU300 SFR_RW (SFR6_BASE + 0x1c*4)
  317. #define GPIOBPD300 SFR_RW (SFR6_BASE + 0x1d*4)
  318. #define FUNCOMCON0 SFR_RW (SFR6_BASE + 0x30*4)
  319. #define FUNCOMCON1 SFR_RW (SFR6_BASE + 0x31*4)
  320. #define FUNCOMCON2 SFR_RW (SFR6_BASE + 0x32*4)
  321. #define FUNCOMCON3 SFR_RW (SFR6_BASE + 0x33*4)
  322. #define FUNCOMCON4 SFR_RW (SFR6_BASE + 0x34*4)
  323. #define FUNCOMCON5 SFR_RW (SFR6_BASE + 0x35*4)
  324. #define FUNCOMCON6 SFR_RW (SFR6_BASE + 0x36*4)
  325. #define FUNCOMCON7 SFR_RW (SFR6_BASE + 0x37*4)
  326. #define FUNCIMCON0 SFR_RW (SFR6_BASE + 0x38*4)
  327. #define FUNCIMCON1 SFR_RW (SFR6_BASE + 0x39*4)
  328. #define FUNCIMCON2 SFR_RW (SFR6_BASE + 0x3a*4)
  329. #define FUNCIMCON3 SFR_RW (SFR6_BASE + 0x3b*4)
  330. #define FUNCIMCON4 SFR_RW (SFR6_BASE + 0x3c*4)
  331. #define FUNCIMCON5 SFR_RW (SFR6_BASE + 0x3d*4)
  332. #define FUNCIMCON6 SFR_RW (SFR6_BASE + 0x3e*4)
  333. //------------------------- SFR Group7 ---------------------------------------//
  334. #define GPIOGSET SFR_RW (SFR7_BASE + 0x00*4)
  335. #define GPIOGCLR SFR_RW (SFR7_BASE + 0x01*4)
  336. #define GPIOG SFR_RW (SFR7_BASE + 0x02*4)
  337. #define GPIOGDIR SFR_RW (SFR7_BASE + 0x03*4)
  338. #define GPIOGDE SFR_RW (SFR7_BASE + 0x04*4)
  339. #define GPIOGFEN SFR_RW (SFR7_BASE + 0x05*4)
  340. #define GPIOGFDIREN SFR_RW (SFR7_BASE + 0x06*4)
  341. #define GPIOGDRV SFR_RW (SFR7_BASE + 0x07*4)
  342. #define GPIOGPU SFR_RW (SFR7_BASE + 0x08*4)
  343. #define GPIOGPD SFR_RW (SFR7_BASE + 0x09*4)
  344. #define GPIOGPU200K SFR_RW (SFR7_BASE + 0x0a*4)
  345. #define GPIOGPD200K SFR_RW (SFR7_BASE + 0x0b*4)
  346. #define GPIOGPU300 SFR_RW (SFR7_BASE + 0x0c*4)
  347. #define GPIOGPD300 SFR_RW (SFR7_BASE + 0x0d*4)
  348. #define IRONETIME SFR_RW (SFR7_BASE + 0x20*4)
  349. #define IRZEROTIME SFR_RW (SFR7_BASE + 0x21*4)
  350. #define IRSTARTTIME SFR_RW (SFR7_BASE + 0x22*4)
  351. #define IRREPEATTIME SFR_RW (SFR7_BASE + 0x23*4)
  352. #define IRREPEATCON SFR_RW (SFR7_BASE + 0x24*4)
  353. #define IRTXCON SFR_RW (SFR7_BASE + 0x25*4)
  354. #define IRTXDATA SFR_RW (SFR7_BASE + 0x26*4)
  355. #define IRTXLEN SFR_RW (SFR7_BASE + 0x27*4)
  356. #define IRTXPEND SFR_RW (SFR7_BASE + 0x28*4)
  357. #define IRDMACON SFR_RW (SFR7_BASE + 0x29*4)
  358. #define IRDMAIADR SFR_RW (SFR7_BASE + 0x2a*4)
  359. #define IRDMAISIZE SFR_RW (SFR7_BASE + 0x2b*4)
  360. #define IRDMAOADR SFR_RW (SFR7_BASE + 0x2c*4)
  361. #define IRDMAOSIZE SFR_RW (SFR7_BASE + 0x2d*4)
  362. #define IRDMAPEND SFR_RW (SFR7_BASE + 0x2e*4)
  363. #define IRRXCON SFR_RW (SFR7_BASE + 0x2f*4)
  364. #define IRRXDAT SFR_RW (SFR7_BASE + 0x30*4)
  365. #define IRRXCPND SFR_WO (SFR7_BASE + 0x31*4)
  366. #define IRRXERR0 SFR_WO (SFR7_BASE + 0x32*4)
  367. #define IRRXERR1 SFR_WO (SFR7_BASE + 0x33*4)
  368. #define IRRXPR0 SFR_WO (SFR7_BASE + 0x34*4)
  369. #define IRRXPR1 SFR_WO (SFR7_BASE + 0x35*4)
  370. #define IRFLTCON SFR_RW (SFR7_BASE + 0x36*4)
  371. #define CORDICCON SFR_RW (SFR7_BASE + 0x3b*4)
  372. #define CORDICINDATX SFR_RW (SFR7_BASE + 0x3c*4)
  373. #define CORDICINDATY SFR_RW (SFR7_BASE + 0x3d*4)
  374. #define CORDICOUTDATX SFR_RW (SFR7_BASE + 0x3e*4)
  375. #define CORDICOUTDATY SFR_RW (SFR7_BASE + 0x3f*4)
  376. //------------------------- SFR Group8 ---------------------------------------//
  377. #define KEYSCAN_CON0 LPSFR_RW (SFR8_BASE + 0x00*4)
  378. #define KEYSCAN_CON1 LPSFR_RW (SFR8_BASE + 0x01*4)
  379. #define KEYSCAN_CLR LPSFR_RW (SFR8_BASE + 0x02*4)
  380. #define KEYSCAN_INFO0 LPSFR_RW (SFR8_BASE + 0x03*4)
  381. #define KEYSCAN_INFO1 LPSFR_RW (SFR8_BASE + 0x04*4)
  382. #define KEYSCAN_INFO2 LPSFR_RW (SFR8_BASE + 0x05*4)
  383. #define LP_GPIOA LPSFR_RW (SFR8_BASE + 0x06*4)
  384. #define LP_GPIOADIR LPSFR_RW (SFR8_BASE + 0x07*4)
  385. #define LP_GPIOADE LPSFR_RW (SFR8_BASE + 0x08*4)
  386. #define LP_GPIOAPU0 LPSFR_RW (SFR8_BASE + 0x09*4)
  387. #define LP_GPIOAPD0 LPSFR_RW (SFR8_BASE + 0x0a*4)
  388. #define LP_GPIOB LPSFR_RW (SFR8_BASE + 0x0b*4)
  389. #define LP_GPIOBDIR LPSFR_RW (SFR8_BASE + 0x0c*4)
  390. #define LP_GPIOBDE LPSFR_RW (SFR8_BASE + 0x0d*4)
  391. #define LP_GPIOBPU0 LPSFR_RW (SFR8_BASE + 0x0e*4)
  392. #define LP_GPIOBPD0 LPSFR_RW (SFR8_BASE + 0x0f*4)
  393. #define LP_GPIOE LPSFR_RW (SFR8_BASE + 0x10*4)
  394. #define LP_GPIOEDIR LPSFR_RW (SFR8_BASE + 0x11*4)
  395. #define LP_GPIOEDE LPSFR_RW (SFR8_BASE + 0x12*4)
  396. #define LP_GPIOEPU0 LPSFR_RW (SFR8_BASE + 0x13*4)
  397. #define LP_GPIOEPD0 LPSFR_RW (SFR8_BASE + 0x14*4)
  398. #define LP_GPIOF LPSFR_RW (SFR8_BASE + 0x15*4)
  399. #define LP_GPIOFDIR LPSFR_RW (SFR8_BASE + 0x16*4)
  400. #define LP_GPIOFDE LPSFR_RW (SFR8_BASE + 0x17*4)
  401. #define LP_GPIOFPU0 LPSFR_RW (SFR8_BASE + 0x18*4)
  402. #define LP_GPIOFPD0 LPSFR_RW (SFR8_BASE + 0x19*4)
  403. #define LP_GPIOG LPSFR_RW (SFR8_BASE + 0x1a*4)
  404. #define LP_GPIOGDIR LPSFR_RW (SFR8_BASE + 0x1b*4)
  405. #define LP_GPIOGDE LPSFR_RW (SFR8_BASE + 0x1c*4)
  406. #define LP_GPIOGPU0 LPSFR_RW (SFR8_BASE + 0x1d*4)
  407. #define LP_GPIOGPD0 LPSFR_RW (SFR8_BASE + 0x1e*4)
  408. #define WKUPCON LPSFR_RW (SFR8_BASE + 0x1f*4)
  409. #define WKUPEDG LPSFR_RW (SFR8_BASE + 0x20*4)
  410. #define WKUPCPND LPSFR_RW (SFR8_BASE + 0x21*4)
  411. #define PORTINTEDG LPSFR_RW (SFR8_BASE + 0x22*4)
  412. #define PORTINTEN LPSFR_RW (SFR8_BASE + 0x23*4)
  413. #define WKRSRC LPSFR_RW (SFR8_BASE + 0x24*4)
  414. #define WKFSRC LPSFR_RW (SFR8_BASE + 0x25*4)
  415. #define BTCON2 LPSFR_RW (SFR8_BASE + 0x26*4)
  416. //------------------------- SFR Group9 ---------------------------------------//
  417. #define TMR3CON SFR_RW (SFR9_BASE + 0x00*4)
  418. #define TMR3CPND SFR_WO (SFR9_BASE + 0x01*4)
  419. #define TMR3CNT SFR_RW (SFR9_BASE + 0x02*4)
  420. #define TMR3PR SFR_RW (SFR9_BASE + 0x03*4)
  421. #define TMR3CPT SFR_RO (SFR9_BASE + 0x04*4)
  422. #define TMR3DUTY0 SFR_WO (SFR9_BASE + 0x05*4)
  423. #define TMR3DUTY1 SFR_WO (SFR9_BASE + 0x06*4)
  424. #define TMR3DUTY2 SFR_WO (SFR9_BASE + 0x07*4)
  425. #define TMR3PSC SFR_RW (SFR9_BASE + 0x08*4)
  426. #define UDETCON SFR_RW (SFR9_BASE + 0x18*4)
  427. #define UDETCPND SFR_RW (SFR9_BASE + 0x19*4)
  428. #define UDETBAUD SFR_RW (SFR9_BASE + 0x1a*4)
  429. #define UDETDATA SFR_RW (SFR9_BASE + 0x1b*4)
  430. #define SPI1CON SFR_RW (SFR9_BASE + 0x20*4)
  431. #define SPI1BUF SFR_RW (SFR9_BASE + 0x21*4)
  432. #define SPI1BAUD SFR_RW (SFR9_BASE + 0x22*4)
  433. #define SPI1CPND SFR_RW (SFR9_BASE + 0x23*4)
  434. #define SPI1DMACNT SFR_RW (SFR9_BASE + 0x24*4)
  435. #define SPI1DMAADR SFR_RW (SFR9_BASE + 0x25*4)
  436. #define FREQDETCON SFR_RW (SFR9_BASE + 0x28*4)
  437. #define FREQDETCPND SFR_RW (SFR9_BASE + 0x29*4)
  438. #define FREQDETCNT SFR_RW (SFR9_BASE + 0x2a*4)
  439. #define FREQDETTGT SFR_RW (SFR9_BASE + 0x2b*4)
  440. //------------------------- SFR Group10 --------------------------------------//
  441. #define INPCON SFR_RW (SFR10_BASE + 0x00*4)
  442. #define INPCPND SFR_RW (SFR10_BASE + 0x01*4)
  443. #define TKCON SFR_RW (SFR10_BASE + 0x02*4)
  444. #define TKCON1 SFR_RW (SFR10_BASE + 0x03*4)
  445. #define TKCNT SFR_RW (SFR10_BASE + 0x04*4)
  446. #define TKCDPR0 SFR_RW (SFR10_BASE + 0x05*4)
  447. #define TKCDPR1 SFR_RW (SFR10_BASE + 0x06*4)
  448. #define TKTMR SFR_RW (SFR10_BASE + 0x07*4)
  449. #define TETMR SFR_RW (SFR10_BASE + 0x08*4)
  450. #define TKBCNT SFR_RW (SFR10_BASE + 0x09*4)
  451. #define TKPTHD SFR_RW (SFR10_BASE + 0x0a*4)
  452. #define TKETHD SFR_RW (SFR10_BASE + 0x0b*4)
  453. #define TEBCNT SFR_RW (SFR10_BASE + 0x0c*4)
  454. #define TEPTHD SFR_RW (SFR10_BASE + 0x0d*4)
  455. #define TEETHD SFR_RW (SFR10_BASE + 0x0e*4)
  456. #define TKCON2 SFR_RW (SFR10_BASE + 0x0f*4)
  457. #define TKVARI SFR_RW (SFR10_BASE + 0x10*4)
  458. #define TKVARITHD SFR_WO (SFR10_BASE + 0x11*4)
  459. #define TKACON0 SFR_RW (SFR10_BASE + 0x12*4)
  460. #define TKACON1 SFR_RW (SFR10_BASE + 0x13*4)
  461. #define RTCRAMADR SFR_RW (SFR10_BASE + 0x1c*4)
  462. #define RTCRAMDAT SFR_RW (SFR10_BASE + 0x1d*4)
  463. #define RTCALM SFR_RW (SFR10_BASE + 0x1e*4)
  464. #define RTCCNT SFR_RW (SFR10_BASE + 0x1f*4)
  465. #define RTCCON0 SFR_RW (SFR10_BASE + 0x20*4)
  466. #define RTCCON1 SFR_RW (SFR10_BASE + 0x21*4)
  467. #define RTCCON2 SFR_RW (SFR10_BASE + 0x22*4)
  468. #define RTCCON3 SFR_RW (SFR10_BASE + 0x23*4)
  469. #define RTCCON4 SFR_RW (SFR10_BASE + 0x24*4)
  470. #define RTCCON5 SFR_RW (SFR10_BASE + 0x25*4)
  471. #define RTCCON6 SFR_RW (SFR10_BASE + 0x26*4)
  472. #define RTCCON7 SFR_RW (SFR10_BASE + 0x27*4)
  473. #define RTCCON8 SFR_RW (SFR10_BASE + 0x28*4)
  474. #define RTCCON9 SFR_RW (SFR10_BASE + 0x29*4)
  475. #define RTCCON10 SFR_RW (SFR10_BASE + 0x2a*4)
  476. #define RTCCON11 SFR_RW (SFR10_BASE + 0x2b*4)
  477. #define RTCCON12 SFR_RW (SFR10_BASE + 0x2c*4)
  478. #define RTCCON13 SFR_RW (SFR10_BASE + 0x2d*4)
  479. #define RTCCON14 SFR_RW (SFR10_BASE + 0x2e*4)
  480. #define RTCCON15 SFR_RW (SFR10_BASE + 0x2f*4)
  481. #define WPTCON SFR_RW (SFR10_BASE + 0x30*4)
  482. #define WPTPND SFR_RW (SFR10_BASE + 0x31*4)
  483. #define WPTADR SFR_RW (SFR10_BASE + 0x32*4)
  484. #define WPTDAT SFR_RW (SFR10_BASE + 0x33*4)
  485. #define FPGATBBGCLR SFR_RW (SFR10_BASE + 0x39*4)
  486. #define FPGATBBGSET SFR_RW (SFR10_BASE + 0x3a*4)
  487. #define FPGAUTCON SFR_RW (SFR10_BASE + 0x3b*4)
  488. #define FPGAUTDATA SFR_RW (SFR10_BASE + 0x3c*4)
  489. #define FPGAUTCPND SFR_RW (SFR10_BASE + 0x3d*4)
  490. #define FPGAUTBAUD SFR_RW (SFR10_BASE + 0x3e*4)
  491. #define FPGATEST SFR_RW (SFR10_BASE + 0x3f*4)
  492. #define FPGAUTCON2 SFR_RW (SFR11_BASE + 0x36*4)
  493. #define FPGAUTDATA2 SFR_RW (SFR11_BASE + 0x37*4)
  494. #define FPGAUTCPND2 SFR_RW (SFR11_BASE + 0x38*4)
  495. #define FPGAUTBAUD2 SFR_RW (SFR11_BASE + 0x39*4)
  496. #define TIM_CR1 SFR_RW (SFR12_BASE + 0x00*4)
  497. #define TIM_CR2 SFR_RW (SFR12_BASE + 0x01*4)
  498. #define TIM_SMCR SFR_RW (SFR12_BASE + 0x02*4)
  499. #define TIM_DIER SFR_RW (SFR12_BASE + 0x03*4)
  500. #define TIM_SR SFR_RW (SFR12_BASE + 0x04*4)
  501. #define TIM_EGR SFR_RW (SFR12_BASE + 0x05*4)
  502. #define TIM_CCMR1 SFR_RW (SFR12_BASE + 0x06*4)
  503. #define TIM_CCMR2 SFR_RW (SFR12_BASE + 0x07*4)
  504. #define TIM_CCER SFR_RW (SFR12_BASE + 0x08*4)
  505. #define TIM_CNT SFR_RW (SFR12_BASE + 0x09*4)
  506. #define TIM_PSC SFR_RW (SFR12_BASE + 0x0a*4)
  507. #define TIM_ARR SFR_RW (SFR12_BASE + 0x0b*4)
  508. #define TIM_RCR SFR_RW (SFR12_BASE + 0x0c*4)
  509. #define TIM_CCR1 SFR_RW (SFR12_BASE + 0x0d*4)
  510. #define TIM_CCR2 SFR_RW (SFR12_BASE + 0x0e*4)
  511. #define TIM_CCR3 SFR_RW (SFR12_BASE + 0x0f*4)
  512. #define TIM_CCR4 SFR_RW (SFR12_BASE + 0x10*4)
  513. #define TIM_BDTR SFR_RW (SFR12_BASE + 0x11*4)
  514. #define TIM_SARAD SFR_RW (SFR12_BASE + 0x12*4)
  515. #define LEDCCON SFR_RW (SFR12_BASE + 0x30*4)
  516. #define LEDCFD SFR_RW (SFR12_BASE + 0x31*4)
  517. #define LEDCLP SFR_RW (SFR12_BASE + 0x32*4)
  518. #define LEDCTIX SFR_RW (SFR12_BASE + 0x33*4)
  519. #define LEDCRSTX SFR_RW (SFR12_BASE + 0x34*4)
  520. #define LEDCADDR SFR_RW (SFR12_BASE + 0x35*4)
  521. #define LEDCCNT SFR_RW (SFR12_BASE + 0x36*4)
  522. #define LEDCPEND SFR_RW (SFR12_BASE + 0x37*4)
  523. // SFR bank13 define
  524. #define QDECXCON SFR_RW (SFR13_BASE + 0x00*4)
  525. #define QDECYCON SFR_RW (SFR13_BASE + 0x01*4)
  526. #define QDECZCON SFR_RW (SFR13_BASE + 0x02*4)
  527. #define QDECXCPND SFR_WO (SFR13_BASE + 0x03*4)
  528. #define QDECYCPND SFR_WO (SFR13_BASE + 0x04*4)
  529. #define QDECZCPND SFR_WO (SFR13_BASE + 0x05*4)
  530. #define QDECXDAT SFR_RW (SFR13_BASE + 0x06*4)
  531. #define QDECYDAT SFR_RW (SFR13_BASE + 0x07*4)
  532. #define QDECZDAT SFR_RW (SFR13_BASE + 0x08*4)
  533. #define SDADCCON SFR_RW (SFR13_BASE + 0x09*4)
  534. #define SDADCGAINCON SFR_RW (SFR13_BASE + 0x0a*4)
  535. #define SDADCGETDCCON SFR_RW (SFR13_BASE + 0x0b*4)
  536. #define SDADCDMACON SFR_RW (SFR13_BASE + 0x0c*4)
  537. #define SDADCDMAADDR SFR_RW (SFR13_BASE + 0x0d*4)
  538. #define SDADCDMASIZE SFR_RW (SFR13_BASE + 0x0e*4)
  539. #define SDADCDMAPEND SFR_RO (SFR13_BASE + 0x0f*4)
  540. #define SDADCDMACPND SFR_WO (SFR13_BASE + 0x10*4)
  541. #define SDADCRAMTADDR SFR_RW (SFR13_BASE + 0x11*4)
  542. #define SDADCRAMTDATA SFR_RW (SFR13_BASE + 0x12*4)
  543. #define DACDMAINCON SFR_RW (SFR13_BASE + 0x13*4)
  544. #define DACDMAINADDR SFR_RW (SFR13_BASE + 0x14*4)
  545. #define DACDMAINSIZE SFR_RW (SFR13_BASE + 0x15*4)
  546. #define DACDMAINPEND SFR_RO (SFR13_BASE + 0x16*4)
  547. #define DACDMAINCPND SFR_WO (SFR13_BASE + 0x17*4)
  548. #define SDDACCON SFR_RW (SFR13_BASE + 0x18*4)
  549. #define AUANGCON0 SFR_RW (SFR13_BASE + 0x19*4)
  550. #define AUANGCON1 SFR_RW (SFR13_BASE + 0x1a*4)
  551. #define LPWMSTCON SFR_RW (SFR13_BASE + 0x20*4)
  552. #define LPWMSWCON SFR_RW (SFR13_BASE + 0x21*4)
  553. #define LPWMCMCON SFR_RW (SFR13_BASE + 0x22*4)
  554. #define LPWMACON SFR_RW (SFR13_BASE + 0x23*4)
  555. #define LPWMBCON SFR_RW (SFR13_BASE + 0x24*4)
  556. #define LPWMCCON SFR_RW (SFR13_BASE + 0x25*4)
  557. #define LPWMDCON SFR_RW (SFR13_BASE + 0x26*4)
  558. #define LPWMECON SFR_RW (SFR13_BASE + 0x27*4)
  559. #define LPWMFCON SFR_RW (SFR13_BASE + 0x28*4)
  560. #define LPWMHLCON SFR_RW (SFR13_BASE + 0x29*4)
  561. #define LPWMPND SFR_RW (SFR13_BASE + 0x2a*4)
  562. #ifndef __ASSEMBLER__
  563. enum funo_select_tbl {
  564. FO_AUDIO = 2,
  565. FO_SDIO = 3,
  566. FO_I2CSCL = 5,
  567. FO_I2CSDA,
  568. FO_T3PWM0,
  569. FO_T3PWM1,
  570. FO_T3PWM2,
  571. FO_TOC1, //10
  572. FO_TOC1N,
  573. FO_TOC2,
  574. FO_TOC2N,
  575. FO_TOC3,
  576. FO_TOC3N, //15
  577. FO_TOC4,
  578. FO_UR0TX,
  579. FO_UR1TX,
  580. FO_HURTX,
  581. FO_HURRTS, //20
  582. FO_SPI1D0,
  583. FO_SPI1D1,
  584. FO_SPI1D2,
  585. FO_SPI1D3,
  586. FO_SPI1CLK, //25
  587. FO_LPWM,
  588. FO_LEDCDAT,
  589. FO_IRTX,
  590. FO_CLKOUT, //29
  591. };
  592. enum funi_io_tbl {
  593. FI_PA0 = 1,
  594. FI_PA1,
  595. FI_PA2,
  596. FI_PA3,
  597. FI_PA4,
  598. FI_PA5,
  599. FI_PA6,
  600. FI_PA7,
  601. FI_PA8,
  602. FI_PA9,
  603. FI_PA10,
  604. FI_PA11,
  605. FI_PA12,
  606. FI_PA13,
  607. FI_PA14,
  608. FI_PA15,
  609. FI_PB0 = 17,
  610. FI_PB1,
  611. FI_PB2,
  612. FI_PB3,
  613. FI_PB4,
  614. FI_PB5,
  615. FI_PB6,
  616. FI_PB7,
  617. FI_PB8,
  618. FI_PB9,
  619. FI_PG1,
  620. FI_PG2,
  621. FI_PG4,
  622. FI_PG5,
  623. };
  624. #endif
  625. #define FUNO_PA0SEL(funo_sel) FUNCOMCON0 = (funo_sel<< 0)
  626. #define FUNO_PA1SEL(funo_sel) FUNCOMCON0 = (funo_sel<< 8)
  627. #define FUNO_PA2SEL(funo_sel) FUNCOMCON0 = (funo_sel<<16)
  628. #define FUNO_PA3SEL(funo_sel) FUNCOMCON0 = (funo_sel<<24)
  629. #define FUNO_PA4SEL(funo_sel) FUNCOMCON1 = (funo_sel<< 0)
  630. #define FUNO_PA5SEL(funo_sel) FUNCOMCON1 = (funo_sel<< 8)
  631. #define FUNO_PA6SEL(funo_sel) FUNCOMCON1 = (funo_sel<<16)
  632. #define FUNO_PA7SEL(funo_sel) FUNCOMCON1 = (funo_sel<<24)
  633. #define FUNO_PA8SEL(funo_sel) FUNCOMCON2 = (funo_sel<< 0)
  634. #define FUNO_PA9SEL(funo_sel) FUNCOMCON2 = (funo_sel<< 8)
  635. #define FUNO_PA10SEL(funo_sel) FUNCOMCON2 = (funo_sel<<16)
  636. #define FUNO_PA11SEL(funo_sel) FUNCOMCON2 = (funo_sel<<24)
  637. #define FUNO_PA12SEL(funo_sel) FUNCOMCON3 = (funo_sel<< 0)
  638. #define FUNO_PA13SEL(funo_sel) FUNCOMCON3 = (funo_sel<< 8)
  639. #define FUNO_PA14SEL(funo_sel) FUNCOMCON3 = (funo_sel<<16)
  640. #define FUNO_PA15SEL(funo_sel) FUNCOMCON3 = (funo_sel<<24)
  641. #define FUNO_PB0SEL(funo_sel) FUNCOMCON4 = (funo_sel<< 0)
  642. #define FUNO_PB1SEL(funo_sel) FUNCOMCON4 = (funo_sel<< 8)
  643. #define FUNO_PB2SEL(funo_sel) FUNCOMCON4 = (funo_sel<<16)
  644. #define FUNO_PB3SEL(funo_sel) FUNCOMCON4 = (funo_sel<<24)
  645. #define FUNO_PB4SEL(funo_sel) FUNCOMCON5 = (funo_sel<< 0)
  646. #define FUNO_PB5SEL(funo_sel) FUNCOMCON5 = (funo_sel<< 8)
  647. #define FUNO_PB6SEL(funo_sel) FUNCOMCON5 = (funo_sel<<16)
  648. #define FUNO_PB7SEL(funo_sel) FUNCOMCON5 = (funo_sel<<24)
  649. #define FUNO_PB8SEL(funo_sel) FUNCOMCON6 = (funo_sel<< 0)
  650. #define FUNO_PB9SEL(funo_sel) FUNCOMCON6 = (funo_sel<< 8)
  651. #define FUNO_PG1SEL(funo_sel) FUNCOMCON7 = (funo_sel<< 0)
  652. #define FUNO_PG2SEL(funo_sel) FUNCOMCON7 = (funo_sel<< 8)
  653. #define FUNO_PG4SEL(funo_sel) FUNCOMCON7 = (funo_sel<<16)
  654. #define FUNO_PG5SEL(funo_sel) FUNCOMCON7 = (funo_sel<<24)
  655. #define FUNI_UR0RX(funi_io) FUNCIMCON0 = (funi_io<< 0) //0
  656. #define FUNI_UR1RX(funi_io) FUNCIMCON0 = (funi_io<< 8)
  657. #define FUNI_SPI1CLK(funi_io) FUNCIMCON0 = (funi_io<<16)
  658. #define FUNI_SPI1DI0(funi_io) FUNCIMCON0 = (funi_io<<24)
  659. #define FUNI_SPI1DI1(funi_io) FUNCIMCON1 = (funi_io<< 0) //4
  660. #define FUNI_HURRX(funi_io) FUNCIMCON1 = (funi_io<< 8)
  661. #define FUNI_HURCTS(funi_io) FUNCIMCON1 = (funi_io<<16)
  662. #define FUNI_T0CAP(funi_io) FUNCIMCON1 = (funi_io<<24)
  663. #define FUNI_T1CAP(funi_io) FUNCIMCON2 = (funi_io<< 0) //8
  664. #define FUNI_T2CAP(funi_io) FUNCIMCON2 = (funi_io<< 8)
  665. #define FUNI_T3CAP(funi_io) FUNCIMCON2 = (funi_io<<16)
  666. #define FUNI_TBKIN(funi_io) FUNCIMCON2 = (funi_io<<24)
  667. #define FUNI_TETR(funi_io) FUNCIMCON3 = (funi_io<< 0) //12
  668. #define FUNI_I2CSCL(funi_io) FUNCIMCON3 = (funi_io<< 8)
  669. #define FUNI_I2CSDA(funi_io) FUNCIMCON3 = (funi_io<<16)
  670. #define FUNI_IRRX(funi_io) FUNCIMCON3 = (funi_io<<24)
  671. #define FUNI_QDECXDI0(funi_io) FUNCIMCON4 = (funi_io<< 0) //16
  672. #define FUNI_QDECXDI1(funi_io) FUNCIMCON4 = (funi_io<< 8)
  673. #define FUNI_QDECYDI0(funi_io) FUNCIMCON4 = (funi_io<<16)
  674. #define FUNI_QDECYDI1(funi_io) FUNCIMCON4 = (funi_io<<24)
  675. #define FUNI_QDECZDI0(funi_io) FUNCIMCON5 = (funi_io<< 0) //20
  676. #define FUNI_QDECZDI1(funi_io) FUNCIMCON5 = (funi_io<< 8)
  677. #define FUNI_SDCMD(funi_io) FUNCIMCON5 = (funi_io<<16)
  678. #define FUNI_SDDAT0(funi_io) FUNCIMCON5 = (funi_io<<24)
  679. #define FUNI_SPI0CLK(funi_io) FUNCIMCON6 = (funi_io<< 0) //24
  680. #define FUNI_SPI0DI0(funi_io) FUNCIMCON6 = (funi_io<< 8)
  681. #define FUNI_SP10DI1(funi_io) FUNCIMCON6 = (funi_io<<16)
  682. #define FUNI_CH27(funi_io) FUNCIMCON6 = (funi_io<<24)
  683. #endif