CDCDSerialPort.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 
35 #ifndef _CDCDSERIALPORT_H_
36 #define _CDCDSERIALPORT_H_
37 
38 /*------------------------------------------------------------------------------
39  * Headers
40  *------------------------------------------------------------------------------*/
41 
42 /* These headers were introduced in C99
43  by working group ISO/IEC JTC1/SC22/WG14. */
44 #include <stdint.h>
45 
46 #include <USBRequests.h>
47 #include <CDCRequests.h>
48 #include <CDCNotifications.h>
49 #include "USBD.h"
50 #include <USBDDriver.h>
55 /*------------------------------------------------------------------------------
56  * Defines
57  *------------------------------------------------------------------------------*/
58 
63 #define CDCDSerialPort_INTERRUPT_MAXPACKETSIZE 8
64 
65 #define CDCDSerialPort_INTERRUPT_INTERVAL_HS 8
66 
67 #define CDCDSerialPort_INTERRUPT_INTERVAL_FS 16
68 
69 #define CDCDSerialPort_BULK_MAXPACKETSIZE_HS 512
70 
71 #define CDCDSerialPort_BULK_MAXPACKETSIZE_FS 64
72 
78 #define CDCDSerialPortEvent_SETCONTROLLINESTATE 0
79 
80 #define CDCDSerialPortEvent_SETLINECODING 1
81 
83 /*------------------------------------------------------------------------------
84  * Types
85  *------------------------------------------------------------------------------*/
86 
88 typedef uint32_t (*CDCDSerialPortEventHandler)(uint32_t dwEvent,
89  uint32_t dwParam,
90  void * pArguments);
91 
95 typedef struct _CDCDSerialPort {
101  void *pEventArg;
105  void *pTansArg;
107  uint8_t bInterfaceNdx;
109  uint8_t bNumInterface;
111  uint8_t bIntInPIPE;
113  uint8_t bBulkInPIPE;
115  uint8_t bBulkOutPIPE;
116 
120  uint16_t wSerialState;
122  CDCLineCoding lineCoding;
123 
124  uint8_t bReserved;
126 
127 /*------------------------------------------------------------------------------
128  * Functions
129  *------------------------------------------------------------------------------*/
130 
131 extern void CDCDSerialPort_Initialize(CDCDSerialPort *pCdcd,
132  USBDDriver *pUsbd,
133  CDCDSerialPortEventHandler fCallback,
134  void *pArg,
135  uint8_t firstInterface,
136  uint8_t numInterface);
137 
138 extern USBGenericDescriptor * CDCDSerialPort_ParseInterfaces(
139  CDCDSerialPort * pCdcd,
140  USBGenericDescriptor * pDescriptors, uint32_t dwLength);
141 
142 extern uint32_t CDCDSerialPort_RequestHandler(
143  CDCDSerialPort *pCdcd,
144  const USBGenericRequest *pRequest);
145 
146 extern uint32_t CDCDSerialPort_Write(
147  CDCDSerialPort *pCdcd,
148  void *pData, uint32_t dwSize,
149  TransferCallback fCallback, void* pArg);
150 
151 extern uint32_t CDCDSerialPort_Read(
152  const CDCDSerialPort *pCdcd,
153  void *pData, uint32_t dwSize,
154  TransferCallback fCallback, void* pArg);
155 
156 extern uint16_t CDCDSerialPort_GetSerialState(
157  const CDCDSerialPort *pCdcd);
158 
160  CDCDSerialPort *pCdcd,
161  uint16_t wSerialState);
162 
164  const CDCDSerialPort * pCdcd);
165 
166 extern void CDCDSerialPort_GetLineCoding(
167  const CDCDSerialPort * pCdcd,
168  CDCLineCoding * pLineCoding);
169 
171 #endif /* #ifndef _CDCDSERIALPORT_H_ */
uint32_t CDCDSerialPort_Write(CDCDSerialPort *pCdcd, void *pData, uint32_t dwSize, TransferCallback fCallback, void *pArg)
uint16_t CDCDSerialPort_GetSerialState(const CDCDSerialPort *pCdcd)
uint16_t wSerialState
void CDCDSerialPort_SetSerialState(CDCDSerialPort *pCdcd, uint16_t wSerialState)
uint32_t CDCDSerialPort_RequestHandler(CDCDSerialPort *pCdcd, const USBGenericRequest *request)
USBDDriver * pUsbd
uint8_t CDCDSerialPort_GetControlLineState(const CDCDSerialPort *pCdcd)
void CDCDSerialPort_Initialize(CDCDSerialPort *pCdcd, USBDDriver *pUsbd, CDCDSerialPortEventHandler fEventHandler, void *pArg, uint8_t firstInterface, uint8_t numInterface)
CDCDSerialPortEventHandler fEventHandler
void(* TransferCallback)(void *pArg, uint8_t status, uint32_t transferred, uint32_t remaining)
Definition: USBD.h:200
void CDCDSerialPort_GetLineCoding(const CDCDSerialPort *pCdcd, CDCLineCoding *pLineCoding)
uint32_t(* CDCDSerialPortEventHandler)(uint32_t dwEvent, uint32_t dwParam, void *pArguments)
uint8_t bControlLineState
TransferCallback fTransCLK
USBGenericDescriptor * CDCDSerialPort_ParseInterfaces(CDCDSerialPort *pCdcd, USBGenericDescriptor *pDescriptors, uint32_t dwLength)
CDCLineCoding lineCoding
struct _CDCDSerialPort CDCDSerialPort
uint32_t CDCDSerialPort_Read(const CDCDSerialPort *pCdcd, void *pData, uint32_t dwSize, TransferCallback fCallback, void *pArg)


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