参考在mini2440上使用USB Gadget功能,修改file_storage.c与s3c2410_udc.c:
1----------------------------------------------------------------------------------
--- a/drivers/usb/gadget/file_storage.c 2008-09-01 11:13:03.000000000 -0400
+++ b/drivers/usb/gadget/file_storage.c 2008-09-01 11:16:41.000000000 -0400
@@ -1463,7 +1463,8 @@
if (rc >= 0 && rc != DELAYED_STATUS) {
rc = min(rc, w_length);
fsg->ep0req->length = rc;
- fsg->ep0req->zero = rc < w_length;
+ fsg->ep0req->zero = rc < w_length
+ && (rc % gadget->ep0->maxpacket) == 0;
fsg->ep0req_name = (ctrl->bRequestType & USB_DIR_IN ?
"ep0-in" : "ep0-out");
rc = ep0_queue(fsg);
2------------------------------------------------------------------------
Index: linux-2.6.28.8/drivers/usb/gadget/s3c2410_udc.c
===================================================================
--- linux-2.6.28.8.orig/drivers/usb/gadget/s3c2410_udc.c 2009-03-17 21:14:28.000000000 +0100
+++ linux-2.6.28.8/drivers/usb/gadget/s3c2410_udc.c 2009-03-17 21:14:46.000000000 +0100
@@ -843,6 +843,7 @@
u32 ep_csr1;
u32 idx;
+handle_ep_again:
if (likely (!list_empty(&ep->queue)))
req = list_entry(ep->queue.next,
struct s3c2410_request, queue);
@@ -882,6 +883,8 @@
if ((ep_csr1 & S3C2410_UDC_OCSR1_PKTRDY) && req) {
s3c2410_udc_read_fifo(ep,req);
+ if (s3c2410_udc_fifo_count_out())
+ goto handle_ep_again;
}
}
}