|
0
|
1 //========================================================================== |
|
|
2 // |
|
|
3 // devs/table.cxx |
|
|
4 // |
|
|
5 // Virtual Device Table without Virtual Functions |
|
|
6 // |
|
|
7 //========================================================================== |
|
|
8 //####COPYRIGHTBEGIN#### |
|
|
9 // |
|
|
10 // ------------------------------------------- |
|
|
11 // The contents of this file are subject to the Cygnus eCos Public License |
|
|
12 // Version 1.0 (the "License"); you may not use this file except in |
|
|
13 // compliance with the License. You may obtain a copy of the License at |
|
|
14 // http://sourceware.cygnus.com/ecos |
|
|
15 // |
|
|
16 // Software distributed under the License is distributed on an "AS IS" |
|
|
17 // basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the |
|
|
18 // License for the specific language governing rights and limitations under |
|
|
19 // the License. |
|
|
20 // |
|
|
21 // The Original Code is eCos - Embedded Cygnus Operating System, released |
|
|
22 // September 30, 1998. |
|
|
23 // |
|
|
24 // The Initial Developer of the Original Code is Cygnus. Portions created |
|
|
25 // by Cygnus are Copyright (C) 1998 Cygnus Solutions. All Rights Reserved. |
|
|
26 // ------------------------------------------- |
|
|
27 // |
|
|
28 //####COPYRIGHTEND#### |
|
|
29 //========================================================================== |
|
|
30 //#####DESCRIPTIONBEGIN#### |
|
|
31 // |
|
|
32 // Author(s): proven |
|
|
33 // Contributors: proven |
|
|
34 // Date: 1998-05-20 |
|
|
35 // Purpose: Virtual Device Table |
|
|
36 // Description: Allow packages to use devices without having to know the |
|
|
37 // device class. |
|
|
38 // |
|
|
39 //####DESCRIPTIONEND#### |
|
|
40 // |
|
|
41 //========================================================================== |
|
|
42 |
|
|
43 #include <pkgconf/devices.h> // Include all the possible devices |
|
|
44 #include <cyg/infra/cyg_type.h> // Common type definitions and support |
|
|
45 #include <cyg/devs/common/table.h> |
|
|
46 #include <cyg/hal/hal_diag.h> // HAL diagnostic output |
|
|
47 |
|
|
48 #ifdef CYG_DEVICE_TABLE |
|
|
49 |
|
|
50 // --------------------------------------------------------------------------- |
|
|
51 // CYG_DEVICE_SERIAL_RS232_MN10300_1 |
|
|
52 |
|
|
53 #ifdef CYG_DEVICE_SERIAL_RS232_MN10300_1 |
|
|
54 |
|
|
55 externC Cyg_ErrNo |
|
|
56 Cyg_Device_Serial_RS232_mn10300_1_read_cancel(CYG_ADDRWORD cookie, Cyg_IORB * iorb) |
|
|
57 { |
|
|
58 cyg_int32 ret; |
|
|
59 |
|
|
60 ret = CYG_DEVICE_SERIAL_RS232_MN10300_1_NAME.io_read_cancel(iorb); |
|
|
61 CYG_ASSERT(ret == 0, "Read cancel failed to the mn10300 serial port 1."); |
|
|
62 return ENOERR; |
|
|
63 } |
|
|
64 |
|
|
65 externC Cyg_ErrNo |
|
|
66 Cyg_Device_Serial_RS232_mn10300_1_read_blocking(CYG_ADDRWORD cookie, Cyg_IORB * iorb) |
|
|
67 { |
|
|
68 cyg_int32 ret; |
|
|
69 |
|
|
70 ret = CYG_DEVICE_SERIAL_RS232_MN10300_1_NAME.io_read_blocking(iorb); |
|
|
71 CYG_ASSERT(ret == 0, "Read failed to the mn10300 serial port 1."); |
|
|
72 return ENOERR; |
|
|
73 } |
|
|
74 |
|
|
75 externC Cyg_ErrNo |
|
|
76 Cyg_Device_Serial_RS232_mn10300_1_write_blocking(CYG_ADDRWORD cookie, Cyg_IORB * iorb) |
|
|
77 { |
|
|
78 cyg_int32 ret; |
|
|
79 |
|
|
80 ret = CYG_DEVICE_SERIAL_RS232_MN10300_1_NAME.io_write_blocking(iorb); |
|
|
81 CYG_ASSERT(ret == 0, "Write failed to the mn10300 serial port 1."); |
|
|
82 return ENOERR; |
|
|
83 } |
|
|
84 |
|
|
85 #ifdef CYG_DEVICE_SERIAL_RS232_MN10300_1_KMODE_INTERRUPT |
|
|
86 externC Cyg_ErrNo |
|
|
87 Cyg_Device_Serial_RS232_mn10300_1_read_asynchronous(CYG_ADDRWORD cookie, Cyg_IORB * iorb) |
|
|
88 { |
|
|
89 cyg_int32 ret; |
|
|
90 |
|
|
91 ret = CYG_DEVICE_SERIAL_RS232_MN10300_1_NAME.io_read_asynchronous(iorb); |
|
|
92 CYG_ASSERT(ret == 0, |
|
|
93 "Read asynchronous failed to the mn10300 serial port 1."); |
|
|
94 return ENOERR; |
|
|
95 } |
|
|
96 |
|
|
97 externC Cyg_ErrNo |
|
|
98 Cyg_Device_Serial_RS232_mn10300_1_write_asynchronous(CYG_ADDRWORD cookie, Cyg_IORB * iorb) |
|
|
99 { |
|
|
100 cyg_int32 ret; |
|
|
101 |
|
|
102 ret = CYG_DEVICE_SERIAL_RS232_MN10300_1_NAME.io_write_asynchronous(iorb); |
|
|
103 CYG_ASSERT(ret == 0, |
|
|
104 "Write asynchronous failed to the mn10300 serial port 1."); |
|
|
105 return ENOERR; |
|
|
106 } |
|
|
107 #endif |
|
|
108 |
|
|
109 // Device specific routines; |
|
|
110 externC Cyg_ErrNo |
|
|
111 Cyg_Device_Serial_RS232_mn10300_1_set_kmode(CYG_ADDRWORD cookie, cyg_uint32 mode) |
|
|
112 { |
|
|
113 cyg_int32 ret; |
|
|
114 |
|
|
115 ret = CYG_DEVICE_SERIAL_RS232_MN10300_1_NAME.set_kmode(mode); |
|
|
116 CYG_ASSERT(ret == 0, "Set kmode failed to the mn10300 serial port 1."); |
|
|
117 return ENOERR; |
|
|
118 } |
|
|
119 |
|
|
120 externC Cyg_ErrNo |
|
|
121 Cyg_Device_Serial_RS232_mn10300_1_get_baud_rate(CYG_ADDRWORD cookie, |
|
|
122 cyg_int32 * old_baud_rate) |
|
|
123 { |
|
|
124 *old_baud_rate = CYG_DEVICE_SERIAL_RS232_MN10300_1_NAME.get_baud_rate(); |
|
|
125 return ENOERR; |
|
|
126 } |
|
|
127 |
|
|
128 externC Cyg_ErrNo |
|
|
129 Cyg_Device_Serial_RS232_mn10300_1_set_baud_rate(CYG_ADDRWORD cookie, |
|
|
130 cyg_int32 baud_rate, cyg_int32 * old_baud_rate) |
|
|
131 { |
|
|
132 *old_baud_rate = |
|
|
133 CYG_DEVICE_SERIAL_RS232_MN10300_1_NAME.set_baud_rate(baud_rate); |
|
|
134 CYG_ASSERT(*old_baud_rate >= 0, |
|
|
135 "Set baud rate failed to the mn10300 serial port 1."); |
|
|
136 return ENOERR; |
|
|
137 } |
|
|
138 |
|
|
139 externC Cyg_ErrNo |
|
|
140 Cyg_Device_Serial_RS232_mn10300_1_get_line_mode(CYG_ADDRWORD cookie, |
|
|
141 cyg_int32 * line_mode) |
|
|
142 { |
|
|
143 *line_mode = CYG_DEVICE_SERIAL_RS232_MN10300_1_NAME.get_line_mode(); |
|
|
144 return ENOERR; |
|
|
145 } |
|
|
146 |
|
|
147 externC Cyg_ErrNo |
|
|
148 Cyg_Device_Serial_RS232_mn10300_1_set_line_mode(CYG_ADDRWORD cookie, |
|
|
149 cyg_int32 line_mode, cyg_int32 * old_line_mode) |
|
|
150 { |
|
|
151 *old_line_mode = |
|
|
152 CYG_DEVICE_SERIAL_RS232_MN10300_1_NAME.set_line_mode(line_mode); |
|
|
153 CYG_ASSERT(*old_line_mode >= 0, |
|
|
154 "Set line mode failed to the mn10300 serial port 1."); |
|
|
155 return ENOERR; |
|
|
156 } |
|
|
157 |
|
|
158 // externC Cyg_ErrNo |
|
|
159 // Cyg_Device_Serial_RS232_mn10300_1_get_read_mode(CYG_ADDRWORD cookie, |
|
|
160 // cyg_int32 * read_mode) |
|
|
161 // { |
|
|
162 // *line_mode = serial.get_read_mode(); |
|
|
163 // return ENOERR; |
|
|
164 // } |
|
|
165 |
|
|
166 externC Cyg_ErrNo |
|
|
167 Cyg_Device_Serial_RS232_mn10300_1_set_read_mode(CYG_ADDRWORD cookie, |
|
|
168 cyg_int32 read_mode, cyg_int32 * old_read_mode) |
|
|
169 { |
|
|
170 *old_read_mode = |
|
|
171 CYG_DEVICE_SERIAL_RS232_MN10300_1_NAME.set_read_mode(read_mode); |
|
|
172 CYG_ASSERT(*old_read_mode >= 0, |
|
|
173 "Set read mode failed to the mn10300 serial port 1."); |
|
|
174 return ENOERR; |
|
|
175 } |
|
|
176 |
|
|
177 externC Cyg_ErrNo |
|
|
178 Cyg_Device_Serial_RS232_mn10300_1_set_read_data(CYG_ADDRWORD cookie, |
|
|
179 cyg_int32 mode, const char * str, cyg_uint32 length) |
|
|
180 { |
|
|
181 cyg_int32 ret; |
|
|
182 |
|
|
183 ret = CYG_DEVICE_SERIAL_RS232_MN10300_1_NAME.set_read_data(mode, str, length); |
|
|
184 CYG_ASSERT(0 == ret, "Set read data failed to the mn10300 serial port 1."); |
|
|
185 return ENOERR; |
|
|
186 } |
|
|
187 |
|
|
188 #endif // CYG_DEVICE_SERIAL_RS232_MN10300_1 |
|
|
189 |
|
|
190 // --------------------------------------------------------------------------- |
|
|
191 // CYG_DEVICE_SERIAL_RS232_MN10300_2 |
|
|
192 |
|
|
193 #ifdef CYG_DEVICE_SERIAL_RS232_MN10300_2 |
|
|
194 |
|
|
195 externC Cyg_ErrNo |
|
|
196 Cyg_Device_Serial_RS232_mn10300_2_read_cancel(CYG_ADDRWORD cookie, Cyg_IORB * iorb) |
|
|
197 { |
|
|
198 cyg_int32 ret; |
|
|
199 |
|
|
200 ret = CYG_DEVICE_SERIAL_RS232_MN10300_2_NAME.io_read_cancel(iorb); |
|
|
201 CYG_ASSERT(ret == 0, "Read cancel failed to the mn10300 serial port 2."); |
|
|
202 return ENOERR; |
|
|
203 } |
|
|
204 |
|
|
205 externC Cyg_ErrNo |
|
|
206 Cyg_Device_Serial_RS232_mn10300_2_read_blocking(CYG_ADDRWORD cookie, Cyg_IORB * iorb) |
|
|
207 { |
|
|
208 cyg_int32 ret; |
|
|
209 |
|
|
210 ret = CYG_DEVICE_SERIAL_RS232_MN10300_2_NAME.io_read_blocking(iorb); |
|
|
211 CYG_ASSERT(ret == 0, "Read failed to the mn10300 serial port 2."); |
|
|
212 return ENOERR; |
|
|
213 } |
|
|
214 |
|
|
215 externC Cyg_ErrNo |
|
|
216 Cyg_Device_Serial_RS232_mn10300_2_write_blocking(CYG_ADDRWORD cookie, Cyg_IORB * iorb) |
|
|
217 { |
|
|
218 cyg_int32 ret; |
|
|
219 |
|
|
220 ret = CYG_DEVICE_SERIAL_RS232_MN10300_2_NAME.io_write_blocking(iorb); |
|
|
221 CYG_ASSERT(ret == 0, "Write failed to the mn10300 serial port 2."); |
|
|
222 return ENOERR; |
|
|
223 } |
|
|
224 |
|
|
225 #ifdef CYG_DEVICE_SERIAL_RS232_MN10300_2_KMODE_INTERRUPT |
|
|
226 externC Cyg_ErrNo |
|
|
227 Cyg_Device_Serial_RS232_mn10300_2_read_asynchronous(CYG_ADDRWORD cookie, Cyg_IORB * iorb) |
|
|
228 { |
|
|
229 cyg_int32 ret; |
|
|
230 |
|
|
231 ret = CYG_DEVICE_SERIAL_RS232_MN10300_2_NAME.io_read_asynchronous(iorb); |
|
|
232 CYG_ASSERT(ret == 0, |
|
|
233 "Read asynchronous failed to the mn10300 serial port 2."); |
|
|
234 return ENOERR; |
|
|
235 } |
|
|
236 |
|
|
237 externC Cyg_ErrNo |
|
|
238 Cyg_Device_Serial_RS232_mn10300_2_write_asynchronous(CYG_ADDRWORD cookie, Cyg_IORB * iorb) |
|
|
239 { |
|
|
240 cyg_int32 ret; |
|
|
241 |
|
|
242 ret = CYG_DEVICE_SERIAL_RS232_MN10300_2_NAME.io_write_asynchronous(iorb); |
|
|
243 CYG_ASSERT(ret == 0, |
|
|
244 "Write asynchronous failed to the mn10300 serial port 2."); |
|
|
245 return ENOERR; |
|
|
246 } |
|
|
247 #endif |
|
|
248 |
|
|
249 // Device specific routines; |
|
|
250 externC Cyg_ErrNo |
|
|
251 Cyg_Device_Serial_RS232_mn10300_2_set_kmode(CYG_ADDRWORD cookie, cyg_uint32 mode) |
|
|
252 { |
|
|
253 cyg_int32 ret; |
|
|
254 |
|
|
255 ret = CYG_DEVICE_SERIAL_RS232_MN10300_2_NAME.set_kmode(mode); |
|
|
256 CYG_ASSERT(ret == 0, "Set kmode failed to the mn10300 serial port 2."); |
|
|
257 return ENOERR; |
|
|
258 } |
|
|
259 |
|
|
260 externC Cyg_ErrNo |
|
|
261 Cyg_Device_Serial_RS232_mn10300_2_get_baud_rate(CYG_ADDRWORD cookie, |
|
|
262 cyg_int32 * old_baud_rate) |
|
|
263 { |
|
|
264 *old_baud_rate = CYG_DEVICE_SERIAL_RS232_MN10300_2_NAME.get_baud_rate(); |
|
|
265 return ENOERR; |
|
|
266 } |
|
|
267 |
|
|
268 externC Cyg_ErrNo |
|
|
269 Cyg_Device_Serial_RS232_mn10300_2_set_baud_rate(CYG_ADDRWORD cookie, |
|
|
270 cyg_int32 baud_rate, cyg_int32 * old_baud_rate) |
|
|
271 { |
|
|
272 *old_baud_rate = |
|
|
273 CYG_DEVICE_SERIAL_RS232_MN10300_2_NAME.set_baud_rate(baud_rate); |
|
|
274 CYG_ASSERT(*old_baud_rate >= 0, |
|
|
275 "Set baud rate failed to the mn10300 serial port 2."); |
|
|
276 return ENOERR; |
|
|
277 } |
|
|
278 |
|
|
279 externC Cyg_ErrNo |
|
|
280 Cyg_Device_Serial_RS232_mn10300_2_get_line_mode(CYG_ADDRWORD cookie, |
|
|
281 cyg_int32 * line_mode) |
|
|
282 { |
|
|
283 *line_mode = CYG_DEVICE_SERIAL_RS232_MN10300_2_NAME.get_line_mode(); |
|
|
284 return ENOERR; |
|
|
285 } |
|
|
286 |
|
|
287 externC Cyg_ErrNo |
|
|
288 Cyg_Device_Serial_RS232_mn10300_2_set_line_mode(CYG_ADDRWORD cookie, |
|
|
289 cyg_int32 line_mode, cyg_int32 * old_line_mode) |
|
|
290 { |
|
|
291 *old_line_mode = |
|
|
292 CYG_DEVICE_SERIAL_RS232_MN10300_2_NAME.set_line_mode(line_mode); |
|
|
293 CYG_ASSERT(*old_line_mode >= 0, |
|
|
294 "Set line mode failed to the mn10300 serial port 2."); |
|
|
295 return ENOERR; |
|
|
296 } |
|
|
297 |
|
|
298 // externC Cyg_ErrNo |
|
|
299 // Cyg_Device_Serial_RS232_mn10300_2_get_read_mode(CYG_ADDRWORD cookie, |
|
|
300 // cyg_int32 * read_mode) |
|
|
301 // { |
|
|
302 // *line_mode = CYG_DEVICE_SERIAL_RS232_MN10300_2_NAME.get_read_mode(); |
|
|
303 // return ENOERR; |
|
|
304 // } |
|
|
305 |
|
|
306 externC Cyg_ErrNo |
|
|
307 Cyg_Device_Serial_RS232_mn10300_2_set_read_mode(CYG_ADDRWORD cookie, |
|
|
308 cyg_int32 read_mode, cyg_int32 * old_read_mode) |
|
|
309 { |
|
|
310 *old_read_mode = |
|
|
311 CYG_DEVICE_SERIAL_RS232_MN10300_2_NAME.set_read_mode(read_mode); |
|
|
312 CYG_ASSERT(*old_read_mode >= 0, |
|
|
313 "Set read mode failed to the mn10300 serial port 2."); |
|
|
314 return ENOERR; |
|
|
315 } |
|
|
316 |
|
|
317 externC Cyg_ErrNo |
|
|
318 Cyg_Device_Serial_RS232_mn10300_2_set_read_data(CYG_ADDRWORD cookie, |
|
|
319 cyg_int32 mode, const char * str, cyg_uint32 length) |
|
|
320 { |
|
|
321 cyg_int32 ret; |
|
|
322 |
|
|
323 ret = CYG_DEVICE_SERIAL_RS232_MN10300_2_NAME.set_read_data(mode, str, length); |
|
|
324 CYG_ASSERT(0 == ret, "Set read data failed to the mn10300 serial port 2."); |
|
|
325 return ENOERR; |
|
|
326 } |
|
|
327 |
|
|
328 #endif // CYG_DEVICE_SERIAL_RS232_MN10300_2 |
|
|
329 |
|
|
330 // --------------------------------------------------------------------------- |
|
|
331 // CYG_DEVICE_SERIAL_RS232_TX39 |
|
|
332 |
|
|
333 #ifdef CYG_DEVICE_SERIAL_RS232_TX39 |
|
|
334 |
|
|
335 externC Cyg_ErrNo |
|
|
336 Cyg_Device_Serial_RS232_tx39_read_blocking(CYG_ADDRWORD cookie, Cyg_IORB * iorb) |
|
|
337 { |
|
|
338 cyg_int32 ret; |
|
|
339 |
|
|
340 ret = CYG_DEVICE_SERIAL_RS232_TX39_NAME.io_read_blocking(iorb); |
|
|
341 CYG_ASSERT(ret == 0, "Read failed to the TX39 serial port 0."); |
|
|
342 return ENOERR; |
|
|
343 } |
|
|
344 |
|
|
345 externC Cyg_ErrNo |
|
|
346 Cyg_Device_Serial_RS232_tx39_write_blocking(CYG_ADDRWORD cookie, Cyg_IORB * iorb) |
|
|
347 { |
|
|
348 cyg_int32 ret; |
|
|
349 |
|
|
350 ret = CYG_DEVICE_SERIAL_RS232_TX39_NAME.io_write_blocking(iorb); |
|
|
351 CYG_ASSERT(ret == 0, "Write failed to the TX39 serial port 0."); |
|
|
352 return ENOERR; |
|
|
353 } |
|
|
354 |
|
|
355 #ifdef CYG_DEVICE_SERIAL_RS232_TX39_KMODE_INTERRUPT |
|
|
356 externC Cyg_ErrNo |
|
|
357 Cyg_Device_Serial_RS232_tx39_read_asynchronous(CYG_ADDRWORD cookie, Cyg_IORB * iorb) |
|
|
358 { |
|
|
359 cyg_int32 ret; |
|
|
360 |
|
|
361 ret = CYG_DEVICE_SERIAL_RS232_TX39_NAME.io_read_asynchronous(iorb); |
|
|
362 CYG_ASSERT(ret == 0, |
|
|
363 "Read asynchronous failed to the TX39 serial port 0."); |
|
|
364 return ENOERR; |
|
|
365 } |
|
|
366 |
|
|
367 externC Cyg_ErrNo |
|
|
368 Cyg_Device_Serial_RS232_tx39_write_asynchronous(CYG_ADDRWORD cookie, Cyg_IORB * iorb) |
|
|
369 { |
|
|
370 cyg_int32 ret; |
|
|
371 |
|
|
372 ret = CYG_DEVICE_SERIAL_RS232_TX39_NAME.io_write_asynchronous(iorb); |
|
|
373 CYG_ASSERT(ret == 0, |
|
|
374 "Write asynchronous failed to the TX39 serial port 0."); |
|
|
375 return ENOERR; |
|
|
376 } |
|
|
377 #endif |
|
|
378 |
|
|
379 // Device specific routines; |
|
|
380 externC Cyg_ErrNo |
|
|
381 Cyg_Device_Serial_RS232_tx39_set_kmode(CYG_ADDRWORD cookie, cyg_uint32 mode) |
|
|
382 { |
|
|
383 cyg_int32 ret; |
|
|
384 |
|
|
385 ret = CYG_DEVICE_SERIAL_RS232_TX39_NAME.set_kmode(mode); |
|
|
386 CYG_ASSERT(ret == 0, "Set kmode failed to the TX39 serial port 0."); |
|
|
387 return ENOERR; |
|
|
388 } |
|
|
389 |
|
|
390 externC Cyg_ErrNo |
|
|
391 Cyg_Device_Serial_RS232_tx39_get_baud_rate(CYG_ADDRWORD cookie, |
|
|
392 cyg_int32 * old_baud_rate) |
|
|
393 { |
|
|
394 *old_baud_rate = CYG_DEVICE_SERIAL_RS232_TX39_NAME.get_baud_rate(); |
|
|
395 return ENOERR; |
|
|
396 } |
|
|
397 |
|
|
398 externC Cyg_ErrNo |
|
|
399 Cyg_Device_Serial_RS232_tx39_set_baud_rate(CYG_ADDRWORD cookie, |
|
|
400 cyg_int32 baud_rate, cyg_int32 * old_baud_rate) |
|
|
401 { |
|
|
402 *old_baud_rate = |
|
|
403 CYG_DEVICE_SERIAL_RS232_TX39_NAME.set_baud_rate(baud_rate); |
|
|
404 CYG_ASSERT(*old_baud_rate >= 0, |
|
|
405 "Set baud rate failed to the TX39 serial port 0."); |
|
|
406 return ENOERR; |
|
|
407 } |
|
|
408 |
|
|
409 externC Cyg_ErrNo |
|
|
410 Cyg_Device_Serial_RS232_tx39_get_line_mode(CYG_ADDRWORD cookie, |
|
|
411 cyg_int32 * line_mode) |
|
|
412 { |
|
|
413 *line_mode = CYG_DEVICE_SERIAL_RS232_TX39_NAME.get_line_mode(); |
|
|
414 return ENOERR; |
|
|
415 } |
|
|
416 |
|
|
417 externC Cyg_ErrNo |
|
|
418 Cyg_Device_Serial_RS232_tx39_set_line_mode(CYG_ADDRWORD cookie, |
|
|
419 cyg_int32 line_mode, cyg_int32 * old_line_mode) |
|
|
420 { |
|
|
421 *old_line_mode = |
|
|
422 CYG_DEVICE_SERIAL_RS232_TX39_NAME.set_line_mode(line_mode); |
|
|
423 CYG_ASSERT(*old_line_mode >= 0, |
|
|
424 "Set line mode failed to the TX39 serial port 0."); |
|
|
425 return ENOERR; |
|
|
426 } |
|
|
427 |
|
|
428 #endif /* CYG_DEVICE_SERIAL_RS232_TX39 */ |
|
|
429 |
|
|
430 // --------------------------------------------------------------------------- |
|
|
431 // HAL_DIAG |
|
|
432 |
|
|
433 #ifdef HAL_DIAG_INIT |
|
|
434 externC Cyg_ErrNo |
|
|
435 Cyg_Device_Pseudo_Hal_Diag_open( CYG_ADDRWORD cookie, Cyg_DeviceOpenMode ) |
|
|
436 { |
|
|
437 HAL_DIAG_INIT(); |
|
|
438 return ENOERR; |
|
|
439 } |
|
|
440 #endif |
|
|
441 |
|
|
442 #ifdef HAL_DIAG_READ_CHAR |
|
|
443 externC Cyg_ErrNo |
|
|
444 Cyg_Device_Pseudo_Hal_Diag_read_blocking( CYG_ADDRWORD cookie, Cyg_IORB *iorb ) |
|
|
445 { |
|
|
446 cyg_ucount32 i; |
|
|
447 cyg_bool exit_loop = false; |
|
|
448 |
|
|
449 for (i=0; (i < iorb->buffer_length) && !exit_loop; i++) |
|
|
450 { |
|
|
451 HAL_DIAG_READ_CHAR(* ((char*)iorb->buffer + i) ); |
|
|
452 |
|
|
453 // exit loop on certain characters, newline, EOF, etc. |
|
|
454 switch (*((char*)iorb->buffer + i)) |
|
|
455 { |
|
|
456 case 4: |
|
|
457 case 10: |
|
|
458 case 13: |
|
|
459 case 26: |
|
|
460 exit_loop = true; |
|
|
461 break; |
|
|
462 default: |
|
|
463 break; |
|
|
464 } // switch |
|
|
465 } // for |
|
|
466 |
|
|
467 iorb->xferred_length = i; |
|
|
468 return ENOERR; |
|
|
469 } |
|
|
470 #endif |
|
|
471 |
|
|
472 #ifdef HAL_DIAG_WRITE_CHAR |
|
|
473 externC Cyg_ErrNo |
|
|
474 Cyg_Device_Pseudo_Hal_Diag_write_blocking( CYG_ADDRWORD cookie, Cyg_IORB *iorb ) |
|
|
475 { |
|
|
476 cyg_ucount32 i; |
|
|
477 |
|
|
478 for (i=0; i < iorb->buffer_length; i++) |
|
|
479 { |
|
|
480 HAL_DIAG_WRITE_CHAR(*((char *)iorb->buffer + i)); |
|
|
481 } // for |
|
|
482 |
|
|
483 iorb->xferred_length = iorb->buffer_length; |
|
|
484 return ENOERR; |
|
|
485 } |
|
|
486 #endif |
|
|
487 |
|
|
488 // --------------------------------------------------------------------------- |
|
|
489 // Device specific ioctl table |
|
|
490 // |
|
|
491 #ifdef CYG_DEVICE_SERIAL_RS232_MN10300_1 |
|
|
492 struct Cyg_Device_Serial_RS232_Table_t Cyg_Device_Serial_RS232_mn10300_1_Table = |
|
|
493 { |
|
|
494 &Cyg_Device_Serial_RS232_mn10300_1_set_kmode, |
|
|
495 &Cyg_Device_Serial_RS232_mn10300_1_get_baud_rate, |
|
|
496 &Cyg_Device_Serial_RS232_mn10300_1_set_baud_rate, |
|
|
497 &Cyg_Device_Serial_RS232_mn10300_1_get_line_mode, |
|
|
498 &Cyg_Device_Serial_RS232_mn10300_1_set_line_mode, |
|
|
499 NULL, |
|
|
500 &Cyg_Device_Serial_RS232_mn10300_1_set_read_mode, |
|
|
501 &Cyg_Device_Serial_RS232_mn10300_1_set_read_data |
|
|
502 }; |
|
|
503 #endif |
|
|
504 |
|
|
505 #ifdef CYG_DEVICE_SERIAL_RS232_MN10300_2 |
|
|
506 struct Cyg_Device_Serial_RS232_Table_t Cyg_Device_Serial_RS232_mn10300_2_Table = |
|
|
507 { |
|
|
508 &Cyg_Device_Serial_RS232_mn10300_2_set_kmode, |
|
|
509 &Cyg_Device_Serial_RS232_mn10300_2_get_baud_rate, |
|
|
510 &Cyg_Device_Serial_RS232_mn10300_2_set_baud_rate, |
|
|
511 &Cyg_Device_Serial_RS232_mn10300_2_get_line_mode, |
|
|
512 &Cyg_Device_Serial_RS232_mn10300_2_set_line_mode, |
|
|
513 NULL, |
|
|
514 &Cyg_Device_Serial_RS232_mn10300_2_set_read_mode, |
|
|
515 &Cyg_Device_Serial_RS232_mn10300_2_set_read_data |
|
|
516 }; |
|
|
517 #endif |
|
|
518 |
|
|
519 #ifdef CYG_DEVICE_SERIAL_RS232_TX39 |
|
|
520 struct Cyg_Device_Serial_RS232_Table_t Cyg_Device_Serial_RS232_tx39_Table = |
|
|
521 { |
|
|
522 &Cyg_Device_Serial_RS232_tx39_set_kmode, |
|
|
523 &Cyg_Device_Serial_RS232_tx39_get_baud_rate, |
|
|
524 &Cyg_Device_Serial_RS232_tx39_set_baud_rate, |
|
|
525 &Cyg_Device_Serial_RS232_tx39_get_line_mode, |
|
|
526 &Cyg_Device_Serial_RS232_tx39_set_line_mode, |
|
|
527 NULL, NULL, NULL |
|
|
528 }; |
|
|
529 #endif |
|
|
530 // --------------------------------------------------------------------------- |
|
|
531 // Device table |
|
|
532 // |
|
|
533 struct Cyg_Device_Table_t Cyg_Device_Table[] = { |
|
|
534 |
|
|
535 #ifdef CYG_DEVICE_SERIAL_RS232_MN10300_1 |
|
|
536 { "serial1", (CYG_ADDRWORD) 0, |
|
|
537 NULL, // no open |
|
|
538 &Cyg_Device_Serial_RS232_mn10300_1_read_cancel, |
|
|
539 NULL, |
|
|
540 &Cyg_Device_Serial_RS232_mn10300_1_read_blocking, |
|
|
541 &Cyg_Device_Serial_RS232_mn10300_1_write_blocking, |
|
|
542 #ifdef CYG_DEVICE_SERIAL_RS232_MN10300_1_KMODE_INTERRUPT |
|
|
543 &Cyg_Device_Serial_RS232_mn10300_1_read_asynchronous, |
|
|
544 &Cyg_Device_Serial_RS232_mn10300_1_write_asynchronous, |
|
|
545 #else |
|
|
546 NULL, NULL, |
|
|
547 #endif |
|
|
548 NULL, // no close |
|
|
549 (CYG_ADDRWORD)&Cyg_Device_Serial_RS232_mn10300_1_Table |
|
|
550 }, |
|
|
551 #endif |
|
|
552 |
|
|
553 #ifdef CYG_DEVICE_SERIAL_RS232_MN10300_2 |
|
|
554 { "serial2", (CYG_ADDRWORD) 0, |
|
|
555 NULL, // no open |
|
|
556 &Cyg_Device_Serial_RS232_mn10300_2_read_cancel, |
|
|
557 NULL, |
|
|
558 &Cyg_Device_Serial_RS232_mn10300_2_read_blocking, |
|
|
559 &Cyg_Device_Serial_RS232_mn10300_2_write_blocking, |
|
|
560 #ifdef CYG_DEVICE_SERIAL_RS232_MN10300_2_KMODE_INTERRUPT |
|
|
561 &Cyg_Device_Serial_RS232_mn10300_2_read_asynchronous, |
|
|
562 &Cyg_Device_Serial_RS232_mn10300_2_write_asynchronous, |
|
|
563 #else |
|
|
564 NULL, NULL, |
|
|
565 #endif |
|
|
566 NULL, // no close |
|
|
567 (CYG_ADDRWORD)&Cyg_Device_Serial_RS232_mn10300_2_Table |
|
|
568 }, |
|
|
569 #endif |
|
|
570 |
|
|
571 #ifdef CYG_DEVICE_SERIAL_RS232_TX39 |
|
|
572 { "serial0", (CYG_ADDRWORD) 0, |
|
|
573 NULL, // no open |
|
|
574 NULL, |
|
|
575 NULL, |
|
|
576 &Cyg_Device_Serial_RS232_tx39_read_blocking, |
|
|
577 &Cyg_Device_Serial_RS232_tx39_write_blocking, |
|
|
578 #ifdef CYG_DEVICE_SERIAL_RS232_TX39_KMODE_INTERRUPT |
|
|
579 &Cyg_Device_Serial_RS232_tx39_read_asynchronous, |
|
|
580 &Cyg_Device_Serial_RS232_tx39_write_asynchronous, |
|
|
581 #else |
|
|
582 NULL,NULL, |
|
|
583 #endif |
|
|
584 NULL, // no close |
|
|
585 (CYG_ADDRWORD)&Cyg_Device_Serial_RS232_tx39_Table |
|
|
586 }, |
|
|
587 #endif |
|
|
588 |
|
|
589 { "haldiag", (CYG_ADDRWORD) 0, |
|
|
590 #ifdef HAL_DIAG_INIT |
|
|
591 &Cyg_Device_Pseudo_Hal_Diag_open, |
|
|
592 #else |
|
|
593 NULL, |
|
|
594 #endif |
|
|
595 |
|
|
596 NULL, |
|
|
597 NULL, |
|
|
598 |
|
|
599 #ifdef HAL_DIAG_READ_CHAR |
|
|
600 &Cyg_Device_Pseudo_Hal_Diag_read_blocking, |
|
|
601 #else |
|
|
602 NULL, |
|
|
603 #endif |
|
|
604 |
|
|
605 #ifdef HAL_DIAG_WRITE_CHAR |
|
|
606 &Cyg_Device_Pseudo_Hal_Diag_write_blocking, |
|
|
607 #else |
|
|
608 NULL, |
|
|
609 #endif |
|
|
610 NULL }, // no close |
|
|
611 |
|
|
612 { NULL, (CYG_ADDRWORD) 0, NULL, NULL, NULL, NULL } |
|
|
613 }; |
|
|
614 |
|
|
615 #ifdef CYG_DEVICE_SERIAL_RS232_MN10300_1 |
|
|
616 CYG_ADDRWORD stdeval1_serial1 = (CYG_ADDRWORD)&Cyg_Device_Table[0]; |
|
|
617 #ifdef CYG_DEVICE_SERIAL_RS232_MN10300_2 |
|
|
618 CYG_ADDRWORD stdeval1_serial2 = (CYG_ADDRWORD)&Cyg_Device_Table[1]; |
|
|
619 #endif |
|
|
620 #else |
|
|
621 #ifdef CYG_DEVICE_SERIAL_RS232_MN10300_2 |
|
|
622 CYG_ADDRWORD stdeval1_serial2 = (CYG_ADDRWORD)&Cyg_Device_Table[0]; |
|
|
623 #endif |
|
|
624 #endif |
|
|
625 |
|
|
626 #ifdef CYG_DEVICE_SERIAL_RS232_TX39 |
|
|
627 CYG_ADDRWORD jmr3904_serial = (CYG_ADDRWORD)&Cyg_Device_Table[0]; |
|
|
628 #endif |
|
|
629 |
|
|
630 #endif |
|
|
631 |
|
|
632 /*---------------------------------------------------------------------------*/ |
|
|
633 /* End of devs/table.cxx */ |