r_pdl_io_port.h 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  1. /*""FILE COMMENT""*******************************************************
  2. * System Name : I/O Port API
  3. * File Name : r_pdl_io_port.h
  4. * Version : 1.02
  5. * Contents : I/O Port API header
  6. * Customer :
  7. * Model :
  8. * Order :
  9. * CPU : RX
  10. * Compiler : RXC
  11. * OS :
  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_IO_PORT_H
  23. #define R_PDL_IO_PORT_H
  24. #include "r_pdl_common_defs_RX62Nxx.h"
  25. /* Function prototypes */
  26. bool R_IO_PORT_Set(
  27. uint16_t,
  28. uint8_t
  29. );
  30. bool R_IO_PORT_ReadControl(
  31. uint16_t,
  32. uint8_t,
  33. uint8_t *
  34. );
  35. bool R_IO_PORT_ModifyControl(
  36. uint16_t,
  37. uint8_t,
  38. uint8_t
  39. );
  40. bool R_IO_PORT_Read(
  41. uint16_t,
  42. uint8_t *
  43. );
  44. bool R_IO_PORT_Write(
  45. uint16_t,
  46. uint8_t
  47. );
  48. bool R_IO_PORT_Compare(
  49. uint16_t,
  50. uint8_t,
  51. void *
  52. );
  53. bool R_IO_PORT_Modify(
  54. uint16_t,
  55. uint8_t,
  56. uint8_t
  57. );
  58. bool R_IO_PORT_Wait(
  59. uint16_t,
  60. uint8_t
  61. );
  62. /* I/O Ports*/
  63. #define PDL_IO_PORT_0 0xF000u /* Port 0 */
  64. #define PDL_IO_PORT_1 0xF001u /* Port 1 */
  65. #define PDL_IO_PORT_2 0xF002u /* Port 2 */
  66. #define PDL_IO_PORT_3 0xF003u /* Port 3 */
  67. #define PDL_IO_PORT_4 0xF004u /* Port 4 */
  68. #define PDL_IO_PORT_5 0xF005u /* Port 5 */
  69. #define PDL_IO_PORT_6 0xF006u /* Port 6 */
  70. #define PDL_IO_PORT_7 0xF007u /* Port 7 */
  71. #define PDL_IO_PORT_8 0xF008u /* Port 8 */
  72. #define PDL_IO_PORT_9 0xF009u /* Port 9 */
  73. #define PDL_IO_PORT_A 0xF00Au /* Port A */
  74. #define PDL_IO_PORT_B 0xF00Bu /* Port B */
  75. #define PDL_IO_PORT_C 0xF00Cu /* Port C */
  76. #define PDL_IO_PORT_D 0xF00Du /* Port D */
  77. #define PDL_IO_PORT_E 0xF00Eu /* Port E */
  78. #define PDL_IO_PORT_F 0xF00Fu /* Port F */
  79. #define PDL_IO_PORT_G 0xF010u /* Port G */
  80. /* I/O port pins */
  81. #define PDL_IO_PORT_0_0 0x0001u /* P00 */
  82. #define PDL_IO_PORT_0_1 0x0002u /* P01 */
  83. #define PDL_IO_PORT_0_2 0x0004u /* P02 */
  84. #define PDL_IO_PORT_0_3 0x0008u /* P03 */
  85. #define PDL_IO_PORT_0_5 0x0020u /* P05 */
  86. #define PDL_IO_PORT_0_7 0x0080u /* P07 */
  87. #define PDL_IO_PORT_1_0 0x0101u /* P10 */
  88. #define PDL_IO_PORT_1_1 0x0102u /* P11 */
  89. #define PDL_IO_PORT_1_2 0x0104u /* P12 */
  90. #define PDL_IO_PORT_1_3 0x0108u /* P13 */
  91. #define PDL_IO_PORT_1_4 0x0110u /* P14 */
  92. #define PDL_IO_PORT_1_5 0x0120u /* P15 */
  93. #define PDL_IO_PORT_1_6 0x0140u /* P16 */
  94. #define PDL_IO_PORT_1_7 0x0180u /* P17 */
  95. #define PDL_IO_PORT_2_0 0x0201u /* P20 */
  96. #define PDL_IO_PORT_2_1 0x0202u /* P21 */
  97. #define PDL_IO_PORT_2_2 0x0204u /* P22 */
  98. #define PDL_IO_PORT_2_3 0x0208u /* P23 */
  99. #define PDL_IO_PORT_2_4 0x0210u /* P24 */
  100. #define PDL_IO_PORT_2_5 0x0220u /* P25 */
  101. #define PDL_IO_PORT_2_6 0x0240u /* P26 */
  102. #define PDL_IO_PORT_2_7 0x0280u /* P27 */
  103. #define PDL_IO_PORT_3_0 0x0301u /* P30 */
  104. #define PDL_IO_PORT_3_1 0x0302u /* P31 */
  105. #define PDL_IO_PORT_3_2 0x0304u /* P32 */
  106. #define PDL_IO_PORT_3_3 0x0308u /* P33 */
  107. #define PDL_IO_PORT_3_4 0x0310u /* P34 */
  108. #define PDL_IO_PORT_3_5 0x0320u /* P35 */
  109. #define PDL_IO_PORT_4_0 0x0401u /* P40 */
  110. #define PDL_IO_PORT_4_1 0x0402u /* P41 */
  111. #define PDL_IO_PORT_4_2 0x0404u /* P42 */
  112. #define PDL_IO_PORT_4_3 0x0408u /* P43 */
  113. #define PDL_IO_PORT_4_4 0x0410u /* P44 */
  114. #define PDL_IO_PORT_4_5 0x0420u /* P45 */
  115. #define PDL_IO_PORT_4_6 0x0440u /* P46 */
  116. #define PDL_IO_PORT_4_7 0x0480u /* P47 */
  117. #define PDL_IO_PORT_5_0 0x0501u /* P50 */
  118. #define PDL_IO_PORT_5_1 0x0502u /* P51 */
  119. #define PDL_IO_PORT_5_2 0x0504u /* P52 */
  120. #define PDL_IO_PORT_5_3 0x0508u /* P53 */
  121. #define PDL_IO_PORT_5_4 0x0510u /* P54 */
  122. #define PDL_IO_PORT_5_5 0x0520u /* P55 */
  123. #define PDL_IO_PORT_5_6 0x0540u /* P56 */
  124. #define PDL_IO_PORT_5_7 0x0580u /* P57 */
  125. #define PDL_IO_PORT_6_0 0x0601u /* P60 */
  126. #define PDL_IO_PORT_6_1 0x0602u /* P61 */
  127. #define PDL_IO_PORT_6_2 0x0604u /* P62 */
  128. #define PDL_IO_PORT_6_3 0x0608u /* P63 */
  129. #define PDL_IO_PORT_6_4 0x0610u /* P64 */
  130. #define PDL_IO_PORT_6_5 0x0620u /* P65 */
  131. #define PDL_IO_PORT_6_6 0x0640u /* P66 */
  132. #define PDL_IO_PORT_6_7 0x0680u /* P67 */
  133. #define PDL_IO_PORT_7_0 0x0701u /* P70 */
  134. #define PDL_IO_PORT_7_1 0x0702u /* P71 */
  135. #define PDL_IO_PORT_7_2 0x0704u /* P72 */
  136. #define PDL_IO_PORT_7_3 0x0708u /* P73 */
  137. #define PDL_IO_PORT_7_4 0x0710u /* P74 */
  138. #define PDL_IO_PORT_7_5 0x0720u /* P75 */
  139. #define PDL_IO_PORT_7_6 0x0740u /* P76 */
  140. #define PDL_IO_PORT_7_7 0x0780u /* P77 */
  141. #define PDL_IO_PORT_8_0 0x0801u /* P80 */
  142. #define PDL_IO_PORT_8_1 0x0802u /* P81 */
  143. #define PDL_IO_PORT_8_2 0x0804u /* P82 */
  144. #define PDL_IO_PORT_8_3 0x0808u /* P83 */
  145. #define PDL_IO_PORT_8_4 0x0810u /* P84 */
  146. #define PDL_IO_PORT_8_5 0x0820u /* P85 */
  147. #define PDL_IO_PORT_9_0 0x0901u /* P90 */
  148. #define PDL_IO_PORT_9_1 0x0902u /* P91 */
  149. #define PDL_IO_PORT_9_2 0x0904u /* P92 */
  150. #define PDL_IO_PORT_9_3 0x0908u /* P93 */
  151. #define PDL_IO_PORT_9_4 0x0910u /* P94 */
  152. #define PDL_IO_PORT_9_5 0x0920u /* P95 */
  153. #define PDL_IO_PORT_9_6 0x0940u /* P96 */
  154. #define PDL_IO_PORT_9_7 0x0980u /* P97 */
  155. #define PDL_IO_PORT_A_0 0x0A01u /* PA0 */
  156. #define PDL_IO_PORT_A_1 0x0A02u /* PA1 */
  157. #define PDL_IO_PORT_A_2 0x0A04u /* PA2 */
  158. #define PDL_IO_PORT_A_3 0x0A08u /* PA3 */
  159. #define PDL_IO_PORT_A_4 0x0A10u /* PA4 */
  160. #define PDL_IO_PORT_A_5 0x0A20u /* PA5 */
  161. #define PDL_IO_PORT_A_6 0x0A40u /* PA6 */
  162. #define PDL_IO_PORT_A_7 0x0A80u /* PA7 */
  163. #define PDL_IO_PORT_B_0 0x0B01u /* PB0 */
  164. #define PDL_IO_PORT_B_1 0x0B02u /* PB1 */
  165. #define PDL_IO_PORT_B_2 0x0B04u /* PB2 */
  166. #define PDL_IO_PORT_B_3 0x0B08u /* PB3 */
  167. #define PDL_IO_PORT_B_4 0x0B10u /* PB4 */
  168. #define PDL_IO_PORT_B_5 0x0B20u /* PB5 */
  169. #define PDL_IO_PORT_B_6 0x0B40u /* PB6 */
  170. #define PDL_IO_PORT_B_7 0x0B80u /* PB7 */
  171. #define PDL_IO_PORT_C_0 0x0C01u /* PC0 */
  172. #define PDL_IO_PORT_C_1 0x0C02u /* PC1 */
  173. #define PDL_IO_PORT_C_2 0x0C04u /* PC2 */
  174. #define PDL_IO_PORT_C_3 0x0C08u /* PC3 */
  175. #define PDL_IO_PORT_C_4 0x0C10u /* PC4 */
  176. #define PDL_IO_PORT_C_5 0x0C20u /* PC5 */
  177. #define PDL_IO_PORT_C_6 0x0C40u /* PC6 */
  178. #define PDL_IO_PORT_C_7 0x0C80u /* PC7 */
  179. #define PDL_IO_PORT_D_0 0x0D01u /* PD0 */
  180. #define PDL_IO_PORT_D_1 0x0D02u /* PD1 */
  181. #define PDL_IO_PORT_D_2 0x0D04u /* PD2 */
  182. #define PDL_IO_PORT_D_3 0x0D08u /* PD3 */
  183. #define PDL_IO_PORT_D_4 0x0D10u /* PD4 */
  184. #define PDL_IO_PORT_D_5 0x0D20u /* PD5 */
  185. #define PDL_IO_PORT_D_6 0x0D40u /* PD6 */
  186. #define PDL_IO_PORT_D_7 0x0D80u /* PD7 */
  187. #define PDL_IO_PORT_E_0 0x0E01u /* PE0 */
  188. #define PDL_IO_PORT_E_1 0x0E02u /* PE1 */
  189. #define PDL_IO_PORT_E_2 0x0E04u /* PE2 */
  190. #define PDL_IO_PORT_E_3 0x0E08u /* PE3 */
  191. #define PDL_IO_PORT_E_4 0x0E10u /* PE4 */
  192. #define PDL_IO_PORT_E_5 0x0E20u /* PE5 */
  193. #define PDL_IO_PORT_E_6 0x0E40u /* PE6 */
  194. #define PDL_IO_PORT_E_7 0x0E80u /* PE7 */
  195. #define PDL_IO_PORT_F_0 0x0F01u /* PF0 */
  196. #define PDL_IO_PORT_F_1 0x0F02u /* PF1 */
  197. #define PDL_IO_PORT_F_2 0x0F04u /* PF2 */
  198. #define PDL_IO_PORT_F_3 0x0F08u /* PF3 */
  199. #define PDL_IO_PORT_F_4 0x0F10u /* PF4 */
  200. #define PDL_IO_PORT_G_0 0x1001u /* PG0 */
  201. #define PDL_IO_PORT_G_1 0x1002u /* PG1 */
  202. #define PDL_IO_PORT_G_2 0x1004u /* PG2 */
  203. #define PDL_IO_PORT_G_3 0x1008u /* PG3 */
  204. #define PDL_IO_PORT_G_4 0x1010u /* PG4 */
  205. #define PDL_IO_PORT_G_5 0x1020u /* PG5 */
  206. #define PDL_IO_PORT_G_6 0x1040u /* PG6 */
  207. #define PDL_IO_PORT_G_7 0x1080u /* PG7 */
  208. /* Settings */
  209. #define PDL_IO_PORT_INPUT 0x01u /* Input port */
  210. #define PDL_IO_PORT_OUTPUT 0x02u /* Output port */
  211. #define PDL_IO_PORT_INPUT_BUFFER_ON 0x04u /* The input buffer is enabled */
  212. #define PDL_IO_PORT_INPUT_BUFFER_OFF 0x08u /* The input buffer is disabled */
  213. #define PDL_IO_PORT_PULL_UP_ON 0x10u /* Pulled high */
  214. #define PDL_IO_PORT_PULL_UP_OFF 0x20u /* Not pulled high */
  215. #define PDL_IO_PORT_OPEN_DRAIN 0x40u /* NMOS open-drain output */
  216. #define PDL_IO_PORT_CMOS 0x80u /* CMOS output */
  217. /* Control register selection */
  218. #define PDL_IO_PORT_DIRECTION 0x01u
  219. #define PDL_IO_PORT_INPUT_BUFFER 0x02u
  220. #define PDL_IO_PORT_PULL_UP 0x04u
  221. #define PDL_IO_PORT_TYPE 0x08u
  222. /* Logical operations */
  223. #define PDL_IO_PORT_AND 0x10u
  224. #define PDL_IO_PORT_OR 0x20u
  225. #define PDL_IO_PORT_XOR 0x40u
  226. #endif
  227. /* End of file */