hw_i2cs.h 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285
  1. /******************************************************************************
  2. * Filename: hw_i2cs.h
  3. * Revised: $Date: 2013-04-30 17:13:44 +0200 (Tue, 30 Apr 2013) $
  4. * Revision: $Revision: 9943 $
  5. *
  6. * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com/
  7. *
  8. *
  9. * Redistribution and use in source and binary forms, with or without
  10. * modification, are permitted provided that the following conditions
  11. * are met:
  12. *
  13. * Redistributions of source code must retain the above copyright
  14. * notice, this list of conditions and the following disclaimer.
  15. *
  16. * Redistributions in binary form must reproduce the above copyright
  17. * notice, this list of conditions and the following disclaimer in the
  18. * documentation and/or other materials provided with the distribution.
  19. *
  20. * Neither the name of Texas Instruments Incorporated nor the names of
  21. * its contributors may be used to endorse or promote products derived
  22. * from this software without specific prior written permission.
  23. *
  24. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  25. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  26. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  27. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  28. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  29. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  30. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  31. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  32. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  33. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  34. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  35. *
  36. ******************************************************************************/
  37. #ifndef __HW_I2CS_H__
  38. #define __HW_I2CS_H__
  39. //*****************************************************************************
  40. //
  41. // The following are defines for the I2CS register offsets.
  42. //
  43. //*****************************************************************************
  44. #define I2CS_OAR 0x40020800 // I2C slave own address This
  45. // register consists of seven
  46. // address bits that identify the
  47. // CC2538 I2C device on the I2C
  48. // bus.
  49. #define I2CS_STAT 0x40020804 // I2C slave control and status
  50. // This register functions as a
  51. // control register when written,
  52. // and a status register when read.
  53. #define I2CS_CTRL 0x40020804 // I2C slave control and status
  54. // This register functions as a
  55. // control register when written,
  56. // and a status register when read.
  57. #define I2CS_DR 0x40020808 // I2C slave data This register
  58. // contains the data to be
  59. // transmitted when in the slave
  60. // transmit state, and the data
  61. // received when in the slave
  62. // receive state.
  63. #define I2CS_IMR 0x4002080C // I2C slave interrupt mask This
  64. // register controls whether a raw
  65. // interrupt is promoted to a
  66. // controller interrupt.
  67. #define I2CS_RIS 0x40020810 // I2C slave raw interrupt status
  68. // This register specifies whether
  69. // an interrupt is pending.
  70. #define I2CS_MIS 0x40020814 // I2C slave masked interrupt
  71. // status This register specifies
  72. // whether an interrupt was
  73. // signaled.
  74. #define I2CS_ICR 0x40020818 // I2C slave interrupt clear This
  75. // register clears the raw
  76. // interrupt. A read of this
  77. // register returns no meaningful
  78. // data.
  79. //*****************************************************************************
  80. //
  81. // The following are defines for the bit fields in the I2CS_OAR register.
  82. //
  83. //*****************************************************************************
  84. #define I2CS_OAR_OAR_M 0x0000007F // I2C slave own address This
  85. // field specifies bits A6 through
  86. // A0 of the slave address.
  87. #define I2CS_OAR_OAR_S 0
  88. //*****************************************************************************
  89. //
  90. // The following are defines for the bit fields in the I2CS_STAT register.
  91. //
  92. //*****************************************************************************
  93. #define I2CS_STAT_FBR 0x00000004 // First byte received 1: The
  94. // first byte following the slave's
  95. // own address has been received.
  96. // 0: The first byte has not been
  97. // received. This bit is only valid
  98. // when the RREQ bit is set and is
  99. // automatically cleared when data
  100. // has been read from the I2CSDR
  101. // register. Note: This bit is not
  102. // used for slave transmit
  103. // operations.
  104. #define I2CS_STAT_FBR_M 0x00000004
  105. #define I2CS_STAT_FBR_S 2
  106. #define I2CS_STAT_TREQ 0x00000002 // Transmit request 1: The I2C
  107. // controller has been addressed as
  108. // a slave transmitter and is using
  109. // clock stretching to delay the
  110. // master until data has been
  111. // written to the I2CSDR register.
  112. // 0: No outstanding transmit
  113. // request.
  114. #define I2CS_STAT_TREQ_M 0x00000002
  115. #define I2CS_STAT_TREQ_S 1
  116. #define I2CS_STAT_RREQ 0x00000001 // Receive request 1: The I2C
  117. // controller has outstanding
  118. // receive data from the I2C master
  119. // and is using clock stretching to
  120. // delay the master until data has
  121. // been read from the I2CSDR
  122. // register. 0: No outstanding
  123. // receive data
  124. #define I2CS_STAT_RREQ_M 0x00000001
  125. #define I2CS_STAT_RREQ_S 0
  126. //*****************************************************************************
  127. //
  128. // The following are defines for the bit fields in the I2CS_CTRL register.
  129. //
  130. //*****************************************************************************
  131. #define I2CS_CTRL_DA 0x00000001 // Device active 0: Disables the
  132. // I2C slave operation 1: Enables
  133. // the I2C slave operation
  134. #define I2CS_CTRL_DA_M 0x00000001
  135. #define I2CS_CTRL_DA_S 0
  136. //*****************************************************************************
  137. //
  138. // The following are defines for the bit fields in the I2CS_DR register.
  139. //
  140. //*****************************************************************************
  141. #define I2CS_DR_DATA_M 0x000000FF // Data for transfer This field
  142. // contains the data for transfer
  143. // during a slave receive or
  144. // transmit operation.
  145. #define I2CS_DR_DATA_S 0
  146. //*****************************************************************************
  147. //
  148. // The following are defines for the bit fields in the I2CS_IMR register.
  149. //
  150. //*****************************************************************************
  151. #define I2CS_IMR_STOPIM 0x00000004 // Stop condition interrupt mask
  152. // 1: The STOP condition interrupt
  153. // is sent to the interrupt
  154. // controller when the STOPRIS bit
  155. // in the I2CSRIS register is set.
  156. // 0: The STOPRIS interrupt is
  157. // supressed and not sent to the
  158. // interrupt controller.
  159. #define I2CS_IMR_STOPIM_M 0x00000004
  160. #define I2CS_IMR_STOPIM_S 2
  161. #define I2CS_IMR_STARTIM 0x00000002 // Start condition interrupt mask
  162. // 1: The START condition interrupt
  163. // is sent to the interrupt
  164. // controller when the STARTRIS bit
  165. // in the I2CSRIS register is set.
  166. // 0: The STARTRIS interrupt is
  167. // supressed and not sent to the
  168. // interrupt controller.
  169. #define I2CS_IMR_STARTIM_M 0x00000002
  170. #define I2CS_IMR_STARTIM_S 1
  171. #define I2CS_IMR_DATAIM 0x00000001 // Data interrupt mask 1: The data
  172. // received or data requested
  173. // interrupt is sent to the
  174. // interrupt controller when the
  175. // DATARIS bit in the I2CSRIS
  176. // register is set. 0: The DATARIS
  177. // interrupt is surpressed and not
  178. // sent to the interrupt
  179. // controller.
  180. #define I2CS_IMR_DATAIM_M 0x00000001
  181. #define I2CS_IMR_DATAIM_S 0
  182. //*****************************************************************************
  183. //
  184. // The following are defines for the bit fields in the I2CS_RIS register.
  185. //
  186. //*****************************************************************************
  187. #define I2CS_RIS_STOPRIS 0x00000004 // Stop condition raw interrupt
  188. // status 1: A STOP condition
  189. // interrupt is pending. 0: No
  190. // interrupt This bit is cleared by
  191. // writing 1 to the STOPIC bit in
  192. // the I2CSICR register.
  193. #define I2CS_RIS_STOPRIS_M 0x00000004
  194. #define I2CS_RIS_STOPRIS_S 2
  195. #define I2CS_RIS_STARTRIS 0x00000002 // Start condition raw interrupt
  196. // status 1: A START condition
  197. // interrupt is pending. 0: No
  198. // interrupt This bit is cleared by
  199. // writing 1 to the STARTIC bit in
  200. // the I2CSICR register.
  201. #define I2CS_RIS_STARTRIS_M 0x00000002
  202. #define I2CS_RIS_STARTRIS_S 1
  203. #define I2CS_RIS_DATARIS 0x00000001 // Data raw interrupt status 1: A
  204. // data received or data requested
  205. // interrupt is pending. 0: No
  206. // interrupt This bit is cleared by
  207. // writing 1 to the DATAIC bit in
  208. // the I2CSICR register.
  209. #define I2CS_RIS_DATARIS_M 0x00000001
  210. #define I2CS_RIS_DATARIS_S 0
  211. //*****************************************************************************
  212. //
  213. // The following are defines for the bit fields in the I2CS_MIS register.
  214. //
  215. //*****************************************************************************
  216. #define I2CS_MIS_STOPMIS 0x00000004 // Stop condition masked interrupt
  217. // status 1: An unmasked STOP
  218. // condition interrupt is pending.
  219. // 0: An interrupt has not occurred
  220. // or is masked. This bit is
  221. // cleared by writing 1 to the
  222. // STOPIC bit in the I2CSICR
  223. // register.
  224. #define I2CS_MIS_STOPMIS_M 0x00000004
  225. #define I2CS_MIS_STOPMIS_S 2
  226. #define I2CS_MIS_STARTMIS 0x00000002 // Start condition masked
  227. // interrupt status 1: An unmasked
  228. // START condition interrupt is
  229. // pending. 0: An interrupt has not
  230. // occurred or is masked. This bit
  231. // is cleared by writing 1 to the
  232. // STARTIC bit in the I2CSICR
  233. // register.
  234. #define I2CS_MIS_STARTMIS_M 0x00000002
  235. #define I2CS_MIS_STARTMIS_S 1
  236. #define I2CS_MIS_DATAMIS 0x00000001 // Data masked interrupt status 1:
  237. // An unmasked data received or
  238. // data requested interrupt is
  239. // pending. 0: An interrupt has not
  240. // occurred or is masked. This bit
  241. // is cleared by writing 1 to the
  242. // DATAIC bit in the I2CSICR
  243. // register.
  244. #define I2CS_MIS_DATAMIS_M 0x00000001
  245. #define I2CS_MIS_DATAMIS_S 0
  246. //*****************************************************************************
  247. //
  248. // The following are defines for the bit fields in the I2CS_ICR register.
  249. //
  250. //*****************************************************************************
  251. #define I2CS_ICR_STOPIC 0x00000004 // Stop condition interrupt clear
  252. // Writing 1 to this bit clears the
  253. // STOPRIS bit in the I2CSRIS
  254. // register and the STOPMIS bit in
  255. // the I2CSMIS register. A read of
  256. // this register returns no
  257. // meaningful data.
  258. #define I2CS_ICR_STOPIC_M 0x00000004
  259. #define I2CS_ICR_STOPIC_S 2
  260. #define I2CS_ICR_STARTIC 0x00000002 // Start condition interrupt vlear
  261. // Writing 1 to this bit clears the
  262. // STARTRIS bit in the I2CSRIS
  263. // register and the STARTMIS bit in
  264. // the I2CSMIS register. A read of
  265. // this register returns no
  266. // meaningful data.
  267. #define I2CS_ICR_STARTIC_M 0x00000002
  268. #define I2CS_ICR_STARTIC_S 1
  269. #define I2CS_ICR_DATAIC 0x00000001 // Data interrupt clear Writing 1
  270. // to this bit clears the DATARIS
  271. // bit in the I2CSRIS register and
  272. // the DATAMIS bit in the I2CSMIS
  273. // register. A read of this
  274. // register returns no meaningful
  275. // data.
  276. #define I2CS_ICR_DATAIC_M 0x00000001
  277. #define I2CS_ICR_DATAIC_S 0
  278. #endif // __HW_I2CS_H__