Statistics
| Branch: | Revision:

root / arduino-1.0 / hardware / arduino / bootloaders / diskloader / src / USBDesc.cpp @ 58d82c77

History | View | Annotate | Download (3.07 KB)

1

    
2

    
3
/* Copyright (c) 2011, Peter Barrett  
4
**  
5
** Permission to use, copy, modify, and/or distribute this software for  
6
** any purpose with or without fee is hereby granted, provided that the  
7
** above copyright notice and this permission notice appear in all copies.  
8
** 
9
** THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL  
10
** WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED  
11
** WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR  
12
** BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES  
13
** OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,  
14
** WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,  
15
** ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS  
16
** SOFTWARE.  
17
*/
18

    
19
#include "Platform.h"
20

    
21
//====================================================================================================
22
//====================================================================================================
23
//        Actual device descriptors
24

    
25
const u16 STRING_LANGUAGE[2] = {
26
        (3<<8) | (2+2),
27
        0x0409        // English
28
};
29

    
30
const u16 STRING_SERIAL[13] = {
31
        (3<<8) | (2+2*12),
32
        USB_SERIAL_STRING
33
};
34

    
35
const u16 STRING_IPRODUCT[28] = {
36
        (3<<8) | (2+2*27),
37
#if USB_PID == USB_PID_LEONARDO        
38
        'A','r','d','u','i','n','o',' ','L','e','o','n','a','r','d','o',' ','b','o','o','t','l','o','a','d','e','r'
39
#elif USB_PID == USB_PID_MICRO
40
        'A','r','d','u','i','n','o',' ','M','i','c','r','o',' ','b','o','o','t','l','o','a','d','e','r',' ',' ',' '
41
#endif
42
};
43

    
44
const u16 STRING_IMANUFACTURER[12] = {
45
        (3<<8) | (2+2*11),
46
        'A','r','d','u','i','n','o',' ','L','L','C'
47
};
48

    
49

    
50
//#ifdef CDC_ENABLED
51
DeviceDescriptor USB_DeviceDescriptorA = D_DEVICE(0X02,0X00,0X00,64,USB_VID,USB_PID,0x100,0,IPRODUCT,ISERIAL,1);
52
//#else
53
DeviceDescriptor USB_DeviceDescriptor = D_DEVICE(0x00,0x00,0x00,64,USB_VID,USB_PID,0x100,0,IPRODUCT,ISERIAL,1);
54
//#endif
55

    
56

    
57
Config USB_ConfigDescriptor =
58
{
59
        D_CONFIG(sizeof(Config),INTERFACE_COUNT),
60

    
61
#ifdef CDC_ENABLED
62
        //        CDC
63
        {
64
                D_IAD(0,2,CDC_COMMUNICATION_INTERFACE_CLASS,CDC_ABSTRACT_CONTROL_MODEL,1),
65

    
66
                //        CDC communication interface
67
                D_INTERFACE(CDC_ACM_INTERFACE,1,CDC_COMMUNICATION_INTERFACE_CLASS,CDC_ABSTRACT_CONTROL_MODEL,0),
68
                D_CDCCS(CDC_HEADER,0x10,0x01),                                                                // Header (1.10 bcd)
69
                D_CDCCS(CDC_CALL_MANAGEMENT,1,1),                                                        // Device handles call management
70
                D_CDCCS4(CDC_ABSTRACT_CONTROL_MANAGEMENT,2),                                // SET_LINE_CODING, GET_LINE_CODING, SET_CONTROL_LINE_STATE supported
71
                D_CDCCS(CDC_UNION,CDC_ACM_INTERFACE,CDC_DATA_INTERFACE),        // Communication interface is master, data interface is slave 0
72
                D_ENDPOINT(USB_ENDPOINT_IN (CDC_ENDPOINT_ACM),USB_ENDPOINT_TYPE_INTERRUPT,0x10,0x40),
73

    
74
                //        CDC data interface
75
                D_INTERFACE(CDC_DATA_INTERFACE,2,CDC_DATA_INTERFACE_CLASS,0,0),
76
                D_ENDPOINT(USB_ENDPOINT_OUT(CDC_ENDPOINT_OUT),USB_ENDPOINT_TYPE_BULK,0x40,0),
77
                D_ENDPOINT(USB_ENDPOINT_IN (CDC_ENDPOINT_IN ),USB_ENDPOINT_TYPE_BULK,0x40,0)
78
        },
79
#endif
80
        // HID
81
        {
82
                D_INTERFACE(HID_INTERFACE,1,3,0,0),
83
                D_HIDREPORT(30),
84
                D_ENDPOINT(USB_ENDPOINT_IN (HID_ENDPOINT_INT),USB_ENDPOINT_TYPE_INTERRUPT,0x40,0x40)
85
        }
86
};
87