diff options
| author | Frank Gevaerts <frank@gevaerts.be> | 2009-04-18 20:40:50 +0000 |
|---|---|---|
| committer | Frank Gevaerts <frank@gevaerts.be> | 2009-04-18 20:40:50 +0000 |
| commit | 3314f389baf54e74e3c52c069f8e829a701b2b94 (patch) | |
| tree | 7407217cc1f7456999c653f610c44a9fab1bb6e1 /firmware/usbstack | |
| parent | 2c0da9d15205b425276d769b4d5f1275bd6ea954 (diff) | |
| download | rockbox-3314f389baf54e74e3c52c069f8e829a701b2b94.zip rockbox-3314f389baf54e74e3c52c069f8e829a701b2b94.tar.gz rockbox-3314f389baf54e74e3c52c069f8e829a701b2b94.tar.bz2 rockbox-3314f389baf54e74e3c52c069f8e829a701b2b94.tar.xz | |
Allow class drivers to reuse the core data buffer for control transfers. This doesn't make much difference right now, but it should keep HID memory usage lower (once HID is ready) (FS#10146 by Tomer Shalev)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20735 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/usbstack')
| -rw-r--r-- | firmware/usbstack/usb_class_driver.h | 2 | ||||
| -rw-r--r-- | firmware/usbstack/usb_core.c | 10 | ||||
| -rw-r--r-- | firmware/usbstack/usb_serial.c | 4 | ||||
| -rw-r--r-- | firmware/usbstack/usb_serial.h | 2 | ||||
| -rw-r--r-- | firmware/usbstack/usb_storage.c | 4 | ||||
| -rw-r--r-- | firmware/usbstack/usb_storage.h | 2 |
6 files changed, 14 insertions, 10 deletions
diff --git a/firmware/usbstack/usb_class_driver.h b/firmware/usbstack/usb_class_driver.h index b51eb3e..36f2ea9 100644 --- a/firmware/usbstack/usb_class_driver.h +++ b/firmware/usbstack/usb_class_driver.h @@ -75,7 +75,7 @@ struct usb_class_driver { able to handle it, it should ack the request, and return true. Otherwise it should return false. Optional function */ - bool (*control_request)(struct usb_ctrlrequest* req); + bool (*control_request)(struct usb_ctrlrequest* req, unsigned char *dest); #ifdef HAVE_HOTSWAP /* Tells the driver that a hotswappable disk/card was inserted or diff --git a/firmware/usbstack/usb_core.c b/firmware/usbstack/usb_core.c index 737ac1a..3f67407 100644 --- a/firmware/usbstack/usb_core.c +++ b/firmware/usbstack/usb_core.c @@ -168,7 +168,7 @@ static enum { DEFAULT, ADDRESS, CONFIGURED } usb_state; static int usb_core_num_interfaces; typedef void (*completion_handler_t)(int ep,int dir, int status, int length); -typedef bool (*control_handler_t)(struct usb_ctrlrequest* req); +typedef bool (*control_handler_t)(struct usb_ctrlrequest* req, unsigned char *dest); static struct { @@ -695,7 +695,7 @@ static void usb_core_control_request_handler(struct usb_ctrlrequest* req) drivers[i].first_interface <= (req->wIndex) && drivers[i].last_interface > (req->wIndex)) { - handled = drivers[i].control_request(req); + handled = drivers[i].control_request(req, response_data); } } if(!handled) { @@ -735,8 +735,10 @@ static void usb_core_control_request_handler(struct usb_ctrlrequest* req) break; default: { bool handled=false; - if(ep_data[req->wIndex & 0xf].control_handler[0] != NULL) - handled = ep_data[req->wIndex & 0xf].control_handler[0](req); + if(ep_data[req->wIndex & 0xf].control_handler[0] != NULL) { + handled = ep_data[req->wIndex & 0xf].control_handler[0](req, + response_data); + } if(!handled) { /* nope. flag error */ logf("usb bad req %d", req->bRequest); diff --git a/firmware/usbstack/usb_serial.c b/firmware/usbstack/usb_serial.c index 514df0d..520a4b3 100644 --- a/firmware/usbstack/usb_serial.c +++ b/firmware/usbstack/usb_serial.c @@ -117,9 +117,11 @@ int usb_serial_get_config_descriptor(unsigned char *dest,int max_packet_size) } /* called by usb_core_control_request() */ -bool usb_serial_control_request(struct usb_ctrlrequest* req) +bool usb_serial_control_request(struct usb_ctrlrequest* req, unsigned char* dest) { bool handled = false; + + (void)dest; switch (req->bRequest) { default: logf("serial: unhandeld req %d", req->bRequest); diff --git a/firmware/usbstack/usb_serial.h b/firmware/usbstack/usb_serial.h index 94decdc..2701a96 100644 --- a/firmware/usbstack/usb_serial.h +++ b/firmware/usbstack/usb_serial.h @@ -30,7 +30,7 @@ void usb_serial_init_connection(void); void usb_serial_init(void); void usb_serial_disconnect(void); void usb_serial_transfer_complete(int ep,int dir, int status, int length); -bool usb_serial_control_request(struct usb_ctrlrequest* req); +bool usb_serial_control_request(struct usb_ctrlrequest* req, unsigned char *dest); void usb_serial_send(unsigned char *data,int length); diff --git a/firmware/usbstack/usb_storage.c b/firmware/usbstack/usb_storage.c index 2a3808d..be785da 100644 --- a/firmware/usbstack/usb_storage.c +++ b/firmware/usbstack/usb_storage.c @@ -593,11 +593,11 @@ void usb_storage_transfer_complete(int ep,int dir,int status,int length) } /* called by usb_core_control_request() */ -bool usb_storage_control_request(struct usb_ctrlrequest* req) +bool usb_storage_control_request(struct usb_ctrlrequest* req, unsigned char* dest) { bool handled = false; - + (void)dest; switch (req->bRequest) { case USB_BULK_GET_MAX_LUN: { #ifdef ONLY_EXPOSE_CARD_SLOT diff --git a/firmware/usbstack/usb_storage.h b/firmware/usbstack/usb_storage.h index c76cb89..3591d28 100644 --- a/firmware/usbstack/usb_storage.h +++ b/firmware/usbstack/usb_storage.h @@ -30,7 +30,7 @@ void usb_storage_init_connection(void); void usb_storage_disconnect(void); void usb_storage_init(void); void usb_storage_transfer_complete(int ep,int dir,int state,int length); -bool usb_storage_control_request(struct usb_ctrlrequest* req); +bool usb_storage_control_request(struct usb_ctrlrequest* req, unsigned char* dest); #ifdef HAVE_HOTSWAP void usb_storage_notify_hotswap(int volume,bool inserted); #endif |