]>
Commit | Line | Data |
---|---|---|
e6f22281 WD |
1 | /* |
2 | * See file CREDITS for list of people who contributed to this | |
3 | * project. | |
4 | * | |
5 | * This program is free software; you can redistribute it and/or | |
6 | * modify it under the terms of the GNU General Public License as | |
7 | * published by the Free Software Foundation; either version 2 of | |
8 | * the License, or (at your option) any later version. | |
9 | * | |
10 | * This program is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License | |
16 | * along with this program; if not, write to the Free Software | |
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, | |
18 | * MA 02111-1307 USA | |
19 | */ | |
20 | ||
21 | /* | |
22 | * MPC8xx I/O port pin manipulation functions | |
23 | * Roughly based on iopin_8260.h | |
24 | */ | |
25 | ||
26 | #ifndef _ASM_IOPIN_8XX_H_ | |
27 | #define _ASM_IOPIN_8XX_H_ | |
28 | ||
29 | #include <linux/types.h> | |
30 | #include <asm/8xx_immap.h> | |
31 | ||
32 | #ifdef __KERNEL__ | |
33 | ||
34 | typedef struct { | |
35 | u_char port:2; /* port number (A=0, B=1, C=2, D=3) */ | |
36 | u_char pin:5; /* port pin (0-31) */ | |
37 | u_char flag:1; /* for whatever */ | |
38 | } iopin_t; | |
39 | ||
40 | #define IOPIN_PORTA 0 | |
41 | #define IOPIN_PORTB 1 | |
42 | #define IOPIN_PORTC 2 | |
43 | #define IOPIN_PORTD 3 | |
44 | ||
45 | extern __inline__ void | |
46 | iopin_set_high(iopin_t *iopin) | |
47 | { | |
48 | if (iopin->port == IOPIN_PORTA) { | |
6d0f6bcf | 49 | volatile ushort *datp = &((immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_padat; |
e6f22281 WD |
50 | *datp |= (1 << (15 - iopin->pin)); |
51 | } else if (iopin->port == IOPIN_PORTB) { | |
6d0f6bcf | 52 | volatile uint *datp = &((immap_t *)CONFIG_SYS_IMMR)->im_cpm.cp_pbdat; |
e6f22281 WD |
53 | *datp |= (1 << (31 - iopin->pin)); |
54 | } else if (iopin->port == IOPIN_PORTC) { | |
6d0f6bcf | 55 | volatile ushort *datp = &((immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_pcdat; |
e6f22281 WD |
56 | *datp |= (1 << (15 - iopin->pin)); |
57 | } else if (iopin->port == IOPIN_PORTD) { | |
6d0f6bcf | 58 | volatile ushort *datp = &((immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_pddat; |
e6f22281 WD |
59 | *datp |= (1 << (15 - iopin->pin)); |
60 | } | |
61 | } | |
62 | ||
63 | extern __inline__ void | |
64 | iopin_set_low(iopin_t *iopin) | |
65 | { | |
66 | if (iopin->port == IOPIN_PORTA) { | |
6d0f6bcf | 67 | volatile ushort *datp = &((immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_padat; |
e6f22281 WD |
68 | *datp &= ~(1 << (15 - iopin->pin)); |
69 | } else if (iopin->port == IOPIN_PORTB) { | |
6d0f6bcf | 70 | volatile uint *datp = &((immap_t *)CONFIG_SYS_IMMR)->im_cpm.cp_pbdat; |
e6f22281 WD |
71 | *datp &= ~(1 << (31 - iopin->pin)); |
72 | } else if (iopin->port == IOPIN_PORTC) { | |
6d0f6bcf | 73 | volatile ushort *datp = &((immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_pcdat; |
e6f22281 WD |
74 | *datp &= ~(1 << (15 - iopin->pin)); |
75 | } else if (iopin->port == IOPIN_PORTD) { | |
6d0f6bcf | 76 | volatile ushort *datp = &((immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_pddat; |
e6f22281 WD |
77 | *datp &= ~(1 << (15 - iopin->pin)); |
78 | } | |
79 | } | |
80 | ||
81 | extern __inline__ uint | |
82 | iopin_is_high(iopin_t *iopin) | |
83 | { | |
84 | if (iopin->port == IOPIN_PORTA) { | |
6d0f6bcf | 85 | volatile ushort *datp = &((immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_padat; |
e6f22281 WD |
86 | return (*datp >> (15 - iopin->pin)) & 1; |
87 | } else if (iopin->port == IOPIN_PORTB) { | |
6d0f6bcf | 88 | volatile uint *datp = &((immap_t *)CONFIG_SYS_IMMR)->im_cpm.cp_pbdat; |
e6f22281 WD |
89 | return (*datp >> (31 - iopin->pin)) & 1; |
90 | } else if (iopin->port == IOPIN_PORTC) { | |
6d0f6bcf | 91 | volatile ushort *datp = &((immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_pcdat; |
e6f22281 WD |
92 | return (*datp >> (15 - iopin->pin)) & 1; |
93 | } else if (iopin->port == IOPIN_PORTD) { | |
6d0f6bcf | 94 | volatile ushort *datp = &((immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_pddat; |
e6f22281 WD |
95 | return (*datp >> (15 - iopin->pin)) & 1; |
96 | } | |
97 | return 0; | |
98 | } | |
99 | ||
100 | extern __inline__ uint | |
101 | iopin_is_low(iopin_t *iopin) | |
102 | { | |
103 | if (iopin->port == IOPIN_PORTA) { | |
6d0f6bcf | 104 | volatile ushort *datp = &((immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_padat; |
e6f22281 WD |
105 | return ((*datp >> (15 - iopin->pin)) & 1) ^ 1; |
106 | } else if (iopin->port == IOPIN_PORTB) { | |
6d0f6bcf | 107 | volatile uint *datp = &((immap_t *)CONFIG_SYS_IMMR)->im_cpm.cp_pbdat; |
e6f22281 WD |
108 | return ((*datp >> (31 - iopin->pin)) & 1) ^ 1; |
109 | } else if (iopin->port == IOPIN_PORTC) { | |
6d0f6bcf | 110 | volatile ushort *datp = &((immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_pcdat; |
e6f22281 WD |
111 | return ((*datp >> (15 - iopin->pin)) & 1) ^ 1; |
112 | } else if (iopin->port == IOPIN_PORTD) { | |
6d0f6bcf | 113 | volatile ushort *datp = &((immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_pddat; |
e6f22281 WD |
114 | return ((*datp >> (15 - iopin->pin)) & 1) ^ 1; |
115 | } | |
116 | return 0; | |
117 | } | |
118 | ||
119 | extern __inline__ void | |
120 | iopin_set_out(iopin_t *iopin) | |
121 | { | |
122 | if (iopin->port == IOPIN_PORTA) { | |
6d0f6bcf | 123 | volatile ushort *dirp = &((immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_padir; |
e6f22281 WD |
124 | *dirp |= (1 << (15 - iopin->pin)); |
125 | } else if (iopin->port == IOPIN_PORTB) { | |
6d0f6bcf | 126 | volatile uint *dirp = &((immap_t *)CONFIG_SYS_IMMR)->im_cpm.cp_pbdir; |
e6f22281 WD |
127 | *dirp |= (1 << (31 - iopin->pin)); |
128 | } else if (iopin->port == IOPIN_PORTC) { | |
6d0f6bcf | 129 | volatile ushort *dirp = &((immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_pcdir; |
e6f22281 WD |
130 | *dirp |= (1 << (15 - iopin->pin)); |
131 | } else if (iopin->port == IOPIN_PORTD) { | |
6d0f6bcf | 132 | volatile ushort *dirp = &((immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_pddir; |
e6f22281 WD |
133 | *dirp |= (1 << (15 - iopin->pin)); |
134 | } | |
135 | } | |
136 | ||
137 | extern __inline__ void | |
138 | iopin_set_in(iopin_t *iopin) | |
139 | { | |
140 | if (iopin->port == IOPIN_PORTA) { | |
6d0f6bcf | 141 | volatile ushort *dirp = &((immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_padir; |
e6f22281 WD |
142 | *dirp &= ~(1 << (15 - iopin->pin)); |
143 | } else if (iopin->port == IOPIN_PORTB) { | |
6d0f6bcf | 144 | volatile uint *dirp = &((immap_t *)CONFIG_SYS_IMMR)->im_cpm.cp_pbdir; |
e6f22281 WD |
145 | *dirp &= ~(1 << (31 - iopin->pin)); |
146 | } else if (iopin->port == IOPIN_PORTC) { | |
6d0f6bcf | 147 | volatile ushort *dirp = &((immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_pcdir; |
e6f22281 WD |
148 | *dirp &= ~(1 << (15 - iopin->pin)); |
149 | } else if (iopin->port == IOPIN_PORTD) { | |
6d0f6bcf | 150 | volatile ushort *dirp = &((immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_pddir; |
e6f22281 WD |
151 | *dirp &= ~(1 << (15 - iopin->pin)); |
152 | } | |
153 | } | |
154 | ||
155 | extern __inline__ uint | |
156 | iopin_is_out(iopin_t *iopin) | |
157 | { | |
158 | if (iopin->port == IOPIN_PORTA) { | |
6d0f6bcf | 159 | volatile ushort *dirp = &((immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_padir; |
e6f22281 WD |
160 | return (*dirp >> (15 - iopin->pin)) & 1; |
161 | } else if (iopin->port == IOPIN_PORTB) { | |
6d0f6bcf | 162 | volatile uint *dirp = &((immap_t *)CONFIG_SYS_IMMR)->im_cpm.cp_pbdir; |
e6f22281 WD |
163 | return (*dirp >> (31 - iopin->pin)) & 1; |
164 | } else if (iopin->port == IOPIN_PORTC) { | |
6d0f6bcf | 165 | volatile ushort *dirp = &((immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_pcdir; |
e6f22281 WD |
166 | return (*dirp >> (15 - iopin->pin)) & 1; |
167 | } else if (iopin->port == IOPIN_PORTD) { | |
6d0f6bcf | 168 | volatile ushort *dirp = &((immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_pddir; |
e6f22281 WD |
169 | return (*dirp >> (15 - iopin->pin)) & 1; |
170 | } | |
171 | return 0; | |
172 | } | |
173 | ||
174 | extern __inline__ uint | |
175 | iopin_is_in(iopin_t *iopin) | |
176 | { | |
177 | if (iopin->port == IOPIN_PORTA) { | |
6d0f6bcf | 178 | volatile ushort *dirp = &((immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_padir; |
e6f22281 WD |
179 | return ((*dirp >> (15 - iopin->pin)) & 1) ^ 1; |
180 | } else if (iopin->port == IOPIN_PORTB) { | |
6d0f6bcf | 181 | volatile uint *dirp = &((immap_t *)CONFIG_SYS_IMMR)->im_cpm.cp_pbdir; |
e6f22281 WD |
182 | return ((*dirp >> (31 - iopin->pin)) & 1) ^ 1; |
183 | } else if (iopin->port == IOPIN_PORTC) { | |
6d0f6bcf | 184 | volatile ushort *dirp = &((immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_pcdir; |
e6f22281 WD |
185 | return ((*dirp >> (15 - iopin->pin)) & 1) ^ 1; |
186 | } else if (iopin->port == IOPIN_PORTD) { | |
6d0f6bcf | 187 | volatile ushort *dirp = &((immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_pddir; |
e6f22281 WD |
188 | return ((*dirp >> (15 - iopin->pin)) & 1) ^ 1; |
189 | } | |
190 | return 0; | |
191 | } | |
192 | ||
193 | extern __inline__ void | |
194 | iopin_set_odr(iopin_t *iopin) | |
195 | { | |
196 | if (iopin->port == IOPIN_PORTA) { | |
6d0f6bcf | 197 | volatile ushort *odrp = &((immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_paodr; |
e6f22281 WD |
198 | *odrp |= (1 << (15 - iopin->pin)); |
199 | } else if (iopin->port == IOPIN_PORTB) { | |
6d0f6bcf | 200 | volatile ushort *odrp = &((immap_t *)CONFIG_SYS_IMMR)->im_cpm.cp_pbodr; |
e6f22281 WD |
201 | *odrp |= (1 << (31 - iopin->pin)); |
202 | } | |
203 | } | |
204 | ||
205 | extern __inline__ void | |
206 | iopin_set_act(iopin_t *iopin) | |
207 | { | |
208 | if (iopin->port == IOPIN_PORTA) { | |
6d0f6bcf | 209 | volatile ushort *odrp = &((immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_paodr; |
e6f22281 WD |
210 | *odrp &= ~(1 << (15 - iopin->pin)); |
211 | } else if (iopin->port == IOPIN_PORTB) { | |
6d0f6bcf | 212 | volatile ushort *odrp = &((immap_t *)CONFIG_SYS_IMMR)->im_cpm.cp_pbodr; |
e6f22281 WD |
213 | *odrp &= ~(1 << (31 - iopin->pin)); |
214 | } | |
215 | } | |
216 | ||
217 | extern __inline__ uint | |
218 | iopin_is_odr(iopin_t *iopin) | |
219 | { | |
220 | if (iopin->port == IOPIN_PORTA) { | |
6d0f6bcf | 221 | volatile ushort *odrp = &((immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_paodr; |
e6f22281 WD |
222 | return (*odrp >> (15 - iopin->pin)) & 1; |
223 | } else if (iopin->port == IOPIN_PORTB) { | |
6d0f6bcf | 224 | volatile ushort *odrp = &((immap_t *)CONFIG_SYS_IMMR)->im_cpm.cp_pbodr; |
e6f22281 WD |
225 | return (*odrp >> (31 - iopin->pin)) & 1; |
226 | } | |
227 | return 0; | |
228 | } | |
229 | ||
230 | extern __inline__ uint | |
231 | iopin_is_act(iopin_t *iopin) | |
232 | { | |
233 | if (iopin->port == IOPIN_PORTA) { | |
6d0f6bcf | 234 | volatile ushort *odrp = &((immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_paodr; |
e6f22281 WD |
235 | return ((*odrp >> (15 - iopin->pin)) & 1) ^ 1; |
236 | } else if (iopin->port == IOPIN_PORTB) { | |
6d0f6bcf | 237 | volatile ushort *odrp = &((immap_t *)CONFIG_SYS_IMMR)->im_cpm.cp_pbodr; |
e6f22281 WD |
238 | return ((*odrp >> (31 - iopin->pin)) & 1) ^ 1; |
239 | } | |
240 | return 0; | |
241 | } | |
242 | ||
243 | extern __inline__ void | |
244 | iopin_set_ded(iopin_t *iopin) | |
245 | { | |
246 | if (iopin->port == IOPIN_PORTA) { | |
6d0f6bcf | 247 | volatile ushort *parp = &((immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_papar; |
e6f22281 WD |
248 | *parp |= (1 << (15 - iopin->pin)); |
249 | } else if (iopin->port == IOPIN_PORTB) { | |
6d0f6bcf | 250 | volatile uint *parp = &((immap_t *)CONFIG_SYS_IMMR)->im_cpm.cp_pbpar; |
e6f22281 WD |
251 | *parp |= (1 << (31 - iopin->pin)); |
252 | } else if (iopin->port == IOPIN_PORTC) { | |
6d0f6bcf | 253 | volatile ushort *parp = &((immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_pcpar; |
e6f22281 WD |
254 | *parp |= (1 << (15 - iopin->pin)); |
255 | } else if (iopin->port == IOPIN_PORTD) { | |
6d0f6bcf | 256 | volatile ushort *parp = &((immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_pdpar; |
e6f22281 WD |
257 | *parp |= (1 << (15 - iopin->pin)); |
258 | } | |
259 | } | |
260 | ||
261 | extern __inline__ void | |
262 | iopin_set_gen(iopin_t *iopin) | |
263 | { | |
264 | if (iopin->port == IOPIN_PORTA) { | |
6d0f6bcf | 265 | volatile ushort *parp = &((immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_papar; |
e6f22281 WD |
266 | *parp &= ~(1 << (15 - iopin->pin)); |
267 | } else if (iopin->port == IOPIN_PORTB) { | |
6d0f6bcf | 268 | volatile uint *parp = &((immap_t *)CONFIG_SYS_IMMR)->im_cpm.cp_pbpar; |
e6f22281 WD |
269 | *parp &= ~(1 << (31 - iopin->pin)); |
270 | } else if (iopin->port == IOPIN_PORTC) { | |
6d0f6bcf | 271 | volatile ushort *parp = &((immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_pcpar; |
e6f22281 WD |
272 | *parp &= ~(1 << (15 - iopin->pin)); |
273 | } else if (iopin->port == IOPIN_PORTD) { | |
6d0f6bcf | 274 | volatile ushort *parp = &((immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_pdpar; |
e6f22281 WD |
275 | *parp &= ~(1 << (15 - iopin->pin)); |
276 | } | |
277 | } | |
278 | ||
279 | extern __inline__ uint | |
280 | iopin_is_ded(iopin_t *iopin) | |
281 | { | |
282 | if (iopin->port == IOPIN_PORTA) { | |
6d0f6bcf | 283 | volatile ushort *parp = &((immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_papar; |
e6f22281 WD |
284 | return (*parp >> (15 - iopin->pin)) & 1; |
285 | } else if (iopin->port == IOPIN_PORTB) { | |
6d0f6bcf | 286 | volatile uint *parp = &((immap_t *)CONFIG_SYS_IMMR)->im_cpm.cp_pbpar; |
e6f22281 WD |
287 | return (*parp >> (31 - iopin->pin)) & 1; |
288 | } else if (iopin->port == IOPIN_PORTC) { | |
6d0f6bcf | 289 | volatile ushort *parp = &((immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_pcpar; |
e6f22281 WD |
290 | return (*parp >> (15 - iopin->pin)) & 1; |
291 | } else if (iopin->port == IOPIN_PORTD) { | |
6d0f6bcf | 292 | volatile ushort *parp = &((immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_pdpar; |
e6f22281 WD |
293 | return (*parp >> (15 - iopin->pin)) & 1; |
294 | } | |
295 | return 0; | |
296 | } | |
297 | ||
298 | extern __inline__ uint | |
299 | iopin_is_gen(iopin_t *iopin) | |
300 | { | |
301 | if (iopin->port == IOPIN_PORTA) { | |
6d0f6bcf | 302 | volatile ushort *parp = &((immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_papar; |
e6f22281 WD |
303 | return ((*parp >> (15 - iopin->pin)) & 1) ^ 1; |
304 | } else if (iopin->port == IOPIN_PORTB) { | |
6d0f6bcf | 305 | volatile uint *parp = &((immap_t *)CONFIG_SYS_IMMR)->im_cpm.cp_pbpar; |
e6f22281 WD |
306 | return ((*parp >> (31 - iopin->pin)) & 1) ^ 1; |
307 | } else if (iopin->port == IOPIN_PORTC) { | |
6d0f6bcf | 308 | volatile ushort *parp = &((immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_pcpar; |
e6f22281 WD |
309 | return ((*parp >> (15 - iopin->pin)) & 1) ^ 1; |
310 | } else if (iopin->port == IOPIN_PORTD) { | |
6d0f6bcf | 311 | volatile ushort *parp = &((immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_pdpar; |
e6f22281 WD |
312 | return ((*parp >> (15 - iopin->pin)) & 1) ^ 1; |
313 | } | |
314 | return 0; | |
315 | } | |
316 | ||
317 | extern __inline__ void | |
318 | iopin_set_opt2(iopin_t *iopin) | |
319 | { | |
320 | if (iopin->port == IOPIN_PORTC) { | |
6d0f6bcf | 321 | volatile ushort *sorp = &((immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_pcso; |
e6f22281 WD |
322 | *sorp |= (1 << (15 - iopin->pin)); |
323 | } | |
324 | } | |
325 | ||
326 | extern __inline__ void | |
327 | iopin_set_opt1(iopin_t *iopin) | |
328 | { | |
329 | if (iopin->port == IOPIN_PORTC) { | |
6d0f6bcf | 330 | volatile ushort *sorp = &((immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_pcso; |
e6f22281 WD |
331 | *sorp &= ~(1 << (15 - iopin->pin)); |
332 | } | |
333 | } | |
334 | ||
335 | extern __inline__ uint | |
336 | iopin_is_opt2(iopin_t *iopin) | |
337 | { | |
338 | if (iopin->port == IOPIN_PORTC) { | |
6d0f6bcf | 339 | volatile ushort *sorp = &((immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_pcso; |
e6f22281 WD |
340 | return (*sorp >> (15 - iopin->pin)) & 1; |
341 | } | |
342 | return 0; | |
343 | } | |
344 | ||
345 | extern __inline__ uint | |
346 | iopin_is_opt1(iopin_t *iopin) | |
347 | { | |
348 | if (iopin->port == IOPIN_PORTC) { | |
6d0f6bcf | 349 | volatile ushort *sorp = &((immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_pcso; |
e6f22281 WD |
350 | return ((*sorp >> (15 - iopin->pin)) & 1) ^ 1; |
351 | } | |
352 | return 0; | |
353 | } | |
354 | ||
355 | extern __inline__ void | |
356 | iopin_set_falledge(iopin_t *iopin) | |
357 | { | |
358 | if (iopin->port == IOPIN_PORTC) { | |
6d0f6bcf | 359 | volatile ushort *intp = &((immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_pcint; |
e6f22281 WD |
360 | *intp |= (1 << (15 - iopin->pin)); |
361 | } | |
362 | } | |
363 | ||
364 | extern __inline__ void | |
365 | iopin_set_anyedge(iopin_t *iopin) | |
366 | { | |
367 | if (iopin->port == IOPIN_PORTC) { | |
6d0f6bcf | 368 | volatile ushort *intp = &((immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_pcint; |
e6f22281 WD |
369 | *intp &= ~(1 << (15 - iopin->pin)); |
370 | } | |
371 | } | |
372 | ||
373 | extern __inline__ uint | |
374 | iopin_is_falledge(iopin_t *iopin) | |
375 | { | |
376 | if (iopin->port == IOPIN_PORTC) { | |
6d0f6bcf | 377 | volatile ushort *intp = &((immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_pcint; |
e6f22281 WD |
378 | return (*intp >> (15 - iopin->pin)) & 1; |
379 | } | |
380 | return 0; | |
381 | } | |
382 | ||
383 | extern __inline__ uint | |
384 | iopin_is_anyedge(iopin_t *iopin) | |
385 | { | |
386 | if (iopin->port == IOPIN_PORTC) { | |
6d0f6bcf | 387 | volatile ushort *intp = &((immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_pcint; |
e6f22281 WD |
388 | return ((*intp >> (15 - iopin->pin)) & 1) ^ 1; |
389 | } | |
390 | return 0; | |
391 | } | |
392 | ||
393 | #endif /* __KERNEL__ */ | |
394 | ||
395 | #endif /* _ASM_IOPIN_8XX_H_ */ |