PERFORCE change 127347 for review
Hans Petter Selasky
hselasky at FreeBSD.org
Tue Oct 9 12:56:03 PDT 2007
http://perforce.freebsd.org/chv.cgi?CH=127347
Change 127347 by hselasky at hselasky_laptop001 on 2007/10/09 19:55:18
This commit is the first of two commits where the "USBD_CHECK_STATUS()"
macro will be replaced by a switch statement. The change was suggested
by Alfred Perlstein.
This commit also includes a fix to the "usbd_std_packet_size[]" table,
which had one BULK entry too little for Variable USB speed.
The entry in question is currently not used.
Affected files ...
.. //depot/projects/usb/src/sys/dev/usb/usb.h#17 edit
.. //depot/projects/usb/src/sys/dev/usb/usb_port.h#18 edit
.. //depot/projects/usb/src/sys/dev/usb/usb_subr.h#47 edit
.. //depot/projects/usb/src/sys/dev/usb/usb_transfer.c#34 edit
Differences ...
==== //depot/projects/usb/src/sys/dev/usb/usb.h#17 (text+ko) ====
@@ -188,9 +188,6 @@
#define USB_MAX_IPACKET 8 /* maximum size of the initial packet */
-#define USB_2_MAX_CTRL_PACKET 64
-#define USB_2_MAX_BULK_PACKET 512
-
typedef struct {
uByte bLength;
uByte bDescriptorType;
==== //depot/projects/usb/src/sys/dev/usb/usb_port.h#18 (text+ko) ====
@@ -234,14 +234,6 @@
#define PRINTFN(n,x)
#endif
-#define USBD_CHECK_STATUS(xfer) do { \
- if (!(xfer)->flags_int.transferring) goto tr_setup; \
- (xfer)->flags_int.transferring = 0; \
- if ((xfer)->error) goto tr_error; \
- goto tr_transferred; \
-} while (0)
-/**/
-
#define _MAKE_ENUM(enum,value,arg...) \
enum value, \
/**/
==== //depot/projects/usb/src/sys/dev/usb/usb_subr.h#47 (text+ko) ====
@@ -70,6 +70,14 @@
MAKE_ENUM(USBD_STATUS,
N_USBD_STATUS);
+#define USBD_GET_STATE(xfer) ((xfer)->usb_state)
+
+enum {
+ USBD_ST_SETUP,
+ USBD_ST_TRANSFERRED,
+ USBD_ST_ERROR,
+};
+
struct usbd_xfer;
struct usbd_pipe;
struct usbd_bus;
@@ -418,6 +426,7 @@
uint8_t usb_smask;
uint8_t usb_cmask;
uint8_t usb_uframe;
+ uint8_t usb_state;
usbd_status error;
==== //depot/projects/usb/src/sys/dev/usb/usb_transfer.c#34 (text+ko) ====
@@ -249,7 +249,7 @@
[USB_SPEED_LOW] = { }, /* invalid (all zero) */
[USB_SPEED_FULL] = { .fixed = { 8, 16, 32, 64 } },
[USB_SPEED_HIGH] = { .fixed = { 512, 512, 512, 512 } },
- [USB_SPEED_VARIABLE] = { .fixed = { 512, 1024, 1536 } },
+ [USB_SPEED_VARIABLE] = { .fixed = { 512, 512, 1024, 1536 } },
},
[UE_ISOCHRONOUS] = {
@@ -1504,6 +1504,17 @@
xfer->flags_int.recursed_1 = 1;
xfer->flags_int.recursed_2 = 1;
+ /* set correct USB state for callback */
+ if (!xfer->flags_int.transferring) {
+ xfer->usb_state = USBD_ST_SETUP;
+ } else {
+ xfer->flags_int.transferring = 0;
+ if (xfer->error)
+ xfer->usb_state = USBD_ST_ERROR;
+ else
+ xfer->usb_state = USBD_ST_TRANSFERRED;
+ }
+
/* call processing routine */
(xfer->callback)(xfer);
More information about the p4-projects
mailing list