nu_i2c.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502
  1. /****************************************************************************//**
  2. * @file nu_i2c.h
  3. * @version V1.00
  4. * @brief M480 series I2C driver header file
  5. *
  6. * SPDX-License-Identifier: Apache-2.0
  7. * @copyright (C) 2016-2020 Nuvoton Technology Corp. All rights reserved.
  8. *****************************************************************************/
  9. #ifndef __NU_I2C_H__
  10. #define __NU_I2C_H__
  11. #ifdef __cplusplus
  12. extern "C"
  13. {
  14. #endif
  15. /** @addtogroup Standard_Driver Standard Driver
  16. @{
  17. */
  18. /** @addtogroup I2C_Driver I2C Driver
  19. @{
  20. */
  21. /** @addtogroup I2C_EXPORTED_CONSTANTS I2C Exported Constants
  22. @{
  23. */
  24. /*---------------------------------------------------------------------------------------------------------*/
  25. /* I2C_CTL constant definitions. */
  26. /*---------------------------------------------------------------------------------------------------------*/
  27. #define I2C_CTL_STA_SI 0x28UL /*!< I2C_CTL setting for I2C control bits. It would set STA and SI bits \hideinitializer */
  28. #define I2C_CTL_STA_SI_AA 0x2CUL /*!< I2C_CTL setting for I2C control bits. It would set STA, SI and AA bits \hideinitializer */
  29. #define I2C_CTL_STO_SI 0x18UL /*!< I2C_CTL setting for I2C control bits. It would set STO and SI bits \hideinitializer */
  30. #define I2C_CTL_STO_SI_AA 0x1CUL /*!< I2C_CTL setting for I2C control bits. It would set STO, SI and AA bits \hideinitializer */
  31. #define I2C_CTL_SI 0x08UL /*!< I2C_CTL setting for I2C control bits. It would set SI bit \hideinitializer */
  32. #define I2C_CTL_SI_AA 0x0CUL /*!< I2C_CTL setting for I2C control bits. It would set SI and AA bits \hideinitializer */
  33. #define I2C_CTL_STA 0x20UL /*!< I2C_CTL setting for I2C control bits. It would set STA bit \hideinitializer */
  34. #define I2C_CTL_STO 0x10UL /*!< I2C_CTL setting for I2C control bits. It would set STO bit \hideinitializer */
  35. #define I2C_CTL_AA 0x04UL /*!< I2C_CTL setting for I2C control bits. It would set AA bit \hideinitializer */
  36. /*---------------------------------------------------------------------------------------------------------*/
  37. /* I2C GCMode constant definitions. */
  38. /*---------------------------------------------------------------------------------------------------------*/
  39. #define I2C_GCMODE_ENABLE 1 /*!< Enable I2C GC Mode \hideinitializer */
  40. #define I2C_GCMODE_DISABLE 0 /*!< Disable I2C GC Mode \hideinitializer */
  41. /*---------------------------------------------------------------------------------------------------------*/
  42. /* I2C SMBUS constant definitions. */
  43. /*---------------------------------------------------------------------------------------------------------*/
  44. #define I2C_SMBH_ENABLE 1 /*!< Enable SMBus Host Mode enable \hideinitializer */
  45. #define I2C_SMBD_ENABLE 0 /*!< Enable SMBus Device Mode enable \hideinitializer */
  46. #define I2C_PECTX_ENABLE 1 /*!< Enable SMBus Packet Error Check Transmit function \hideinitializer */
  47. #define I2C_PECTX_DISABLE 0 /*!< Disable SMBus Packet Error Check Transmit function \hideinitializer */
  48. /*@}*/ /* end of group I2C_EXPORTED_CONSTANTS */
  49. /** @addtogroup I2C_EXPORTED_FUNCTIONS I2C Exported Functions
  50. @{
  51. */
  52. /**
  53. * @brief The macro is used to set I2C bus condition at One Time
  54. *
  55. * @param[in] i2c Specify I2C port
  56. * @param[in] u8Ctrl A byte writes to I2C control register
  57. *
  58. * @return None
  59. *
  60. * @details Set I2C_CTL register to control I2C bus conditions of START, STOP, SI, ACK.
  61. * \hideinitializer
  62. */
  63. #define I2C_SET_CONTROL_REG(i2c, u8Ctrl) ((i2c)->CTL0 = ((i2c)->CTL0 & ~0x3c) | (u8Ctrl))
  64. /**
  65. * @brief The macro is used to set START condition of I2C Bus
  66. *
  67. * @param[in] i2c Specify I2C port
  68. *
  69. * @return None
  70. *
  71. * @details Set the I2C bus START condition in I2C_CTL register.
  72. * \hideinitializer
  73. */
  74. #define I2C_START(i2c) ((i2c)->CTL0 = ((i2c)->CTL0 & ~I2C_CTL0_SI_Msk) | I2C_CTL0_STA_Msk)
  75. /**
  76. * @brief The macro is used to wait I2C bus status get ready
  77. *
  78. * @param[in] i2c Specify I2C port
  79. *
  80. * @return None
  81. *
  82. * @details When a new status is presented of I2C bus, the SI flag will be set in I2C_CTL register.
  83. * \hideinitializer
  84. */
  85. #define I2C_WAIT_READY(i2c) while(!((i2c)->CTL0 & I2C_CTL0_SI_Msk))
  86. /**
  87. * @brief The macro is used to Read I2C Bus Data Register
  88. *
  89. * @param[in] i2c Specify I2C port
  90. *
  91. * @return A byte of I2C data register
  92. *
  93. * @details I2C controller read data from bus and save it in I2CDAT register.
  94. * \hideinitializer
  95. */
  96. #define I2C_GET_DATA(i2c) ((i2c)->DAT)
  97. /**
  98. * @brief Write a Data to I2C Data Register
  99. *
  100. * @param[in] i2c Specify I2C port
  101. * @param[in] u8Data A byte that writes to data register
  102. *
  103. * @return None
  104. *
  105. * @details When write a data to I2C_DAT register, the I2C controller will shift it to I2C bus.
  106. * \hideinitializer
  107. */
  108. #define I2C_SET_DATA(i2c, u8Data) ((i2c)->DAT = (u8Data))
  109. /**
  110. * @brief Get I2C Bus status code
  111. *
  112. * @param[in] i2c Specify I2C port
  113. *
  114. * @return I2C status code
  115. *
  116. * @details To get this status code to monitor I2C bus event.
  117. * \hideinitializer
  118. */
  119. #define I2C_GET_STATUS(i2c) ((i2c)->STATUS0)
  120. /**
  121. * @brief Get Time-out flag from I2C Bus
  122. *
  123. * @param[in] i2c Specify I2C port
  124. *
  125. * @retval 0 I2C Bus time-out is not happened
  126. * @retval 1 I2C Bus time-out is happened
  127. *
  128. * @details When I2C bus occurs time-out event, the time-out flag will be set.
  129. * \hideinitializer
  130. */
  131. #define I2C_GET_TIMEOUT_FLAG(i2c) ( ((i2c)->TOCTL & I2C_TOCTL_TOIF_Msk) == I2C_TOCTL_TOIF_Msk ? 1:0 )
  132. /**
  133. * @brief To get wake-up flag from I2C Bus
  134. *
  135. * @param[in] i2c Specify I2C port
  136. *
  137. * @retval 0 Chip is not woken-up from power-down mode
  138. * @retval 1 Chip is woken-up from power-down mode
  139. *
  140. * @details I2C bus occurs wake-up event, wake-up flag will be set.
  141. * \hideinitializer
  142. */
  143. #define I2C_GET_WAKEUP_FLAG(i2c) ( ((i2c)->WKSTS & I2C_WKSTS_WKIF_Msk) == I2C_WKSTS_WKIF_Msk ? 1:0 )
  144. /**
  145. * @brief To clear wake-up flag
  146. *
  147. * @param[in] i2c Specify I2C port
  148. *
  149. * @return None
  150. *
  151. * @details If wake-up flag is set, use this macro to clear it.
  152. * \hideinitializer
  153. */
  154. #define I2C_CLEAR_WAKEUP_FLAG(i2c) ((i2c)->WKSTS = I2C_WKSTS_WKIF_Msk)
  155. /**
  156. * @brief To get SMBus Status
  157. *
  158. * @param[in] i2c Specify I2C port
  159. *
  160. * @return SMBus status
  161. *
  162. * @details To get the Bus Management status of I2C_BUSSTS register
  163. * \hideinitializer
  164. *
  165. */
  166. #define I2C_SMBUS_GET_STATUS(i2c) ((i2c)->BUSSTS)
  167. /**
  168. * @brief Get SMBus CRC value
  169. *
  170. * @param[in] i2c Specify I2C port
  171. *
  172. * @return Packet error check byte value
  173. *
  174. * @details The CRC check value after a transmission or a reception by count by using CRC8
  175. * \hideinitializer
  176. */
  177. #define I2C_SMBUS_GET_PEC_VALUE(i2c) ((i2c)->PKTCRC)
  178. /**
  179. * @brief Set SMBus Bytes number of Transmission or reception
  180. *
  181. * @param[in] i2c Specify I2C port
  182. * @param[in] u32PktSize Transmit / Receive bytes
  183. *
  184. * @return None
  185. *
  186. * @details The transmission or receive byte number in one transaction when PECEN is set. The maximum is 255 bytes.
  187. * \hideinitializer
  188. */
  189. #define I2C_SMBUS_SET_PACKET_BYTE_COUNT(i2c, u32PktSize) ((i2c)->PKTSIZE = (u32PktSize))
  190. /**
  191. * @brief Enable SMBus Alert function
  192. *
  193. * @param[in] i2c Specify I2C port
  194. *
  195. * @return None
  196. *
  197. * @details Device Mode(BMHEN=0): If ALERTEN(I2C_BUSCTL[4]) is set, the Alert pin will pull lo, and reply ACK when get ARP from host
  198. * Host Mode(BMHEN=1): If ALERTEN(I2C_BUSCTL[4]) is set, the Alert pin is supported to receive alert state(Lo trigger)
  199. * \hideinitializer
  200. */
  201. #define I2C_SMBUS_ENABLE_ALERT(i2c) ((i2c)->BUSCTL |= I2C_BUSCTL_ALERTEN_Msk)
  202. /**
  203. * @brief Disable SMBus Alert pin function
  204. *
  205. * @param[in] i2c Specify I2C port
  206. *
  207. * @return None
  208. *
  209. * @details Device Mode(BMHEN=0): If ALERTEN(I2C_BUSCTL[4]) is clear, the Alert pin will pull hi, and reply NACK when get ARP from host
  210. * Host Mode(BMHEN=1): If ALERTEN(I2C_BUSCTL[4]) is clear, the Alert pin is not supported to receive alert state(Lo trigger)
  211. * \hideinitializer
  212. */
  213. #define I2C_SMBUS_DISABLE_ALERT(i2c) ((i2c)->BUSCTL &= ~I2C_BUSCTL_ALERTEN_Msk)
  214. /**
  215. * @brief Set SMBus SUSCON pin is output mode
  216. *
  217. * @param[in] i2c Specify I2C port
  218. *
  219. * @return None
  220. *
  221. * @details This function to set SUSCON(I2C_BUSCTL[6]) pin is output mode.
  222. *
  223. * \hideinitializer
  224. */
  225. #define I2C_SMBUS_SET_SUSCON_OUT(i2c) ((i2c)->BUSCTL |= I2C_BUSCTL_SCTLOEN_Msk)
  226. /**
  227. * @brief Set SMBus SUSCON pin is input mode
  228. *
  229. * @param[in] i2c Specify I2C port
  230. *
  231. * @return None
  232. *
  233. * @details This function to set SUSCON(I2C_BUSCTL[6]) pin is input mode.
  234. *
  235. * \hideinitializer
  236. */
  237. #define I2C_SMBUS_SET_SUSCON_IN(i2c) ((i2c)->BUSCTL &= ~I2C_BUSCTL_SCTLOEN_Msk)
  238. /**
  239. * @brief Set SMBus SUSCON pin output high state
  240. *
  241. * @param[in] i2c Specify I2C port
  242. *
  243. * @return None
  244. *
  245. * @details This function to set SUSCON(I2C_BUSCTL[6]) pin is output hi state.
  246. * \hideinitializer
  247. */
  248. #define I2C_SMBUS_SET_SUSCON_HIGH(i2c) ((i2c)->BUSCTL |= I2C_BUSCTL_SCTLOSTS_Msk)
  249. /**
  250. * @brief Set SMBus SUSCON pin output low state
  251. *
  252. * @param[in] i2c Specify I2C port
  253. *
  254. * @return None
  255. *
  256. * @details This function to set SUSCON(I2C_BUSCTL[6]) pin is output lo state.
  257. * \hideinitializer
  258. */
  259. #define I2C_SMBUS_SET_SUSCON_LOW(i2c) ((i2c)->BUSCTL &= ~I2C_BUSCTL_SCTLOSTS_Msk)
  260. /**
  261. * @brief Enable SMBus Acknowledge control by manual
  262. *
  263. * @param[in] i2c Specify I2C port
  264. *
  265. * @return None
  266. *
  267. * @details The 9th bit can response the ACK or NACK according the received data by user. When the byte is received, SCLK line stretching to low between the 8th and 9th SCLK pulse.
  268. * \hideinitializer
  269. */
  270. #define I2C_SMBUS_ACK_MANUAL(i2c) ((i2c)->BUSCTL |= I2C_BUSCTL_ACKMEN_Msk)
  271. /**
  272. * @brief Disable SMBus Acknowledge control by manual
  273. *
  274. * @param[in] i2c Specify I2C port
  275. *
  276. * @return None
  277. *
  278. * @details Disable acknowledge response control by user.
  279. * \hideinitializer
  280. */
  281. #define I2C_SMBUS_ACK_AUTO(i2c) ((i2c)->BUSCTL &= ~I2C_BUSCTL_ACKMEN_Msk)
  282. /**
  283. * @brief Enable SMBus Acknowledge manual interrupt
  284. *
  285. * @param[in] i2c Specify I2C port
  286. *
  287. * @return None
  288. *
  289. * @details This function is used to enable SMBUS acknowledge manual interrupt on the 9th clock cycle when SMBUS=1 and ACKMEN=1
  290. * \hideinitializer
  291. */
  292. #define I2C_SMBUS_9THBIT_INT_ENABLE(i2c) ((i2c)->BUSCTL |= I2C_BUSCTL_ACKM9SI_Msk)
  293. /**
  294. * @brief Disable SMBus Acknowledge manual interrupt
  295. *
  296. * @param[in] i2c Specify I2C port
  297. *
  298. * @return None
  299. *
  300. * @details This function is used to disable SMBUS acknowledge manual interrupt on the 9th clock cycle when SMBUS=1 and ACKMEN=1
  301. * \hideinitializer
  302. */
  303. #define I2C_SMBUS_9THBIT_INT_DISABLE(i2c) ((i2c)->BUSCTL &= ~I2C_BUSCTL_ACKM9SI_Msk)
  304. /**
  305. * @brief Enable SMBus PEC clear at REPEAT START
  306. *
  307. * @param[in] i2c Specify I2C port
  308. *
  309. * @return None
  310. *
  311. * @details This function is used to enable the condition of REAEAT START can clear the PEC calculation.
  312. * \hideinitializer
  313. */
  314. #define I2C_SMBUS_RST_PEC_AT_START_ENABLE(i2c) ((i2c)->BUSCTL |= I2C_BUSCTL_PECCLR_Msk)
  315. /**
  316. * @brief Disable SMBus PEC clear at Repeat START
  317. *
  318. * @param[in] i2c Specify I2C port
  319. *
  320. * @return None
  321. *
  322. * @details This function is used to disable the condition of Repeat START can clear the PEC calculation.
  323. * \hideinitializer
  324. */
  325. #define I2C_SMBUS_RST_PEC_AT_START_DISABLE(i2c) ((i2c)->BUSCTL &= ~I2C_BUSCTL_PECCLR_Msk)
  326. /**
  327. * @brief Enable RX PDMA function.
  328. * @param[in] i2c The pointer of the specified I2C module.
  329. * @return None.
  330. * @details Set RXPDMAEN bit of I2C_CTL1 register to enable RX PDMA transfer function.
  331. * \hideinitializer
  332. */
  333. #define I2C_ENABLE_RX_PDMA(i2c) ((i2c)->CTL1 |= I2C_CTL1_RXPDMAEN_Msk)
  334. /**
  335. * @brief Enable TX PDMA function.
  336. * @param[in] i2c The pointer of the specified I2C module.
  337. * @return None.
  338. * @details Set TXPDMAEN bit of I2C_CTL1 register to enable TX PDMA transfer function.
  339. * \hideinitializer
  340. */
  341. #define I2C_ENABLE_TX_PDMA(i2c) ((i2c)->CTL1 |= I2C_CTL1_TXPDMAEN_Msk)
  342. /**
  343. * @brief Disable RX PDMA transfer.
  344. * @param[in] i2c The pointer of the specified I2C module.
  345. * @return None.
  346. * @details Clear RXPDMAEN bit of I2C_CTL1 register to disable RX PDMA transfer function.
  347. * \hideinitializer
  348. */
  349. #define I2C_DISABLE_RX_PDMA(i2c) ((i2c)->CTL1 &= ~I2C_CTL1_RXPDMAEN_Msk)
  350. /**
  351. * @brief Disable TX PDMA transfer.
  352. * @param[in] i2c The pointer of the specified I2C module.
  353. * @return None.
  354. * @details Clear TXPDMAEN bit of I2C_CTL1 register to disable TX PDMA transfer function.
  355. * \hideinitializer
  356. */
  357. #define I2C_DISABLE_TX_PDMA(i2c) ((i2c)->CTL1 &= ~I2C_CTL1_TXPDMAEN_Msk)
  358. /**
  359. * @brief Enable PDMA stretch function.
  360. * @param[in] i2c The pointer of the specified I2C module.
  361. * @return None.
  362. * @details Enable this function is to stretch bus by hardware after PDMA transfer is done if SI is not cleared.
  363. * \hideinitializer
  364. */
  365. #define I2C_ENABLE_PDMA_STRETCH(i2c) ((i2c)->CTL1 |= I2C_CTL1_PDMASTR_Msk)
  366. /**
  367. * @brief Disable PDMA stretch function.
  368. * @param[in] i2c The pointer of the specified I2C module.
  369. * @return None.
  370. * @details I2C will send STOP after PDMA transfers done automatically.
  371. * \hideinitializer
  372. */
  373. #define I2C_DISABLE_PDMA_STRETCH(i2c) ((i2c)->CTL1 &= ~I2C_CTL1_PDMASTR_Msk)
  374. /**
  375. * @brief Reset PDMA function.
  376. * @param[in] i2c The pointer of the specified I2C module.
  377. * @return None.
  378. * @details I2C PDMA engine will be reset after this function is called.
  379. * \hideinitializer
  380. */
  381. #define I2C_DISABLE_RST_PDMA(i2c) ((i2c)->CTL1 |= I2C_CTL1_PDMARST_Msk)
  382. /*---------------------------------------------------------------------------------------------------------*/
  383. /* inline functions */
  384. /*---------------------------------------------------------------------------------------------------------*/
  385. /* Declare these inline functions here to avoid MISRA C 2004 rule 8.1 error */
  386. __STATIC_INLINE void I2C_STOP(I2C_T *i2c);
  387. /**
  388. * @brief The macro is used to set STOP condition of I2C Bus
  389. *
  390. * @param[in] i2c Specify I2C port
  391. *
  392. * @return None
  393. *
  394. * @details Set the I2C bus STOP condition in I2C_CTL register.
  395. */
  396. __STATIC_INLINE void I2C_STOP(I2C_T *i2c)
  397. {
  398. (i2c)->CTL0 |= (I2C_CTL0_SI_Msk | I2C_CTL0_STO_Msk);
  399. while(i2c->CTL0 & I2C_CTL0_STO_Msk)
  400. {
  401. }
  402. }
  403. void I2C_ClearTimeoutFlag(I2C_T *i2c);
  404. void I2C_Close(I2C_T *i2c);
  405. void I2C_Trigger(I2C_T *i2c, uint8_t u8Start, uint8_t u8Stop, uint8_t u8Si, uint8_t u8Ack);
  406. void I2C_DisableInt(I2C_T *i2c);
  407. void I2C_EnableInt(I2C_T *i2c);
  408. uint32_t I2C_GetBusClockFreq(I2C_T *i2c);
  409. uint32_t I2C_GetIntFlag(I2C_T *i2c);
  410. uint32_t I2C_GetStatus(I2C_T *i2c);
  411. uint32_t I2C_Open(I2C_T *i2c, uint32_t u32BusClock);
  412. uint8_t I2C_GetData(I2C_T *i2c);
  413. void I2C_SetSlaveAddr(I2C_T *i2c, uint8_t u8SlaveNo, uint8_t u8SlaveAddr, uint8_t u8GCMode);
  414. void I2C_SetSlaveAddrMask(I2C_T *i2c, uint8_t u8SlaveNo, uint8_t u8SlaveAddrMask);
  415. uint32_t I2C_SetBusClockFreq(I2C_T *i2c, uint32_t u32BusClock);
  416. void I2C_EnableTimeout(I2C_T *i2c, uint8_t u8LongTimeout);
  417. void I2C_DisableTimeout(I2C_T *i2c);
  418. void I2C_EnableWakeup(I2C_T *i2c);
  419. void I2C_DisableWakeup(I2C_T *i2c);
  420. void I2C_SetData(I2C_T *i2c, uint8_t u8Data);
  421. void I2C_SMBusClearInterruptFlag(I2C_T *i2c, uint8_t u8SMBusIntFlag);
  422. uint8_t I2C_WriteByte(I2C_T *i2c, uint8_t u8SlaveAddr, uint8_t data);
  423. uint32_t I2C_WriteMultiBytes(I2C_T *i2c, uint8_t u8SlaveAddr, uint8_t data[], uint32_t u32wLen);
  424. uint8_t I2C_WriteByteOneReg(I2C_T *i2c, uint8_t u8SlaveAddr, uint8_t u8DataAddr, uint8_t data);
  425. uint32_t I2C_WriteMultiBytesOneReg(I2C_T *i2c, uint8_t u8SlaveAddr, uint8_t u8DataAddr, uint8_t data[], uint32_t u32wLen);
  426. uint8_t I2C_WriteByteTwoRegs(I2C_T *i2c, uint8_t u8SlaveAddr, uint16_t u16DataAddr, uint8_t data);
  427. uint32_t I2C_WriteMultiBytesTwoRegs(I2C_T *i2c, uint8_t u8SlaveAddr, uint16_t u16DataAddr, uint8_t data[], uint32_t u32wLen);
  428. uint8_t I2C_ReadByte(I2C_T *i2c, uint8_t u8SlaveAddr);
  429. uint32_t I2C_ReadMultiBytes(I2C_T *i2c, uint8_t u8SlaveAddr, uint8_t rdata[], uint32_t u32rLen);
  430. uint8_t I2C_ReadByteOneReg(I2C_T *i2c, uint8_t u8SlaveAddr, uint8_t u8DataAddr);
  431. uint32_t I2C_ReadMultiBytesOneReg(I2C_T *i2c, uint8_t u8SlaveAddr, uint8_t u8DataAddr, uint8_t rdata[], uint32_t u32rLen);
  432. uint8_t I2C_ReadByteTwoRegs(I2C_T *i2c, uint8_t u8SlaveAddr, uint16_t u16DataAddr);
  433. uint32_t I2C_ReadMultiBytesTwoRegs(I2C_T *i2c, uint8_t u8SlaveAddr, uint16_t u16DataAddr, uint8_t rdata[], uint32_t u32rLen);
  434. uint32_t I2C_SMBusGetStatus(I2C_T *i2c);
  435. void I2C_SMBusSetPacketByteCount(I2C_T *i2c, uint32_t u32PktSize);
  436. void I2C_SMBusOpen(I2C_T *i2c, uint8_t u8HostDevice);
  437. void I2C_SMBusClose(I2C_T *i2c);
  438. void I2C_SMBusPECTxEnable(I2C_T *i2c, uint8_t u8PECTxEn);
  439. uint8_t I2C_SMBusGetPECValue(I2C_T *i2c);
  440. void I2C_SMBusIdleTimeout(I2C_T *i2c, uint32_t us, uint32_t u32Hclk);
  441. void I2C_SMBusTimeout(I2C_T *i2c, uint32_t ms, uint32_t u32Pclk);
  442. void I2C_SMBusClockLoTimeout(I2C_T *i2c, uint32_t ms, uint32_t u32Pclk);
  443. /*@}*/ /* end of group I2C_EXPORTED_FUNCTIONS */
  444. /*@}*/ /* end of group I2C_Driver */
  445. /*@}*/ /* end of group Standard_Driver */
  446. #ifdef __cplusplus
  447. }
  448. #endif
  449. #endif
  450. /*** (C) COPYRIGHT 2016 Nuvoton Technology Corp. ***/