r_pdl_iic.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. /*""FILE COMMENT""*******************************************************
  2. * System Name : I²C API for RX62Nxx
  3. * File Name : r_pdl_iic.h
  4. * Version : 1.02
  5. * Contents : I²C API header
  6. * Customer :
  7. * Model :
  8. * Order :
  9. * CPU : RX
  10. * Compiler : RXC
  11. * OS : Nothing
  12. * Programmer :
  13. * Note :
  14. ************************************************************************
  15. * Copyright, 2011. Renesas Electronics Corporation
  16. * and Renesas Solutions Corporation
  17. ************************************************************************
  18. * History : 2011.04.08
  19. * : Ver 1.02
  20. * : CS-5 release.
  21. *""FILE COMMENT END""**************************************************/
  22. #ifndef R_PDL_IIC_H
  23. #define R_PDL_IIC_H
  24. #include "r_pdl_common_defs_RX62Nxx.h"
  25. /* Function prototypes */
  26. bool R_IIC_Create(
  27. uint8_t,
  28. uint32_t,
  29. uint32_t,
  30. uint16_t,
  31. uint16_t,
  32. uint16_t,
  33. uint32_t,
  34. uint32_t
  35. );
  36. bool R_IIC_Destroy(
  37. uint8_t
  38. );
  39. bool R_IIC_MasterSend(
  40. uint8_t,
  41. uint16_t,
  42. uint16_t,
  43. uint8_t *,
  44. uint16_t,
  45. void *,
  46. uint8_t
  47. );
  48. bool R_IIC_MasterReceive(
  49. uint8_t,
  50. uint16_t,
  51. uint16_t,
  52. uint8_t *,
  53. uint16_t,
  54. void *,
  55. uint8_t
  56. );
  57. bool R_IIC_MasterReceiveLast(
  58. uint8_t,
  59. uint8_t *
  60. );
  61. bool R_IIC_SlaveMonitor(
  62. uint8_t,
  63. uint16_t,
  64. uint8_t *,
  65. uint16_t,
  66. void *,
  67. uint8_t
  68. );
  69. bool R_IIC_SlaveSend(
  70. uint8_t,
  71. uint8_t *,
  72. uint16_t
  73. );
  74. bool R_IIC_Control(
  75. uint8_t,
  76. uint8_t
  77. );
  78. bool R_IIC_GetStatus(
  79. uint8_t,
  80. uint32_t *,
  81. uint16_t *,
  82. uint16_t *
  83. );
  84. /* Bus mode */
  85. #define PDL_IIC_MODE_IIC 0x00000001ul
  86. #define PDL_IIC_MODE_IIC_FMP 0x00000002ul
  87. #define PDL_IIC_MODE_SMBUS 0x00000004ul
  88. /* Internal reference clock */
  89. #define PDL_IIC_INT_PCLK_DIV_1 0x00000008ul
  90. #define PDL_IIC_INT_PCLK_DIV_2 0x00000010ul
  91. #define PDL_IIC_INT_PCLK_DIV_4 0x00000020ul
  92. #define PDL_IIC_INT_PCLK_DIV_8 0x00000040ul
  93. #define PDL_IIC_INT_PCLK_DIV_16 0x00000080ul
  94. #define PDL_IIC_INT_PCLK_DIV_32 0x00000100ul
  95. #define PDL_IIC_INT_PCLK_DIV_64 0x00000200ul
  96. #define PDL_IIC_INT_PCLK_DIV_128 0x00000400ul
  97. /* Timeout detection */
  98. #define PDL_IIC_TIMEOUT_DISABLE 0x00000800ul
  99. #define PDL_IIC_TIMEOUT_LOW 0x00001000ul
  100. #define PDL_IIC_TIMEOUT_HIGH 0x00002000ul
  101. #define PDL_IIC_TIMEOUT_BOTH 0x00004000ul
  102. /* Timeout mode */
  103. #define PDL_IIC_TIMEOUT_LONG 0x00008000ul
  104. #define PDL_IIC_TIMEOUT_SHORT 0x00010000ul
  105. /* SDA output delay count */
  106. #define PDL_IIC_SDA_DELAY_0 0x00020000ul
  107. #define PDL_IIC_SDA_DELAY_1 0x00040000ul
  108. #define PDL_IIC_SDA_DELAY_2 0x00080000ul
  109. #define PDL_IIC_SDA_DELAY_3 0x00100000ul
  110. #define PDL_IIC_SDA_DELAY_4 0x00200000ul
  111. #define PDL_IIC_SDA_DELAY_5 0x00400000ul
  112. #define PDL_IIC_SDA_DELAY_6 0x00800000ul
  113. #define PDL_IIC_SDA_DELAY_7 0x01000000ul
  114. /* SDA output delay clock source */
  115. #define PDL_IIC_SDA_DELAY_DIV_1 0x02000000ul
  116. #define PDL_IIC_SDA_DELAY_DIV_2 0x04000000ul
  117. /* Noise filter control */
  118. #define PDL_IIC_NF_DISABLE 0x08000000ul
  119. #define PDL_IIC_NF_1 0x10000000ul
  120. #define PDL_IIC_NF_2 0x20000000ul
  121. #define PDL_IIC_NF_3 0x40000000ul
  122. #define PDL_IIC_NF_4 0x80000000ul
  123. /* NACK Transmission Arbitration Lost Detection control */
  124. #define PDL_IIC_NTALD_DISABLE 0x00000001ul
  125. #define PDL_IIC_NTALD_ENABLE 0x00000002ul
  126. /* Slave Arbitration Lost Detection control */
  127. #define PDL_IIC_SALD_DISABLE 0x00000004ul
  128. #define PDL_IIC_SALD_ENABLE 0x00000008ul
  129. /* Slave address detection control */
  130. #define PDL_IIC_SLAVE_0_DISABLE 0x00000010ul
  131. #define PDL_IIC_SLAVE_0_ENABLE_7 0x00000020ul
  132. #define PDL_IIC_SLAVE_0_ENABLE_10 0x00000040ul
  133. #define PDL_IIC_SLAVE_1_DISABLE 0x00000080ul
  134. #define PDL_IIC_SLAVE_1_ENABLE_7 0x00000100ul
  135. #define PDL_IIC_SLAVE_1_ENABLE_10 0x00000200ul
  136. #define PDL_IIC_SLAVE_2_DISABLE 0x00000400ul
  137. #define PDL_IIC_SLAVE_2_ENABLE_7 0x00000800ul
  138. #define PDL_IIC_SLAVE_2_ENABLE_10 0x00001000ul
  139. #define PDL_IIC_SLAVE_GCA_DISABLE 0x00002000ul
  140. #define PDL_IIC_SLAVE_GCA_ENABLE 0x00004000ul
  141. /* Device-ID detection control */
  142. #define PDL_IIC_DEVICE_ID_DISABLE 0x00008000ul
  143. #define PDL_IIC_DEVICE_ID_ENABLE 0x00010000ul
  144. /* Host Address detection control */
  145. #define PDL_IIC_HOST_ADDRESS_DISABLE 0x00020000ul
  146. #define PDL_IIC_HOST_ADDRESS_ENABLE 0x00040000ul
  147. /* Start / Repeated Start condition control */
  148. #define PDL_IIC_START_ENABLE 0x0001u
  149. #define PDL_IIC_START_DISABLE 0x0002u
  150. /* Stop condition control */
  151. #define PDL_IIC_STOP_ENABLE 0x0004u
  152. #define PDL_IIC_STOP_DISABLE 0x0008u
  153. /* Master DMAC / DTC trigger control */
  154. #define PDL_IIC_DMAC_DTC_TRIGGER_DISABLE 0x0010u
  155. #define PDL_IIC_DMAC_TRIGGER_ENABLE 0x0020u
  156. #define PDL_IIC_DTC_TRIGGER_ENABLE 0x0040u
  157. /* Slave DMAC / DTC trigger control */
  158. #define PDL_IIC_RX_DMAC_DTC_TRIGGER_DISABLE 0x0080u
  159. #define PDL_IIC_RX_DMAC_TRIGGER_ENABLE 0x0100u
  160. #define PDL_IIC_RX_DTC_TRIGGER_ENABLE 0x0200u
  161. #define PDL_IIC_TX_DMAC_DTC_TRIGGER_DISABLE 0x0400u
  162. #define PDL_IIC_TX_DMAC_TRIGGER_ENABLE 0x0800u
  163. #define PDL_IIC_TX_DTC_TRIGGER_ENABLE 0x1000u
  164. /* Stop generation */
  165. #define PDL_IIC_STOP 0x01u
  166. /* NACK generation */
  167. #define PDL_IIC_NACK 0x02u
  168. /* Pin control */
  169. #define PDL_IIC_SDA_LOW 0x04u
  170. #define PDL_IIC_SDA_HI_Z 0x08u
  171. #define PDL_IIC_SCL_LOW 0x10u
  172. #define PDL_IIC_SCL_HI_Z 0x20u
  173. /* Extra clock cycle generation */
  174. #define PDL_IIC_CYCLE_SCL 0x40u
  175. /* Reset control */
  176. #define PDL_IIC_RESET 0x80u
  177. #endif
  178. /* End of file */