PERFORCE change 120020 for review
Hans Petter Selasky
hselasky at FreeBSD.org
Fri May 18 13:24:01 PDT 2007
http://perforce.freebsd.org/chv.cgi?CH=120020
Change 120020 by hselasky at hselasky_mini_itx on 2007/05/18 20:23:09
Style changes only: Convert spaces into tabs and tab after "#define".
Affected files ...
.. //depot/projects/usb/src/sys/dev/usb/usb_compat_linux.c#3 edit
.. //depot/projects/usb/src/sys/dev/usb/usb_compat_linux.h#3 edit
Differences ...
==== //depot/projects/usb/src/sys/dev/usb/usb_compat_linux.c#3 (text+ko) ====
@@ -79,21 +79,21 @@
static LIST_HEAD(,usb_linux_softc) usb_linux_attached_list;
static device_method_t usb_linux_methods[] = {
- /* Device interface */
- DEVMETHOD(device_probe, usb_linux_probe),
- DEVMETHOD(device_attach, usb_linux_attach),
+ /* Device interface */
+ DEVMETHOD(device_probe, usb_linux_probe),
+ DEVMETHOD(device_attach, usb_linux_attach),
DEVMETHOD(device_detach, usb_linux_detach),
DEVMETHOD(device_suspend, usb_linux_suspend),
DEVMETHOD(device_resume, usb_linux_resume),
- DEVMETHOD(device_shutdown, usb_linux_shutdown),
+ DEVMETHOD(device_shutdown, usb_linux_shutdown),
- { 0, 0 }
+ { 0, 0 }
};
static driver_t usb_linux_driver = {
- .name = "usb_linux",
- .methods = usb_linux_methods,
- .size = sizeof(struct usb_linux_softc),
+ .name = "usb_linux",
+ .methods = usb_linux_methods,
+ .size = sizeof(struct usb_linux_softc),
};
static devclass_t usb_linux_devclass;
@@ -255,7 +255,7 @@
if (p_dev == NULL) {
p_dev = usb_linux_create_usb_device(uaa->device, dev);
if (p_dev == NULL) {
- return ENOMEM;
+ return ENOMEM;
}
uaa->device->linux_dev = p_dev;
}
@@ -272,7 +272,7 @@
if (udrv->probe) {
if ((udrv->probe)(sc->sc_ui, id)) {
- return ENXIO;
+ return ENXIO;
}
}
@@ -419,11 +419,11 @@
urb->actual_length = 0;
for (x = 0; x < urb->number_of_packets; x++) {
- urb->iso_frame_desc[x].actual_length = 0;
+ urb->iso_frame_desc[x].actual_length = 0;
}
if (urb->complete) {
- (urb->complete)(urb, NULL);
+ (urb->complete)(urb, NULL);
}
} else {
@@ -431,14 +431,14 @@
if (uhe->bsd_xfer[0] &&
(uhe->bsd_xfer[0]->priv_fifo == (void *)urb))
{
- usbd_transfer_stop(uhe->bsd_xfer[0]);
+ usbd_transfer_stop(uhe->bsd_xfer[0]);
usbd_transfer_start(uhe->bsd_xfer[0]);
}
if (uhe->bsd_xfer[1] &&
(uhe->bsd_xfer[1]->priv_fifo == (void *)urb))
{
- usbd_transfer_stop(uhe->bsd_xfer[1]);
+ usbd_transfer_stop(uhe->bsd_xfer[1]);
usbd_transfer_start(uhe->bsd_xfer[1]);
}
}
@@ -450,13 +450,13 @@
{
struct usbd_config cfg[1];
struct usbd_pipe *pipe;
- uint8_t type;
- uint8_t addr;
+ uint8_t type;
+ uint8_t addr;
if (uhe == NULL) return -EINVAL;
- type = uhe->desc.bmAttributes & UE_XFERTYPE;
- addr = uhe->desc.bEndpointAddress;
+ type = uhe->desc.bmAttributes & UE_XFERTYPE;
+ addr = uhe->desc.bEndpointAddress;
bzero(cfg, sizeof(cfg));
@@ -542,19 +542,19 @@
uhe_read = NULL;
} else {
if (type == UE_ISOCHRONOUS) {
- return -EINVAL;
+ return -EINVAL;
}
uhe_write = usb_find_host_endpoint(dev, type, addr | UE_DIR_OUT);
if (uhe_write == NULL) {
- return -EINVAL;
+ return -EINVAL;
}
if (requesttype & UT_READ) {
- uhe_read = usb_find_host_endpoint(dev, type, addr | UE_DIR_IN);
+ uhe_read = usb_find_host_endpoint(dev, type, addr | UE_DIR_IN);
if (uhe_read == NULL) {
return -EINVAL;
}
} else {
- uhe_read = NULL;
+ uhe_read = NULL;
}
}
@@ -571,11 +571,11 @@
req = (void *)(urb->setup_packet);
- req->bmRequestType = requesttype;
- req->bRequest = request;
- USETW(req->wValue, value);
- USETW(req->wIndex, index);
- USETW(req->wLength, size);
+ req->bmRequestType = requesttype;
+ req->bRequest = request;
+ USETW(req->wValue, value);
+ USETW(req->wIndex, index);
+ USETW(req->wLength, size);
if (size && (req->bmRequestType & UT_WRITE)) {
/* move the data to a real buffer */
@@ -592,17 +592,17 @@
err = usb_start_wait_urb(urb, 1000, &actlen);
if (err) {
- goto done;
+ goto done;
}
if (actlen < sizeof(*req)) {
- err = -EPIPE;
+ err = -EPIPE;
actlen = 0;
goto done;
}
if (size) {
- if (req->bmRequestType & UT_READ) {
+ if (req->bmRequestType & UT_READ) {
urb->pipe = uhe_read;
}
urb->transfer_buffer = req->bData;
@@ -618,11 +618,11 @@
done:
if (req->bmRequestType & UT_READ) {
if (actlen < size) {
- /* we don't like returning random data */
- bzero(((uint8_t *)data) + actlen, size - actlen);
+ /* we don't like returning random data */
+ bzero(((uint8_t *)data) + actlen, size - actlen);
}
if (actlen) {
- bcopy(req->bData, data, actlen);
+ bcopy(req->bData, data, actlen);
}
}
@@ -649,75 +649,75 @@
int32_t
usb_setup_endpoint(struct usb_device *dev, struct usb_host_endpoint *uhe, uint32_t bufsize)
{
- struct usbd_config cfg[2];
- uint16_t mfs = usbd_get_max_frame_size((usb_endpoint_descriptor_t *)&(uhe->desc));
- uint8_t type = uhe->desc.bmAttributes & UE_XFERTYPE;
- uint8_t addr = uhe->desc.bEndpointAddress;
+ struct usbd_config cfg[2];
+ uint16_t mfs = usbd_get_max_frame_size((usb_endpoint_descriptor_t *)&(uhe->desc));
+ uint8_t type = uhe->desc.bmAttributes & UE_XFERTYPE;
+ uint8_t addr = uhe->desc.bEndpointAddress;
if (uhe->fbsd_buf_size == bufsize) {
/* optimize */
return 0;
}
- usbd_transfer_unsetup(uhe->bsd_xfer, 2);
+ usbd_transfer_unsetup(uhe->bsd_xfer, 2);
uhe->fbsd_buf_size = bufsize;
- if (bufsize == 0) {
- return 0;
- }
+ if (bufsize == 0) {
+ return 0;
+ }
- bzero(cfg, sizeof(cfg));
+ bzero(cfg, sizeof(cfg));
- if (type == UE_ISOCHRONOUS) {
+ if (type == UE_ISOCHRONOUS) {
- /* Isochronous is special */
+ /* Isochronous is special */
- cfg[0].type = type;
- cfg[0].endpoint = addr & UE_ADDR;
- cfg[0].direction = addr & (UE_DIR_OUT|UE_DIR_IN);
- cfg[0].callback = &usb_linux_isoc_callback;
- cfg[0].bufsize = 0; /* use wMaxPacketSize */
+ cfg[0].type = type;
+ cfg[0].endpoint = addr & UE_ADDR;
+ cfg[0].direction = addr & (UE_DIR_OUT|UE_DIR_IN);
+ cfg[0].callback = &usb_linux_isoc_callback;
+ cfg[0].bufsize = 0; /* use wMaxPacketSize */
cfg[0].frames = usb_max_isoc_frames(dev);
- bcopy(cfg + 0, cfg + 1, sizeof(*cfg));
+ bcopy(cfg + 0, cfg + 1, sizeof(*cfg));
- if (usbd_transfer_setup(dev->bsd_udev, uhe->bsd_iface_index,
- uhe->bsd_xfer, cfg, 2, uhe,
- &usb_global_lock))
- {
- return -EINVAL;
- }
- } else {
- if (bufsize > (1 << 22)) {
- /* limit buffer size */
- bufsize = (1 << 22);
- }
+ if (usbd_transfer_setup(dev->bsd_udev, uhe->bsd_iface_index,
+ uhe->bsd_xfer, cfg, 2, uhe,
+ &usb_global_lock))
+ {
+ return -EINVAL;
+ }
+ } else {
+ if (bufsize > (1 << 22)) {
+ /* limit buffer size */
+ bufsize = (1 << 22);
+ }
/* we need enough room for the control header */
if (bufsize < sizeof(usb_device_request_t)) {
- bufsize = sizeof(usb_device_request_t);
+ bufsize = sizeof(usb_device_request_t);
}
- if (bufsize < mfs) {
- /* we need to be able to hold at least one frame! */
- bufsize = mfs;
- }
+ if (bufsize < mfs) {
+ /* we need to be able to hold at least one frame! */
+ bufsize = mfs;
+ }
- cfg[0].type = type;
- cfg[0].endpoint = addr & UE_ADDR;
- cfg[0].direction = addr & (UE_DIR_OUT|UE_DIR_IN);
- cfg[0].callback = &usb_linux_non_isoc_callback;
- cfg[0].bufsize = bufsize;
+ cfg[0].type = type;
+ cfg[0].endpoint = addr & UE_ADDR;
+ cfg[0].direction = addr & (UE_DIR_OUT|UE_DIR_IN);
+ cfg[0].callback = &usb_linux_non_isoc_callback;
+ cfg[0].bufsize = bufsize;
- if (usbd_transfer_setup(dev->bsd_udev, uhe->bsd_iface_index,
- uhe->bsd_xfer, cfg, 1, uhe,
- &usb_global_lock))
- {
- return -EINVAL;
- }
- }
- return 0;
+ if (usbd_transfer_setup(dev->bsd_udev, uhe->bsd_iface_index,
+ uhe->bsd_xfer, cfg, 1, uhe,
+ &usb_global_lock))
+ {
+ return -EINVAL;
+ }
+ }
+ return 0;
}
static struct usb_device *
@@ -750,12 +750,12 @@
while ((desc = usbd_desc_foreach(cd, desc))) {
- switch (desc->bDescriptorType) {
+ switch (desc->bDescriptorType) {
case UDESC_DEVICE:
dd = (void *)desc;
if (dd->bLength < sizeof(*dd)) break;
if (p_ud) {
- bcopy(dd, &(p_ud->descriptor), sizeof(p_ud->descriptor));
+ bcopy(dd, &(p_ud->descriptor), sizeof(p_ud->descriptor));
}
break;
@@ -764,12 +764,12 @@
if ((ed->bLength < sizeof(*ed)) ||
(iface_index == 0)) break;
if (p_uhe) {
- bcopy(ed, &(p_uhe->desc), sizeof(p_uhe->desc));
+ bcopy(ed, &(p_uhe->desc), sizeof(p_uhe->desc));
p_uhe->bsd_iface_index = iface_index-1;
p_uhe++;
}
if (p_uhi) {
- (p_uhi-1)->desc.bNumEndpoints++;
+ (p_uhi-1)->desc.bNumEndpoints++;
}
nedesc ++;
break;
@@ -778,7 +778,7 @@
id = (void *)desc;
if (id->bLength < sizeof(*id)) break;
if (p_uhi) {
- bcopy(id, &(p_uhi->desc), sizeof(p_uhi->desc));
+ bcopy(id, &(p_uhi->desc), sizeof(p_uhi->desc));
p_uhi->desc.bNumEndpoints = 0;
p_uhi->endpoint = p_uhe;
p_uhi->string = "";
@@ -787,7 +787,7 @@
iface_no = id->bInterfaceNumber;
niface_total ++;
if (iface_no_curr != iface_no) {
- if (p_ui) {
+ if (p_ui) {
p_ui->altsetting = p_uhi-1;
p_ui->cur_altsetting = p_uhi-1;
p_ui->num_altsetting = 1;
@@ -795,10 +795,10 @@
p_ui->linux_udev = p_ud;
p_ui++;
}
- iface_no_curr = iface_no;
+ iface_no_curr = iface_no;
iface_index ++;
} else {
- if (p_ui) {
+ if (p_ui) {
(p_ui-1)->num_altsetting ++;
}
}
@@ -864,12 +864,12 @@
urb = malloc(size, M_USBDEV, M_WAITOK | M_ZERO);
if (urb) {
if (iso_packets == 0xFFFF) {
- urb->setup_packet = (void *)(urb + 1);
+ urb->setup_packet = (void *)(urb + 1);
urb->transfer_buffer = (void *)(urb->setup_packet +
sizeof(usb_device_request_t));
urb->transfer_buffer_length = mem_flags;
} else {
- urb->number_of_packets = iso_packets;
+ urb->number_of_packets = iso_packets;
}
}
return urb;
@@ -903,7 +903,7 @@
ui++) {
uhi = ui->cur_altsetting;
if (uhi) {
- uhe_end = uhi->endpoint + uhi->desc.bNumEndpoints;
+ uhe_end = uhi->endpoint + uhi->desc.bNumEndpoints;
for (uhe = uhi->endpoint;
uhe != uhe_end;
uhe++) {
@@ -913,7 +913,7 @@
if (((ea & mask) == ep) &&
((at & UE_XFERTYPE) == type)) {
- return uhe;
+ return uhe;
}
}
}
@@ -982,11 +982,11 @@
repeat:
mtx_lock(&usb_global_lock);
- LIST_FOREACH(sc, &usb_linux_attached_list, sc_attached_list)
+ LIST_FOREACH(sc, &usb_linux_attached_list, sc_attached_list)
{
if (sc->sc_udrv == drv)
{
- mtx_unlock(&usb_global_lock);
+ mtx_unlock(&usb_global_lock);
device_detach(sc->sc_fbsd_dev);
goto repeat;
}
@@ -1077,8 +1077,8 @@
uhe = uhi->endpoint;
uhe_end = uhi->endpoint + uhi->desc.bNumEndpoints;
while (uhe != uhe_end) {
- err = usb_setup_endpoint(dev, uhe, 0);
- uhe++;
+ err = usb_setup_endpoint(dev, uhe, 0);
+ uhe++;
}
uhi++;
}
@@ -1118,7 +1118,7 @@
struct usb_host_endpoint *uhe = xfer->priv_sc;
struct usb_iso_packet_descriptor *uipd;
- USBD_CHECK_STATUS(xfer);
+ USBD_CHECK_STATUS(xfer);
tr_error:
if (xfer->error == USBD_CANCELLED) {
@@ -1151,17 +1151,17 @@
offset = 0;
for (x = 0; x < urb->number_of_packets; x++) {
- uipd = urb->iso_frame_desc + x;
+ uipd = urb->iso_frame_desc + x;
uipd->actual_length = xfer->frlengths[x];
uipd->status = 0;
- usbd_copy_out(&(xfer->buf_data), offset,
+ usbd_copy_out(&(xfer->buf_data), offset,
((uint8_t *)(urb->transfer_buffer)) + uipd->offset,
uipd->actual_length);
offset += max_frame;
}
} else {
for (x = 0; x < urb->number_of_packets; x++) {
- uipd = urb->iso_frame_desc + x;
+ uipd = urb->iso_frame_desc + x;
uipd->actual_length = xfer->frlengths[x];
uipd->status = 0;
}
@@ -1173,9 +1173,9 @@
if (xfer->actlen < xfer->length) {
/* short transfer */
if (urb->transfer_flags & URB_SHORT_NOT_OK) {
- urb->status = -EPIPE; /* XXX should be EREMOTEIO */
+ urb->status = -EPIPE; /* XXX should be EREMOTEIO */
} else {
- urb->status = 0;
+ urb->status = 0;
}
} else {
/* success */
@@ -1192,8 +1192,8 @@
/* get next transfer */
urb = TAILQ_FIRST(&(uhe->bsd_urb_list));
if (urb == NULL) {
- /* nothing to do */
- return;
+ /* nothing to do */
+ return;
}
TAILQ_REMOVE(&(uhe->bsd_urb_list), urb, bsd_urb_list);
@@ -1201,8 +1201,8 @@
x = usb_max_isoc_frames(urb->dev);
if (urb->number_of_packets > x) {
- /* XXX simply truncate the transfer */
- urb->number_of_packets = x;
+ /* XXX simply truncate the transfer */
+ urb->number_of_packets = x;
}
} else {
@@ -1218,7 +1218,7 @@
offset = 0;
for (x = 0; x < urb->number_of_packets; x++) {
- uipd = urb->iso_frame_desc + x;
+ uipd = urb->iso_frame_desc + x;
xfer->frlengths[x] = uipd->length;
usbd_copy_in(&(xfer->buf_data), offset,
((uint8_t *)(urb->transfer_buffer)) + uipd->offset,
@@ -1230,7 +1230,7 @@
offset = urb->number_of_packets * max_frame;
for (x = 0; x < urb->number_of_packets; x++) {
- uipd = urb->iso_frame_desc + x;
+ uipd = urb->iso_frame_desc + x;
xfer->frlengths[x] = max_frame;
}
}
@@ -1252,7 +1252,7 @@
uint32_t max_bulk = (uhe->fbsd_buf_size -
(uhe->fbsd_buf_size % xfer->max_packet_size));
- USBD_CHECK_STATUS(xfer);
+ USBD_CHECK_STATUS(xfer);
tr_error:
if (xfer->error == USBD_CANCELLED) {
@@ -1290,15 +1290,15 @@
/* short transfer */
if (urb->transfer_flags & URB_SHORT_NOT_OK) {
- urb->status = -EPIPE;
+ urb->status = -EPIPE;
} else {
- urb->status = 0;
+ urb->status = 0;
}
} else {
/* check remainder */
if (urb->bsd_length_rem) {
- goto setup_bulk;
+ goto setup_bulk;
}
/* success */
@@ -1357,7 +1357,7 @@
if (max_bulk == urb->bsd_length_rem) {
if (urb->transfer_flags & URB_ZERO_PACKET) {
- xfer->flags |= USBD_FORCE_SHORT_XFER;
+ xfer->flags |= USBD_FORCE_SHORT_XFER;
}
}
==== //depot/projects/usb/src/sys/dev/usb/usb_compat_linux.h#3 (text+ko) ====
@@ -27,7 +27,7 @@
*/
#ifndef _USB_COMPAT_LINUX_H
-#define _USB_COMPAT_LINUX_H
+#define _USB_COMPAT_LINUX_H
#include <sys/param.h>
#include <sys/systm.h>
@@ -49,8 +49,8 @@
typedef void (usb_complete_t)(struct urb *, struct pt_regs *);
typedef uint32_t gfp_t;
-#define USB_MAX_FULL_SPEED_ISOC_FRAMES (60 * 1)
-#define USB_MAX_HIGH_SPEED_ISOC_FRAMES (60 * 8)
+#define USB_MAX_FULL_SPEED_ISOC_FRAMES (60 * 1)
+#define USB_MAX_HIGH_SPEED_ISOC_FRAMES (60 * 8)
/*
* Linux compatible USB device drivers put their device information
@@ -61,16 +61,16 @@
struct usb_device_id {
/* which fields to match against */
uint16_t match_flags;
-#define USB_DEVICE_ID_MATCH_VENDOR 0x0001
-#define USB_DEVICE_ID_MATCH_PRODUCT 0x0002
-#define USB_DEVICE_ID_MATCH_DEV_LO 0x0004
-#define USB_DEVICE_ID_MATCH_DEV_HI 0x0008
-#define USB_DEVICE_ID_MATCH_DEV_CLASS 0x0010
-#define USB_DEVICE_ID_MATCH_DEV_SUBCLASS 0x0020
-#define USB_DEVICE_ID_MATCH_DEV_PROTOCOL 0x0040
-#define USB_DEVICE_ID_MATCH_INT_CLASS 0x0080
-#define USB_DEVICE_ID_MATCH_INT_SUBCLASS 0x0100
-#define USB_DEVICE_ID_MATCH_INT_PROTOCOL 0x0200
+#define USB_DEVICE_ID_MATCH_VENDOR 0x0001
+#define USB_DEVICE_ID_MATCH_PRODUCT 0x0002
+#define USB_DEVICE_ID_MATCH_DEV_LO 0x0004
+#define USB_DEVICE_ID_MATCH_DEV_HI 0x0008
+#define USB_DEVICE_ID_MATCH_DEV_CLASS 0x0010
+#define USB_DEVICE_ID_MATCH_DEV_SUBCLASS 0x0020
+#define USB_DEVICE_ID_MATCH_DEV_PROTOCOL 0x0040
+#define USB_DEVICE_ID_MATCH_INT_CLASS 0x0080
+#define USB_DEVICE_ID_MATCH_INT_SUBCLASS 0x0100
+#define USB_DEVICE_ID_MATCH_INT_PROTOCOL 0x0200
/* Used for product specific matches; the BCD range is inclusive */
uint16_t idVendor;
@@ -92,10 +92,10 @@
unsigned long driver_info;
};
-#define USB_DEVICE_ID_MATCH_DEVICE \
+#define USB_DEVICE_ID_MATCH_DEVICE \
(USB_DEVICE_ID_MATCH_VENDOR | USB_DEVICE_ID_MATCH_PRODUCT)
-#define USB_DEVICE(vend,prod) \
+#define USB_DEVICE(vend,prod) \
.match_flags = USB_DEVICE_ID_MATCH_DEVICE, .idVendor = (vend), \
.idProduct = (prod)
@@ -120,7 +120,7 @@
LIST_ENTRY(usb_driver) linux_driver_list;
};
-#define USB_DRIVER_EXPORT(id,p_usb_drv) \
+#define USB_DRIVER_EXPORT(id,p_usb_drv) \
SYSINIT(id,SI_SUB_KLD,SI_ORDER_FIRST,usb_linux_register,p_usb_drv); \
SYSUNINIT(id,SI_SUB_KLD,SI_ORDER_ANY,usb_linux_deregister,p_usb_drv)
@@ -181,21 +181,21 @@
uint8_t bSynchAddress;
} __packed;
-#define USB_DT_ENDPOINT_SIZE 7
-#define USB_DT_ENDPOINT_AUDIO_SIZE 9
+#define USB_DT_ENDPOINT_SIZE 7
+#define USB_DT_ENDPOINT_AUDIO_SIZE 9
/*
* Endpoints
*/
-#define USB_ENDPOINT_NUMBER_MASK 0x0f /* in bEndpointAddress */
-#define USB_ENDPOINT_DIR_MASK 0x80
+#define USB_ENDPOINT_NUMBER_MASK 0x0f /* in bEndpointAddress */
+#define USB_ENDPOINT_DIR_MASK 0x80
-#define USB_ENDPOINT_XFERTYPE_MASK 0x03 /* in bmAttributes */
-#define USB_ENDPOINT_XFER_CONTROL 0
-#define USB_ENDPOINT_XFER_ISOC 1
-#define USB_ENDPOINT_XFER_BULK 2
-#define USB_ENDPOINT_XFER_INT 3
-#define USB_ENDPOINT_MAX_ADJUSTABLE 0x80
+#define USB_ENDPOINT_XFERTYPE_MASK 0x03 /* in bmAttributes */
+#define USB_ENDPOINT_XFER_CONTROL 0
+#define USB_ENDPOINT_XFER_ISOC 1
+#define USB_ENDPOINT_XFER_BULK 2
+#define USB_ENDPOINT_XFER_INT 3
+#define USB_ENDPOINT_MAX_ADJUSTABLE 0x80
/* CONTROL REQUEST SUPPORT */
@@ -204,101 +204,101 @@
* "bEndpointAddress" and "bRequestType":
*/
#define USB_DIR_MASK 0x80
-#define USB_DIR_OUT 0x00 /* write to USB device */
-#define USB_DIR_IN 0x80 /* read from USB device */
+#define USB_DIR_OUT 0x00 /* write to USB device */
+#define USB_DIR_IN 0x80 /* read from USB device */
/*
* Definition of type mask for
* "bRequestType":
*/
-#define USB_TYPE_MASK (0x03 << 5)
-#define USB_TYPE_STANDARD (0x00 << 5)
-#define USB_TYPE_CLASS (0x01 << 5)
-#define USB_TYPE_VENDOR (0x02 << 5)
-#define USB_TYPE_RESERVED (0x03 << 5)
+#define USB_TYPE_MASK (0x03 << 5)
+#define USB_TYPE_STANDARD (0x00 << 5)
+#define USB_TYPE_CLASS (0x01 << 5)
+#define USB_TYPE_VENDOR (0x02 << 5)
+#define USB_TYPE_RESERVED (0x03 << 5)
/*
* Definition of receiver mask for
* "bRequestType":
*/
-#define USB_RECIP_MASK 0x1f
-#define USB_RECIP_DEVICE 0x00
-#define USB_RECIP_INTERFACE 0x01
-#define USB_RECIP_ENDPOINT 0x02
-#define USB_RECIP_OTHER 0x03
+#define USB_RECIP_MASK 0x1f
+#define USB_RECIP_DEVICE 0x00
+#define USB_RECIP_INTERFACE 0x01
+#define USB_RECIP_ENDPOINT 0x02
+#define USB_RECIP_OTHER 0x03
/*
* Definition of standard request values for
* "bRequest":
*/
-#define USB_REQ_GET_STATUS 0x00
-#define USB_REQ_CLEAR_FEATURE 0x01
-#define USB_REQ_SET_FEATURE 0x03
-#define USB_REQ_SET_ADDRESS 0x05
-#define USB_REQ_GET_DESCRIPTOR 0x06
-#define USB_REQ_SET_DESCRIPTOR 0x07
-#define USB_REQ_GET_CONFIGURATION 0x08
-#define USB_REQ_SET_CONFIGURATION 0x09
-#define USB_REQ_GET_INTERFACE 0x0A
-#define USB_REQ_SET_INTERFACE 0x0B
-#define USB_REQ_SYNCH_FRAME 0x0C
+#define USB_REQ_GET_STATUS 0x00
+#define USB_REQ_CLEAR_FEATURE 0x01
+#define USB_REQ_SET_FEATURE 0x03
+#define USB_REQ_SET_ADDRESS 0x05
+#define USB_REQ_GET_DESCRIPTOR 0x06
+#define USB_REQ_SET_DESCRIPTOR 0x07
+#define USB_REQ_GET_CONFIGURATION 0x08
+#define USB_REQ_SET_CONFIGURATION 0x09
+#define USB_REQ_GET_INTERFACE 0x0A
+#define USB_REQ_SET_INTERFACE 0x0B
+#define USB_REQ_SYNCH_FRAME 0x0C
-#define USB_REQ_SET_ENCRYPTION 0x0D /* Wireless USB */
-#define USB_REQ_GET_ENCRYPTION 0x0E
-#define USB_REQ_SET_HANDSHAKE 0x0F
-#define USB_REQ_GET_HANDSHAKE 0x10
-#define USB_REQ_SET_CONNECTION 0x11
-#define USB_REQ_SET_SECURITY_DATA 0x12
-#define USB_REQ_GET_SECURITY_DATA 0x13
-#define USB_REQ_SET_WUSB_DATA 0x14
-#define USB_REQ_LOOPBACK_DATA_WRITE 0x15
-#define USB_REQ_LOOPBACK_DATA_READ 0x16
-#define USB_REQ_SET_INTERFACE_DS 0x17
+#define USB_REQ_SET_ENCRYPTION 0x0D /* Wireless USB */
+#define USB_REQ_GET_ENCRYPTION 0x0E
+#define USB_REQ_SET_HANDSHAKE 0x0F
+#define USB_REQ_GET_HANDSHAKE 0x10
+#define USB_REQ_SET_CONNECTION 0x11
+#define USB_REQ_SET_SECURITY_DATA 0x12
+#define USB_REQ_GET_SECURITY_DATA 0x13
+#define USB_REQ_SET_WUSB_DATA 0x14
+#define USB_REQ_LOOPBACK_DATA_WRITE 0x15
+#define USB_REQ_LOOPBACK_DATA_READ 0x16
+#define USB_REQ_SET_INTERFACE_DS 0x17
/*
* USB feature flags are written using USB_REQ_{CLEAR,SET}_FEATURE, and
* are read as a bit array returned by USB_REQ_GET_STATUS. (So there
* are at most sixteen features of each type.)
*/
-#define USB_DEVICE_SELF_POWERED 0 /* (read only) */
-#define USB_DEVICE_REMOTE_WAKEUP 1 /* dev may initiate wakeup */
-#define USB_DEVICE_TEST_MODE 2 /* (wired high speed only) */
-#define USB_DEVICE_BATTERY 2 /* (wireless) */
-#define USB_DEVICE_B_HNP_ENABLE 3 /* (otg) dev may initiate HNP */
-#define USB_DEVICE_WUSB_DEVICE 3 /* (wireless)*/
-#define USB_DEVICE_A_HNP_SUPPORT 4 /* (otg) RH port supports HNP */
-#define USB_DEVICE_A_ALT_HNP_SUPPORT 5 /* (otg) other RH port does */
-#define USB_DEVICE_DEBUG_MODE 6 /* (special devices only) */
+#define USB_DEVICE_SELF_POWERED 0 /* (read only) */
+#define USB_DEVICE_REMOTE_WAKEUP 1 /* dev may initiate wakeup */
+#define USB_DEVICE_TEST_MODE 2 /* (wired high speed only) */
+#define USB_DEVICE_BATTERY 2 /* (wireless) */
+#define USB_DEVICE_B_HNP_ENABLE 3 /* (otg) dev may initiate HNP */
+#define USB_DEVICE_WUSB_DEVICE 3 /* (wireless)*/
+#define USB_DEVICE_A_HNP_SUPPORT 4 /* (otg) RH port supports HNP */
+#define USB_DEVICE_A_ALT_HNP_SUPPORT 5 /* (otg) other RH port does */
+#define USB_DEVICE_DEBUG_MODE 6 /* (special devices only) */
-#define USB_ENDPOINT_HALT 0 /* IN/OUT will STALL */
+#define USB_ENDPOINT_HALT 0 /* IN/OUT will STALL */
-#define PIPE_ISOCHRONOUS UE_ISOCHRONOUS
-#define PIPE_INTERRUPT UE_INTERRUPT
-#define PIPE_CONTROL UE_CONTROL
-#define PIPE_BULK UE_BULK
+#define PIPE_ISOCHRONOUS UE_ISOCHRONOUS
+#define PIPE_INTERRUPT UE_INTERRUPT
+#define PIPE_CONTROL UE_CONTROL
+#define PIPE_BULK UE_BULK
-#define usb_sndctrlpipe(dev,endpoint) \
+#define usb_sndctrlpipe(dev,endpoint) \
usb_find_host_endpoint(dev, PIPE_CONTROL, (endpoint) | USB_DIR_OUT)
-#define usb_rcvctrlpipe(dev,endpoint) \
+#define usb_rcvctrlpipe(dev,endpoint) \
usb_find_host_endpoint(dev, PIPE_CONTROL, (endpoint) | USB_DIR_IN)
-#define usb_sndisocpipe(dev,endpoint) \
+#define usb_sndisocpipe(dev,endpoint) \
usb_find_host_endpoint(dev, PIPE_ISOCHRONOUS, (endpoint) | USB_DIR_OUT)
-#define usb_rcvisocpipe(dev,endpoint) \
+#define usb_rcvisocpipe(dev,endpoint) \
usb_find_host_endpoint(dev, PIPE_ISOCHRONOUS, (endpoint) | USB_DIR_IN)
-#define usb_sndbulkpipe(dev,endpoint) \
+#define usb_sndbulkpipe(dev,endpoint) \
usb_find_host_endpoint(dev, PIPE_BULK, (endpoint) | USB_DIR_OUT)
-#define usb_rcvbulkpipe(dev,endpoint) \
+#define usb_rcvbulkpipe(dev,endpoint) \
usb_find_host_endpoint(dev, PIPE_BULK, (endpoint) | USB_DIR_IN)
-#define usb_sndintpipe(dev,endpoint) \
+#define usb_sndintpipe(dev,endpoint) \
usb_find_host_endpoint(dev, PIPE_INTERRUPT, (endpoint) | USB_DIR_OUT)
-#define usb_rcvintpipe(dev,endpoint) \
+#define usb_rcvintpipe(dev,endpoint) \
usb_find_host_endpoint(dev, PIPE_INTERRUPT, (endpoint) | USB_DIR_IN)
struct usb_host_endpoint {
@@ -387,10 +387,10 @@
uint32_t timeout; /* FreeBSD specific */
uint16_t transfer_flags; /* (in) */
-#define URB_SHORT_NOT_OK 0x0001 /* report short transfers like errors */
-#define URB_ISO_ASAP 0x0002 /* ignore "start_frame" field */
-#define URB_ZERO_PACKET 0x0004 /* the USB transfer ends with a short packet */
-#define URB_NO_TRANSFER_DMA_MAP 0x0008 /* "transfer_dma" is valid on submit */
+#define URB_SHORT_NOT_OK 0x0001 /* report short transfers like errors */
+#define URB_ISO_ASAP 0x0002 /* ignore "start_frame" field */
+#define URB_ZERO_PACKET 0x0004 /* the USB transfer ends with a short packet */
+#define URB_NO_TRANSFER_DMA_MAP 0x0008 /* "transfer_dma" is valid on submit */
#define URB_WAIT_WAKEUP 0x0010 /* custom flags */
#define URB_IS_SLEEPING 0x0020 /* custom flags */
@@ -432,6 +432,6 @@
void usb_linux_register(void *arg);
void usb_linux_deregister(void *arg);
-#define interface_to_usbdev(intf) (intf)->linux_udev
+#define interface_to_usbdev(intf) (intf)->linux_udev
#endif /* _USB_COMPAT_LINUX_H */
More information about the p4-projects
mailing list