1 /* ----------------------------------------------------------------------------
\r
2 * ATMEL Microcontroller Software Support
\r
3 * ----------------------------------------------------------------------------
\r
4 * Copyright (c) 2008, Atmel Corporation
\r
6 * All rights reserved.
\r
8 * Redistribution and use in source and binary forms, with or without
\r
9 * modification, are permitted provided that the following conditions are met:
\r
11 * - Redistributions of source code must retain the above copyright notice,
\r
12 * this list of conditions and the disclaimer below.
\r
14 * Atmel's name may not be used to endorse or promote products derived from
\r
15 * this software without specific prior written permission.
\r
17 * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
\r
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
\r
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
\r
20 * DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
\r
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
\r
22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
\r
23 * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
\r
24 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
\r
25 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
\r
26 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\r
27 * ----------------------------------------------------------------------------
\r
35 * Definitions and methods for USB composite device implement.
\r
39 * -# Initialize USB function specified driver ( for MSD currently )
\r
40 * - MSDDFunctionDriver_Initialize()
\r
42 * -# Initialize USB composite driver and USB driver
\r
43 * - CDCHIDDDriver_Initialize()
\r
45 * -# Handle and dispach USB requests
\r
46 * - CDCHIDDDriver_RequestHandler()
\r
48 * -# Try starting a remote wake-up sequence
\r
49 * - CDCHIDDDriver_RemoteWakeUp()
\r
52 #ifndef CDCHIDDDRIVER_H
\r
53 #define CDCHIDDDRIVER_H
\r
54 /** \addtogroup usbd_composite_cdchid
\r
58 /*---------------------------------------------------------------------------
\r
60 *---------------------------------------------------------------------------*/
\r
62 #include <USBRequests.h>
\r
63 #include <CDCDescriptors.h>
\r
64 #include <HIDDescriptors.h>
\r
66 #include <USBDDriver.h>
\r
68 /*---------------------------------------------------------------------------
\r
70 *---------------------------------------------------------------------------*/
\r
72 /** \addtogroup usbd_cdc_hid_desc USB CDC(Serial) + HID(Kbd) Descriptors define
\r
75 /** Number of interfaces of the device */
\r
76 #define CDCHIDDDriverDescriptors_NUMINTERFACE 3
\r
77 /** Number of the CDC interface. */
\r
78 #define CDCHIDDDriverDescriptors_CDC_INTERFACE 0
\r
79 /** Number of the HID interface. */
\r
80 #define CDCHIDDDriverDescriptors_HID_INTERFACE 2
\r
83 /*---------------------------------------------------------------------------
\r
85 *---------------------------------------------------------------------------*/
\r
87 #if defined ( __CC_ARM ) /* Keil ¦ÌVision 4 */
\r
88 #elif defined ( __ICCARM__ ) /* IAR Ewarm */
\r
89 #define __attribute__(...)
\r
90 #define __packed__ packed
\r
91 #elif defined ( __GNUC__ ) /* GCC CS3 */
\r
92 #define __packed__ aligned(1)
\r
95 * \typedef CdcHidDriverConfigurationDescriptors
\r
96 * \brief Configuration descriptor list for a device implementing a
\r
99 typedef struct _CdcHidDriverConfigurationDescriptors {
\r
101 /** Standard configuration descriptor. */
\r
102 USBConfigurationDescriptor configuration;
\r
106 USBInterfaceAssociationDescriptor cdcIAD0;
\r
107 /** Communication interface descriptor */
\r
108 USBInterfaceDescriptor cdcCommunication0;
\r
109 /** CDC header functional descriptor. */
\r
110 CDCHeaderDescriptor cdcHeader0;
\r
111 /** CDC call management functional descriptor. */
\r
112 CDCCallManagementDescriptor cdcCallManagement0;
\r
113 /** CDC abstract control management functional descriptor. */
\r
114 CDCAbstractControlManagementDescriptor cdcAbstractControlManagement0;
\r
115 /** CDC union functional descriptor (with one slave interface). */
\r
116 CDCUnionDescriptor cdcUnion0;
\r
117 /** Notification endpoint descriptor. */
\r
118 USBEndpointDescriptor cdcNotification0;
\r
119 /** Data interface descriptor. */
\r
120 USBInterfaceDescriptor cdcData0;
\r
121 /** Data OUT endpoint descriptor. */
\r
122 USBEndpointDescriptor cdcDataOut0;
\r
123 /** Data IN endpoint descriptor. */
\r
124 USBEndpointDescriptor cdcDataIn0;
\r
127 USBInterfaceDescriptor hidInterface;
\r
128 HIDDescriptor1 hid;
\r
129 USBEndpointDescriptor hidInterruptIn;
\r
130 USBEndpointDescriptor hidInterruptOut;
\r
132 } __attribute__ ((__packed__)) CdcHidDriverConfigurationDescriptors;
\r
136 /*---------------------------------------------------------------------------
\r
137 * Exported functions
\r
138 *---------------------------------------------------------------------------*/
\r
141 extern void CDCHIDDDriver_Initialize(
\r
142 const USBDDriverDescriptors * pDescriptors);
\r
144 extern void CDCHIDDDriver_ConfigurationChangedHandler(uint8_t cfgnum);
\r
146 extern void CDCHIDDDriver_RequestHandler(const USBGenericRequest *request);
\r
148 extern void CDCHIDDDriver_RemoteWakeUp(void);
\r
151 #endif //#ifndef CDCHIDDDRIVER_H
\r