PERFORCE change 167070 for review
Sylvestre Gallon
syl at FreeBSD.org
Thu Aug 6 19:04:55 UTC 2009
http://perforce.freebsd.org/chv.cgi?CH=167070
Change 167070 by syl at syl_atuin on 2009/08/06 19:04:02
Factorising all controllers.
All controller have now only one usb_pipe_methods for isochronous endpoint.
Affected files ...
.. //depot/projects/soc2009/syl_usb/src/sys/dev/usb/controller/at91dci.c#10 edit
.. //depot/projects/soc2009/syl_usb/src/sys/dev/usb/controller/atmegadci.c#10 edit
.. //depot/projects/soc2009/syl_usb/src/sys/dev/usb/controller/avr32dci.c#9 edit
.. //depot/projects/soc2009/syl_usb/src/sys/dev/usb/controller/musb_otg.c#11 edit
.. //depot/projects/soc2009/syl_usb/src/sys/dev/usb/controller/s3c24xxdci.c#18 edit
.. //depot/projects/soc2009/syl_usb/src/sys/dev/usb/controller/uss820dci.c#10 edit
Differences ...
==== //depot/projects/soc2009/syl_usb/src/sys/dev/usb/controller/at91dci.c#10 (text+ko) ====
@@ -102,10 +102,6 @@
/* prototypes */
struct usb_bus_methods at91dci_bus_methods;
-struct usb_pipe_methods at91dci_device_bulk_methods;
-struct usb_pipe_methods at91dci_device_ctrl_methods;
-struct usb_pipe_methods at91dci_device_intr_methods;
-struct usb_pipe_methods at91dci_device_isoc_fs_methods;
static at91dci_cmd_t at91dci_setup_rx;
static at91dci_cmd_t at91dci_data_rx;
@@ -1567,7 +1563,7 @@
at91dci_start_standard_chain(xfer);
}
-struct usb_pipe_methods at91dci_device_bulk_methods =
+struct usb_pipe_methods at91dci_device_nonisoc_methods =
{
.open = at91dci_device_dummy,
.enter = at91dci_device_dummy,
@@ -1575,23 +1571,7 @@
.start = at91dci_device_nonisoc_start,
};
-struct usb_pipe_methods at91dci_device_ctrl_methods =
-{
- .open = at91dci_device_dummy,
- .enter = at91dci_device_dummy,
- .close = at91dci_device_close,
- .start = at91dci_device_nonisoc_start,
-};
-struct usb_pipe_methods at91dci_device_intr_methods =
-{
- .open = at91dci_device_dummy,
- .enter = at91dci_device_dummy,
- .close = at91dci_device_close,
- .start = at91dci_device_nonisoc_start,
-};
-
-
struct usb_pipe_methods at91dci_device_isoc_fs_methods =
{
.open = at91dci_device_dummy,
@@ -2113,28 +2093,11 @@
/*
* compute maximum number of TDs
*/
- if (parm->methods == &at91dci_device_ctrl_methods) {
-
- ntd = xfer->nframes + 1 /* STATUS */ + 1 /* SYNC 1 */
- + 1 /* SYNC 2 */ ;
-
- } else if (parm->methods == &at91dci_device_bulk_methods) {
-
- ntd = xfer->nframes + 1 /* SYNC */ ;
-
- } else if (parm->methods == &at91dci_device_intr_methods) {
-
- ntd = xfer->nframes + 1 /* SYNC */ ;
-
- } else if (parm->methods == &at91dci_device_isoc_fs_methods) {
-
+ if ((xfer->endpoint->edesc->bmAttributes & UE_XFERTYPE) == UE_CONTROL)
+ ntd = xfer->nframes + 1 /* STATUS */ + 1 /* SYNC 1 */ + 1 /* SYNC 2 */ ;
+ else
ntd = xfer->nframes + 1 /* SYNC */ ;
- } else {
-
- ntd = 0;
- }
-
/*
* check if "usbd_transfer_setup_sub" set an error
*/
@@ -2223,17 +2186,13 @@
}
switch (edesc->bmAttributes & UE_XFERTYPE) {
case UE_CONTROL:
- ep->methods = &at91dci_device_ctrl_methods;
- break;
case UE_INTERRUPT:
- ep->methods = &at91dci_device_intr_methods;
+ case UE_BULK:
+ ep->methods = &at91dci_device_nonisoc_methods;
break;
case UE_ISOCHRONOUS:
ep->methods = &at91dci_device_isoc_fs_methods;
break;
- case UE_BULK:
- ep->methods = &at91dci_device_bulk_methods;
- break;
default:
/* do nothing */
break;
==== //depot/projects/soc2009/syl_usb/src/sys/dev/usb/controller/atmegadci.c#10 (text+ko) ====
==== //depot/projects/soc2009/syl_usb/src/sys/dev/usb/controller/avr32dci.c#9 (text+ko) ====
==== //depot/projects/soc2009/syl_usb/src/sys/dev/usb/controller/musb_otg.c#11 (text+ko) ====
@@ -94,10 +94,6 @@
/* prototypes */
struct usb_bus_methods musbotg_bus_methods;
-struct usb_pipe_methods musbotg_device_bulk_methods;
-struct usb_pipe_methods musbotg_device_ctrl_methods;
-struct usb_pipe_methods musbotg_device_intr_methods;
-struct usb_pipe_methods musbotg_device_isoc_methods;
static musbotg_cmd_t musbotg_setup_rx;
static musbotg_cmd_t musbotg_setup_data_rx;
@@ -1974,15 +1970,7 @@
musbotg_start_standard_chain(xfer);
}
-struct usb_pipe_methods musbotg_device_bulk_methods =
-{
- .open = musbotg_device_dummy,
- .enter = musbotg_device_dummy,
- .close = musbotg_device_close,
- .start = musbotg_device_nonisoc_start,
-};
-
-struct usb_pipe_methods musbotg_device_ctrl_methods =
+struct usb_pipe_methods musbotg_device_nonisoc_methods =
{
.open = musbotg_device_dummy,
.enter = musbotg_device_dummy,
@@ -1990,14 +1978,6 @@
.start = musbotg_device_nonisoc_start,
};
-struct usb_pipe_methods musbotg_device_intr_methods =
-{
- .open = musbotg_device_dummy,
- .enter = musbotg_device_dummy,
- .close = musbotg_device_close,
- .start = musbotg_device_nonisoc_start,
-};
-
struct usb_pipe_methods musbotg_device_isoc_methods =
{
.open = musbotg_device_dummy,
@@ -2518,7 +2498,7 @@
parm->hc_max_frame_size = 0x400;
if ((parm->methods == &musbotg_device_isoc_methods) ||
- (parm->methods == &musbotg_device_intr_methods))
+ xfer->endpoint->edesc->bmAttributes == UE_INTERRUPT)
parm->hc_max_packet_count = 3;
else
parm->hc_max_packet_count = 1;
@@ -2528,27 +2508,10 @@
/*
* compute maximum number of TDs
*/
- if (parm->methods == &musbotg_device_ctrl_methods) {
-
- ntd = xfer->nframes + 1 /* STATUS */ + 1 /* SYNC */ ;
-
- } else if (parm->methods == &musbotg_device_bulk_methods) {
-
- ntd = xfer->nframes + 1 /* SYNC */ ;
-
- } else if (parm->methods == &musbotg_device_intr_methods) {
-
+ if ((xfer->endpoint->edesc->bmAttributes & UE_XFERTYPE) == UE_CONTROL)
+ ntd = xfer->nframes + 1 /* STATUS */ + 1 /* SYNC 1 */ + 1 /* SYNC 2 */ ;
+ else
ntd = xfer->nframes + 1 /* SYNC */ ;
-
- } else if (parm->methods == &musbotg_device_isoc_methods) {
-
- ntd = xfer->nframes + 1 /* SYNC */ ;
-
- } else {
-
- ntd = 0;
- }
-
/*
* check if "usbd_transfer_setup_sub" set an error
*/
@@ -2632,17 +2595,13 @@
}
switch (edesc->bmAttributes & UE_XFERTYPE) {
case UE_CONTROL:
- ep->methods = &musbotg_device_ctrl_methods;
- break;
+ case UE_BULK:
case UE_INTERRUPT:
- ep->methods = &musbotg_device_intr_methods;
+ ep->methods = &musbotg_device_nonisoc_methods;
break;
case UE_ISOCHRONOUS:
ep->methods = &musbotg_device_isoc_methods;
break;
- case UE_BULK:
- ep->methods = &musbotg_device_bulk_methods;
- break;
default:
/* do nothing */
break;
==== //depot/projects/soc2009/syl_usb/src/sys/dev/usb/controller/s3c24xxdci.c#18 (text+ko) ====
@@ -846,27 +846,13 @@
return ;
}
-struct usb_pipe_methods s3c24dci_device_ctrl_methods = {
+struct usb_pipe_methods s3c24dci_device_nonisoc_methods = {
.open = s3c24dci_device_dummy,
.enter = s3c24dci_device_dummy,
.close = s3c24dci_device_close,
.start = s3c24dci_device_nonisoc_start,
};
-struct usb_pipe_methods s3c24dci_device_bulk_methods = {
- .open = s3c24dci_device_dummy,
- .enter = s3c24dci_device_dummy,
- .close = s3c24dci_device_close,
- .start = s3c24dci_device_nonisoc_start,
-};
-
-struct usb_pipe_methods s3c24dci_device_intr_methods = {
- .open = s3c24dci_device_dummy,
- .enter = s3c24dci_device_dummy,
- .close = s3c24dci_device_close,
- .start = s3c24dci_device_nonisoc_start,
-};
-
/*
* s3c24dci root control support
* Simulate a hardware HUB by handling all the necessary requests.
@@ -1374,24 +1360,11 @@
/*
* compute maximum number of TDs
*/
- if (parm->methods == &s3c24dci_device_ctrl_methods) {
-
- ntd = xfer->nframes + 1 /* STATUS */ + 1 /* SYNC 1 */
- + 1 /* SYNC 2 */ ;
-
- } else if (parm->methods == &s3c24dci_device_bulk_methods) {
-
+ if ((xfer->endpoint->edesc->bmAttributes & UE_XFERTYPE) == UE_CONTROL)
+ ntd = xfer->nframes + 1 /* STATUS */ + 1 /* SYNC 1 */ + 1 /* SYNC 2 */ ;
+ else
ntd = xfer->nframes + 1 /* SYNC */ ;
- } else if (parm->methods == &s3c24dci_device_intr_methods) {
-
- ntd = xfer->nframes + 1 /* SYNC */ ;
-
- } else {
-
- ntd = 0;
- }
-
/*
* check if "usbd_transfer_setup_sub" set an error
*/
@@ -1476,13 +1449,9 @@
}
switch (edesc->bmAttributes & UE_XFERTYPE) {
case UE_CONTROL:
- ep->methods = &s3c24dci_device_ctrl_methods;
- break;
case UE_INTERRUPT:
- ep->methods = &s3c24dci_device_intr_methods;
- break;
case UE_BULK:
- ep->methods = &s3c24dci_device_bulk_methods;
+ ep->methods = &s3c24dci_device_nonisoc_methods;
break;
default:
break;
==== //depot/projects/soc2009/syl_usb/src/sys/dev/usb/controller/uss820dci.c#10 (text+ko) ====
@@ -90,9 +90,6 @@
/* prototypes */
struct usb_bus_methods uss820dci_bus_methods;
-struct usb_pipe_methods uss820dci_device_bulk_methods;
-struct usb_pipe_methods uss820dci_device_ctrl_methods;
-struct usb_pipe_methods uss820dci_device_intr_methods;
struct usb_pipe_methods uss820dci_device_isoc_fs_methods;
static uss820dci_cmd_t uss820dci_setup_rx;
@@ -1610,15 +1607,7 @@
uss820dci_start_standard_chain(xfer);
}
-struct usb_pipe_methods uss820dci_device_bulk_methods =
-{
- .open = uss820dci_device_dummy,
- .enter = uss820dci_device_dummy,
- .close = uss820dci_device_close,
- .start = uss820dci_device_nonisoc_start,
-};
-
-struct usb_pipe_methods uss820dci_device_ctrl_methods =
+struct usb_pipe_methods uss820dci_device_nonisoc_methods =
{
.open = uss820dci_device_dummy,
.enter = uss820dci_device_dummy,
@@ -1626,14 +1615,6 @@
.start = uss820dci_device_nonisoc_start,
};
-struct usb_pipe_methods uss820dci_device_intr_methods =
-{
- .open = uss820dci_device_dummy,
- .enter = uss820dci_device_dummy,
- .close = uss820dci_device_close,
- .start = uss820dci_device_nonisoc_start,
-};
-
struct usb_pipe_methods uss820dci_device_isoc_fs_methods =
{
.open = uss820dci_device_dummy,
@@ -2147,27 +2128,11 @@
/*
* compute maximum number of TDs
*/
- if (parm->methods == &uss820dci_device_ctrl_methods) {
-
- ntd = xfer->nframes + 1 /* STATUS */ + 1 /* SYNC */ ;
-
- } else if (parm->methods == &uss820dci_device_bulk_methods) {
-
- ntd = xfer->nframes + 1 /* SYNC */ ;
-
- } else if (parm->methods == &uss820dci_device_intr_methods) {
-
+ if ((xfer->endpoint->edesc->bmAttributes & UE_XFERTYPE) == UE_CONTROL)
+ ntd = xfer->nframes + 1 /* STATUS */ + 1 /* SYNC 1 */ + 1 /* SYNC 2 */ ;
+ else
ntd = xfer->nframes + 1 /* SYNC */ ;
- } else if (parm->methods == &uss820dci_device_isoc_fs_methods) {
-
- ntd = xfer->nframes + 1 /* SYNC */ ;
-
- } else {
-
- ntd = 0;
- }
-
/*
* check if "usbd_transfer_setup_sub" set an error
*/
@@ -2214,7 +2179,7 @@
td->max_packet_size = xfer->max_packet_size;
td->ep_index = ep_no;
if (pf->support_multi_buffer &&
- (parm->methods != &uss820dci_device_ctrl_methods)) {
+ (xfer->endpoint->edesc->bmAttributes != UE_CONTROL)) {
td->support_multi_buffer = 1;
}
td->obj_next = last_obj;
@@ -2256,17 +2221,13 @@
}
switch (edesc->bmAttributes & UE_XFERTYPE) {
case UE_CONTROL:
- ep->methods = &uss820dci_device_ctrl_methods;
- break;
case UE_INTERRUPT:
- ep->methods = &uss820dci_device_intr_methods;
+ case UE_BULK:
+ ep->methods = &uss820dci_device_nonisoc_methods;
break;
case UE_ISOCHRONOUS:
ep->methods = &uss820dci_device_isoc_fs_methods;
break;
- case UE_BULK:
- ep->methods = &uss820dci_device_bulk_methods;
- break;
default:
/* do nothing */
break;
More information about the p4-projects
mailing list