Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/usb Change the way the direction is extracted from t...
details: https://anonhg.NetBSD.org/src/rev/32884328bb19
branches: trunk
changeset: 476053:32884328bb19
user: augustss <augustss%NetBSD.org@localhost>
date: Sat Sep 04 22:26:11 1999 +0000
description:
Change the way the direction is extracted from the endpoint descriptor.
No functional changes to the drivers. From Nick Hibma, FreeBSD.
diffstat:
sys/dev/usb/ohci.c | 13 +++++++------
sys/dev/usb/ugen.c | 20 ++++++++++++--------
sys/dev/usb/uhci.c | 13 +++++++------
sys/dev/usb/uhid.c | 6 +++---
sys/dev/usb/ukbd.c | 6 +++---
sys/dev/usb/ulpt.c | 6 +++---
sys/dev/usb/umass.c | 6 +++---
sys/dev/usb/umodem.c | 6 +++---
sys/dev/usb/ums.c | 6 +++---
sys/dev/usb/usb.h | 9 ++++-----
10 files changed, 48 insertions(+), 43 deletions(-)
diffs (truncated from 342 to 300 lines):
diff -r 3a5a9db40721 -r 32884328bb19 sys/dev/usb/ohci.c
--- a/sys/dev/usb/ohci.c Sat Sep 04 22:25:51 1999 +0000
+++ b/sys/dev/usb/ohci.c Sat Sep 04 22:26:11 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ohci.c,v 1.39 1999/08/22 23:41:00 augustss Exp $ */
+/* $NetBSD: ohci.c,v 1.40 1999/09/04 22:26:11 augustss Exp $ */
/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -1276,7 +1276,7 @@
case USB_CONTROL_ENDPOINT:
pipe->methods = &ohci_root_ctrl_methods;
break;
- case UE_IN | OHCI_INTR_ENDPT:
+ case UE_DIR_IN | OHCI_INTR_ENDPT:
pipe->methods = &ohci_root_intr_methods;
break;
default:
@@ -1497,7 +1497,7 @@
usb_endpoint_descriptor_t ohci_endpd = {
USB_ENDPOINT_DESCRIPTOR_SIZE,
UDESC_ENDPOINT,
- UE_IN | OHCI_INTR_ENDPT,
+ UE_DIR_IN | OHCI_INTR_ENDPT,
UE_INTERRUPT,
{8, 0}, /* max packet */
255
@@ -2026,7 +2026,7 @@
ohci_soft_ed_t *sed;
usb_dma_t *dmap;
usbd_status r;
- int s, len, isread;
+ int s, len, isread, endpt;
#ifdef DIAGNOSTIC
if (reqh->isreq) {
@@ -2038,12 +2038,13 @@
len = reqh->length;
dmap = &opipe->u.bulk.datadma;
- isread = reqh->pipe->endpoint->edesc->bEndpointAddress & UE_IN;
+ endpt = reqh->pipe->endpoint->edesc->bEndpointAddress;
+ isread = UE_GET_DIR(endpt) == UE_DIR_IN;
sed = opipe->sed;
DPRINTFN(4,("ohci_device_bulk_start: reqh=%p len=%d isread=%d "
"flags=%d endpt=%d\n", reqh, len, isread, reqh->flags,
- reqh->pipe->endpoint->edesc->bEndpointAddress));
+ endpt));
opipe->u.bulk.isread = isread;
opipe->u.bulk.length = len;
diff -r 3a5a9db40721 -r 32884328bb19 sys/dev/usb/ugen.c
--- a/sys/dev/usb/ugen.c Sat Sep 04 22:25:51 1999 +0000
+++ b/sys/dev/usb/ugen.c Sat Sep 04 22:26:11 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ugen.c,v 1.20 1999/08/28 21:42:35 augustss Exp $ */
+/* $NetBSD: ugen.c,v 1.21 1999/09/04 22:26:11 augustss Exp $ */
/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -98,8 +98,8 @@
char sc_is_open[USB_MAX_ENDPOINTS];
struct ugen_endpoint sc_endpoints[USB_MAX_ENDPOINTS][2];
-#define OUT 0 /* index order is important, from UE_OUT */
-#define IN 1 /* from UE_IN */
+#define OUT 0
+#define IN 1
int sc_refcnt;
u_char sc_dying;
@@ -204,6 +204,7 @@
u_int8_t niface, nendpt;
int ifaceno, endptno, endpt;
usbd_status r;
+ int dir;
DPRINTFN(1,("ugen_set_config: %s to configno %d, sc=%p\n",
USBDEVNAME(sc->sc_dev), configno, sc));
@@ -229,12 +230,12 @@
for (endptno = 0; endptno < nendpt; endptno++) {
ed = usbd_interface2endpoint_descriptor(iface,endptno);
endpt = ed->bEndpointAddress;
- sce = &sc->sc_endpoints[UE_GET_ADDR(endpt)]
- [UE_GET_IN(endpt)];
+ dir = UE_GET_DIR(endpt) == UE_DIR_IN ? IN : OUT;
+ sce = &sc->sc_endpoints[UE_GET_ADDR(endpt)][dir];
DPRINTFN(1,("ugen_set_config: endptno %d, endpt=0x%02x"
"(%d,%d), sce=%p\n",
endptno, endpt, UE_GET_ADDR(endpt),
- UE_GET_IN(endpt), sce));
+ UE_GET_DIR(endpt), sce));
sce->sc = sc;
sce->edesc = ed;
sce->iface = iface;
@@ -696,6 +697,7 @@
usbd_status r;
struct ugen_endpoint *sce;
u_int8_t niface, nendpt, endptno, endpt;
+ int dir;
DPRINTFN(15, ("ugen_set_interface %d %d\n", ifaceidx, altno));
@@ -714,7 +716,8 @@
for (endptno = 0; endptno < nendpt; endptno++) {
ed = usbd_interface2endpoint_descriptor(iface,endptno);
endpt = ed->bEndpointAddress;
- sce = &sc->sc_endpoints[UE_GET_ADDR(endpt)][UE_GET_IN(endpt)];
+ dir = UE_GET_DIR(endpt) == UE_DIR_IN ? IN : OUT;
+ sce = &sc->sc_endpoints[UE_GET_ADDR(endpt)][dir];
sce->sc = 0;
sce->edesc = 0;
sce->iface = 0;
@@ -731,7 +734,8 @@
for (endptno = 0; endptno < nendpt; endptno++) {
ed = usbd_interface2endpoint_descriptor(iface,endptno);
endpt = ed->bEndpointAddress;
- sce = &sc->sc_endpoints[UE_GET_ADDR(endpt)][UE_GET_IN(endpt)];
+ dir = UE_GET_DIR(endpt) == UE_DIR_IN ? IN : OUT;
+ sce = &sc->sc_endpoints[UE_GET_ADDR(endpt)][dir];
sce->sc = sc;
sce->edesc = ed;
sce->iface = iface;
diff -r 3a5a9db40721 -r 32884328bb19 sys/dev/usb/uhci.c
--- a/sys/dev/usb/uhci.c Sat Sep 04 22:25:51 1999 +0000
+++ b/sys/dev/usb/uhci.c Sat Sep 04 22:26:11 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uhci.c,v 1.44 1999/09/02 18:11:41 augustss Exp $ */
+/* $NetBSD: uhci.c,v 1.45 1999/09/04 22:26:12 augustss Exp $ */
/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -1288,7 +1288,7 @@
uhci_soft_qh_t *sqh;
usb_dma_t *dmap;
usbd_status r;
- int len, isread;
+ int len, isread, endpt;
int s;
DPRINTFN(3, ("uhci_device_bulk_transfer: reqh=%p buf=%p len=%d "
@@ -1300,7 +1300,8 @@
len = reqh->length;
dmap = &upipe->u.bulk.datadma;
- isread = reqh->pipe->endpoint->edesc->bEndpointAddress & UE_IN;
+ endpt = reqh->pipe->endpoint->edesc->bEndpointAddress;
+ isread = UE_GET_DIR(endpt) == UE_DIR_IN;
sqh = upipe->u.bulk.sqh;
upipe->u.bulk.isread = isread;
@@ -1865,7 +1866,7 @@
uhci_softc_t *sc = (uhci_softc_t *)dev->bus;
int addr = upipe->pipe.device->address;
int endpt = upipe->pipe.endpoint->edesc->bEndpointAddress;
- int rd = upipe->pipe.endpoint->edesc->bEndpointAddress & UE_IN;
+ int rd = UE_GET_DIR(endpt) == UE_DIR_IN;
struct iso *iso;
int i;
usbd_status r;
@@ -2188,7 +2189,7 @@
case USB_CONTROL_ENDPOINT:
pipe->methods = &uhci_root_ctrl_methods;
break;
- case UE_IN | UHCI_INTR_ENDPT:
+ case UE_DIR_IN | UHCI_INTR_ENDPT:
pipe->methods = &uhci_root_intr_methods;
break;
default:
@@ -2291,7 +2292,7 @@
usb_endpoint_descriptor_t uhci_endpd = {
USB_ENDPOINT_DESCRIPTOR_SIZE,
UDESC_ENDPOINT,
- UE_IN | UHCI_INTR_ENDPT,
+ UE_DIR_IN | UHCI_INTR_ENDPT,
UE_INTERRUPT,
{8},
255
diff -r 3a5a9db40721 -r 32884328bb19 sys/dev/usb/uhid.c
--- a/sys/dev/usb/uhid.c Sat Sep 04 22:25:51 1999 +0000
+++ b/sys/dev/usb/uhid.c Sat Sep 04 22:26:11 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uhid.c,v 1.22 1999/08/28 21:42:35 augustss Exp $ */
+/* $NetBSD: uhid.c,v 1.23 1999/09/04 22:26:12 augustss Exp $ */
/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -202,11 +202,11 @@
" bInterval=%d\n",
ed->bLength, ed->bDescriptorType,
ed->bEndpointAddress & UE_ADDR,
- ed->bEndpointAddress & UE_IN ? "in" : "out",
+ UE_GET_DIR(ed->bEndpointAddress)==UE_DIR_IN? "in" : "out",
ed->bmAttributes & UE_XFERTYPE,
UGETW(ed->wMaxPacketSize), ed->bInterval));
- if ((ed->bEndpointAddress & UE_IN) != UE_IN ||
+ if (UE_GET_DIR(ed->bEndpointAddress) != UE_DIR_IN ||
(ed->bmAttributes & UE_XFERTYPE) != UE_INTERRUPT) {
printf("%s: unexpected endpoint\n", USBDEVNAME(sc->sc_dev));
sc->sc_dying = 1;
diff -r 3a5a9db40721 -r 32884328bb19 sys/dev/usb/ukbd.c
--- a/sys/dev/usb/ukbd.c Sat Sep 04 22:25:51 1999 +0000
+++ b/sys/dev/usb/ukbd.c Sat Sep 04 22:26:11 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ukbd.c,v 1.41 1999/08/28 21:42:35 augustss Exp $ */
+/* $NetBSD: ukbd.c,v 1.42 1999/09/04 22:26:12 augustss Exp $ */
/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -289,11 +289,11 @@
" bInterval=%d\n",
ed->bLength, ed->bDescriptorType,
ed->bEndpointAddress & UE_ADDR,
- ed->bEndpointAddress & UE_IN ? "in" : "out",
+ UE_GET_DIR(ed->bEndpointAddress)==UE_DIR_IN? "in" : "out",
ed->bmAttributes & UE_XFERTYPE,
UGETW(ed->wMaxPacketSize), ed->bInterval));
- if ((ed->bEndpointAddress & UE_IN) != UE_IN ||
+ if (UE_GET_DIR(ed->bEndpointAddress) != UE_DIR_IN ||
(ed->bmAttributes & UE_XFERTYPE) != UE_INTERRUPT) {
printf("%s: unexpected endpoint\n",
USBDEVNAME(sc->sc_dev));
diff -r 3a5a9db40721 -r 32884328bb19 sys/dev/usb/ulpt.c
--- a/sys/dev/usb/ulpt.c Sat Sep 04 22:25:51 1999 +0000
+++ b/sys/dev/usb/ulpt.c Sat Sep 04 22:26:11 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ulpt.c,v 1.18 1999/08/28 21:42:35 augustss Exp $ */
+/* $NetBSD: ulpt.c,v 1.19 1999/09/04 22:26:12 augustss Exp $ */
/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -168,13 +168,13 @@
ed = usbd_interface2endpoint_descriptor(iface, 0);
if (!ed)
goto nobulk;
- if ((ed->bEndpointAddress & UE_IN) != UE_OUT ||
+ if (UE_GET_DIR(ed->bEndpointAddress) != UE_DIR_OUT ||
(ed->bmAttributes & UE_XFERTYPE) != UE_BULK) {
/* In case we are using a bidir protocol... */
ed = usbd_interface2endpoint_descriptor(iface, 1);
if (!ed)
goto nobulk;
- if ((ed->bEndpointAddress & UE_IN) != UE_OUT ||
+ if (UE_GET_DIR(ed->bEndpointAddress) != UE_DIR_OUT ||
(ed->bmAttributes & UE_XFERTYPE) != UE_BULK)
goto nobulk;
}
diff -r 3a5a9db40721 -r 32884328bb19 sys/dev/usb/umass.c
--- a/sys/dev/usb/umass.c Sat Sep 04 22:25:51 1999 +0000
+++ b/sys/dev/usb/umass.c Sat Sep 04 22:26:11 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: umass.c,v 1.10 1999/08/30 01:05:08 thorpej Exp $ */
+/* $NetBSD: umass.c,v 1.11 1999/09/04 22:26:12 augustss Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -275,10 +275,10 @@
USBDEVNAME(sc->sc_dev));
USB_ATTACH_ERROR_RETURN;
}
- if (UE_GET_DIR(ed->bEndpointAddress) == UE_IN
+ if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN
&& (ed->bmAttributes & UE_XFERTYPE) == UE_BULK) {
sc->sc_bulkin = ed->bEndpointAddress;
- } else if (UE_GET_DIR(ed->bEndpointAddress) == UE_OUT
+ } else if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_OUT
&& (ed->bmAttributes & UE_XFERTYPE) == UE_BULK) {
sc->sc_bulkout = ed->bEndpointAddress;
}
diff -r 3a5a9db40721 -r 32884328bb19 sys/dev/usb/umodem.c
--- a/sys/dev/usb/umodem.c Sat Sep 04 22:25:51 1999 +0000
+++ b/sys/dev/usb/umodem.c Sat Sep 04 22:26:11 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: umodem.c,v 1.11 1999/08/28 21:42:35 augustss Exp $ */
+/* $NetBSD: umodem.c,v 1.12 1999/09/04 22:26:12 augustss Exp $ */
/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -247,10 +247,10 @@
USBDEVNAME(sc->sc_dev), i);
goto bad;
}
- if (UE_GET_IN(ed->bEndpointAddress) &&
+ if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN &&
(ed->bmAttributes & UE_XFERTYPE) == UE_BULK) {
sc->sc_bulkin_no = ed->bEndpointAddress;
- } else if (!UE_GET_IN(ed->bEndpointAddress) &&
+ } else if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_OUT &&
(ed->bmAttributes & UE_XFERTYPE) == UE_BULK) {
sc->sc_bulkout_no = ed->bEndpointAddress;
}
diff -r 3a5a9db40721 -r 32884328bb19 sys/dev/usb/ums.c
--- a/sys/dev/usb/ums.c Sat Sep 04 22:25:51 1999 +0000
+++ b/sys/dev/usb/ums.c Sat Sep 04 22:26:11 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ums.c,v 1.29 1999/08/28 21:42:35 augustss Exp $ */
+/* $NetBSD: ums.c,v 1.30 1999/09/04 22:26:12 augustss Exp $ */
Home |
Main Index |
Thread Index |
Old Index