Get rid of a bunch of code that was part of an old USBDI proposal, but that
is unused in our USB stack. Once upon a time, when I started writing the USB stack for NetBSD, there was an effort to make a standard for how USB device drivers should interact with the rest of the USB stack. This effort had contributors from just about all Un*x camps (but not Micro$oft :). I based my design on one of their early proposals since I thought it would be a good idea if we could all share device drivers with a minimum effort. Shortly after I started my work all the free Un*x people were thrown out of the USBDI work since we did not pay the USB membership fee. Well, some time has passed now and the work of the standardization group is almost public again. But alas, the new standard has grown to be a monster! I do not want to have this as the basis for the *BSD USB stack; it is far too complicated. So, since we are not even close to being compilant with the standard, I've thrown out some old baggage.
This commit is contained in:
parent
656245dc18
commit
475ed73e46
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ukbd.c,v 1.34 1999/06/11 19:05:13 wrstuden Exp $ */
|
||||
/* $NetBSD: ukbd.c,v 1.35 1999/06/14 17:09:57 augustss Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
@ -684,11 +684,11 @@ ukbd_cngetc(v, type, data)
|
||||
int *data;
|
||||
{
|
||||
struct ukbd_softc *sc = v;
|
||||
usbd_lock_token s;
|
||||
int s;
|
||||
int c;
|
||||
|
||||
DPRINTFN(-1,("ukbd_cngetc: enter\n"));
|
||||
s = usbd_lock();
|
||||
s = splusb();
|
||||
sc->sc_polling = 1;
|
||||
while(sc->sc_npollchar <= 0)
|
||||
usbd_dopoll(sc->sc_iface);
|
||||
@ -699,7 +699,7 @@ ukbd_cngetc(v, type, data)
|
||||
sc->sc_npollchar * sizeof(u_int16_t));
|
||||
*type = c & RELEASE ? WSCONS_EVENT_KEY_UP : WSCONS_EVENT_KEY_DOWN;
|
||||
*data = c & CODEMASK;
|
||||
usbd_unlock(s);
|
||||
splx(s);
|
||||
DPRINTFN(-1,("ukbd_cngetc: return 0x%02x\n", c));
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: usb_quirks.c,v 1.9 1999/05/20 09:51:13 augustss Exp $ */
|
||||
/* $NetBSD: usb_quirks.c,v 1.10 1999/06/14 17:09:57 augustss Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
@ -61,7 +61,6 @@ struct usbd_quirk_entry {
|
||||
{ USB_VENDOR_GENIUS, USB_PRODUCT_GENIUS_NICHE, 0x100, { UQ_NO_SET_PROTO}},
|
||||
{ USB_VENDOR_INSIDEOUT,USB_PRODUCT_INSIDEOUT_EDGEPORT4,
|
||||
0x094, { UQ_SWAP_UNICODE}},
|
||||
{ USB_VENDOR_TI, USB_PRODUCT_TI_UTUSB41, 0x100, { UQ_HUB_POWER }},
|
||||
{ USB_VENDOR_BTC, USB_PRODUCT_BTC_BTC7932, 0x100, { UQ_NO_STRINGS }},
|
||||
{ USB_VENDOR_ADS, USB_PRODUCT_ADS_ENET, 0x002, { UQ_NO_STRINGS }},
|
||||
{ USB_VENDOR_PERACOM, USB_PRODUCT_PERACOM_SERIAL1, 0x101, { UQ_NO_STRINGS }},
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: usb_quirks.h,v 1.5 1998/12/29 15:23:59 augustss Exp $ */
|
||||
/* $NetBSD: usb_quirks.h,v 1.6 1999/06/14 17:09:57 augustss Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
@ -41,8 +41,7 @@ struct usbd_quirks {
|
||||
u_int32_t uq_flags; /* Device problems: */
|
||||
#define UQ_NO_SET_PROTO 0x01 /* cannot handle SET PROTOCOL. */
|
||||
#define UQ_SWAP_UNICODE 0x02 /* has some Unicode strings swapped. */
|
||||
#define UQ_HUB_POWER 0x04 /* does not respond correctly to get
|
||||
device status; use get hub status. */
|
||||
/*#define UQ_ 0x04 */
|
||||
#define UQ_NO_STRINGS 0x08 /* string descriptors are broken. */
|
||||
#define UQ_BAD_ADC 0x10 /* bad audio spec version number. */
|
||||
};
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: usb_subr.c,v 1.32 1999/05/16 13:51:05 augustss Exp $ */
|
||||
/* $NetBSD: usb_subr.c,v 1.33 1999/06/14 17:09:57 augustss Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
@ -110,12 +110,10 @@ char *usbd_error_strs[] = {
|
||||
"PENDING_REQUESTS",
|
||||
"NOT_STARTED",
|
||||
"INVAL",
|
||||
"IS_IDLE",
|
||||
"NOMEM",
|
||||
"CANCELLED",
|
||||
"BAD_ADDRESS",
|
||||
"IN_USE",
|
||||
"INTERFACE_NOT_ACTIVE",
|
||||
"NO_ADDR",
|
||||
"SET_ADDR_FAILED",
|
||||
"NO_POWER",
|
||||
@ -125,6 +123,7 @@ char *usbd_error_strs[] = {
|
||||
"TIMEOUT",
|
||||
"SHORT_XFER",
|
||||
"STALLED",
|
||||
"INTERRUPTED",
|
||||
"XXX",
|
||||
};
|
||||
#endif
|
||||
@ -459,14 +458,12 @@ usbd_fill_iface_data(dev, ifaceidx, altidx)
|
||||
goto bad;
|
||||
found:
|
||||
ifc->endpoints[endpt].edesc = ed;
|
||||
ifc->endpoints[endpt].state = USBD_ENDPOINT_ACTIVE;
|
||||
ifc->endpoints[endpt].refcnt = 0;
|
||||
ifc->endpoints[endpt].toggle = 0;
|
||||
p += ed->bLength;
|
||||
}
|
||||
#undef ed
|
||||
LIST_INIT(&ifc->pipes);
|
||||
ifc->state = USBD_INTERFACE_ACTIVE;
|
||||
return (USBD_NORMAL_COMPLETION);
|
||||
|
||||
bad:
|
||||
@ -528,7 +525,6 @@ usbd_set_config_index(dev, index, msg)
|
||||
int msg;
|
||||
{
|
||||
usb_status_t ds;
|
||||
usb_hub_status_t hs;
|
||||
usb_config_descriptor_t cd, *cdp;
|
||||
usbd_status r;
|
||||
int ifcidx, nifc, len, selfpowered, power;
|
||||
@ -547,7 +543,6 @@ usbd_set_config_index(dev, index, msg)
|
||||
dev->ifaces = 0;
|
||||
dev->cdesc = 0;
|
||||
dev->config = 0;
|
||||
dev->state = USBD_DEVICE_ADDRESSED;
|
||||
}
|
||||
|
||||
/* Figure out what config number to use. */
|
||||
@ -572,18 +567,10 @@ usbd_set_config_index(dev, index, msg)
|
||||
/* May be self powered. */
|
||||
if (cdp->bmAttributes & UC_BUS_POWERED) {
|
||||
/* Must ask device. */
|
||||
if (dev->quirks->uq_flags & UQ_HUB_POWER) {
|
||||
/* Buggy hub, use hub descriptor. */
|
||||
r = usbd_get_hub_status(dev, &hs);
|
||||
if (r == USBD_NORMAL_COMPLETION &&
|
||||
!(UGETW(hs.wHubStatus) & UHS_LOCAL_POWER))
|
||||
selfpowered = 1;
|
||||
} else {
|
||||
r = usbd_get_device_status(dev, &ds);
|
||||
if (r == USBD_NORMAL_COMPLETION &&
|
||||
(UGETW(ds.wStatus) & UDS_SELF_POWERED))
|
||||
selfpowered = 1;
|
||||
}
|
||||
r = usbd_get_device_status(dev, &ds);
|
||||
if (r == USBD_NORMAL_COMPLETION &&
|
||||
(UGETW(ds.wStatus) & UDS_SELF_POWERED))
|
||||
selfpowered = 1;
|
||||
DPRINTF(("usbd_set_config_index: status=0x%04x, "
|
||||
"error=%d(%s)\n",
|
||||
UGETW(ds.wStatus), r, usbd_error_strs[r]));
|
||||
@ -591,10 +578,9 @@ usbd_set_config_index(dev, index, msg)
|
||||
selfpowered = 1;
|
||||
}
|
||||
DPRINTF(("usbd_set_config_index: (addr %d) attr=0x%02x, "
|
||||
"selfpowered=%d, power=%d, powerquirk=%x\n",
|
||||
"selfpowered=%d, power=%d\n",
|
||||
dev->address, cdp->bmAttributes,
|
||||
selfpowered, cdp->bMaxPower * 2,
|
||||
dev->quirks->uq_flags & UQ_HUB_POWER));
|
||||
selfpowered, cdp->bMaxPower * 2));
|
||||
#ifdef USB_DEBUG
|
||||
if (!dev->powersrc) {
|
||||
printf("usbd_set_config_index: No power source?\n");
|
||||
@ -637,7 +623,6 @@ usbd_set_config_index(dev, index, msg)
|
||||
DPRINTFN(5,("usbd_set_config_index: dev=%p cdesc=%p\n", dev, cdp));
|
||||
dev->cdesc = cdp;
|
||||
dev->config = cdp->bConfigurationValue;
|
||||
dev->state = USBD_DEVICE_CONFIGURED;
|
||||
for (ifcidx = 0; ifcidx < nifc; ifcidx++) {
|
||||
r = usbd_fill_iface_data(dev, ifcidx, 0);
|
||||
if (r != USBD_NORMAL_COMPLETION) {
|
||||
@ -673,7 +658,6 @@ usbd_setup_pipe(dev, iface, ep, pipe)
|
||||
return (USBD_NOMEM);
|
||||
p->device = dev;
|
||||
p->iface = iface;
|
||||
p->state = USBD_PIPE_ACTIVE;
|
||||
p->endpoint = ep;
|
||||
ep->refcnt++;
|
||||
p->refcnt = 1;
|
||||
@ -873,7 +857,6 @@ usbd_new_device(parent, bus, depth, lowspeed, port, up)
|
||||
|
||||
/* Set up default endpoint handle. */
|
||||
dev->def_ep.edesc = &dev->def_ep_desc;
|
||||
dev->def_ep.state = USBD_ENDPOINT_ACTIVE;
|
||||
|
||||
/* Set up default endpoint descriptor. */
|
||||
dev->def_ep_desc.bLength = USB_ENDPOINT_DESCRIPTOR_SIZE;
|
||||
@ -883,7 +866,6 @@ usbd_new_device(parent, bus, depth, lowspeed, port, up)
|
||||
USETW(dev->def_ep_desc.wMaxPacketSize, USB_MAX_IPACKET);
|
||||
dev->def_ep_desc.bInterval = 0;
|
||||
|
||||
dev->state = USBD_DEVICE_DEFAULT;
|
||||
dev->quirks = &usbd_no_quirk;
|
||||
dev->address = USB_START_ADDR;
|
||||
dev->ddesc.bMaxPacketSize = 0;
|
||||
@ -956,7 +938,6 @@ usbd_new_device(parent, bus, depth, lowspeed, port, up)
|
||||
usbd_delay_ms(dev, USB_SET_ADDRESS_SETTLE);
|
||||
|
||||
dev->address = addr; /* New device address now */
|
||||
dev->state = USBD_DEVICE_ADDRESSED;
|
||||
bus->devices[addr] = dev;
|
||||
|
||||
/* Assume 100mA bus powered for now. Changed when configured. */
|
||||
@ -1073,15 +1054,8 @@ usb_insert_transfer(reqh)
|
||||
usbd_request_handle reqh;
|
||||
{
|
||||
usbd_pipe_handle pipe = reqh->pipe;
|
||||
usbd_interface_handle iface = pipe->iface;
|
||||
|
||||
if (pipe->state == USBD_PIPE_IDLE ||
|
||||
(iface && iface->state == USBD_INTERFACE_IDLE))
|
||||
return (USBD_IS_IDLE);
|
||||
SIMPLEQ_INSERT_TAIL(&pipe->queue, reqh, next);
|
||||
if (pipe->state != USBD_PIPE_ACTIVE ||
|
||||
(iface && iface->state != USBD_INTERFACE_ACTIVE))
|
||||
return (USBD_NOT_STARTED);
|
||||
if (pipe->running)
|
||||
return (USBD_IN_PROGRESS);
|
||||
pipe->running = 1;
|
||||
@ -1114,10 +1088,6 @@ usb_start_next(pipe)
|
||||
|
||||
/* First remove remove old */
|
||||
SIMPLEQ_REMOVE_HEAD(&pipe->queue, SIMPLEQ_FIRST(&pipe->queue), next);
|
||||
if (pipe->state != USBD_PIPE_ACTIVE) {
|
||||
pipe->running = 0;
|
||||
return;
|
||||
}
|
||||
reqh = SIMPLEQ_FIRST(&pipe->queue);
|
||||
DPRINTFN(5, ("usb_start_next: start reqh=%p\n", reqh));
|
||||
if (!reqh)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: usbdi.c,v 1.23 1999/05/13 23:29:41 augustss Exp $ */
|
||||
/* $NetBSD: usbdi.c,v 1.24 1999/06/14 17:09:58 augustss Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
@ -70,7 +70,6 @@ extern int usbdebug;
|
||||
#endif
|
||||
|
||||
static usbd_status usbd_ar_pipe __P((usbd_pipe_handle pipe));
|
||||
static usbd_status usbd_ar_iface __P((usbd_interface_handle iface));
|
||||
static void usbd_transfer_cb __P((usbd_request_handle reqh));
|
||||
static void usbd_sync_transfer_cb __P((usbd_request_handle reqh));
|
||||
static usbd_status usbd_do_transfer __P((usbd_request_handle reqh));
|
||||
@ -97,8 +96,6 @@ usbd_open_pipe(iface, address, flags, pipe)
|
||||
usbd_status r;
|
||||
int i;
|
||||
|
||||
if (iface->state != USBD_INTERFACE_ACTIVE)
|
||||
return (USBD_INTERFACE_NOT_ACTIVE);
|
||||
for (i = 0; i < iface->idesc->bNumEndpoints; i++) {
|
||||
ep = &iface->endpoints[i];
|
||||
if (ep->edesc->bEndpointAddress == address)
|
||||
@ -192,8 +189,6 @@ usbd_status
|
||||
usbd_close_pipe(pipe)
|
||||
usbd_pipe_handle pipe;
|
||||
{
|
||||
if (pipe->iface->state != USBD_INTERFACE_ACTIVE)
|
||||
return (USBD_INTERFACE_NOT_ACTIVE);
|
||||
if (--pipe->refcnt != 0)
|
||||
return (USBD_NORMAL_COMPLETION);
|
||||
if (SIMPLEQ_FIRST(&pipe->queue) != 0)
|
||||
@ -277,16 +272,6 @@ usbd_setup_request(reqh, pipe, priv, buffer, length, flags, timeout, callback)
|
||||
return (USBD_NORMAL_COMPLETION);
|
||||
}
|
||||
|
||||
usbd_status
|
||||
usbd_setup_device_request(reqh, req)
|
||||
usbd_request_handle reqh;
|
||||
usb_device_request_t *req;
|
||||
{
|
||||
reqh->isreq = 1;
|
||||
reqh->request = *req;
|
||||
return (USBD_NORMAL_COMPLETION);
|
||||
}
|
||||
|
||||
usbd_status
|
||||
usbd_setup_default_request(reqh, dev, priv, timeout, req, buffer,
|
||||
length, flags, callback)
|
||||
@ -317,15 +302,6 @@ usbd_setup_default_request(reqh, dev, priv, timeout, req, buffer,
|
||||
return (USBD_NORMAL_COMPLETION);
|
||||
}
|
||||
|
||||
usbd_status
|
||||
usbd_set_request_timeout(reqh, timeout)
|
||||
usbd_request_handle reqh;
|
||||
u_int32_t timeout;
|
||||
{
|
||||
reqh->timeout = timeout;
|
||||
return (USBD_NORMAL_COMPLETION);
|
||||
}
|
||||
|
||||
usbd_status
|
||||
usbd_get_request_status(reqh, priv, buffer, count, status)
|
||||
usbd_request_handle reqh;
|
||||
@ -341,25 +317,6 @@ usbd_get_request_status(reqh, priv, buffer, count, status)
|
||||
return (USBD_NORMAL_COMPLETION);
|
||||
}
|
||||
|
||||
usbd_status
|
||||
usbd_request_device_data(reqh, req)
|
||||
usbd_request_handle reqh;
|
||||
usb_device_request_t *req;
|
||||
{
|
||||
if (!reqh->isreq)
|
||||
return (USBD_INVAL);
|
||||
*req = reqh->request;
|
||||
return (USBD_NORMAL_COMPLETION);
|
||||
}
|
||||
|
||||
#if 0
|
||||
usb_descriptor_t *
|
||||
usbd_get_descriptor(iface, desc_type)
|
||||
usbd_interface_handle *iface;
|
||||
u_int8_t desc_type;
|
||||
XX
|
||||
#endif
|
||||
|
||||
usb_config_descriptor_t *
|
||||
usbd_get_config_descriptor(dev)
|
||||
usbd_device_handle dev;
|
||||
@ -391,92 +348,19 @@ usbd_interface2endpoint_descriptor(iface, index)
|
||||
return (iface->endpoints[index].edesc);
|
||||
}
|
||||
|
||||
usbd_status
|
||||
usbd_set_configuration(dev, conf)
|
||||
usbd_device_handle dev;
|
||||
u_int8_t conf;
|
||||
{
|
||||
return usbd_set_config_no(dev, conf, 0);
|
||||
}
|
||||
|
||||
usbd_status
|
||||
usbd_retry_request(reqh, retry_count)
|
||||
usbd_request_handle reqh;
|
||||
u_int32_t retry_count;
|
||||
{
|
||||
usbd_status r;
|
||||
|
||||
r = usbd_set_pipe_state(reqh->pipe, USBD_PIPE_ACTIVE);
|
||||
if (r != USBD_NORMAL_COMPLETION)
|
||||
return (r);
|
||||
reqh->retries = retry_count;
|
||||
return (usbd_transfer(reqh));
|
||||
}
|
||||
|
||||
usbd_status
|
||||
usbd_abort_pipe(pipe)
|
||||
usbd_pipe_handle pipe;
|
||||
{
|
||||
usbd_status r;
|
||||
int s, st;
|
||||
int s;
|
||||
|
||||
if (pipe->iface->state != USBD_INTERFACE_ACTIVE)
|
||||
return (USBD_INTERFACE_NOT_ACTIVE);
|
||||
s = splusb();
|
||||
st = pipe->state;
|
||||
r = usbd_ar_pipe(pipe);
|
||||
pipe->state = st;
|
||||
splx(s);
|
||||
return (r);
|
||||
}
|
||||
|
||||
usbd_status
|
||||
usbd_abort_interface(iface)
|
||||
usbd_interface_handle iface;
|
||||
{
|
||||
usbd_status r;
|
||||
int s, st;
|
||||
|
||||
s = splusb();
|
||||
st = iface->state;
|
||||
r = usbd_ar_iface(iface);
|
||||
iface->state = st;
|
||||
splx(s);
|
||||
return (r);
|
||||
}
|
||||
|
||||
usbd_status
|
||||
usbd_reset_pipe(pipe)
|
||||
usbd_pipe_handle pipe;
|
||||
{
|
||||
usbd_status r;
|
||||
int s;
|
||||
|
||||
if (pipe->iface->state != USBD_INTERFACE_ACTIVE)
|
||||
return (USBD_INTERFACE_NOT_ACTIVE);
|
||||
s = splusb();
|
||||
r = usbd_ar_pipe(pipe);
|
||||
/* XXX anything else */
|
||||
pipe->state = USBD_PIPE_ACTIVE;
|
||||
splx(s);
|
||||
return (r);
|
||||
}
|
||||
|
||||
usbd_status
|
||||
usbd_reset_interface(iface)
|
||||
usbd_interface_handle iface;
|
||||
{
|
||||
usbd_status r;
|
||||
int s;
|
||||
|
||||
s = splusb();
|
||||
r = usbd_ar_iface(iface);
|
||||
/* XXX anything else */
|
||||
iface->state = USBD_INTERFACE_ACTIVE;
|
||||
splx(s);
|
||||
return (r);
|
||||
}
|
||||
|
||||
usbd_status
|
||||
usbd_clear_endpoint_stall(pipe)
|
||||
usbd_pipe_handle pipe;
|
||||
@ -519,126 +403,6 @@ usbd_clear_endpoint_stall_async(pipe)
|
||||
return (r);
|
||||
}
|
||||
|
||||
usbd_status
|
||||
usbd_set_pipe_state(pipe, state)
|
||||
usbd_pipe_handle pipe;
|
||||
usbd_pipe_state state;
|
||||
{
|
||||
int s;
|
||||
usbd_status r;
|
||||
usbd_request_handle reqh;
|
||||
|
||||
if (pipe->iface->state != USBD_INTERFACE_ACTIVE)
|
||||
return (USBD_INTERFACE_NOT_ACTIVE);
|
||||
if (state != USBD_PIPE_ACTIVE &&
|
||||
state != USBD_PIPE_STALLED &&
|
||||
state != USBD_PIPE_IDLE)
|
||||
return (USBD_INVAL);
|
||||
pipe->state = state;
|
||||
r = USBD_NORMAL_COMPLETION;
|
||||
if (state == USBD_PIPE_ACTIVE) {
|
||||
s = splusb();
|
||||
if (!pipe->running) {
|
||||
reqh = SIMPLEQ_FIRST(&pipe->queue);
|
||||
if (reqh != 0) {
|
||||
pipe->running = 1;
|
||||
splx(s);
|
||||
r = pipe->methods->start(reqh);
|
||||
} else
|
||||
splx(s);
|
||||
} else
|
||||
splx(s);
|
||||
}
|
||||
return (r);
|
||||
}
|
||||
|
||||
usbd_status
|
||||
usbd_get_pipe_state(pipe, state, endpoint_state, request_count)
|
||||
usbd_pipe_handle pipe;
|
||||
usbd_pipe_state *state;
|
||||
u_int32_t *endpoint_state;
|
||||
u_int32_t *request_count;
|
||||
{
|
||||
int n;
|
||||
usbd_request_handle r;
|
||||
|
||||
*state = pipe->state;
|
||||
*endpoint_state = pipe->endpoint->state;
|
||||
for (r = SIMPLEQ_FIRST(&pipe->queue), n = 0;
|
||||
r != 0;
|
||||
r = SIMPLEQ_NEXT(r, next), n++)
|
||||
;
|
||||
*request_count = n;
|
||||
return (USBD_NORMAL_COMPLETION);
|
||||
}
|
||||
|
||||
usbd_status
|
||||
usbd_set_interface_state(iface, state)
|
||||
usbd_interface_handle iface;
|
||||
usbd_interface_state state;
|
||||
{
|
||||
int ps;
|
||||
usbd_pipe_handle p;
|
||||
|
||||
if (state == USBD_INTERFACE_ACTIVE)
|
||||
ps = USBD_PIPE_ACTIVE;
|
||||
else if (state == USBD_INTERFACE_STALLED)
|
||||
ps = USBD_PIPE_STALLED;
|
||||
else if (state == USBD_INTERFACE_IDLE)
|
||||
ps = USBD_PIPE_IDLE;
|
||||
else
|
||||
return (USBD_INVAL);
|
||||
iface->state = USBD_INTERFACE_ACTIVE; /* to allow setting the pipe */
|
||||
for (p = LIST_FIRST(&iface->pipes); p != 0; p = LIST_NEXT(p, next))
|
||||
usbd_set_pipe_state(p, ps);
|
||||
iface->state = state;
|
||||
return (USBD_NORMAL_COMPLETION);
|
||||
}
|
||||
|
||||
usbd_status
|
||||
usbd_get_interface_state(iface, state)
|
||||
usbd_interface_handle iface;
|
||||
usbd_interface_state *state;
|
||||
{
|
||||
*state = iface->state;
|
||||
return (USBD_NORMAL_COMPLETION);
|
||||
}
|
||||
|
||||
usbd_status
|
||||
usbd_get_device_state(dev, state)
|
||||
usbd_device_handle dev;
|
||||
usbd_device_state *state;
|
||||
{
|
||||
*state = dev->state;
|
||||
return (USBD_NORMAL_COMPLETION);
|
||||
}
|
||||
|
||||
#if 0
|
||||
usbd_status
|
||||
usbd_set_device_state(dev, state)
|
||||
usbd_device_handle dev;
|
||||
usbd_device_state state;
|
||||
X
|
||||
#endif
|
||||
|
||||
usbd_status
|
||||
usbd_device_address(dev, address)
|
||||
usbd_device_handle dev;
|
||||
u_int8_t *address;
|
||||
{
|
||||
*address = dev->address;
|
||||
return (USBD_NORMAL_COMPLETION);
|
||||
}
|
||||
|
||||
usbd_status
|
||||
usbd_endpoint_address(pipe, address)
|
||||
usbd_pipe_handle pipe;
|
||||
u_int8_t *address;
|
||||
{
|
||||
*address = pipe->endpoint->edesc->bEndpointAddress;
|
||||
return (USBD_NORMAL_COMPLETION);
|
||||
}
|
||||
|
||||
usbd_status
|
||||
usbd_endpoint_count(iface, count)
|
||||
usbd_interface_handle iface;
|
||||
@ -659,73 +423,6 @@ usbd_interface_count(dev, count)
|
||||
return (USBD_NORMAL_COMPLETION);
|
||||
}
|
||||
|
||||
#if 0
|
||||
u_int8_t
|
||||
usbd_bus_count()
|
||||
{
|
||||
return (usb_bus_count());
|
||||
}
|
||||
|
||||
usbd_status
|
||||
usbd_get_bus_handle(index, bus)
|
||||
u_int8_t index;
|
||||
usbd_bus_handle *bus;
|
||||
{
|
||||
return (usb_get_bus_handle(index, bus));
|
||||
}
|
||||
#endif
|
||||
|
||||
usbd_status
|
||||
usbd_get_root_hub(bus, dev)
|
||||
usbd_bus_handle bus;
|
||||
usbd_device_handle *dev;
|
||||
{
|
||||
*dev = bus->root_hub;
|
||||
return (USBD_NORMAL_COMPLETION);
|
||||
}
|
||||
|
||||
usbd_status
|
||||
usbd_port_count(dev, nports)
|
||||
usbd_device_handle dev;
|
||||
u_int8_t *nports;
|
||||
{
|
||||
if (dev->hub == 0)
|
||||
return (USBD_INVAL);
|
||||
*nports = dev->hub->hubdesc.bNbrPorts;
|
||||
return (USBD_NORMAL_COMPLETION);
|
||||
}
|
||||
|
||||
usbd_status
|
||||
usbd_hub2device_handle(dev, port, devp)
|
||||
usbd_device_handle dev;
|
||||
u_int8_t port;
|
||||
usbd_device_handle *devp;
|
||||
{
|
||||
if (dev->hub == 0 || port >= dev->hub->hubdesc.bNbrPorts ||
|
||||
dev->hub->ports[port].device == 0)
|
||||
return (USBD_INVAL);
|
||||
*devp = dev->hub->ports[port].device;
|
||||
return (USBD_NORMAL_COMPLETION);
|
||||
}
|
||||
|
||||
usbd_status
|
||||
usbd_request2pipe_handle(reqh, pipe)
|
||||
usbd_request_handle reqh;
|
||||
usbd_pipe_handle *pipe;
|
||||
{
|
||||
*pipe = reqh->pipe;
|
||||
return (USBD_NORMAL_COMPLETION);
|
||||
}
|
||||
|
||||
usbd_status
|
||||
usbd_pipe2interface_handle(pipe, iface)
|
||||
usbd_pipe_handle pipe;
|
||||
usbd_interface_handle *iface;
|
||||
{
|
||||
*iface = pipe->iface;
|
||||
return (USBD_NORMAL_COMPLETION);
|
||||
}
|
||||
|
||||
usbd_status
|
||||
usbd_interface2device_handle(iface, dev)
|
||||
usbd_interface_handle iface;
|
||||
@ -735,15 +432,6 @@ usbd_interface2device_handle(iface, dev)
|
||||
return (USBD_NORMAL_COMPLETION);
|
||||
}
|
||||
|
||||
usbd_status
|
||||
usbd_device2bus_handle(dev, bus)
|
||||
usbd_device_handle dev;
|
||||
usbd_bus_handle *bus;
|
||||
{
|
||||
*bus = dev->bus;
|
||||
return (USBD_NORMAL_COMPLETION);
|
||||
}
|
||||
|
||||
usbd_status
|
||||
usbd_device2interface_handle(dev, ifaceno, iface)
|
||||
usbd_device_handle dev;
|
||||
@ -758,53 +446,6 @@ usbd_device2interface_handle(dev, ifaceno, iface)
|
||||
return (USBD_NORMAL_COMPLETION);
|
||||
}
|
||||
|
||||
usbd_status
|
||||
usbd_set_interface_private_handle(iface, priv)
|
||||
usbd_interface_handle iface;
|
||||
usbd_private_handle priv;
|
||||
{
|
||||
iface->priv = priv;
|
||||
return (USBD_NORMAL_COMPLETION);
|
||||
}
|
||||
|
||||
usbd_status
|
||||
usbd_get_interface_private_handle(iface, priv)
|
||||
usbd_interface_handle iface;
|
||||
usbd_private_handle *priv;
|
||||
{
|
||||
*priv = iface->priv;
|
||||
return (USBD_NORMAL_COMPLETION);
|
||||
}
|
||||
|
||||
usbd_status
|
||||
usbd_reference_pipe(pipe)
|
||||
usbd_pipe_handle pipe;
|
||||
{
|
||||
pipe->refcnt++;
|
||||
return (USBD_NORMAL_COMPLETION);
|
||||
}
|
||||
|
||||
usbd_status
|
||||
usbd_dereference_pipe(pipe)
|
||||
usbd_pipe_handle pipe;
|
||||
{
|
||||
pipe->refcnt--;
|
||||
return (USBD_NORMAL_COMPLETION);
|
||||
}
|
||||
|
||||
usbd_lock_token
|
||||
usbd_lock()
|
||||
{
|
||||
return (splusb());
|
||||
}
|
||||
|
||||
void
|
||||
usbd_unlock(tok)
|
||||
usbd_lock_token tok;
|
||||
{
|
||||
splx(tok);
|
||||
}
|
||||
|
||||
/* XXXX use altno */
|
||||
usbd_status
|
||||
usbd_set_interface(iface, altidx)
|
||||
@ -821,7 +462,6 @@ usbd_set_interface(iface, altidx)
|
||||
free(iface->endpoints, M_USB);
|
||||
iface->endpoints = 0;
|
||||
iface->idesc = 0;
|
||||
iface->state = USBD_INTERFACE_IDLE;
|
||||
|
||||
r = usbd_fill_iface_data(iface->device, iface->index, altidx);
|
||||
if (r != USBD_NORMAL_COMPLETION)
|
||||
@ -905,22 +545,6 @@ usbd_ar_pipe(pipe)
|
||||
return (USBD_NORMAL_COMPLETION);
|
||||
}
|
||||
|
||||
/* Dequeue all interface operations, called at splusb(). */
|
||||
static usbd_status
|
||||
usbd_ar_iface(iface)
|
||||
usbd_interface_handle iface;
|
||||
{
|
||||
usbd_pipe_handle p;
|
||||
usbd_status r, ret = USBD_NORMAL_COMPLETION;
|
||||
|
||||
for (p = LIST_FIRST(&iface->pipes); p != 0; p = LIST_NEXT(p, next)) {
|
||||
r = usbd_ar_pipe(p);
|
||||
if (r != USBD_NORMAL_COMPLETION)
|
||||
ret = r;
|
||||
}
|
||||
return (ret);
|
||||
}
|
||||
|
||||
static int usbd_global_init_done = 0;
|
||||
|
||||
void
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: usbdi.h,v 1.18 1999/05/16 13:51:05 augustss Exp $ */
|
||||
/* $NetBSD: usbdi.h,v 1.19 1999/06/14 17:09:58 augustss Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
@ -44,32 +44,6 @@ typedef struct usbd_pipe *usbd_pipe_handle;
|
||||
typedef struct usbd_request *usbd_request_handle;
|
||||
typedef void *usbd_private_handle;
|
||||
|
||||
typedef enum {
|
||||
USBD_ENDPOINT_ACTIVE,
|
||||
USBD_ENDPOINT_STALLED,
|
||||
} usbd_endpoint_state;
|
||||
|
||||
typedef enum {
|
||||
USBD_PIPE_ACTIVE,
|
||||
USBD_PIPE_STALLED,
|
||||
USBD_PIPE_IDLE,
|
||||
} usbd_pipe_state;
|
||||
|
||||
typedef enum {
|
||||
USBD_INTERFACE_ACTIVE,
|
||||
USBD_INTERFACE_STALLED,
|
||||
USBD_INTERFACE_IDLE,
|
||||
} usbd_interface_state;
|
||||
|
||||
typedef enum {
|
||||
USBD_DEVICE_ATTACHED,
|
||||
USBD_DEVICE_POWERED,
|
||||
USBD_DEVICE_DEFAULT,
|
||||
USBD_DEVICE_ADDRESSED,
|
||||
USBD_DEVICE_CONFIGURED,
|
||||
USBD_DEVICE_SUSPENDED,
|
||||
} usbd_device_state;
|
||||
|
||||
typedef enum {
|
||||
USBD_NORMAL_COMPLETION = 0,
|
||||
USBD_IN_PROGRESS,
|
||||
@ -77,12 +51,10 @@ typedef enum {
|
||||
USBD_PENDING_REQUESTS,
|
||||
USBD_NOT_STARTED,
|
||||
USBD_INVAL,
|
||||
USBD_IS_IDLE,
|
||||
USBD_NOMEM,
|
||||
USBD_CANCELLED,
|
||||
USBD_BAD_ADDRESS,
|
||||
USBD_IN_USE,
|
||||
USBD_INTERFACE_NOT_ACTIVE,
|
||||
USBD_NO_ADDR,
|
||||
USBD_SET_ADDR_FAILED,
|
||||
USBD_NO_POWER,
|
||||
@ -125,83 +97,27 @@ usbd_status usbd_setup_request
|
||||
usbd_private_handle priv, void *buffer,
|
||||
u_int32_t length, u_int16_t flags, u_int32_t timeout,
|
||||
usbd_callback));
|
||||
usbd_status usbd_setup_device_request
|
||||
__P((usbd_request_handle reqh, usb_device_request_t *req));
|
||||
usbd_status usbd_setup_default_request
|
||||
__P((usbd_request_handle reqh, usbd_device_handle dev,
|
||||
usbd_private_handle priv, u_int32_t timeout,
|
||||
usb_device_request_t *req, void *buffer,
|
||||
u_int32_t length, u_int16_t flags, usbd_callback));
|
||||
usbd_status usbd_set_request_timeout
|
||||
__P((usbd_request_handle reqh, u_int32_t timeout));
|
||||
usbd_status usbd_get_request_status
|
||||
__P((usbd_request_handle reqh, usbd_private_handle *priv,
|
||||
void **buffer, u_int32_t *count, usbd_status *status));
|
||||
usbd_status usbd_request_device_data
|
||||
__P((usbd_request_handle reqh, usb_device_request_t *req));
|
||||
usb_descriptor_t *usbd_get_descriptor
|
||||
__P((usbd_interface_handle *iface, u_int8_t desc_type));
|
||||
usb_endpoint_descriptor_t *usbd_interface2endpoint_descriptor
|
||||
__P((usbd_interface_handle iface, u_int8_t address));
|
||||
usbd_status usbd_set_configuration
|
||||
__P((usbd_device_handle dev, u_int8_t conf));
|
||||
usbd_status usbd_retry_request
|
||||
__P((usbd_request_handle reqh, u_int32_t retry_count));
|
||||
usbd_status usbd_abort_pipe __P((usbd_pipe_handle pipe));
|
||||
usbd_status usbd_abort_interface __P((usbd_interface_handle iface));
|
||||
usbd_status usbd_reset_pipe __P((usbd_pipe_handle pipe));
|
||||
usbd_status usbd_reset_interface __P((usbd_interface_handle iface));
|
||||
usbd_status usbd_clear_endpoint_stall __P((usbd_pipe_handle pipe));
|
||||
usbd_status usbd_clear_endpoint_stall_async __P((usbd_pipe_handle pipe));
|
||||
usbd_status usbd_set_pipe_state
|
||||
__P((usbd_pipe_handle pipe, usbd_pipe_state state));
|
||||
usbd_status usbd_get_pipe_state
|
||||
__P((usbd_pipe_handle pipe, usbd_pipe_state *state,
|
||||
u_int32_t *endpoint_state, u_int32_t *request_count));
|
||||
usbd_status usbd_set_interface_state
|
||||
__P((usbd_interface_handle iface, usbd_interface_state state));
|
||||
usbd_status usbd_get_interface_state
|
||||
__P((usbd_interface_handle iface, usbd_interface_state *state));
|
||||
usbd_status usbd_get_device_state
|
||||
__P((usbd_device_handle dev, usbd_device_state *state));
|
||||
usbd_status usbd_set_device_state
|
||||
__P((usbd_device_handle dev, usbd_device_state state));
|
||||
usbd_status usbd_device_address
|
||||
__P((usbd_device_handle dev, u_int8_t *address));
|
||||
usbd_status usbd_endpoint_address
|
||||
__P((usbd_pipe_handle dev, u_int8_t *address));
|
||||
usbd_status usbd_endpoint_count
|
||||
__P((usbd_interface_handle dev, u_int8_t *count));
|
||||
usbd_status usbd_interface_count
|
||||
__P((usbd_device_handle dev, u_int8_t *count));
|
||||
#if 0
|
||||
u_int8_t usbd_bus_count __P((void));
|
||||
usbd_status usbd_get_bus_handle __P((u_int8_t index, usbd_bus_handle *bus));
|
||||
#endif
|
||||
usbd_status usbd_get_root_hub
|
||||
__P((usbd_bus_handle bus, usbd_device_handle *dev));
|
||||
usbd_status usbd_port_count __P((usbd_device_handle hub, u_int8_t *nports));
|
||||
usbd_status usbd_hub2device_handle
|
||||
__P((usbd_device_handle hub, u_int8_t port, usbd_device_handle *dev));
|
||||
usbd_status usbd_request2pipe_handle
|
||||
__P((usbd_request_handle reqh, usbd_pipe_handle *pipe));
|
||||
usbd_status usbd_pipe2interface_handle
|
||||
__P((usbd_pipe_handle pipe, usbd_interface_handle *iface));
|
||||
usbd_status usbd_interface2device_handle
|
||||
__P((usbd_interface_handle iface, usbd_device_handle *dev));
|
||||
usbd_status usbd_device2bus_handle
|
||||
__P((usbd_device_handle dev, usbd_bus_handle *bus));
|
||||
usbd_status usbd_device2interface_handle
|
||||
__P((usbd_device_handle dev, u_int8_t ifaceno,
|
||||
usbd_interface_handle *iface));
|
||||
usbd_status usbd_set_interface_private_handle
|
||||
__P((usbd_interface_handle iface, usbd_private_handle priv));
|
||||
usbd_status usbd_get_interface_private_handle
|
||||
__P((usbd_interface_handle iface, usbd_private_handle *priv));
|
||||
usbd_status usbd_reference_pipe __P((usbd_pipe_handle pipe));
|
||||
usbd_status usbd_dereference_pipe __P((usbd_pipe_handle pipe));
|
||||
usbd_lock_token usbd_lock __P((void));
|
||||
void usbd_unlock __P((usbd_lock_token tok));
|
||||
__P((usbd_device_handle dev, u_int8_t ifaceno, usbd_interface_handle *iface));
|
||||
|
||||
/* Non-standard */
|
||||
usbd_status usbd_sync_transfer __P((usbd_request_handle req));
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: usbdivar.h,v 1.20 1999/05/16 13:51:05 augustss Exp $ */
|
||||
/* $NetBSD: usbdivar.h,v 1.21 1999/06/14 17:09:58 augustss Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
@ -42,7 +42,6 @@ struct usbd_pipe;
|
||||
|
||||
struct usbd_endpoint {
|
||||
usb_endpoint_descriptor_t *edesc;
|
||||
usbd_endpoint_state state;
|
||||
int refcnt;
|
||||
int toggle; /* XXX */
|
||||
};
|
||||
@ -96,7 +95,6 @@ struct usbd_bus {
|
||||
|
||||
struct usbd_device {
|
||||
struct usbd_bus *bus;
|
||||
usbd_device_state state;
|
||||
struct usbd_pipe *default_pipe;
|
||||
u_int8_t address;
|
||||
u_int8_t depth;
|
||||
@ -119,7 +117,6 @@ struct usbd_device {
|
||||
|
||||
struct usbd_interface {
|
||||
struct usbd_device *device;
|
||||
usbd_interface_state state;
|
||||
usb_interface_descriptor_t *idesc;
|
||||
int index;
|
||||
int altindex;
|
||||
@ -132,8 +129,7 @@ struct usbd_pipe {
|
||||
struct usbd_interface *iface;
|
||||
struct usbd_device *device;
|
||||
struct usbd_endpoint *endpoint;
|
||||
usbd_pipe_state state;
|
||||
int32_t refcnt;
|
||||
int refcnt;
|
||||
char running;
|
||||
SIMPLEQ_HEAD(, usbd_request) queue;
|
||||
LIST_ENTRY(usbd_pipe) next;
|
||||
|
Loading…
Reference in New Issue
Block a user