From 69a4117c1d15d91836de91abe5f8f93b868ec808 Mon Sep 17 00:00:00 2001 From: Frank Gevaerts Date: Sat, 16 May 2009 15:30:09 +0000 Subject: Add working USB HID driver, by Tomer Shalev (part of his GSoC work). This needs support for usb interrupt transfers, so there are some changes in various USB drivers as well (only usb-drv-arc supports it at this point, others won't have working HID yet). HID is disabled for now, as the apps/ part is not included yet. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20962 a1c6a512-1295-4272-9138-f99709370657 --- firmware/export/usb.h | 2 +- firmware/export/usb_core.h | 13 ++++++++++++- firmware/export/usb_drv.h | 2 +- 3 files changed, 14 insertions(+), 3 deletions(-) (limited to 'firmware/export') diff --git a/firmware/export/usb.h b/firmware/export/usb.h index e1bacfffc7..42893c3468 100644 --- a/firmware/export/usb.h +++ b/firmware/export/usb.h @@ -105,7 +105,7 @@ struct usb_transfer_completion_event_data int length; void* data; }; -#endif +#endif /* HAVE_USBSTACK */ void usb_init(void); void usb_enable(bool on); diff --git a/firmware/export/usb_core.h b/firmware/export/usb_core.h index abf090ed9d..9c105fbc7c 100644 --- a/firmware/export/usb_core.h +++ b/firmware/export/usb_core.h @@ -36,6 +36,17 @@ /* endpoints */ #define EP_CONTROL 0 + +#define DIR_OUT 0 +#define DIR_IN 1 + +/* The USB core is a device, and OUT is RX from that P.O.V */ +#define DIR_RX DIR_OUT +#define DIR_TX DIR_IN + +#define EP_DIR(ep) (((ep) & USB_ENDPOINT_DIR_MASK) ? DIR_IN : DIR_OUT) +#define EP_NUM(ep) ((ep) & USB_ENDPOINT_NUMBER_MASK) + extern int usb_max_pkt_size; struct usb_class_driver; @@ -52,7 +63,7 @@ void usb_core_handle_transfer_completion( struct usb_transfer_completion_event_data* event); int usb_core_ack_control(struct usb_ctrlrequest* req); -int usb_core_request_endpoint(int dir,struct usb_class_driver* drv); +int usb_core_request_endpoint(int type, int dir,struct usb_class_driver* drv); void usb_core_release_endpoint(int dir); #ifdef HAVE_HOTSWAP diff --git a/firmware/export/usb_drv.h b/firmware/export/usb_drv.h index 0c99630b11..fad9c79c10 100644 --- a/firmware/export/usb_drv.h +++ b/firmware/export/usb_drv.h @@ -44,7 +44,7 @@ int usb_drv_port_speed(void); void usb_drv_cancel_all_transfers(void); void usb_drv_set_test_mode(int mode); bool usb_drv_connected(void); -int usb_drv_request_endpoint(int dir); +int usb_drv_request_endpoint(int type, int dir); void usb_drv_release_endpoint(int ep); #endif /* _USB_DRV_H */ -- cgit v1.2.3