ui2c_reg.h 45 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583
  1. /**************************************************************************//**
  2. * @file ui2c_reg.h
  3. * @version V1.00
  4. * @brief UI2C register definition header file
  5. *
  6. * SPDX-License-Identifier: Apache-2.0
  7. * @copyright (C) 2017-2020 Nuvoton Technology Corp. All rights reserved.
  8. *****************************************************************************/
  9. #ifndef __UI2C_REG_H__
  10. #define __UI2C_REG_H__
  11. #if defined ( __CC_ARM )
  12. #pragma anon_unions
  13. #endif
  14. /**
  15. @addtogroup REGISTER Control Register
  16. @{
  17. */
  18. /**
  19. @addtogroup UI2C I2C Mode of USCI Controller(UI2C)
  20. Memory Mapped Structure for UI2C Controller
  21. @{ */
  22. typedef struct
  23. {
  24. /**
  25. * @var UI2C_T::CTL
  26. * Offset: 0x00 USCI Control Register
  27. * ---------------------------------------------------------------------------------------------------
  28. * |Bits |Field |Descriptions
  29. * | :----: | :----: | :---- |
  30. * |[2:0] |FUNMODE |Function Mode
  31. * | | |This bit field selects the protocol for this USCI controller
  32. * | | |Selecting a protocol that is not available or a reserved combination disables the USCI
  33. * | | |When switching between two protocols, the USCI has to be disabled before selecting a new protocol
  34. * | | |Simultaneously, the USCI will be reset when user write 000 to FUNMODE.
  35. * | | |000 = The USCI is disabled. All protocol related state machines are set to idle state.
  36. * | | |001 = The SPI protocol is selected.
  37. * | | |010 = The UART protocol is selected.
  38. * | | |100 = The I2C protocol is selected.
  39. * | | |Note: Other bit combinations are reserved.
  40. * @var UI2C_T::BRGEN
  41. * Offset: 0x08 USCI Baud Rate Generator Register
  42. * ---------------------------------------------------------------------------------------------------
  43. * |Bits |Field |Descriptions
  44. * | :----: | :----: | :---- |
  45. * |[0] |RCLKSEL |Reference Clock Source Selection
  46. * | | |This bit selects the source signal of reference clock (fREF_CLK).
  47. * | | |0 = Peripheral device clock fPCLK.
  48. * | | |1 = Reserved.
  49. * |[1] |PTCLKSEL |Protocol Clock Source Selection
  50. * | | |This bit selects the source signal of protocol clock (fPROT_CLK).
  51. * | | |0 = Reference clock fREF_CLK.
  52. * | | |1 = fREF_CLK2 (its frequency is half of fREF_CLK).
  53. * |[3:2] |SPCLKSEL |Sample Clock Source Selection
  54. * | | |This bit field used for the clock source selection of a sample clock (fSAMP_CLK) for the protocol processor.
  55. * | | |00 = fSAMP_CLK = fDIV_CLK.
  56. * | | |01 = fSAMP_CLK = fPROT_CLK.
  57. * | | |10 = fSAMP_CLK = fSCLK.
  58. * | | |11 = fSAMP_CLK = fREF_CLK.
  59. * |[4] |TMCNTEN |Time Measurement Counter Enable Bit
  60. * | | |This bit enables the 10-bit timing measurement counter.
  61. * | | |0 = Time measurement counter is Disabled.
  62. * | | |1 = Time measurement counter is Enabled.
  63. * |[5] |TMCNTSRC |Time Measurement Counter Clock Source Selection
  64. * | | |0 = Time measurement counter with fPROT_CLK.
  65. * | | |1 = Time measurement counter with fDIV_CLK.
  66. * |[9:8] |PDSCNT |Pre-divider for Sample Counter
  67. * | | |This bit field defines the divide ratio of the clock division from sample clock fSAMP_CLK
  68. * | | |The divided frequency fPDS_CNT = fSAMP_CLK / (PDSCNT+1).
  69. * |[14:10] |DSCNT |Denominator for Sample Counter
  70. * | | |This bit field defines the divide ratio of the sample clock fSAMP_CLK.
  71. * | | |The divided frequency fDS_CNT = fPDS_CNT / (DSCNT+1).
  72. * | | |Note: The maximum value of DSCNT is 0xF on UART mode and suggest to set over 4 to confirm the receiver data is sampled in right value
  73. * |[25:16] |CLKDIV |Clock Divider
  74. * | | |This bit field defines the ratio between the protocol clock frequency fPROT_CLK and the clock divider frequency fDIV_CLK (fDIV_CLK = fPROT_CLK / (CLKDIV+1) ).
  75. * | | |Note: In UART function, it can be updated by hardware in the 4th falling edge of the input data 0x55 when the auto baud rate function (ABREN(USCI_PROTCTL[6])) is enabled
  76. * | | |The revised value is the average bit time between bit 5 and bit 6
  77. * | | |The user can use revised CLKDIV and new BRDETITV (USCI_PROTCTL[24:16]) to calculate the precise baud rate.
  78. * @var UI2C_T::LINECTL
  79. * Offset: 0x2C USCI Line Control Register
  80. * ---------------------------------------------------------------------------------------------------
  81. * |Bits |Field |Descriptions
  82. * | :----: | :----: | :---- |
  83. * |[0] |LSB |LSB First Transmission Selection
  84. * | | |0 = The MSB, which bit of transmit/receive data buffer depends on the setting of DWIDTH, is transmitted/received first.
  85. * | | |1 = The LSB, the bit 0 of data buffer, will be transmitted/received first.
  86. * |[11:8] |DWIDTH |Word Length of Transmission
  87. * | | |This bit field defines the data word length (amount of bits) for reception and transmission
  88. * | | |The data word is always right-aligned in the data buffer
  89. * | | |USCI support word length from 4 to 16 bits.
  90. * | | |0x0: The data word contains 16 bits located at bit positions [15:0].
  91. * | | |0x1: Reserved.
  92. * | | |0x2: Reserved.
  93. * | | |0x3: Reserved.
  94. * | | |0x4: The data word contains 4 bits located at bit positions [3:0].
  95. * | | |0x5: The data word contains 5 bits located at bit positions [4:0].
  96. * | | |...
  97. * | | |0xF: The data word contains 15 bits located at bit positions [14:0].
  98. * | | |Note: In UART protocol, the length can be configured as 6~13 bits
  99. * | | |And in I2C protocol, the length fixed as 8 bits.
  100. * @var UI2C_T::TXDAT
  101. * Offset: 0x30 USCI Transmit Data Register
  102. * ---------------------------------------------------------------------------------------------------
  103. * |Bits |Field |Descriptions
  104. * | :----: | :----: | :---- |
  105. * |[15:0] |TXDAT |Transmit Data
  106. * | | |Software can use this bit field to write 16-bit transmit data for transmission.
  107. * @var UI2C_T::RXDAT
  108. * Offset: 0x34 USCI Receive Data Register
  109. * ---------------------------------------------------------------------------------------------------
  110. * |Bits |Field |Descriptions
  111. * | :----: | :----: | :---- |
  112. * |[15:0] |RXDAT |Received Data
  113. * | | |This bit field monitors the received data which stored in receive data buffer.
  114. * | | |Note 1: In I2C protocol, RXDAT[12:8] indicate the different transmission conditions which defined in I2C.
  115. * | | |Note 2: In UART protocol, RXDAT[15:13] indicate the same frame status of BREAK, FRMERR and PARITYERR (USCI_PROTSTS[7:5]).
  116. * @var UI2C_T::DEVADDR0
  117. * Offset: 0x44 USCI Device Address Register 0
  118. * ---------------------------------------------------------------------------------------------------
  119. * |Bits |Field |Descriptions
  120. * | :----: | :----: | :---- |
  121. * |[9:0] |DEVADDR |Device Address
  122. * | | |In I2C protocol, this bit field contains the programmed slave address
  123. * | | |If the first received address byte are 1111 0AAXB, the AA bits are compared to the bits DEVADDR[9:8] to check for address match, where the X is R/W bit
  124. * | | |Then the second address byte is also compared to DEVADDR[7:0].
  125. * | | |Note 1: The DEVADDR [9:7] must be set 3'b000 when I2C operating in 7-bit address mode.
  126. * | | |Note 2: When software set 10'h000, the address can not be used.
  127. * @var UI2C_T::DEVADDR1
  128. * Offset: 0x48 USCI Device Address Register 1
  129. * ---------------------------------------------------------------------------------------------------
  130. * |Bits |Field |Descriptions
  131. * | :----: | :----: | :---- |
  132. * |[9:0] |DEVADDR |Device Address
  133. * | | |In I2C protocol, this bit field contains the programmed slave address
  134. * | | |If the first received address byte are 1111 0AAXB, the AA bits are compared to the bits DEVADDR[9:8] to check for address match, where the X is R/W bit
  135. * | | |Then the second address byte is also compared to DEVADDR[7:0].
  136. * | | |Note 1: The DEVADDR [9:7] must be set 3'000 when I2C operating in 7-bit address mode.
  137. * | | |Note 2: When software set 10'h000, the address can not be used.
  138. * @var UI2C_T::ADDRMSK0
  139. * Offset: 0x4C USCI Device Address Mask Register 0
  140. * ---------------------------------------------------------------------------------------------------
  141. * |Bits |Field |Descriptions
  142. * | :----: | :----: | :---- |
  143. * |[9:0] |ADDRMSK |USCI Device Address Mask
  144. * | | |0 = Mask Disabled (the received corresponding register bit should be exact the same as address register.).
  145. * | | |1 = Mask Enabled (the received corresponding address bit is don't care.).
  146. * | | |USCI support multiple address recognition with two address mask register
  147. * | | |When the bit in the address mask register is set to one, it means the received corresponding address bit is don't-care
  148. * | | |If the bit is set to zero, that means the received corresponding register bit should be exact the same as address register.
  149. * | | |Note: The wake-up function can not use address mask.
  150. * @var UI2C_T::ADDRMSK1
  151. * Offset: 0x50 USCI Device Address Mask Register 1
  152. * ---------------------------------------------------------------------------------------------------
  153. * |Bits |Field |Descriptions
  154. * | :----: | :----: | :---- |
  155. * |[9:0] |ADDRMSK |USCI Device Address Mask
  156. * | | |0 = Mask Disabled (the received corresponding register bit should be exact the same as address register.).
  157. * | | |1 = Mask Enabled (the received corresponding address bit is don't care.).
  158. * | | |USCI support multiple address recognition with two address mask register
  159. * | | |When the bit in the address mask register is set to one, it means the received corresponding address bit is don't-care
  160. * | | |If the bit is set to zero, that means the received corresponding register bit should be exact the same as address register.
  161. * | | |Note: The wake-up function can not use address mask.
  162. * @var UI2C_T::WKCTL
  163. * Offset: 0x54 USCI Wake-up Control Register
  164. * ---------------------------------------------------------------------------------------------------
  165. * |Bits |Field |Descriptions
  166. * | :----: | :----: | :---- |
  167. * |[0] |WKEN |Wake-up Enable Bit
  168. * | | |0 = Wake-up function Disabled.
  169. * | | |1 = Wake-up function Enabled.
  170. * |[1] |WKADDREN |Wake-up Address Match Enable Bit
  171. * | | |0 = The chip is woken up according data toggle.
  172. * | | |1 = The chip is woken up according address match.
  173. * @var UI2C_T::WKSTS
  174. * Offset: 0x58 USCI Wake-up Status Register
  175. * ---------------------------------------------------------------------------------------------------
  176. * |Bits |Field |Descriptions
  177. * | :----: | :----: | :---- |
  178. * |[0] |WKF |Wake-up Flag
  179. * | | |When chip is woken up from Power-down mode, this bit is set to 1
  180. * | | |Software can write 1 to clear this bit.
  181. * @var UI2C_T::PROTCTL
  182. * Offset: 0x5C USCI Protocol Control Register
  183. * ---------------------------------------------------------------------------------------------------
  184. * |Bits |Field |Descriptions
  185. * | :----: | :----: | :---- |
  186. * |[0] |GCFUNC |General Call Function
  187. * | | |0 = General Call Function Disabled.
  188. * | | |1 = General Call Function Enabled.
  189. * |[1] |AA |Assert Acknowledge Control
  190. * | | |When AA=1 prior to address or data received, an acknowledged (low level to SDA) will be returned during the acknowledge clock pulse on the SCL line when 1.) A slave is acknowledging the address sent from master, 2.) The receiver devices are acknowledging the data sent by transmitter
  191. * | | |When AA=0 prior to address or data received, a Not acknowledged (high level to SDA) will be returned during the acknowledge clock pulse on the SCL line.
  192. * |[2] |STO |I2C STOP Control
  193. * | | |In Master mode, setting STO to transmit a STOP condition to bus then I2C hardware will check the bus condition if a STOP condition is detected this bit will be cleared by hardware automatically
  194. * | | |In a slave mode, setting STO resets I2C hardware to the defined "not addressed" slave mode when bus error (USCI_PROTSTS.ERRIF = 1).
  195. * |[3] |STA |I2C START Control
  196. * | | |Setting STA to logic 1 to enter Master mode, the I2C hardware sends a START or repeat START condition to bus when the bus is free.
  197. * |[4] |ADDR10EN |Address 10-bit Function Enable Bit
  198. * | | |0 = Address match 10 bit function is disabled.
  199. * | | |1 = Address match 10 bit function is enabled.
  200. * |[5] |PTRG |I2C Protocol Trigger (Write Only)
  201. * | | |When a new state is present in the USCI_PROTSTS register, if the related interrupt enable bits are set, the I2C interrupt is requested
  202. * | | |It must write one by software to this bit after the related interrupt flags are set to 1 and the I2C protocol function will go ahead until the STOP is active or the PROTEN is disabled.
  203. * | | |0 = I2C's stretch disabled and the I2C protocol function will go ahead.
  204. * | | |1 = I2C's stretch active.
  205. * |[8] |SCLOUTEN |SCL Output Enable Bit
  206. * | | |This bit enables monitor pulling SCL to low
  207. * | | |This monitor will pull SCL to low until it has had time to respond to an I2C interrupt.
  208. * | | |0 = SCL output will be forced high due to open drain mechanism.
  209. * | | |1 = I2C module may act as a slave peripheral just like in normal operation, the I2C holds the clock line low until it has had time to clear I2C interrupt.
  210. * |[9] |MONEN |Monitor Mode Enable Bit
  211. * | | |This bit enables monitor mode
  212. * | | |In monitor mode the SDA output will be put in high impedance mode
  213. * | | |This prevents the I2C module from outputting data of any kind (including ACK) onto the I2C data bus.
  214. * | | |0 = The monitor mode is disabled.
  215. * | | |1 = The monitor mode is enabled.
  216. * | | |Note: Depending on the state of the SCLOUTEN bit, the SCL output may be also forced high, preventing the module from having control over the I2C clock line.
  217. * |[25:16] |TOCNT |Time-out Clock Cycle
  218. * | | |This bit field indicates how many clock cycle selected by TMCNTSRC (USCI_BRGEN [5]) when each interrupt flags are clear
  219. * | | |The time-out is enable when TOCNT bigger than 0.
  220. * | | |Note: The TMCNTSRC (USCI_BRGEN [5]) must be set zero on I2C mode.
  221. * |[31] |PROTEN |I2C Protocol Enable Bit
  222. * | | |0 = I2C Protocol disable.
  223. * | | |1 = I2C Protocol enable.
  224. * @var UI2C_T::PROTIEN
  225. * Offset: 0x60 USCI Protocol Interrupt Enable Register
  226. * ---------------------------------------------------------------------------------------------------
  227. * |Bits |Field |Descriptions
  228. * | :----: | :----: | :---- |
  229. * |[0] |TOIEN |Time-out Interrupt Enable Control
  230. * | | |In I2C protocol, this bit enables the interrupt generation in case of a time-out event.
  231. * | | |0 = The time-out interrupt is disabled.
  232. * | | |1 = The time-out interrupt is enabled.
  233. * |[1] |STARIEN |Start Condition Received Interrupt Enable Control
  234. * | | |This bit enables the generation of a protocol interrupt if a start condition is detected.
  235. * | | |0 = The start condition interrupt is disabled.
  236. * | | |1 = The start condition interrupt is enabled.
  237. * |[2] |STORIEN |Stop Condition Received Interrupt Enable Control
  238. * | | |This bit enables the generation of a protocol interrupt if a stop condition is detected.
  239. * | | |0 = The stop condition interrupt is disabled.
  240. * | | |1 = The stop condition interrupt is enabled.
  241. * |[3] |NACKIEN |Non - Acknowledge Interrupt Enable Control
  242. * | | |This bit enables the generation of a protocol interrupt if a non - acknowledge is detected by a master.
  243. * | | |0 = The non - acknowledge interrupt is disabled.
  244. * | | |1 = The non - acknowledge interrupt is enabled.
  245. * |[4] |ARBLOIEN |Arbitration Lost Interrupt Enable Control
  246. * | | |This bit enables the generation of a protocol interrupt if an arbitration lost event is detected.
  247. * | | |0 = The arbitration lost interrupt is disabled.
  248. * | | |1 = The arbitration lost interrupt is enabled.
  249. * |[5] |ERRIEN |Error Interrupt Enable Control
  250. * | | |This bit enables the generation of a protocol interrupt if an I2C error condition is detected (indicated by ERR (USCI_PROTSTS [16])).
  251. * | | |0 = The error interrupt is disabled.
  252. * | | |1 = The error interrupt is enabled.
  253. * |[6] |ACKIEN |Acknowledge Interrupt Enable Control
  254. * | | |This bit enables the generation of a protocol interrupt if an acknowledge is detected by a master.
  255. * | | |0 = The acknowledge interrupt is disabled.
  256. * | | |1 = The acknowledge interrupt is enabled.
  257. * @var UI2C_T::PROTSTS
  258. * Offset: 0x64 USCI Protocol Status Register
  259. * ---------------------------------------------------------------------------------------------------
  260. * |Bits |Field |Descriptions
  261. * | :----: | :----: | :---- |
  262. * |[5] |TOIF |Time-out Interrupt Flag
  263. * | | |0 = A time-out interrupt status has not occurred.
  264. * | | |1 = A time-out interrupt status has occurred.
  265. * | | |Note: It is cleared by software writing one into this bit
  266. * |[6] |ONBUSY |On Bus Busy
  267. * | | |Indicates that a communication is in progress on the bus
  268. * | | |It is set by hardware when a START condition is detected
  269. * | | |It is cleared by hardware when a STOP condition is detected
  270. * | | |0 = The bus is IDLE (both SCLK and SDA High).
  271. * | | |1 = The bus is busy.
  272. * |[8] |STARIF |Start Condition Received Interrupt Flag
  273. * | | |This bit indicates that a start condition or repeated start condition has been detected on master mode
  274. * | | |However, this bit also indicates that a repeated start condition has been detected on slave mode.
  275. * | | |A protocol interrupt can be generated if USCI_PROTCTL.STARIEN = 1.
  276. * | | |0 = A start condition has not yet been detected.
  277. * | | |1 = A start condition has been detected.
  278. * | | |It is cleared by software writing one into this bit
  279. * |[9] |STORIF |Stop Condition Received Interrupt Flag
  280. * | | |This bit indicates that a stop condition has been detected on the I2C bus lines
  281. * | | |A protocol interrupt can be generated if USCI_PROTCTL.STORIEN = 1.
  282. * | | |0 = A stop condition has not yet been detected.
  283. * | | |1 = A stop condition has been detected.
  284. * | | |It is cleared by software writing one into this bit
  285. * | | |Note: This bit is set when slave RX mode.
  286. * |[10] |NACKIF |Non - Acknowledge Received Interrupt Flag
  287. * | | |This bit indicates that a non - acknowledge has been received in master mode
  288. * | | |A protocol interrupt can be generated if USCI_PROTCTL.NACKIEN = 1.
  289. * | | |0 = A non - acknowledge has not been received.
  290. * | | |1 = A non - acknowledge has been received.
  291. * | | |It is cleared by software writing one into this bit
  292. * |[11] |ARBLOIF |Arbitration Lost Interrupt Flag
  293. * | | |This bit indicates that an arbitration has been lost
  294. * | | |A protocol interrupt can be generated if USCI_PROTCTL.ARBLOIEN = 1.
  295. * | | |0 = An arbitration has not been lost.
  296. * | | |1 = An arbitration has been lost.
  297. * | | |It is cleared by software writing one into this bit
  298. * |[12] |ERRIF |Error Interrupt Flag
  299. * | | |This bit indicates that a Bus Error occurs when a START or STOP condition is present at an illegal position in the formation frame
  300. * | | |Example of illegal position are during the serial transfer of an address byte, a data byte or an acknowledge bit
  301. * | | |A protocol interrupt can be generated if USCI_PROTCTL.ERRIEN = 1.
  302. * | | |0 = An I2C error has not been detected.
  303. * | | |1 = An I2C error has been detected.
  304. * | | |It is cleared by software writing one into this bit
  305. * | | |Note: This bit is set when slave mode, user must write one into STO register to the defined "not addressed" slave mode.
  306. * |[13] |ACKIF |Acknowledge Received Interrupt Flag
  307. * | | |This bit indicates that an acknowledge has been received in master mode
  308. * | | |A protocol interrupt can be generated if USCI_PROTCTL.ACKIEN = 1.
  309. * | | |0 = An acknowledge has not been received.
  310. * | | |1 = An acknowledge has been received.
  311. * | | |It is cleared by software writing one into this bit
  312. * |[14] |SLASEL |Slave Select Status
  313. * | | |This bit indicates that this device has been selected as slave.
  314. * | | |0 = The device is not selected as slave.
  315. * | | |1 = The device is selected as slave.
  316. * | | |Note: This bit has no interrupt signal, and it will be cleared automatically by hardware.
  317. * |[15] |SLAREAD |Slave Read Request Status
  318. * | | |This bit indicates that a slave read request has been detected.
  319. * | | |0 = A slave R/W bit is 1 has not been detected.
  320. * | | |1 = A slave R/W bit is 1 has been detected.
  321. * | | |Note: This bit has no interrupt signal, and it will be cleared automatically by hardware.
  322. * |[16] |WKAKDONE |Wakeup Address Frame Acknowledge Bit Done
  323. * | | |0 = The ACK bit cycle of address match frame isn't done.
  324. * | | |1 = The ACK bit cycle of address match frame is done in power-down.
  325. * | | |Note: This bit can't release when WKUPIF is set.
  326. * |[17] |WRSTSWK |Read/Write Status Bit in Address Wakeup Frame
  327. * | | |0 = Write command be record on the address match wakeup frame.
  328. * | | |1 = Read command be record on the address match wakeup frame.
  329. * |[18] |BUSHANG |Bus Hang-up
  330. * | | |This bit indicates bus hang-up status
  331. * | | |There is 4-bit counter count when SCL hold high and refer fSAMP_CLK
  332. * | | |The hang-up counter will count to overflow and set this bit when SDA is low
  333. * | | |The counter will be reset by falling edge of SCL signal.
  334. * | | |0 = The bus is normal status for transmission.
  335. * | | |1 = The bus is hang-up status for transmission.
  336. * | | |Note: This bit has no interrupt signal, and it will be cleared automatically by hardware when a START condition is present.
  337. * |[19] |ERRARBLO |Error Arbitration Lost
  338. * | | |This bit indicates bus arbitration lost due to bigger noise which is can't be filtered by input processor
  339. * | | |The I2C can send start condition when ERRARBLO is set
  340. * | | |Thus this bit doesn't be cared on slave mode.
  341. * | | |0 = The bus is normal status for transmission.
  342. * | | |1 = The bus is error arbitration lost status for transmission.
  343. * | | |Note: This bit has no interrupt signal, and it will be cleared automatically by hardware when a START condition is present.
  344. * @var UI2C_T::ADMAT
  345. * Offset: 0x88 I2C Slave Match Address Register
  346. * ---------------------------------------------------------------------------------------------------
  347. * |Bits |Field |Descriptions
  348. * | :----: | :----: | :---- |
  349. * |[0] |ADMAT0 |USCI Address 0 Match Status Register
  350. * | | |When address 0 is matched, hardware will inform which address used
  351. * | | |This bit will set to 1, and software can write 1 to clear this bit.
  352. * |[1] |ADMAT1 |USCI Address 1 Match Status Register
  353. * | | |When address 1 is matched, hardware will inform which address used
  354. * | | |This bit will set to 1, and software can write 1 to clear this bit.
  355. * @var UI2C_T::TMCTL
  356. * Offset: 0x8C I2C Timing Configure Control Register
  357. * ---------------------------------------------------------------------------------------------------
  358. * |Bits |Field |Descriptions
  359. * | :----: | :----: | :---- |
  360. * |[8:0] |STCTL |Setup Time Configure Control Register
  361. * | | |This field is used to generate a delay timing between SDA edge and SCL rising edge in transmission mode.
  362. * | | |The delay setup time is numbers of peripheral clock = STCTL x fPCLK.
  363. * |[24:16] |HTCTL |Hold Time Configure Control Register
  364. * | | |This field is used to generate the delay timing between SCL falling edge SDA edge in
  365. * | | |transmission mode.
  366. * | | |The delay hold time is numbers of peripheral clock = HTCTL x fPCLK.
  367. */
  368. __IO uint32_t CTL; /*!< [0x0000] USCI Control Register */
  369. /// @cond HIDDEN_SYMBOLS
  370. __I uint32_t RESERVE0[1];
  371. /// @endcond //HIDDEN_SYMBOLS
  372. __IO uint32_t BRGEN; /*!< [0x0008] USCI Baud Rate Generator Register */
  373. /// @cond HIDDEN_SYMBOLS
  374. __I uint32_t RESERVE1[8];
  375. /// @endcond //HIDDEN_SYMBOLS
  376. __IO uint32_t LINECTL; /*!< [0x002c] USCI Line Control Register */
  377. __O uint32_t TXDAT; /*!< [0x0030] USCI Transmit Data Register */
  378. __I uint32_t RXDAT; /*!< [0x0034] USCI Receive Data Register */
  379. /// @cond HIDDEN_SYMBOLS
  380. __I uint32_t RESERVE2[3];
  381. /// @endcond //HIDDEN_SYMBOLS
  382. __IO uint32_t DEVADDR0; /*!< [0x0044] USCI Device Address Register 0 */
  383. __IO uint32_t DEVADDR1; /*!< [0x0048] USCI Device Address Register 1 */
  384. __IO uint32_t ADDRMSK0; /*!< [0x004c] USCI Device Address Mask Register 0 */
  385. __IO uint32_t ADDRMSK1; /*!< [0x0050] USCI Device Address Mask Register 1 */
  386. __IO uint32_t WKCTL; /*!< [0x0054] USCI Wake-up Control Register */
  387. __IO uint32_t WKSTS; /*!< [0x0058] USCI Wake-up Status Register */
  388. __IO uint32_t PROTCTL; /*!< [0x005c] USCI Protocol Control Register */
  389. __IO uint32_t PROTIEN; /*!< [0x0060] USCI Protocol Interrupt Enable Register */
  390. __IO uint32_t PROTSTS; /*!< [0x0064] USCI Protocol Status Register */
  391. /// @cond HIDDEN_SYMBOLS
  392. __I uint32_t RESERVE3[8];
  393. /// @endcond //HIDDEN_SYMBOLS
  394. __IO uint32_t ADMAT; /*!< [0x0088] I2C Slave Match Address Register */
  395. __IO uint32_t TMCTL; /*!< [0x008c] I2C Timing Configure Control Register */
  396. } UI2C_T;
  397. /**
  398. @addtogroup UI2C_CONST UI2C Bit Field Definition
  399. Constant Definitions for UI2C Controller
  400. @{ */
  401. #define UI2C_CTL_FUNMODE_Pos (0) /*!< UI2C_T::CTL: FUNMODE Position */
  402. #define UI2C_CTL_FUNMODE_Msk (0x7ul << UI2C_CTL_FUNMODE_Pos) /*!< UI2C_T::CTL: FUNMODE Mask */
  403. #define UI2C_BRGEN_RCLKSEL_Pos (0) /*!< UI2C_T::BRGEN: RCLKSEL Position */
  404. #define UI2C_BRGEN_RCLKSEL_Msk (0x1ul << UI2C_BRGEN_RCLKSEL_Pos) /*!< UI2C_T::BRGEN: RCLKSEL Mask */
  405. #define UI2C_BRGEN_PTCLKSEL_Pos (1) /*!< UI2C_T::BRGEN: PTCLKSEL Position */
  406. #define UI2C_BRGEN_PTCLKSEL_Msk (0x1ul << UI2C_BRGEN_PTCLKSEL_Pos) /*!< UI2C_T::BRGEN: PTCLKSEL Mask */
  407. #define UI2C_BRGEN_SPCLKSEL_Pos (2) /*!< UI2C_T::BRGEN: SPCLKSEL Position */
  408. #define UI2C_BRGEN_SPCLKSEL_Msk (0x3ul << UI2C_BRGEN_SPCLKSEL_Pos) /*!< UI2C_T::BRGEN: SPCLKSEL Mask */
  409. #define UI2C_BRGEN_TMCNTEN_Pos (4) /*!< UI2C_T::BRGEN: TMCNTEN Position */
  410. #define UI2C_BRGEN_TMCNTEN_Msk (0x1ul << UI2C_BRGEN_TMCNTEN_Pos) /*!< UI2C_T::BRGEN: TMCNTEN Mask */
  411. #define UI2C_BRGEN_TMCNTSRC_Pos (5) /*!< UI2C_T::BRGEN: TMCNTSRC Position */
  412. #define UI2C_BRGEN_TMCNTSRC_Msk (0x1ul << UI2C_BRGEN_TMCNTSRC_Pos) /*!< UI2C_T::BRGEN: TMCNTSRC Mask */
  413. #define UI2C_BRGEN_PDSCNT_Pos (8) /*!< UI2C_T::BRGEN: PDSCNT Position */
  414. #define UI2C_BRGEN_PDSCNT_Msk (0x3ul << UI2C_BRGEN_PDSCNT_Pos) /*!< UI2C_T::BRGEN: PDSCNT Mask */
  415. #define UI2C_BRGEN_DSCNT_Pos (10) /*!< UI2C_T::BRGEN: DSCNT Position */
  416. #define UI2C_BRGEN_DSCNT_Msk (0x1ful << UI2C_BRGEN_DSCNT_Pos) /*!< UI2C_T::BRGEN: DSCNT Mask */
  417. #define UI2C_BRGEN_CLKDIV_Pos (16) /*!< UI2C_T::BRGEN: CLKDIV Position */
  418. #define UI2C_BRGEN_CLKDIV_Msk (0x3fful << UI2C_BRGEN_CLKDIV_Pos) /*!< UI2C_T::BRGEN: CLKDIV Mask */
  419. #define UI2C_LINECTL_LSB_Pos (0) /*!< UI2C_T::LINECTL: LSB Position */
  420. #define UI2C_LINECTL_LSB_Msk (0x1ul << UI2C_LINECTL_LSB_Pos) /*!< UI2C_T::LINECTL: LSB Mask */
  421. #define UI2C_LINECTL_DWIDTH_Pos (8) /*!< UI2C_T::LINECTL: DWIDTH Position */
  422. #define UI2C_LINECTL_DWIDTH_Msk (0xful << UI2C_LINECTL_DWIDTH_Pos) /*!< UI2C_T::LINECTL: DWIDTH Mask */
  423. #define UI2C_TXDAT_TXDAT_Pos (0) /*!< UI2C_T::TXDAT: TXDAT Position */
  424. #define UI2C_TXDAT_TXDAT_Msk (0xfffful << UI2C_TXDAT_TXDAT_Pos) /*!< UI2C_T::TXDAT: TXDAT Mask */
  425. #define UI2C_RXDAT_RXDAT_Pos (0) /*!< UI2C_T::RXDAT: RXDAT Position */
  426. #define UI2C_RXDAT_RXDAT_Msk (0xfffful << UI2C_RXDAT_RXDAT_Pos) /*!< UI2C_T::RXDAT: RXDAT Mask */
  427. #define UI2C_DEVADDR0_DEVADDR_Pos (0) /*!< UI2C_T::DEVADDR0: DEVADDR Position */
  428. #define UI2C_DEVADDR0_DEVADDR_Msk (0x3fful << UI2C_DEVADDR0_DEVADDR_Pos) /*!< UI2C_T::DEVADDR0: DEVADDR Mask */
  429. #define UI2C_DEVADDR1_DEVADDR_Pos (0) /*!< UI2C_T::DEVADDR1: DEVADDR Position */
  430. #define UI2C_DEVADDR1_DEVADDR_Msk (0x3fful << UI2C_DEVADDR1_DEVADDR_Pos) /*!< UI2C_T::DEVADDR1: DEVADDR Mask */
  431. #define UI2C_ADDRMSK0_ADDRMSK_Pos (0) /*!< UI2C_T::ADDRMSK0: ADDRMSK Position */
  432. #define UI2C_ADDRMSK0_ADDRMSK_Msk (0x3fful << UI2C_ADDRMSK0_ADDRMSK_Pos) /*!< UI2C_T::ADDRMSK0: ADDRMSK Mask */
  433. #define UI2C_ADDRMSK1_ADDRMSK_Pos (0) /*!< UI2C_T::ADDRMSK1: ADDRMSK Position */
  434. #define UI2C_ADDRMSK1_ADDRMSK_Msk (0x3fful << UI2C_ADDRMSK1_ADDRMSK_Pos) /*!< UI2C_T::ADDRMSK1: ADDRMSK Mask */
  435. #define UI2C_WKCTL_WKEN_Pos (0) /*!< UI2C_T::WKCTL: WKEN Position */
  436. #define UI2C_WKCTL_WKEN_Msk (0x1ul << UI2C_WKCTL_WKEN_Pos) /*!< UI2C_T::WKCTL: WKEN Mask */
  437. #define UI2C_WKCTL_WKADDREN_Pos (1) /*!< UI2C_T::WKCTL: WKADDREN Position */
  438. #define UI2C_WKCTL_WKADDREN_Msk (0x1ul << UI2C_WKCTL_WKADDREN_Pos) /*!< UI2C_T::WKCTL: WKADDREN Mask */
  439. #define UI2C_WKSTS_WKF_Pos (0) /*!< UI2C_T::WKSTS: WKF Position */
  440. #define UI2C_WKSTS_WKF_Msk (0x1ul << UI2C_WKSTS_WKF_Pos) /*!< UI2C_T::WKSTS: WKF Mask */
  441. #define UI2C_PROTCTL_GCFUNC_Pos (0) /*!< UI2C_T::PROTCTL: GCFUNC Position */
  442. #define UI2C_PROTCTL_GCFUNC_Msk (0x1ul << UI2C_PROTCTL_GCFUNC_Pos) /*!< UI2C_T::PROTCTL: GCFUNC Mask */
  443. #define UI2C_PROTCTL_AA_Pos (1) /*!< UI2C_T::PROTCTL: AA Position */
  444. #define UI2C_PROTCTL_AA_Msk (0x1ul << UI2C_PROTCTL_AA_Pos) /*!< UI2C_T::PROTCTL: AA Mask */
  445. #define UI2C_PROTCTL_STO_Pos (2) /*!< UI2C_T::PROTCTL: STO Position */
  446. #define UI2C_PROTCTL_STO_Msk (0x1ul << UI2C_PROTCTL_STO_Pos) /*!< UI2C_T::PROTCTL: STO Mask */
  447. #define UI2C_PROTCTL_STA_Pos (3) /*!< UI2C_T::PROTCTL: STA Position */
  448. #define UI2C_PROTCTL_STA_Msk (0x1ul << UI2C_PROTCTL_STA_Pos) /*!< UI2C_T::PROTCTL: STA Mask */
  449. #define UI2C_PROTCTL_ADDR10EN_Pos (4) /*!< UI2C_T::PROTCTL: ADDR10EN Position */
  450. #define UI2C_PROTCTL_ADDR10EN_Msk (0x1ul << UI2C_PROTCTL_ADDR10EN_Pos) /*!< UI2C_T::PROTCTL: ADDR10EN Mask */
  451. #define UI2C_PROTCTL_PTRG_Pos (5) /*!< UI2C_T::PROTCTL: PTRG Position */
  452. #define UI2C_PROTCTL_PTRG_Msk (0x1ul << UI2C_PROTCTL_PTRG_Pos) /*!< UI2C_T::PROTCTL: PTRG Mask */
  453. #define UI2C_PROTCTL_SCLOUTEN_Pos (8) /*!< UI2C_T::PROTCTL: SCLOUTEN Position */
  454. #define UI2C_PROTCTL_SCLOUTEN_Msk (0x1ul << UI2C_PROTCTL_SCLOUTEN_Pos) /*!< UI2C_T::PROTCTL: SCLOUTEN Mask */
  455. #define UI2C_PROTCTL_MONEN_Pos (9) /*!< UI2C_T::PROTCTL: MONEN Position */
  456. #define UI2C_PROTCTL_MONEN_Msk (0x1ul << UI2C_PROTCTL_MONEN_Pos) /*!< UI2C_T::PROTCTL: MONEN Mask */
  457. #define UI2C_PROTCTL_TOCNT_Pos (16) /*!< UI2C_T::PROTCTL: TOCNT Position */
  458. #define UI2C_PROTCTL_TOCNT_Msk (0x3fful << UI2C_PROTCTL_TOCNT_Pos) /*!< UI2C_T::PROTCTL: TOCNT Mask */
  459. #define UI2C_PROTCTL_PROTEN_Pos (31) /*!< UI2C_T::PROTCTL: PROTEN Position */
  460. #define UI2C_PROTCTL_PROTEN_Msk (0x1ul << UI2C_PROTCTL_PROTEN_Pos) /*!< UI2C_T::PROTCTL: PROTEN Mask */
  461. #define UI2C_PROTIEN_TOIEN_Pos (0) /*!< UI2C_T::PROTIEN: TOIEN Position */
  462. #define UI2C_PROTIEN_TOIEN_Msk (0x1ul << UI2C_PROTIEN_TOIEN_Pos) /*!< UI2C_T::PROTIEN: TOIEN Mask */
  463. #define UI2C_PROTIEN_STARIEN_Pos (1) /*!< UI2C_T::PROTIEN: STARIEN Position */
  464. #define UI2C_PROTIEN_STARIEN_Msk (0x1ul << UI2C_PROTIEN_STARIEN_Pos) /*!< UI2C_T::PROTIEN: STARIEN Mask */
  465. #define UI2C_PROTIEN_STORIEN_Pos (2) /*!< UI2C_T::PROTIEN: STORIEN Position */
  466. #define UI2C_PROTIEN_STORIEN_Msk (0x1ul << UI2C_PROTIEN_STORIEN_Pos) /*!< UI2C_T::PROTIEN: STORIEN Mask */
  467. #define UI2C_PROTIEN_NACKIEN_Pos (3) /*!< UI2C_T::PROTIEN: NACKIEN Position */
  468. #define UI2C_PROTIEN_NACKIEN_Msk (0x1ul << UI2C_PROTIEN_NACKIEN_Pos) /*!< UI2C_T::PROTIEN: NACKIEN Mask */
  469. #define UI2C_PROTIEN_ARBLOIEN_Pos (4) /*!< UI2C_T::PROTIEN: ARBLOIEN Position */
  470. #define UI2C_PROTIEN_ARBLOIEN_Msk (0x1ul << UI2C_PROTIEN_ARBLOIEN_Pos) /*!< UI2C_T::PROTIEN: ARBLOIEN Mask */
  471. #define UI2C_PROTIEN_ERRIEN_Pos (5) /*!< UI2C_T::PROTIEN: ERRIEN Position */
  472. #define UI2C_PROTIEN_ERRIEN_Msk (0x1ul << UI2C_PROTIEN_ERRIEN_Pos) /*!< UI2C_T::PROTIEN: ERRIEN Mask */
  473. #define UI2C_PROTIEN_ACKIEN_Pos (6) /*!< UI2C_T::PROTIEN: ACKIEN Position */
  474. #define UI2C_PROTIEN_ACKIEN_Msk (0x1ul << UI2C_PROTIEN_ACKIEN_Pos) /*!< UI2C_T::PROTIEN: ACKIEN Mask */
  475. #define UI2C_PROTSTS_TOIF_Pos (5) /*!< UI2C_T::PROTSTS: TOIF Position */
  476. #define UI2C_PROTSTS_TOIF_Msk (0x1ul << UI2C_PROTSTS_TOIF_Pos) /*!< UI2C_T::PROTSTS: TOIF Mask */
  477. #define UI2C_PROTSTS_ONBUSY_Pos (6) /*!< UI2C_T::PROTSTS: ONBUSY Position */
  478. #define UI2C_PROTSTS_ONBUSY_Msk (0x1ul << UI2C_PROTSTS_ONBUSY_Pos) /*!< UI2C_T::PROTSTS: ONBUSY Mask */
  479. #define UI2C_PROTSTS_STARIF_Pos (8) /*!< UI2C_T::PROTSTS: STARIF Position */
  480. #define UI2C_PROTSTS_STARIF_Msk (0x1ul << UI2C_PROTSTS_STARIF_Pos) /*!< UI2C_T::PROTSTS: STARIF Mask */
  481. #define UI2C_PROTSTS_STORIF_Pos (9) /*!< UI2C_T::PROTSTS: STORIF Position */
  482. #define UI2C_PROTSTS_STORIF_Msk (0x1ul << UI2C_PROTSTS_STORIF_Pos) /*!< UI2C_T::PROTSTS: STORIF Mask */
  483. #define UI2C_PROTSTS_NACKIF_Pos (10) /*!< UI2C_T::PROTSTS: NACKIF Position */
  484. #define UI2C_PROTSTS_NACKIF_Msk (0x1ul << UI2C_PROTSTS_NACKIF_Pos) /*!< UI2C_T::PROTSTS: NACKIF Mask */
  485. #define UI2C_PROTSTS_ARBLOIF_Pos (11) /*!< UI2C_T::PROTSTS: ARBLOIF Position */
  486. #define UI2C_PROTSTS_ARBLOIF_Msk (0x1ul << UI2C_PROTSTS_ARBLOIF_Pos) /*!< UI2C_T::PROTSTS: ARBLOIF Mask */
  487. #define UI2C_PROTSTS_ERRIF_Pos (12) /*!< UI2C_T::PROTSTS: ERRIF Position */
  488. #define UI2C_PROTSTS_ERRIF_Msk (0x1ul << UI2C_PROTSTS_ERRIF_Pos) /*!< UI2C_T::PROTSTS: ERRIF Mask */
  489. #define UI2C_PROTSTS_ACKIF_Pos (13) /*!< UI2C_T::PROTSTS: ACKIF Position */
  490. #define UI2C_PROTSTS_ACKIF_Msk (0x1ul << UI2C_PROTSTS_ACKIF_Pos) /*!< UI2C_T::PROTSTS: ACKIF Mask */
  491. #define UI2C_PROTSTS_SLASEL_Pos (14) /*!< UI2C_T::PROTSTS: SLASEL Position */
  492. #define UI2C_PROTSTS_SLASEL_Msk (0x1ul << UI2C_PROTSTS_SLASEL_Pos) /*!< UI2C_T::PROTSTS: SLASEL Mask */
  493. #define UI2C_PROTSTS_SLAREAD_Pos (15) /*!< UI2C_T::PROTSTS: SLAREAD Position */
  494. #define UI2C_PROTSTS_SLAREAD_Msk (0x1ul << UI2C_PROTSTS_SLAREAD_Pos) /*!< UI2C_T::PROTSTS: SLAREAD Mask */
  495. #define UI2C_PROTSTS_WKAKDONE_Pos (16) /*!< UI2C_T::PROTSTS: WKAKDONE Position */
  496. #define UI2C_PROTSTS_WKAKDONE_Msk (0x1ul << UI2C_PROTSTS_WKAKDONE_Pos) /*!< UI2C_T::PROTSTS: WKAKDONE Mask */
  497. #define UI2C_PROTSTS_WRSTSWK_Pos (17) /*!< UI2C_T::PROTSTS: WRSTSWK Position */
  498. #define UI2C_PROTSTS_WRSTSWK_Msk (0x1ul << UI2C_PROTSTS_WRSTSWK_Pos) /*!< UI2C_T::PROTSTS: WRSTSWK Mask */
  499. #define UI2C_PROTSTS_BUSHANG_Pos (18) /*!< UI2C_T::PROTSTS: BUSHANG Position */
  500. #define UI2C_PROTSTS_BUSHANG_Msk (0x1ul << UI2C_PROTSTS_BUSHANG_Pos) /*!< UI2C_T::PROTSTS: BUSHANG Mask */
  501. #define UI2C_PROTSTS_ERRARBLO_Pos (19) /*!< UI2C_T::PROTSTS: ERRARBLO Position */
  502. #define UI2C_PROTSTS_ERRARBLO_Msk (0x1ul << UI2C_PROTSTS_ERRARBLO_Pos) /*!< UI2C_T::PROTSTS: ERRARBLO Mask */
  503. #define UI2C_ADMAT_ADMAT0_Pos (0) /*!< UI2C_T::ADMAT: ADMAT0 Position */
  504. #define UI2C_ADMAT_ADMAT0_Msk (0x1ul << UI2C_ADMAT_ADMAT0_Pos) /*!< UI2C_T::ADMAT: ADMAT0 Mask */
  505. #define UI2C_ADMAT_ADMAT1_Pos (1) /*!< UI2C_T::ADMAT: ADMAT1 Position */
  506. #define UI2C_ADMAT_ADMAT1_Msk (0x1ul << UI2C_ADMAT_ADMAT1_Pos) /*!< UI2C_T::ADMAT: ADMAT1 Mask */
  507. #define UI2C_TMCTL_STCTL_Pos (0) /*!< UI2C_T::TMCTL: STCTL Position */
  508. #define UI2C_TMCTL_STCTL_Msk (0x1fful << UI2C_TMCTL_STCTL_Pos) /*!< UI2C_T::TMCTL: STCTL Mask */
  509. #define UI2C_TMCTL_HTCTL_Pos (16) /*!< UI2C_T::TMCTL: HTCTL Position */
  510. #define UI2C_TMCTL_HTCTL_Msk (0x1fful << UI2C_TMCTL_HTCTL_Pos) /*!< UI2C_T::TMCTL: HTCTL Mask */
  511. /**@}*/ /* UI2C_CONST */
  512. /**@}*/ /* end of UI2C register group */
  513. /**@}*/ /* end of REGISTER group */
  514. #if defined ( __CC_ARM )
  515. #pragma no_anon_unions
  516. #endif
  517. #endif /* __UI2C_REG_H__ */