Project

General

Profile

Download (2.58 KB) Statistics
| Branch: | Tag: | Revision:
1
#ifndef _USB_DESCRIPTORS_H
2
#define _USB_DESCRIPTORS_H
3

    
4
#include <usb_ch9.h>
5
#include <sys/types.h>
6
#include <openpcd.h>
7
#include <dfu/dfu.h>
8

    
9
#include "../config.h"
10

    
11
const struct usb_device_descriptor dev_descriptor = {
12
	.bLength = USB_DT_DEVICE_SIZE,
13
	.bDescriptorType = USB_DT_DEVICE,
14
	.bcdUSB = 0x0100,
15
	.bDeviceClass = USB_CLASS_VENDOR_SPEC,
16
	.bDeviceSubClass = 0xff,
17
	.bDeviceProtocol = 0xff,
18
	.bMaxPacketSize0 = 0x08,
19
	.idVendor = USB_VENDOR_ID,
20
	.idProduct = USB_PRODUCT_ID,
21
	.bcdDevice = 0x0030,	/* Version 0.3 */
22
#ifdef CONFIG_USB_STRING
23
	.iManufacturer = 4,
24
	.iProduct = 5,
25
	.iSerialNumber = 0,
26
#else
27
	.iManufacturer = 0,
28
	.iProduct = 0,
29
	.iSerialNumber = 0,
30
#endif
31
	.bNumConfigurations = 0x01,
32
};
33

    
34
struct _desc {
35
	struct usb_config_descriptor ucfg;
36
	struct usb_interface_descriptor uif;
37
	struct usb_endpoint_descriptor ep[3];
38
#ifdef CONFIG_DFU
39
	struct usb_interface_descriptor uif_dfu[3];
40
#endif
41
};
42

    
43
const struct _desc cfg_descriptor = {
44
	.ucfg = {
45
		 .bLength = USB_DT_CONFIG_SIZE,
46
		 .bDescriptorType = USB_DT_CONFIG,
47
		 .wTotalLength = USB_DT_CONFIG_SIZE +
48
#ifdef CONFIG_DFU
49
		 		 4 * USB_DT_INTERFACE_SIZE + 
50
				 3 * USB_DT_ENDPOINT_SIZE,
51
		 .bNumInterfaces = 4,
52
#else
53
		 		 1 * USB_DT_INTERFACE_SIZE + 
54
				 3 * USB_DT_ENDPOINT_SIZE,
55
		 .bNumInterfaces = 1,
56
#endif
57
		 .bConfigurationValue = 1,
58
#ifdef CONFIG_USB_STRING
59
		 .iConfiguration = 6,
60
#else
61
		 .iConfiguration = 0,
62
#endif
63
		 .bmAttributes = USB_CONFIG_ATT_ONE,
64
		 .bMaxPower = 250,	/* 500mA */
65
		 },
66
	.uif = {
67
		.bLength = USB_DT_INTERFACE_SIZE,
68
		.bDescriptorType = USB_DT_INTERFACE,
69
		.bInterfaceNumber = 0,
70
		.bAlternateSetting = 0,
71
		.bNumEndpoints = 3,
72
		.bInterfaceClass = USB_CLASS_VENDOR_SPEC,
73
		.bInterfaceSubClass = 0,
74
		.bInterfaceProtocol = 0xff,
75
#ifdef CONFIG_USB_STRING
76
		.iInterface = 7,
77
#else
78
		.iInterface = 0,
79
#endif
80
		},
81
	.ep= {
82
		{
83
			  .bLength = USB_DT_ENDPOINT_SIZE,
84
			  .bDescriptorType = USB_DT_ENDPOINT,
85
			  .bEndpointAddress = OPENPCD_OUT_EP,
86
			  .bmAttributes = USB_ENDPOINT_XFER_BULK,
87
			  .wMaxPacketSize = AT91C_EP_OUT_SIZE,
88
			  .bInterval = 0x00,
89
		  }, {
90
			  .bLength = USB_DT_ENDPOINT_SIZE,
91
			  .bDescriptorType = USB_DT_ENDPOINT,
92
			  .bEndpointAddress = OPENPCD_IN_EP,
93
			  .bmAttributes = USB_ENDPOINT_XFER_BULK,
94
			  .wMaxPacketSize = AT91C_EP_IN_SIZE,
95
			  .bInterval = 0x00,
96
		  }, {
97
			  .bLength = USB_DT_ENDPOINT_SIZE,
98
			  .bDescriptorType = USB_DT_ENDPOINT,
99
			  .bEndpointAddress = OPENPCD_IRQ_EP,
100
			  .bmAttributes = USB_ENDPOINT_XFER_INT,
101
			  .wMaxPacketSize = AT91C_EP_IN_SIZE,
102
			  .bInterval = 0xff,	/* FIXME */
103
		  },
104
	},
105
#ifdef CONFIG_DFU
106
	.uif_dfu = DFU_RT_IF_DESC,
107
#endif
108
};
109

    
110
#endif /* _USB_DESCRIPTORS_H */
(33-33/40)
Add picture from clipboard (Maximum size: 48.8 MB)