Rev Author Line No. Line
4932 kaklik 1 /************************************************************************
2 usb_config.c
3  
4 WFF USB Generic HID Demonstration 3
5 usbGenericHidCommunication reference firmware 3_0_0_0
6 Copyright (C) 2011 Simon Inns
7  
8 This program is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation, either version 3 of the License, or
11 (at your option) any later version.
12  
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17  
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>.
20  
21 Email: simon.inns@gmail.com
22  
23 ************************************************************************/
24  
25 #ifndef USBCONFIG_H
26 #define USBCONFIG_H
27  
28 // Definitions
29 #define USB_EP0_BUFF_SIZE 8 // Valid Options are 8, 16, 32, or 64 bytes.
30 #define USB_MAX_NUM_INT 1
31 #define USB_MAX_EP_NUMBER 1
32  
33 // USB device descriptor
34 #define USB_USER_DEVICE_DESCRIPTOR &device_dsc
35 #define USB_USER_DEVICE_DESCRIPTOR_INCLUDE extern ROM USB_DEVICE_DESCRIPTOR device_dsc
36  
37 // Configuration descriptors
38 #define USB_USER_CONFIG_DESCRIPTOR USB_CD_Ptr
39 #define USB_USER_CONFIG_DESCRIPTOR_INCLUDE extern ROM BYTE *ROM USB_CD_Ptr[]
40  
41 // Set the USB ping pong mode
42 #define USB_PING_PONG_MODE USB_PING_PONG__FULL_PING_PONG
43  
44 // Uncomment either USB_POLLING or USB_INTERRUPT to set how the USB
45 // device is updated
46 #define USB_POLLING
47 //#define USB_INTERRUPT
48  
49 // Set the USB pullup option for usb_device.h
50 #define USB_PULLUP_OPTION USB_PULLUP_ENABLE
51 //#define USB_PULLUP_OPTION USB_PULLUP_DISABLED
52  
53 // Use the internal USB transceiver module
54 #define USB_TRANSCEIVER_OPTION USB_INTERNAL_TRANSCEIVER
55  
56 // Set either full-speed or low-speed USB device mode
57 #define USB_SPEED_OPTION USB_FULL_SPEED
58 //#define USB_SPEED_OPTION USB_LOW_SPEED
59  
60 // Option to enable auto-arming of the status stage of control transfers
61 #define USB_ENABLE_STATUS_STAGE_TIMEOUTS
62  
63 // Section 9.2.6 of the USB 2.0 specifications state that:
64 // Control transfers with no data stage must complete within 50ms of the start of the control transfer.
65 // Control transfers with (IN) data stage must complete within 50ms of sending the last IN data packet in fullfilment of the data stage.
66 // Control transfers with (OUT) data stage have no specific status stage timing (but must not exceed 5 seconds)
67 #define USB_STATUS_STAGE_TIMEOUT (BYTE)45
68  
69 #define USB_SUPPORT_DEVICE
70  
71 #define USB_NUM_STRING_DESCRIPTORS 3
72  
73 // Enable/disable event handlers
74 //#define USB_INTERRUPT_LEGACY_CALLBACKS
75 #define USB_ENABLE_ALL_HANDLERS
76 //#define USB_ENABLE_SUSPEND_HANDLER
77 //#define USB_ENABLE_WAKEUP_FROM_SUSPEND_HANDLER
78 //#define USB_ENABLE_SOF_HANDLER
79 //#define USB_ENABLE_ERROR_HANDLER
80 //#define USB_ENABLE_OTHER_REQUEST_HANDLER
81 //#define USB_ENABLE_SET_DESCRIPTOR_HANDLER
82 //#define USB_ENABLE_INIT_EP_HANDLER
83 //#define USB_ENABLE_EP0_DATA_HANDLER
84 //#define USB_ENABLE_TRANSFER_COMPLETE_HANDLER
85  
86 // Set device type to USB HID
87 #define USB_USE_HID
88  
89 // HID endpoint allocation
90 #define HID_INTF_ID 0x00
91 #define HID_EP 1
92 #define HID_INT_OUT_EP_SIZE 3
93 #define HID_INT_IN_EP_SIZE 3
94 #define HID_NUM_OF_DSC 1
95 #define HID_RPT01_SIZE 28
96  
97 #endif