r_pdl_sci.h 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. /*""FILE COMMENT""*******************************************************
  2. * System Name : Serial Communication Interface API for RX62Nxx
  3. * File Name : r_pdl_sci.h
  4. * Version : 1.02
  5. * Contents : Serial Interface 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_SCI_H
  23. #define R_PDL_SCI_H
  24. #include "r_pdl_common_defs_RX62Nxx.h"
  25. /* Function prototypes */
  26. bool R_SCI_Set(
  27. uint8_t
  28. );
  29. bool R_SCI_Create(
  30. uint8_t,
  31. uint32_t,
  32. uint32_t,
  33. uint8_t
  34. );
  35. bool R_SCI_Destroy(
  36. uint8_t
  37. );
  38. bool R_SCI_Send(
  39. uint8_t,
  40. uint16_t,
  41. uint8_t *,
  42. uint16_t,
  43. void *
  44. );
  45. bool R_SCI_Receive(
  46. uint8_t,
  47. uint16_t,
  48. uint8_t *,
  49. uint16_t,
  50. void *,
  51. void *
  52. );
  53. bool R_SCI_Control(
  54. uint8_t,
  55. uint8_t
  56. );
  57. bool R_SCI_GetStatus(
  58. uint8_t,
  59. uint8_t *,
  60. uint8_t *,
  61. uint16_t *,
  62. uint16_t *
  63. );
  64. /* ------------------------ */
  65. /* R_SCI_Set, Configuration */
  66. /* ------------------------ */
  67. /* Pin selection */
  68. #define PDL_SCI_PIN_SCI1_A 0x01u
  69. #define PDL_SCI_PIN_SCI1_B 0x02u
  70. #define PDL_SCI_PIN_SCI2_A 0x04u
  71. #define PDL_SCI_PIN_SCI2_B 0x08u
  72. #define PDL_SCI_PIN_SCI3_A 0x10u
  73. #define PDL_SCI_PIN_SCI3_B 0x20u
  74. #define PDL_SCI_PIN_SCI6_A 0x40u
  75. #define PDL_SCI_PIN_SCI6_B 0x80u
  76. /* ----------------------------------------- */
  77. /* R_SCI_Create, data2 Channel configuration */
  78. /* ----------------------------------------- */
  79. /* Operation mode */
  80. #define PDL_SCI_ASYNC 0x00000001ul
  81. #define PDL_SCI_SYNC 0x00000002ul
  82. #define PDL_SCI_SMART 0x00000004ul
  83. #define PDL_SCI_ASYNC_MP 0x00000008ul
  84. /* Common selections */
  85. /* Transmit / Receive connections */
  86. #define PDL_SCI_TX_CONNECTED 0x00000010ul
  87. #define PDL_SCI_TX_DISCONNECTED 0x00000020ul
  88. #define PDL_SCI_RX_CONNECTED 0x00000040ul
  89. #define PDL_SCI_RX_DISCONNECTED 0x00000080ul
  90. /* Data clock source */
  91. #define PDL_SCI_CLK_INT_OUT 0x00000100ul
  92. #define PDL_SCI_CLK_EXT 0x00000200ul
  93. /* Parity selection */
  94. #define PDL_SCI_PARITY_EVEN 0x00000400ul
  95. #define PDL_SCI_PARITY_ODD 0x00000800ul
  96. /* Asynchronous-only selections */
  97. /* Data clock source */
  98. #define PDL_SCI_CLK_INT_IO 0x00001000ul
  99. #define PDL_SCI_CLK_TMR 0x00002000ul
  100. /* Data length */
  101. #define PDL_SCI_8_BIT_LENGTH 0x00004000ul
  102. #define PDL_SCI_7_BIT_LENGTH 0x00008000ul
  103. /* Parity selection */
  104. #define PDL_SCI_PARITY_NONE 0x00010000ul
  105. /* Stop bit length */
  106. #define PDL_SCI_STOP_1 0x00020000ul
  107. #define PDL_SCI_STOP_2 0x00040000ul
  108. #define PDL_SCI_8N1 (PDL_SCI_8_BIT_LENGTH | PDL_SCI_PARITY_NONE | PDL_SCI_STOP_1)
  109. /* Smart card-only selections */
  110. /* Data transfer format */
  111. #define PDL_SCI_LSB_FIRST 0x00001000ul
  112. #define PDL_SCI_MSB_FIRST 0x00002000ul
  113. /* Data inversion */
  114. #define PDL_SCI_INVERSION_OFF 0x00004000ul
  115. #define PDL_SCI_INVERSION_ON 0x00008000ul
  116. /* Base clock pulse cycle count */
  117. #define PDL_SCI_BCP_32 0x00010000ul
  118. #define PDL_SCI_BCP_64 0x00020000ul
  119. #define PDL_SCI_BCP_93 0x00040000ul
  120. #define PDL_SCI_BCP_128 0x00080000ul
  121. #define PDL_SCI_BCP_186 0x00100000ul
  122. #define PDL_SCI_BCP_256 0x00200000ul
  123. #define PDL_SCI_BCP_372 0x00400000ul
  124. #define PDL_SCI_BCP_512 0x00800000ul
  125. /* Block transfer mode */
  126. #define PDL_SCI_BLOCK_MODE_OFF 0x01000000ul
  127. #define PDL_SCI_BLOCK_MODE_ON 0x02000000ul
  128. /* GSM mode */
  129. #define PDL_SCI_GSM_MODE_OFF 0x04000000ul
  130. #define PDL_SCI_GSM_MODE_ON 0x08000000ul
  131. /* Clock output control */
  132. #define PDL_SCI_SCK_OUTPUT_OFF 0x10000000ul
  133. #define PDL_SCI_SCK_OUTPUT_LOW 0x20000000ul
  134. #define PDL_SCI_SCK_OUTPUT_ON 0x40000000ul
  135. #define PDL_SCI_SCK_OUTPUT_HIGH 0x80000000ul
  136. /* ----------------------------------- */
  137. /* R_SCI_Create, data3 register value */
  138. /* ----------------------------------- */
  139. /* Transfer clock control */
  140. /* CKS selection (optional) */
  141. #define PDL_SCI_PCLK_DIV_1 0x01000000ul
  142. #define PDL_SCI_PCLK_DIV_4 0x02000000ul
  143. #define PDL_SCI_PCLK_DIV_16 0x03000000ul
  144. #define PDL_SCI_PCLK_DIV_64 0x04000000ul
  145. /* ABCS selection (optional) */
  146. #define PDL_SCI_CYCLE_BIT_16 0x10000000ul
  147. #define PDL_SCI_CYCLE_BIT_8 0x20000000ul
  148. /* ----------------------------------------------- */
  149. /* R_SCI_Send/R_SCI_Receive, Channel configuration */
  150. /* ----------------------------------------------- */
  151. /* DMAC / DTC trigger control */
  152. #define PDL_SCI_DMAC_DTC_TRIGGER_DISABLE 0x0001u
  153. #define PDL_SCI_DMAC_TRIGGER_ENABLE 0x0002u
  154. #define PDL_SCI_DTC_TRIGGER_ENABLE 0x0004u
  155. #define PDL_SCI_MP_ID_CYCLE 0x0008u
  156. /* ------------------------------ */
  157. /* R_SCI_Control, Channel control */
  158. /* ------------------------------ */
  159. /* Stop control */
  160. #define PDL_SCI_STOP_TX 0x01u
  161. #define PDL_SCI_STOP_RX 0x02u
  162. #define PDL_SCI_STOP_TX_AND_RX (PDL_SCI_STOP_TX | PDL_SCI_STOP_RX)
  163. /* Break output control */
  164. #define PDL_SCI_OUTPUT_MARK 0x04u
  165. #define PDL_SCI_OUTPUT_SPACE 0x08u
  166. /* Error flag control */
  167. #define PDL_SCI_CLEAR_RECEIVE_ERROR_FLAGS 0x10u
  168. /* Manual SCK control */
  169. #define PDL_SCI_GSM_SCK_STOP 0x20u
  170. #define PDL_SCI_GSM_SCK_START 0x40u
  171. #endif
  172. /* End of file */