Sync usage with man page.
[netbsd-mini2440.git] / sys / rump / dev / wip / libucom / ucom_at_usb.c
blob9b9fc4204e47d994a1e37d4af4c20cccc0e7b377
1 /* $NetBSD: ucom_at_usb.c,v 1.1 2009/12/20 15:43:13 pooka Exp $ */
3 #include <sys/param.h>
4 #include <sys/types.h>
5 #include <sys/conf.h>
6 #include <sys/device.h>
7 #include <sys/kmem.h>
9 /*
10 * MACHINE GENERATED: DO NOT EDIT
12 * ioconf.c, from "TESTI_ucom"
15 #include <sys/param.h>
16 #include <sys/conf.h>
17 #include <sys/device.h>
18 #include <sys/mount.h>
20 static const struct cfiattrdata gpibdevcf_iattrdata = {
21 "gpibdev", 1,
23 { "address", "-1", -1 },
26 static const struct cfiattrdata acpibuscf_iattrdata = {
27 "acpibus", 0, {
28 { NULL, NULL, 0 },
31 static const struct cfiattrdata caccf_iattrdata = {
32 "cac", 1,
34 { "unit", "-1", -1 },
37 static const struct cfiattrdata spicf_iattrdata = {
38 "spi", 1,
40 { "slave", "NULL", 0 },
43 static const struct cfiattrdata radiodevcf_iattrdata = {
44 "radiodev", 0, {
45 { NULL, NULL, 0 },
48 static const struct cfiattrdata mlxcf_iattrdata = {
49 "mlx", 1,
51 { "unit", "-1", -1 },
54 static const struct cfiattrdata ucombuscf_iattrdata = {
55 "ucombus", 1,
57 { "portno", "-1", -1 },
60 static const struct cfiattrdata videobuscf_iattrdata = {
61 "videobus", 0, {
62 { NULL, NULL, 0 },
65 static const struct cfiattrdata isabuscf_iattrdata = {
66 "isabus", 0, {
67 { NULL, NULL, 0 },
70 static const struct cfiattrdata i2cbuscf_iattrdata = {
71 "i2cbus", 0, {
72 { NULL, NULL, 0 },
75 static const struct cfiattrdata ata_hlcf_iattrdata = {
76 "ata_hl", 1,
78 { "drive", "-1", -1 },
81 static const struct cfiattrdata depcacf_iattrdata = {
82 "depca", 0, {
83 { NULL, NULL, 0 },
86 static const struct cfiattrdata ppbuscf_iattrdata = {
87 "ppbus", 0, {
88 { NULL, NULL, 0 },
91 static const struct cfiattrdata eisabuscf_iattrdata = {
92 "eisabus", 0, {
93 { NULL, NULL, 0 },
96 static const struct cfiattrdata atapicf_iattrdata = {
97 "atapi", 0, {
98 { NULL, NULL, 0 },
101 static const struct cfiattrdata usbroothubifcf_iattrdata = {
102 "usbroothubif", 0, {
103 { NULL, NULL, 0 },
106 static const struct cfiattrdata altmemdevcf_iattrdata = {
107 "altmemdev", 0, {
108 { NULL, NULL, 0 },
111 static const struct cfiattrdata tcbuscf_iattrdata = {
112 "tcbus", 0, {
113 { NULL, NULL, 0 },
116 static const struct cfiattrdata onewirebuscf_iattrdata = {
117 "onewirebus", 0, {
118 { NULL, NULL, 0 },
121 static const struct cfiattrdata gpiocf_iattrdata = {
122 "gpio", 2,
124 { "offset", "-1", -1 },
125 { "mask", "0", 0 },
128 static const struct cfiattrdata cbbuscf_iattrdata = {
129 "cbbus", 0, {
130 { NULL, NULL, 0 },
133 static const struct cfiattrdata gpiobuscf_iattrdata = {
134 "gpiobus", 0, {
135 { NULL, NULL, 0 },
138 static const struct cfiattrdata drmcf_iattrdata = {
139 "drm", 0, {
140 { NULL, NULL, 0 },
143 static const struct cfiattrdata pckbportcf_iattrdata = {
144 "pckbport", 1,
146 { "slot", "-1", -1 },
149 static const struct cfiattrdata irbuscf_iattrdata = {
150 "irbus", 0, {
151 { NULL, NULL, 0 },
154 static const struct cfiattrdata aaccf_iattrdata = {
155 "aac", 1,
157 { "unit", "-1", -1 },
160 static const struct cfiattrdata pcibuscf_iattrdata = {
161 "pcibus", 1,
163 { "bus", "-1", -1 },
166 static const struct cfiattrdata usbififcf_iattrdata = {
167 "usbifif", 6,
169 { "port", "-1", -1 },
170 { "configuration", "-1", -1 },
171 { "interface", "-1", -1 },
172 { "vendor", "-1", -1 },
173 { "product", "-1", -1 },
174 { "release", "-1", -1 },
177 static const struct cfiattrdata upccf_iattrdata = {
178 "upc", 1,
180 { "offset", "-1", -1 },
183 static const struct cfiattrdata iiccf_iattrdata = {
184 "iic", 2,
186 { "addr", "-1", -1 },
187 { "size", "-1", -1 },
190 static const struct cfiattrdata onewirecf_iattrdata = {
191 "onewire", 0, {
192 { NULL, NULL, 0 },
195 static const struct cfiattrdata mcabuscf_iattrdata = {
196 "mcabus", 0, {
197 { NULL, NULL, 0 },
200 static const struct cfiattrdata wsdisplaydevcf_iattrdata = {
201 "wsdisplaydev", 1,
203 { "kbdmux", "1", 1 },
206 static const struct cfiattrdata miicf_iattrdata = {
207 "mii", 1,
209 { "phy", "-1", -1 },
212 static const struct cfiattrdata cpcbuscf_iattrdata = {
213 "cpcbus", 2,
215 { "addr", "NULL", 0 },
216 { "irq", "-1", -1 },
219 static const struct cfiattrdata parportcf_iattrdata = {
220 "parport", 0, {
221 { NULL, NULL, 0 },
224 static const struct cfiattrdata dbcoolcf_iattrdata = {
225 "dbcool", 0, {
226 { NULL, NULL, 0 },
229 static const struct cfiattrdata usbdevifcf_iattrdata = {
230 "usbdevif", 6,
232 { "port", "-1", -1 },
233 { "configuration", "-1", -1 },
234 { "interface", "-1", -1 },
235 { "vendor", "-1", -1 },
236 { "product", "-1", -1 },
237 { "release", "-1", -1 },
240 static const struct cfiattrdata wskbddevcf_iattrdata = {
241 "wskbddev", 2,
243 { "console", "-1", -1 },
244 { "mux", "1", 1 },
247 static const struct cfiattrdata audiobuscf_iattrdata = {
248 "audiobus", 0, {
249 { NULL, NULL, 0 },
252 static const struct cfiattrdata btbuscf_iattrdata = {
253 "btbus", 0, {
254 { NULL, NULL, 0 },
257 static const struct cfiattrdata midibuscf_iattrdata = {
258 "midibus", 0, {
259 { NULL, NULL, 0 },
262 static const struct cfiattrdata vmebuscf_iattrdata = {
263 "vmebus", 0, {
264 { NULL, NULL, 0 },
267 static const struct cfiattrdata wsemuldisplaydevcf_iattrdata = {
268 "wsemuldisplaydev", 2,
270 { "console", "-1", -1 },
271 { "kbdmux", "1", 1 },
274 static const struct cfiattrdata uhidbuscf_iattrdata = {
275 "uhidbus", 1,
277 { "reportid", "-1", -1 },
280 static const struct cfiattrdata icpcf_iattrdata = {
281 "icp", 1,
283 { "unit", "-1", -1 },
286 static const struct cfiattrdata sdmmcbuscf_iattrdata = {
287 "sdmmcbus", 0, {
288 { NULL, NULL, 0 },
291 static const struct cfiattrdata comcf_iattrdata = {
292 "com", 0, {
293 { NULL, NULL, 0 },
296 static const struct cfiattrdata spiflashbuscf_iattrdata = {
297 "spiflashbus", 0, {
298 { NULL, NULL, 0 },
301 static const struct cfiattrdata fwbuscf_iattrdata = {
302 "fwbus", 0, {
303 { NULL, NULL, 0 },
306 static const struct cfiattrdata pcmciaslotcf_iattrdata = {
307 "pcmciaslot", 0, {
308 { NULL, NULL, 0 },
311 static const struct cfiattrdata usbuscf_iattrdata = {
312 "usbus", 0, {
313 { NULL, NULL, 0 },
316 static const struct cfiattrdata wsmousedevcf_iattrdata = {
317 "wsmousedev", 1,
319 { "mux", "0", 0 },
322 static const struct cfiattrdata scsicf_iattrdata = {
323 "scsi", 1,
325 { "channel", "-1", -1 },
328 static const struct cfiattrdata atacf_iattrdata = {
329 "ata", 1,
331 { "channel", "-1", -1 },
334 static const struct cfiattrdata spibuscf_iattrdata = {
335 "spibus", 0, {
336 { NULL, NULL, 0 },
339 static const struct cfiattrdata pcmciabuscf_iattrdata = {
340 "pcmciabus", 2,
342 { "controller", "-1", -1 },
343 { "socket", "-1", -1 },
347 static const struct cfiattrdata * const usb_attrs[] = { &usbroothubifcf_iattrdata, NULL };
348 CFDRIVER_DECL(usb, DV_DULL, usb_attrs);
350 static const struct cfiattrdata * const uhub_attrs[] = { &usbififcf_iattrdata, &usbdevifcf_iattrdata, NULL };
351 CFDRIVER_DECL(uhub, DV_DULL, uhub_attrs);
353 CFDRIVER_DECL(ucom, DV_DULL, NULL);
355 static const struct cfiattrdata * const uplcom_attrs[] = { &ucombuscf_iattrdata, NULL };
356 CFDRIVER_DECL(uplcom, DV_DULL, uplcom_attrs);
358 static const struct cfiattrdata * const rumpusbhc_attrs[] = { &usbuscf_iattrdata, NULL };
359 CFDRIVER_DECL(rumpusbhc, DV_DULL, rumpusbhc_attrs);
363 extern struct cfattach usb_ca;
364 extern struct cfattach uroothub_ca;
365 extern struct cfattach ucom_ca;
366 extern struct cfattach uplcom_ca;
367 extern struct cfattach rumpusbhc_ca;
369 /* locators */
370 static int loc[7] = {
371 -1, -1, -1, -1, -1, -1, -1,
374 static const struct cfparent pspec1 = {
375 "usbus", "rumpusbhc", DVUNIT_ANY
377 static const struct cfparent pspec2 = {
378 "usbroothubif", "usb", DVUNIT_ANY
380 static const struct cfparent pspec3 = {
381 "usbdevif", "uhub", DVUNIT_ANY
383 static const struct cfparent pspec4 = {
384 "ucombus", "uplcom", DVUNIT_ANY
387 #define NORM FSTATE_NOTFOUND
388 #define STAR FSTATE_STAR
390 struct cfdata cfdata_ucom[] = {
391 /* driver attachment unit state loc flags pspec */
392 /* 0: usb* at rumpusbhc? */
393 { "usb", "usb", 0, STAR, loc, 0, &pspec1 },
394 /* 1: uhub* at usb? */
395 { "uhub", "uroothub", 0, STAR, loc, 0, &pspec2 },
396 /* 2: ucom* at uplcom? portno -1 */
397 { "ucom", "ucom", 0, STAR, loc+ 6, 0, &pspec4 },
398 /* 3: uplcom* at uhub? port -1 configuration -1 interface -1 vendor -1 product -1 release -1 */
399 { "uplcom", "uplcom", 0, STAR, loc+ 0, 0, &pspec3 },
400 { NULL, NULL, 0, 0, NULL, 0, NULL }
403 #include <sys/stat.h>
405 #include "rump_dev_private.h"
406 #include "rump_vfs_private.h"
408 #define FLAWLESSCALL(call) \
409 do { \
410 int att_error; \
411 if ((att_error = call) != 0) \
412 panic("\"%s\" failed", #call); \
413 } while (/*CONSTCOND*/0)
415 void tty_init(void);
417 void
418 rump_device_configuration(void)
420 extern struct cfattach usb_ca, uhub_ca, uroothub_ca, ucom_ca, uplcom_ca;
421 extern struct cdevsw ucom_cdevsw;
422 devmajor_t cmaj, bmaj;
424 FLAWLESSCALL(config_cfdata_attach(cfdata_ucom, 0));
426 FLAWLESSCALL(config_cfdriver_attach(&usb_cd));
427 FLAWLESSCALL(config_cfattach_attach("usb", &usb_ca));
429 FLAWLESSCALL(config_cfdriver_attach(&uhub_cd));
430 FLAWLESSCALL(config_cfattach_attach("uhub", &uhub_ca));
432 FLAWLESSCALL(config_cfdriver_attach(&uplcom_cd));
433 FLAWLESSCALL(config_cfattach_attach("uplcom", &uplcom_ca));
435 FLAWLESSCALL(config_cfdriver_attach(&ucom_cd));
436 FLAWLESSCALL(config_cfattach_attach("ucom", &ucom_ca));
438 FLAWLESSCALL(config_cfattach_attach("uhub", &uroothub_ca));
440 bmaj = cmaj = -1;
441 FLAWLESSCALL(devsw_attach("ucom", NULL, &bmaj, &ucom_cdevsw, &cmaj));
443 FLAWLESSCALL(rump_vfs_makedevnodes(S_IFCHR, "/dev/ttyU", '0',
444 cmaj, 0, 1));
445 FLAWLESSCALL(rump_vfs_makedevnodes(S_IFCHR, "/dev/dtyU", '0',
446 cmaj, 0x80000, 1));
448 tty_init();