CDCDSerialDriver.c
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 
41 /*------------------------------------------------------------------------------
42  * Headers
43  *------------------------------------------------------------------------------*/
44 
45 #include "CDCDSerialDriver.h"
46 
47 #include <USBLib_Trace.h>
48 #include <USBDDriver.h>
49 #include <USBD_HAL.h>
50 
51 /*------------------------------------------------------------------------------
52  * Types
53  *------------------------------------------------------------------------------*/
54 
55 /*------------------------------------------------------------------------------
56  * Internal variables
57  *------------------------------------------------------------------------------*/
58 
59 /*------------------------------------------------------------------------------
60  * Internal functions
61  *------------------------------------------------------------------------------*/
62 
63 /*------------------------------------------------------------------------------
64  * Exported functions
65  *------------------------------------------------------------------------------*/
66 
72 {
73  USBDDriver *pUsbd = USBD_GetDriver();
74 
75  /* Initialize the standard driver */
77  pDescriptors,
78  0); /* Multiple settings for interfaces not supported */
79 
81 
82  /* Initialize the USB driver */
83  USBD_Init();
84 }
85 
92 {
93  USBDDriver *pUsbd = USBD_GetDriver();
94  USBConfigurationDescriptor *pDesc;
95 
96  if (cfgnum) {
97  pDesc = USBDDriver_GetCfgDescriptors(pUsbd, cfgnum);
98  CDCDSerial_ConfigureFunction((USBGenericDescriptor *)pDesc,
99  pDesc->wTotalLength);
100  }
101 }
102 
109 {
110  USBDDriver *pUsbd = USBD_GetDriver();
111  TRACE_INFO_WP("NewReq ");
112 
113  if (CDCDSerial_RequestHandler(request))
114  USBDDriver_RequestHandler(pUsbd, request);
115 }
116 
void CDCDSerial_Initialize(USBDDriver *pUsbd, uint8_t bInterfaceNb)
Definition: CDCDSerial.c:108
uint32_t CDCDSerial_RequestHandler(const USBGenericRequest *request)
Definition: CDCDSerial.c:144
void CDCDSerialDriver_RequestHandler(const USBGenericRequest *request)
void USBDDriver_RequestHandler(USBDDriver *pDriver, const USBGenericRequest *pRequest)
Definition: USBDDriver.c:609
#define CDCDSerialDriver_CC_INTERFACE
USBConfigurationDescriptor * USBDDriver_GetCfgDescriptors(USBDDriver *pDriver, uint8_t cfgNum)
Definition: USBDDriver.c:587
void CDCDSerialDriver_ConfigurationChangedHandler(uint8_t cfgnum)
void CDCDSerial_ConfigureFunction(USBGenericDescriptor *pDescriptors, uint16_t wLength)
Definition: CDCDSerial.c:129
void CDCDSerialDriver_Initialize(const USBDDriverDescriptors *pDescriptors)
USBDDriver * USBD_GetDriver(void)
Definition: USBDDriver.c:549
void USBD_Init(void)
Definition: USBD.c:518
void USBDDriver_Initialize(USBDDriver *pDriver, const USBDDriverDescriptors *pDescriptors, uint8_t *pInterfaces)
Definition: USBDDriver.c:563
#define TRACE_INFO_WP(...)
Definition: USBLib_Trace.h:167


inertial_sense_ros
Author(s):
autogenerated on Sat Sep 19 2020 03:19:04