F2837xD_i2c.h 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. //###########################################################################
  2. //
  3. // FILE: F2837xD_i2c.h
  4. //
  5. // TITLE: I2C Register Definitions.
  6. //
  7. //###########################################################################
  8. // $TI Release: F2837xD Support Library v3.05.00.00 $
  9. // $Release Date: Tue Jun 26 03:15:23 CDT 2018 $
  10. // $Copyright:
  11. // Copyright (C) 2013-2018 Texas Instruments Incorporated - http://www.ti.com/
  12. //
  13. // Redistribution and use in source and binary forms, with or without
  14. // modification, are permitted provided that the following conditions
  15. // are met:
  16. //
  17. // Redistributions of source code must retain the above copyright
  18. // notice, this list of conditions and the following disclaimer.
  19. //
  20. // Redistributions in binary form must reproduce the above copyright
  21. // notice, this list of conditions and the following disclaimer in the
  22. // documentation and/or other materials provided with the
  23. // distribution.
  24. //
  25. // Neither the name of Texas Instruments Incorporated nor the names of
  26. // its contributors may be used to endorse or promote products derived
  27. // from this software without specific prior written permission.
  28. //
  29. // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  30. // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  31. // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  32. // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  33. // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  34. // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  35. // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  36. // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  37. // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  38. // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  39. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  40. // $
  41. //###########################################################################
  42. #ifndef __F2837xD_I2C_H__
  43. #define __F2837xD_I2C_H__
  44. #ifdef __cplusplus
  45. extern "C" {
  46. #endif
  47. //---------------------------------------------------------------------------
  48. // I2C Individual Register Bit Definitions:
  49. struct I2COAR_BITS { // bits description
  50. Uint16 OAR:10; // 9:0 I2C Own address
  51. Uint16 rsvd1:6; // 15:10 Reserved
  52. };
  53. union I2COAR_REG {
  54. Uint16 all;
  55. struct I2COAR_BITS bit;
  56. };
  57. struct I2CIER_BITS { // bits description
  58. Uint16 ARBL:1; // 0 Arbitration-lost interrupt enable
  59. Uint16 NACK:1; // 1 No-acknowledgment interrupt enable
  60. Uint16 ARDY:1; // 2 Register-access-ready interrupt enable
  61. Uint16 RRDY:1; // 3 Receive-data-ready interrupt enable
  62. Uint16 XRDY:1; // 4 Transmit-data-ready interrupt enable
  63. Uint16 SCD:1; // 5 Stop condition detected interrupt enable
  64. Uint16 AAS:1; // 6 Addressed as slave interrupt enable
  65. Uint16 rsvd1:9; // 15:7 Reserved
  66. };
  67. union I2CIER_REG {
  68. Uint16 all;
  69. struct I2CIER_BITS bit;
  70. };
  71. struct I2CSTR_BITS { // bits description
  72. Uint16 ARBL:1; // 0 Arbitration-lost interrupt flag bit
  73. Uint16 NACK:1; // 1 No-acknowledgment interrupt flag bit.
  74. Uint16 ARDY:1; // 2 Register-access-ready interrupt flag bit
  75. Uint16 RRDY:1; // 3 Receive-data-ready interrupt flag bit.
  76. Uint16 XRDY:1; // 4 Transmit-data-ready interrupt flag bit.
  77. Uint16 SCD:1; // 5 Stop condition detected bit.
  78. Uint16 rsvd1:2; // 7:6 Reserved
  79. Uint16 AD0:1; // 8 Address 0 bits
  80. Uint16 AAS:1; // 9 Addressed-as-slave bit
  81. Uint16 XSMT:1; // 10 Transmit shift register empty bit.
  82. Uint16 RSFULL:1; // 11 Receive shift register full bit.
  83. Uint16 BB:1; // 12 Bus busy bit.
  84. Uint16 NACKSNT:1; // 13 NACK sent bit.
  85. Uint16 SDIR:1; // 14 Slave direction bit
  86. Uint16 rsvd2:1; // 15 Reserved
  87. };
  88. union I2CSTR_REG {
  89. Uint16 all;
  90. struct I2CSTR_BITS bit;
  91. };
  92. struct I2CDRR_BITS { // bits description
  93. Uint16 DATA:8; // 7:0 Receive data
  94. Uint16 rsvd1:8; // 15:8 Reserved
  95. };
  96. union I2CDRR_REG {
  97. Uint16 all;
  98. struct I2CDRR_BITS bit;
  99. };
  100. struct I2CSAR_BITS { // bits description
  101. Uint16 SAR:10; // 9:0 Slave Address
  102. Uint16 rsvd1:6; // 15:10 Reserved
  103. };
  104. union I2CSAR_REG {
  105. Uint16 all;
  106. struct I2CSAR_BITS bit;
  107. };
  108. struct I2CDXR_BITS { // bits description
  109. Uint16 DATA:8; // 7:0 Transmit data
  110. Uint16 rsvd1:8; // 15:8 Reserved
  111. };
  112. union I2CDXR_REG {
  113. Uint16 all;
  114. struct I2CDXR_BITS bit;
  115. };
  116. struct I2CMDR_BITS { // bits description
  117. Uint16 BC:3; // 2:0 Bit count bits.
  118. Uint16 FDF:1; // 3 Free Data Format
  119. Uint16 STB:1; // 4 START Byte Mode
  120. Uint16 IRS:1; // 5 I2C Module Reset
  121. Uint16 DLB:1; // 6 Digital Loopback Mode
  122. Uint16 RM:1; // 7 Repeat Mode
  123. Uint16 XA:1; // 8 Expanded Address Mode
  124. Uint16 TRX:1; // 9 Transmitter Mode
  125. Uint16 MST:1; // 10 Master Mode
  126. Uint16 STP:1; // 11 STOP Condition
  127. Uint16 rsvd1:1; // 12 Reserved
  128. Uint16 STT:1; // 13 START condition bit
  129. Uint16 FREE:1; // 14 Debug Action
  130. Uint16 NACKMOD:1; // 15 NACK mode bit
  131. };
  132. union I2CMDR_REG {
  133. Uint16 all;
  134. struct I2CMDR_BITS bit;
  135. };
  136. struct I2CISRC_BITS { // bits description
  137. Uint16 INTCODE:3; // 2:0 Interrupt code bits.
  138. Uint16 rsvd1:5; // 7:3 Reserved
  139. Uint16 WRITE_ZEROS:4; // 11:8 Reserved
  140. Uint16 rsvd2:4; // 15:12 Reserved
  141. };
  142. union I2CISRC_REG {
  143. Uint16 all;
  144. struct I2CISRC_BITS bit;
  145. };
  146. struct I2CEMDR_BITS { // bits description
  147. Uint16 BC:1; // 0 Backwards compatibility mode
  148. Uint16 rsvd1:15; // 15:1 Reserved
  149. };
  150. union I2CEMDR_REG {
  151. Uint16 all;
  152. struct I2CEMDR_BITS bit;
  153. };
  154. struct I2CPSC_BITS { // bits description
  155. Uint16 IPSC:8; // 7:0 I2C Prescaler Divide Down
  156. Uint16 rsvd1:8; // 15:8 Reserved
  157. };
  158. union I2CPSC_REG {
  159. Uint16 all;
  160. struct I2CPSC_BITS bit;
  161. };
  162. struct I2CFFTX_BITS { // bits description
  163. Uint16 TXFFIL:5; // 4:0 Transmit FIFO Interrupt Level
  164. Uint16 TXFFIENA:1; // 5 Transmit FIFO Interrupt Enable
  165. Uint16 TXFFINTCLR:1; // 6 Transmit FIFO Interrupt Flag Clear
  166. Uint16 TXFFINT:1; // 7 Transmit FIFO Interrupt Flag
  167. Uint16 TXFFST:5; // 12:8 Transmit FIFO Status
  168. Uint16 TXFFRST:1; // 13 Transmit FIFO Reset
  169. Uint16 I2CFFEN:1; // 14 Transmit FIFO Enable
  170. Uint16 rsvd1:1; // 15 Reserved
  171. };
  172. union I2CFFTX_REG {
  173. Uint16 all;
  174. struct I2CFFTX_BITS bit;
  175. };
  176. struct I2CFFRX_BITS { // bits description
  177. Uint16 RXFFIL:5; // 4:0 Receive FIFO Interrupt Level
  178. Uint16 RXFFIENA:1; // 5 Receive FIFO Interrupt Enable
  179. Uint16 RXFFINTCLR:1; // 6 Receive FIFO Interrupt Flag Clear
  180. Uint16 RXFFINT:1; // 7 Receive FIFO Interrupt Flag
  181. Uint16 RXFFST:5; // 12:8 Receive FIFO Status
  182. Uint16 RXFFRST:1; // 13 Receive FIFO Reset
  183. Uint16 rsvd1:2; // 15:14 Reserved
  184. };
  185. union I2CFFRX_REG {
  186. Uint16 all;
  187. struct I2CFFRX_BITS bit;
  188. };
  189. struct I2C_REGS {
  190. union I2COAR_REG I2COAR; // I2C Own address
  191. union I2CIER_REG I2CIER; // I2C Interrupt Enable
  192. union I2CSTR_REG I2CSTR; // I2C Status
  193. Uint16 I2CCLKL; // I2C Clock low-time divider
  194. Uint16 I2CCLKH; // I2C Clock high-time divider
  195. Uint16 I2CCNT; // I2C Data count
  196. union I2CDRR_REG I2CDRR; // I2C Data receive
  197. union I2CSAR_REG I2CSAR; // I2C Slave address
  198. union I2CDXR_REG I2CDXR; // I2C Data Transmit
  199. union I2CMDR_REG I2CMDR; // I2C Mode
  200. union I2CISRC_REG I2CISRC; // I2C Interrupt Source
  201. union I2CEMDR_REG I2CEMDR; // I2C Extended Mode
  202. union I2CPSC_REG I2CPSC; // I2C Prescaler
  203. Uint16 rsvd1[19]; // Reserved
  204. union I2CFFTX_REG I2CFFTX; // I2C FIFO Transmit
  205. union I2CFFRX_REG I2CFFRX; // I2C FIFO Receive
  206. };
  207. //---------------------------------------------------------------------------
  208. // I2C External References & Function Declarations:
  209. //
  210. #ifdef CPU1
  211. extern volatile struct I2C_REGS I2caRegs;
  212. extern volatile struct I2C_REGS I2cbRegs;
  213. #endif
  214. #ifdef CPU2
  215. extern volatile struct I2C_REGS I2caRegs;
  216. extern volatile struct I2C_REGS I2cbRegs;
  217. #endif
  218. #ifdef __cplusplus
  219. }
  220. #endif /* extern "C" */
  221. #endif
  222. //===========================================================================
  223. // End of file.
  224. //===========================================================================