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