]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/CORTEX_A5_SAMA5D4x_EK_IAR/AtmelFiles/usb/include/CDCHIDDDriver.h
Core kernel code:
[freertos] / FreeRTOS / Demo / CORTEX_A5_SAMA5D4x_EK_IAR / AtmelFiles / usb / include / CDCHIDDDriver.h
1 /* ----------------------------------------------------------------------------\r
2  *         ATMEL Microcontroller Software Support \r
3  * ----------------------------------------------------------------------------\r
4  * Copyright (c) 2008, Atmel Corporation\r
5  *\r
6  * All rights reserved.\r
7  *\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
10  *\r
11  * - Redistributions of source code must retain the above copyright notice,\r
12  * this list of conditions and the disclaimer below.\r
13  *\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
16  *\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
28  */\r
29 \r
30 /**\r
31  * \file\r
32  *\r
33  * \section Purpose\r
34  *\r
35  *   Definitions and methods for USB composite device implement.\r
36  * \r
37  * \section Usage\r
38  * \r
39  * -# Initialize USB function specified driver ( for MSD currently )\r
40  *  - MSDDFunctionDriver_Initialize()\r
41  *\r
42  * -# Initialize USB composite driver and USB driver\r
43  *  - CDCHIDDDriver_Initialize()\r
44  *\r
45  * -# Handle and dispach USB requests\r
46  *  - CDCHIDDDriver_RequestHandler()\r
47  *\r
48  * -# Try starting a remote wake-up sequence\r
49  *  - CDCHIDDDriver_RemoteWakeUp()\r
50  */\r
51 \r
52 #ifndef CDCHIDDDRIVER_H\r
53 #define CDCHIDDDRIVER_H\r
54 /** \addtogroup usbd_composite_cdchid\r
55  *@{\r
56  */\r
57 \r
58 /*---------------------------------------------------------------------------\r
59  *         Headers\r
60  *---------------------------------------------------------------------------*/\r
61 \r
62 #include <USBRequests.h>\r
63 #include <CDCDescriptors.h>\r
64 #include <HIDDescriptors.h>\r
65 #include "USBD.h"\r
66 #include <USBDDriver.h>\r
67 \r
68 /*---------------------------------------------------------------------------\r
69  *         Definitions\r
70  *---------------------------------------------------------------------------*/\r
71 \r
72 /** \addtogroup usbd_cdc_hid_desc USB CDC(Serial) + HID(Kbd) Descriptors define\r
73  *      @{\r
74  */\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
81 /**     @}*/\r
82 \r
83 /*---------------------------------------------------------------------------\r
84  *         Types\r
85  *---------------------------------------------------------------------------*/\r
86 #pragma pack(1)\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
93 #endif\r
94 /**\r
95  * \typedef CdcHidDriverConfigurationDescriptors\r
96  * \brief Configuration descriptor list for a device implementing a\r
97  *        composite driver.\r
98  */\r
99 typedef struct _CdcHidDriverConfigurationDescriptors {\r
100 \r
101     /** Standard configuration descriptor. */\r
102     USBConfigurationDescriptor configuration;\r
103 \r
104     /* --- CDC 0 */\r
105     /** IAD 0 */\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
125 \r
126     /* --- HID */\r
127     USBInterfaceDescriptor hidInterface;\r
128     HIDDescriptor1 hid;\r
129     USBEndpointDescriptor hidInterruptIn;\r
130     USBEndpointDescriptor hidInterruptOut;\r
131 \r
132 } __attribute__ ((__packed__)) CdcHidDriverConfigurationDescriptors;\r
133 \r
134 #pragma pack()\r
135 \r
136 /*---------------------------------------------------------------------------\r
137  *         Exported functions\r
138  *---------------------------------------------------------------------------*/\r
139 \r
140 /* -CDCHID */\r
141 extern void CDCHIDDDriver_Initialize(\r
142     const USBDDriverDescriptors * pDescriptors);\r
143 \r
144 extern void CDCHIDDDriver_ConfigurationChangedHandler(uint8_t cfgnum);\r
145 \r
146 extern void CDCHIDDDriver_RequestHandler(const USBGenericRequest *request);\r
147 \r
148 extern void CDCHIDDDriver_RemoteWakeUp(void);\r
149 \r
150 /**@}*/\r
151 #endif //#ifndef CDCHIDDDRIVER_H\r
152 \r