usbhcdc.h
Go to the documentation of this file.
1 //*****************************************************************************
2 //
3 // usbhcdc.h - This hold the host driver for CDC class.
4 //
5 // Copyright (c) 2008-2017 Texas Instruments Incorporated. All rights reserved.
6 // Software License Agreement
7 //
8 // Texas Instruments (TI) is supplying this software for use solely and
9 // exclusively on TI's microcontroller products. The software is owned by
10 // TI and/or its suppliers, and is protected under applicable copyright
11 // laws. You may not combine this software with "viral" open-source
12 // software in order to form a larger program.
13 //
14 // THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS.
15 // NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT
16 // NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
17 // A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY
18 // CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
19 // DAMAGES, FOR ANY REASON WHATSOEVER.
20 //
21 //*****************************************************************************
22 
23 #ifndef __USBHCDC_H__
24 #define __USBHCDC_H__
25 
26 //*****************************************************************************
27 //
28 // If building with a C++ compiler, make all of the definitions in this header
29 // have a C binding.
30 //
31 //*****************************************************************************
32 #ifdef __cplusplus
33 extern "C"
34 {
35 #endif
36 
37 //*****************************************************************************
38 //
41 //
42 //*****************************************************************************
43 
44 typedef struct tCDCInstance tCDCInstance;
45 
46 
47 //*****************************************************************************
48 //
49 // These defines are the the events that will be passed in the \e ui32Event
50 // parameter of the callback from the driver.
51 //
52 //*****************************************************************************
53 #define CDC_EVENT_OPEN 1
54 #define CDC_EVENT_CLOSE 2
55 
56 
57 //*****************************************************************************
58 //
59 // CDC USB requests.
60 //
61 //*****************************************************************************
62 #define USBREQ_GET_LINE_CODING 0x21
63 #define USBREQ_SET_LINE_CODING 0x20
64 #define USBREQ_SET_CONTROL_LINE_STATE 0x22
65 
66 #define USB_GET_LINE_CODING_SIZE 0x07
67 #define CDC_DEACTIVATE_CARRIER 0x00
68 #define CDC_ACTIVATE_CARRIER 0x03
69 
70 
71 //*****************************************************************************
72 //
73 // These defines are the the events that will be passed in the ui32Event
74 // parameter of the callback from the driver.
75 //
76 //*****************************************************************************
77 
78 //
80 //
81 #define USBH_EVENT_RX_CDC_DATA USBH_CDC_EVENT_BASE + 16
82 
83 //
84 // CDC data to send
85 //
86 #define USBH_EVENT_TX_CDC_DATA USBH_CDC_EVENT_BASE + 17
87 
88 //*****************************************************************************
89 //
92 //
93 //*****************************************************************************
94 typedef enum
95 {
96  //
99  //
101 
102  //
104  //
106 
107  //
109  //
111 
112  //
114  //
116 
117  //
119  //
121 
122  //
124  //
126 
127  //
129  //
131 
132  //
134  //
136 
137  //
139  //
141 }
143 
144 //*****************************************************************************
145 //
146 // Prototypes.
147 //
148 //*****************************************************************************
149 extern tCDCInstance * USBHCDCOpen(tCDCSubClassProtocol iDeviceType,
150  tUSBCallback pfnCallback,
151  void *pvCBData);
152 extern void USBHCDCClose(tCDCInstance *psCDCInstance);
153 
154 extern uint32_t USBHCDCSetControlLineState(tCDCInstance *psCDCInstance, uint16_t carrierValue);
155 extern uint32_t USBHCDCSetLineCoding(tCDCInstance *psCDCInstance, uint8_t *pui8Data);
156 extern uint32_t USBHCDCGetLineCoding(tCDCInstance *psCDCInstance, uint8_t *pui8Buffer,
157  uint32_t ui32Size);
158 extern uint32_t USBHCDCReadData(tCDCInstance *psCDCInstance, uint32_t ui32Interface,
159  uint8_t *pui8Data, uint32_t ui32Size);
160 
162 extern uint32_t USBHCDCWriteData(tCDCInstance *psCDCInstance, uint32_t ui32Interface,
163  uint8_t *pui8Data, uint32_t ui32Size);
164 
165 //*****************************************************************************
166 //
167 // Mark the end of the C bindings section for C++ compilers.
168 //
169 //*****************************************************************************
170 #ifdef __cplusplus
171 }
172 #endif
173 #endif
This is a vendor specific device.
Definition: usbhcdc.h:140
This is Ethernet Networking Control device.
Definition: usbhcdc.h:130
This is CAPI control device.
Definition: usbhcdc.h:125
struct tCDCInstance tCDCInstance
Definition: usbhcdc.h:44
tCDCInstance * USBHCDCOpen(tCDCSubClassProtocol iDeviceType, tUSBCallback pfnCallback, void *pvCBData)
Definition: usbhcdc.c:153
tCDCSubClassProtocol
Definition: usbhcdc.h:94
void USBHCDCClose(tCDCInstance *psCDCInstance)
Definition: usbhcdc.c:203
This is ATM Networking control device.
Definition: usbhcdc.h:135
This is multi-channel control device.
Definition: usbhcdc.h:120
uint32_t USBHCDCGetLineCoding(tCDCInstance *psCDCInstance, uint8_t *pui8Buffer, uint32_t ui32Size)
Definition: usbhcdc.c:522
uint32_t USBHCDCSetLineCoding(tCDCInstance *psCDCInstance, uint8_t *pui8Data)
Definition: usbhcdc.c:577
uint32_t USBHCDCSetControlLineState(tCDCInstance *psCDCInstance, uint16_t carrierValue)
Definition: usbhcdc.c:632
This is a direct line control device.
Definition: usbhcdc.h:105
Definition: usbhost.h:156
uint32_t(* tUSBCallback)(void *pvCBData, uint32_t ui32Event, uint32_t ui32MsgParam, void *pvMsgData)
Definition: usblib.h:1220
uint32_t USBHCDCReadData(tCDCInstance *psCDCInstance, uint32_t ui32Interface, uint8_t *pui8Data, uint32_t ui32Size)
Definition: usbhcdc.c:698
const tUSBHostClassDriver g_sUSBCDCClassDriver
Definition: usbhcdc.c:116
This is telephone control device.
Definition: usbhcdc.h:115
This is a abstract control device.
Definition: usbhcdc.h:110
Definition: usbhcdc.h:100
uint32_t USBHCDCWriteData(tCDCInstance *psCDCInstance, uint32_t ui32Interface, uint8_t *pui8Data, uint32_t ui32Size)
Definition: usbhcdc.c:736
Copyright 2018, Texas Instruments Incorporated