From 4dc2cb5b49115f5376f27ff736a7939247deb111 Mon Sep 17 00:00:00 2001 From: laforge Date: Sat, 23 Feb 2008 13:19:06 +0000 Subject: * move usb descriptors into separate file (src/os/usb_descriptors_openpcd.h) * add USB HID skeleton git-svn-id: https://svn.openpcd.org:2342/trunk@426 6dc7ffe9-61d6-0310-9af1-9938baff3ed1 --- firmware/src/os/pcd_enumerate.c | 101 ++-------------------------------------- 1 file changed, 4 insertions(+), 97 deletions(-) (limited to 'firmware/src/os/pcd_enumerate.c') diff --git a/firmware/src/os/pcd_enumerate.c b/firmware/src/os/pcd_enumerate.c index 5fc47a3..ab000c7 100644 --- a/firmware/src/os/pcd_enumerate.c +++ b/firmware/src/os/pcd_enumerate.c @@ -85,106 +85,13 @@ static const struct dfuapi *dfu = DFU_API_LOCATION; #error non-DFU builds currently not supported (yet) again #endif -static struct udp_pcd upcd; - -const struct usb_device_descriptor dev_descriptor = { - .bLength = USB_DT_DEVICE_SIZE, - .bDescriptorType = USB_DT_DEVICE, - .bcdUSB = 0x0100, - .bDeviceClass = USB_CLASS_VENDOR_SPEC, - .bDeviceSubClass = 0xff, - .bDeviceProtocol = 0xff, - .bMaxPacketSize0 = 0x08, - .idVendor = USB_VENDOR_ID, - .idProduct = USB_PRODUCT_ID, - .bcdDevice = 0x0030, /* Version 0.3 */ -#ifdef CONFIG_USB_STRING - .iManufacturer = 3, - .iProduct = 4, - .iSerialNumber = 0, +#ifdef CONFIG_USB_HID +#include "usb_descriptors_hid.h" #else - .iManufacturer = 0, - .iProduct = 0, - .iSerialNumber = 0, -#endif - .bNumConfigurations = 0x01, -}; - -struct _desc { - struct usb_config_descriptor ucfg; - struct usb_interface_descriptor uif; - struct usb_endpoint_descriptor ep[3]; -#ifdef CONFIG_DFU - struct usb_interface_descriptor uif_dfu[2]; +#include "usb_descriptors_openpcd.h" #endif -}; -const struct _desc cfg_descriptor = { - .ucfg = { - .bLength = USB_DT_CONFIG_SIZE, - .bDescriptorType = USB_DT_CONFIG, - .wTotalLength = USB_DT_CONFIG_SIZE + -#ifdef CONFIG_DFU - 3 * USB_DT_INTERFACE_SIZE + - 3 * USB_DT_ENDPOINT_SIZE, - .bNumInterfaces = 3, -#else - 1 * USB_DT_INTERFACE_SIZE + - 3 * USB_DT_ENDPOINT_SIZE, - .bNumInterfaces = 1, -#endif - .bConfigurationValue = 1, -#ifdef CONFIG_USB_STRING - .iConfiguration = 5, -#else - .iConfiguration = 0, -#endif - .bmAttributes = USB_CONFIG_ATT_ONE, - .bMaxPower = 250, /* 500mA */ - }, - .uif = { - .bLength = USB_DT_INTERFACE_SIZE, - .bDescriptorType = USB_DT_INTERFACE, - .bInterfaceNumber = 0, - .bAlternateSetting = 0, - .bNumEndpoints = 3, - .bInterfaceClass = USB_CLASS_VENDOR_SPEC, - .bInterfaceSubClass = 0, - .bInterfaceProtocol = 0xff, -#ifdef CONFIG_SB_STRING - .iInterface = 6, -#else - .iInterface = 0, -#endif - }, - .ep= { - { - .bLength = USB_DT_ENDPOINT_SIZE, - .bDescriptorType = USB_DT_ENDPOINT, - .bEndpointAddress = OPENPCD_OUT_EP, - .bmAttributes = USB_ENDPOINT_XFER_BULK, - .wMaxPacketSize = AT91C_EP_OUT_SIZE, - .bInterval = 0x00, - }, { - .bLength = USB_DT_ENDPOINT_SIZE, - .bDescriptorType = USB_DT_ENDPOINT, - .bEndpointAddress = OPENPCD_IN_EP, - .bmAttributes = USB_ENDPOINT_XFER_BULK, - .wMaxPacketSize = AT91C_EP_IN_SIZE, - .bInterval = 0x00, - }, { - .bLength = USB_DT_ENDPOINT_SIZE, - .bDescriptorType = USB_DT_ENDPOINT, - .bEndpointAddress = OPENPCD_IRQ_EP, - .bmAttributes = USB_ENDPOINT_XFER_INT, - .wMaxPacketSize = AT91C_EP_IN_SIZE, - .bInterval = 0xff, /* FIXME */ - }, - }, -#ifdef CONFIG_DFU - .uif_dfu = DFU_RT_IF_DESC, -#endif -}; +static struct udp_pcd upcd; struct epstate { u_int32_t state_busy; -- cgit v1.2.3