CDCDSerialDriver.h
Go to the documentation of this file.
1 /* ---------------------------------------------------------------------------- */
2 /* Atmel Microcontroller Software Support */
3 /* SAM Software Package License */
4 /* ---------------------------------------------------------------------------- */
5 /* Copyright (c) 2015, Atmel Corporation */
6 /* */
7 /* All rights reserved. */
8 /* */
9 /* Redistribution and use in source and binary forms, with or without */
10 /* modification, are permitted provided that the following condition is met: */
11 /* */
12 /* - Redistributions of source code must retain the above copyright notice, */
13 /* this list of conditions and the disclaimer below. */
14 /* */
15 /* Atmel's name may not be used to endorse or promote products derived from */
16 /* this software without specific prior written permission. */
17 /* */
18 /* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR */
19 /* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
20 /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE */
21 /* DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, */
22 /* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */
23 /* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, */
24 /* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
25 /* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING */
26 /* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */
27 /* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
28 /* ---------------------------------------------------------------------------- */
29 
49 #ifndef CDCDSERIALDRIVER_H
50 #define CDCDSERIALDRIVER_H
51 
56 /*------------------------------------------------------------------------------
57  * Headers
58  *------------------------------------------------------------------------------*/
59 
60 /* These headers were introduced in C99
61  by working group ISO/IEC JTC1/SC22/WG14. */
62 #include <stdint.h>
63 
64 #include <USBRequests.h>
65 #include <CDCRequests.h>
66 #include <CDCDescriptors.h>
67 #include <CDCNotifications.h>
68 
69 #include <CDCDSerial.h>
70 
71 /*------------------------------------------------------------------------------
72  * Definitions
73  *------------------------------------------------------------------------------*/
74 
79 #define CDCDSerialDriver_CC_INTERFACE 0
80 
81 #define CDCDSerialDriver_DC_INTERFACE 1
82 
84 /*------------------------------------------------------------------------------
85  * Types
86  *------------------------------------------------------------------------------*/
87 #pragma pack(1)
88 #if defined ( __CC_ARM ) /* Keil ¦̀Vision 4 */
89 #elif defined ( __ICCARM__ ) /* IAR Ewarm */
90 #define __attribute__(...)
91 #define __packed__ packed
92 #elif defined ( __GNUC__ ) /* GCC CS3 */
93 #define __packed__ aligned(1)
94 #endif
95 
102 
104  USBConfigurationDescriptor configuration;
106  USBInterfaceDescriptor communication;
108  CDCHeaderDescriptor header;
110  CDCCallManagementDescriptor callManagement;
112  CDCAbstractControlManagementDescriptor abstractControlManagement;
114  CDCUnionDescriptor union1;
116  USBEndpointDescriptor notification;
118  USBInterfaceDescriptor data;
120  USBEndpointDescriptor dataOut;
122  USBEndpointDescriptor dataIn;
123 
124 } __attribute__ ((__packed__)) CDCDSerialDriverConfigurationDescriptors;
125 
132 
134  USBConfigurationDescriptor configuration;
135  /* OTG descriptor */
136  USBOtgDescriptor otgDescriptor;
138  USBInterfaceDescriptor communication;
140  CDCHeaderDescriptor header;
142  CDCCallManagementDescriptor callManagement;
144  CDCAbstractControlManagementDescriptor abstractControlManagement;
146  CDCUnionDescriptor union1;
148  USBEndpointDescriptor notification;
150  USBInterfaceDescriptor data;
152  USBEndpointDescriptor dataOut;
154  USBEndpointDescriptor dataIn;
155 
156 } __attribute__ ((__packed__)) CDCDSerialDriverConfigurationDescriptorsOTG;
157 
158 #pragma pack()
159 
160 /*------------------------------------------------------------------------------
161  * Exported functions
162  *------------------------------------------------------------------------------*/
163 
164 extern void CDCDSerialDriver_Initialize(
165  const USBDDriverDescriptors *pDescriptors);
166 
167 extern void CDCDSerialDriver_ConfigurationChangedHandler(uint8_t cfgnum);
168 
170  const USBGenericRequest *request);
171 
183 static inline uint32_t CDCDSerialDriver_Write(
184  void *data,
185  uint32_t size,
186  TransferCallback callback,
187  void *argument)
188 {
189  return CDCDSerial_Write(data, size, callback, argument);
190 }
191 
203 static inline uint32_t CDCDSerialDriver_Read(
204  void *data,
205  uint32_t size,
206  TransferCallback callback,
207  void *argument)
208 {
209  return CDCDSerial_Read(data, size, callback, argument);
210 }
211 
216 static inline void CDCDSerialDriver_GetLineCoding(CDCLineCoding * pLineCoding)
217 {
218  CDCDSerial_GetLineCoding(pLineCoding);
219 }
220 
224 static inline uint8_t CDCDSerialDriver_GetControlLineState(void)
225 {
227 }
228 
232 static inline uint16_t CDCDSerialDriver_GetSerialState(void)
233 {
234  return CDCDSerial_GetSerialState();
235 }
236 
241 static inline void CDCDSerialDriver_SetSerialState(uint16_t serialState)
242 {
243  CDCDSerial_SetSerialState(serialState);
244 }
245 
248 #endif /*#ifndef CDCSERIALDRIVER_H*/
249 
void CDCDSerial_GetLineCoding(CDCLineCoding *pLineCoding)
Definition: CDCDSerial.c:208
static void CDCDSerialDriver_GetLineCoding(CDCLineCoding *pLineCoding)
static uint32_t CDCDSerialDriver_Read(void *data, uint32_t size, TransferCallback callback, void *argument)
static uint16_t CDCDSerialDriver_GetSerialState(void)
CDCCallManagementDescriptor callManagement
static uint8_t CDCDSerialDriver_GetControlLineState(void)
uint16_t CDCDSerial_GetSerialState(void)
Definition: CDCDSerial.c:218
static uint32_t CDCDSerialDriver_Write(void *data, uint32_t size, TransferCallback callback, void *argument)
void CDCDSerialDriver_RequestHandler(const USBGenericRequest *request)
uint32_t CDCDSerial_Write(void *data, uint32_t size, TransferCallback callback, void *argument)
Definition: CDCDSerial.c:184
struct _CDCDSerialDriverConfigurationDescriptors __attribute__((__packed__)) CDCDSerialDriverConfigurationDescriptors
static void CDCDSerialDriver_SetSerialState(uint16_t serialState)
void CDCDSerialDriver_ConfigurationChangedHandler(uint8_t cfgnum)
void(* TransferCallback)(void *pArg, uint8_t status, uint32_t transferred, uint32_t remaining)
Definition: USBD.h:200
CDCAbstractControlManagementDescriptor abstractControlManagement
void CDCDSerialDriver_Initialize(const USBDDriverDescriptors *pDescriptors)
USBConfigurationDescriptor configuration
uint32_t CDCDSerial_Read(void *data, uint32_t size, TransferCallback callback, void *argument)
Definition: CDCDSerial.c:163
CDCAbstractControlManagementDescriptor abstractControlManagement
uint8_t CDCDSerial_GetControlLineState(void)
Definition: CDCDSerial.c:197
void CDCDSerial_SetSerialState(uint16_t serialState)
Definition: CDCDSerial.c:229


inertial_sense_ros
Author(s):
autogenerated on Sun Feb 28 2021 03:17:57