r_pdl_spi.h 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. /*""FILE COMMENT""*******************************************************
  2. * System Name : Serial Peripheral Interface API for RX62Nxx
  3. * File Name : r_pdl_spi.h
  4. * Version : 1.02
  5. * Contents : SPI 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_SPI_H
  23. #define R_PDL_SPI_H
  24. #include "r_pdl_common_defs_RX62Nxx.h"
  25. /* Function prototypes */
  26. bool R_SPI_Create(
  27. uint8_t,
  28. uint32_t,
  29. uint32_t,
  30. uint32_t,
  31. uint32_t
  32. );
  33. bool R_SPI_Destroy(
  34. uint8_t
  35. );
  36. bool R_SPI_Command(
  37. uint8_t,
  38. uint8_t,
  39. uint32_t,
  40. uint8_t
  41. );
  42. bool R_SPI_Transfer(
  43. uint8_t,
  44. uint8_t,
  45. uint32_t *,
  46. uint32_t *,
  47. uint16_t,
  48. void *,
  49. uint8_t
  50. );
  51. bool R_SPI_Control(
  52. uint8_t,
  53. uint8_t,
  54. uint32_t
  55. );
  56. bool R_SPI_GetStatus(
  57. uint8_t,
  58. uint16_t *,
  59. uint16_t *
  60. );
  61. /* Connection mode */
  62. #define PDL_SPI_MODE_SPI_MASTER 0x00000001ul
  63. #define PDL_SPI_MODE_SPI_MULTI_MASTER 0x00000002ul
  64. #define PDL_SPI_MODE_SPI_SLAVE 0x00000004ul
  65. #define PDL_SCI_MODE_SYNC_MASTER 0x00000008ul
  66. #define PDL_SCI_MODE_SYNC_SLAVE 0x00000010ul
  67. /* Reception control */
  68. #define PDL_SPI_FULL_DUPLEX 0x00000020ul
  69. #define PDL_SPI_TRANSMIT_ONLY 0x00000040ul
  70. /* Pin selection and control */
  71. #define PDL_SPI_PIN_CMOS 0x00000080ul
  72. #define PDL_SPI_PIN_OPEN_DRAIN 0x00000100ul
  73. #define PDL_SPI_PIN_A 0x00000200ul
  74. #define PDL_SPI_PIN_B 0x00000400ul
  75. #define PDL_SPI_PIN_RSPCK_ENABLE 0x00000800ul
  76. #define PDL_SPI_PIN_RSPCK_DISABLE 0x00001000ul
  77. #define PDL_SPI_PIN_MOSI_ENABLE 0x00002000ul
  78. #define PDL_SPI_PIN_MOSI_DISABLE 0x00004000ul
  79. #define PDL_SPI_PIN_MISO_ENABLE 0x00008000ul
  80. #define PDL_SPI_PIN_MISO_DISABLE 0x00010000ul
  81. #define PDL_SPI_PIN_SSL0_LOW 0x00020000ul
  82. #define PDL_SPI_PIN_SSL0_HIGH 0x00040000ul
  83. #define PDL_SPI_PIN_SSL0_DISABLE 0x00080000ul
  84. #define PDL_SPI_PIN_SSL1_LOW 0x00100000ul
  85. #define PDL_SPI_PIN_SSL1_HIGH 0x00200000ul
  86. #define PDL_SPI_PIN_SSL1_DISABLE 0x00400000ul
  87. #define PDL_SPI_PIN_SSL2_LOW 0x00800000ul
  88. #define PDL_SPI_PIN_SSL2_HIGH 0x01000000ul
  89. #define PDL_SPI_PIN_SSL2_DISABLE 0x02000000ul
  90. #define PDL_SPI_PIN_SSL3_LOW 0x04000000ul
  91. #define PDL_SPI_PIN_SSL3_HIGH 0x08000000ul
  92. #define PDL_SPI_PIN_SSL3_DISABLE 0x10000000ul
  93. #define PDL_SPI_PIN_MOSI_IDLE_LAST 0x20000000ul
  94. #define PDL_SPI_PIN_MOSI_IDLE_LOW 0x40000000ul
  95. #define PDL_SPI_PIN_MOSI_IDLE_HIGH 0x80000000ul
  96. /* Buffer size */
  97. #define PDL_SPI_BUFFER_64 0x00000001ul
  98. #define PDL_SPI_BUFFER_128 0x00000002ul
  99. /* Frame configuration selection */
  100. #define PDL_SPI_FRAME_1_1 0x00000004ul
  101. #define PDL_SPI_FRAME_1_2 0x00000008ul
  102. #define PDL_SPI_FRAME_1_3 0x00000010ul
  103. #define PDL_SPI_FRAME_1_4 0x00000020ul
  104. #define PDL_SPI_FRAME_2_1 0x00000040ul
  105. #define PDL_SPI_FRAME_2_2 0x00000080ul
  106. #define PDL_SPI_FRAME_3 0x00000100ul
  107. #define PDL_SPI_FRAME_4 0x00000200ul
  108. #define PDL_SPI_FRAME_5 0x00000400ul
  109. #define PDL_SPI_FRAME_6 0x00000800ul
  110. #define PDL_SPI_FRAME_7 0x00001000ul
  111. #define PDL_SPI_FRAME_8 0x00002000ul
  112. /* Parity bit control */
  113. #define PDL_SPI_PARITY_NONE 0x00004000ul
  114. #define PDL_SPI_PARITY_EVEN 0x00008000ul
  115. #define PDL_SPI_PARITY_ODD 0x00010000ul
  116. /* Extended clock delay */
  117. #define PDL_SPI_CLOCK_DELAY_1 0x00000001ul
  118. #define PDL_SPI_CLOCK_DELAY_2 0x00000002ul
  119. #define PDL_SPI_CLOCK_DELAY_3 0x00000004ul
  120. #define PDL_SPI_CLOCK_DELAY_4 0x00000008ul
  121. #define PDL_SPI_CLOCK_DELAY_5 0x00000010ul
  122. #define PDL_SPI_CLOCK_DELAY_6 0x00000020ul
  123. #define PDL_SPI_CLOCK_DELAY_7 0x00000040ul
  124. #define PDL_SPI_CLOCK_DELAY_8 0x00000080ul
  125. /* Extended SSL negation delay */
  126. #define PDL_SPI_SSL_DELAY_1 0x00000100ul
  127. #define PDL_SPI_SSL_DELAY_2 0x00000200ul
  128. #define PDL_SPI_SSL_DELAY_3 0x00000400ul
  129. #define PDL_SPI_SSL_DELAY_4 0x00000800ul
  130. #define PDL_SPI_SSL_DELAY_5 0x00001000ul
  131. #define PDL_SPI_SSL_DELAY_6 0x00002000ul
  132. #define PDL_SPI_SSL_DELAY_7 0x00004000ul
  133. #define PDL_SPI_SSL_DELAY_8 0x00008000ul
  134. /* Extended next-access delay */
  135. #define PDL_SPI_NEXT_DELAY_1 0x00010000ul
  136. #define PDL_SPI_NEXT_DELAY_2 0x00020000ul
  137. #define PDL_SPI_NEXT_DELAY_3 0x00040000ul
  138. #define PDL_SPI_NEXT_DELAY_4 0x00080000ul
  139. #define PDL_SPI_NEXT_DELAY_5 0x00100000ul
  140. #define PDL_SPI_NEXT_DELAY_6 0x00200000ul
  141. #define PDL_SPI_NEXT_DELAY_7 0x00400000ul
  142. #define PDL_SPI_NEXT_DELAY_8 0x00800000ul
  143. /* Channel control */
  144. #define PDL_SPI_DISABLE 0x01u
  145. /* Loopback control */
  146. #define PDL_SPI_LOOPBACK_DISABLE 0x02u
  147. #define PDL_SPI_LOOPBACK_DIRECT 0x04u
  148. #define PDL_SPI_LOOPBACK_REVERSED 0x08u
  149. /* Clock phase and polarity */
  150. #define PDL_SPI_CLOCK_MODE_0 0x00000001ul
  151. #define PDL_SPI_CLOCK_MODE_1 0x00000002ul
  152. #define PDL_SPI_CLOCK_MODE_2 0x00000004ul
  153. #define PDL_SPI_CLOCK_MODE_3 0x00000008ul
  154. /* Clock division */
  155. #define PDL_SPI_DIV_1 0x00000010ul
  156. #define PDL_SPI_DIV_2 0x00000020ul
  157. #define PDL_SPI_DIV_4 0x00000040ul
  158. #define PDL_SPI_DIV_8 0x00000080ul
  159. /* SSL assertion */
  160. #define PDL_SPI_ASSERT_SSL0 0x00000100ul
  161. #define PDL_SPI_ASSERT_SSL1 0x00000200ul
  162. #define PDL_SPI_ASSERT_SSL2 0x00000400ul
  163. #define PDL_SPI_ASSERT_SSL3 0x00000800ul
  164. /* SSL negation */
  165. #define PDL_SPI_SSL_NEGATE 0x00001000ul
  166. #define PDL_SPI_SSL_KEEP 0x00002000ul
  167. /* Frame data length */
  168. #define PDL_SPI_LENGTH_8 0x00004000ul
  169. #define PDL_SPI_LENGTH_9 0x00008000ul
  170. #define PDL_SPI_LENGTH_10 0x00010000ul
  171. #define PDL_SPI_LENGTH_11 0x00020000ul
  172. #define PDL_SPI_LENGTH_12 0x00040000ul
  173. #define PDL_SPI_LENGTH_13 0x00080000ul
  174. #define PDL_SPI_LENGTH_14 0x00100000ul
  175. #define PDL_SPI_LENGTH_15 0x00200000ul
  176. #define PDL_SPI_LENGTH_16 0x00400000ul
  177. #define PDL_SPI_LENGTH_20 0x00800000ul
  178. #define PDL_SPI_LENGTH_24 0x01000000ul
  179. #define PDL_SPI_LENGTH_32 0x02000000ul
  180. /* Data transfer format */
  181. #define PDL_SPI_MSB_FIRST 0x04000000ul
  182. #define PDL_SPI_LSB_FIRST 0x08000000ul
  183. /* Extended timing selection */
  184. #define PDL_SPI_CLOCK_DELAY_MINIMUM 0x01u
  185. #define PDL_SPI_CLOCK_DELAY_EXTENDED 0x02u
  186. /* Extended timing selection */
  187. #define PDL_SPI_SSL_DELAY_MINIMUM 0x04u
  188. #define PDL_SPI_SSL_DELAY_EXTENDED 0x08u
  189. /* Next-access delay */
  190. #define PDL_SPI_NEXT_DELAY_MINIMUM 0x10u
  191. #define PDL_SPI_NEXT_DELAY_EXTENDED 0x20u
  192. /* DMAC / DTC trigger control */
  193. #define PDL_SPI_DMAC_DTC_TRIGGER_DISABLE 0x01u
  194. #define PDL_SPI_DMAC_TRIGGER_ENABLE 0x02u
  195. #define PDL_SPI_DTC_TRIGGER_ENABLE 0x04u
  196. #endif
  197. /* End of file */