Line No. | Rev | Author | Line |
---|---|---|---|
1 | 32 | kaklik | /****************************************************************************** |
2 | |||
3 | USB Host Communication Device Class(CDC) Interface header file |
||
4 | |||
5 | This file provides all the interface functions to the CDC host client driver. |
||
6 | This file should be used in a project with usb_host_cdc.h to provide access |
||
7 | to CDC host. |
||
8 | |||
9 | Acronyms/abbreviations used by this class: |
||
10 | * CDC - Communication Device Class |
||
11 | * ACM - Abstract Control Module |
||
12 | |||
13 | This file provides interface functions for USB CDC host to the application. |
||
14 | These interface function can be used to set up transfers with the device attached |
||
15 | on the bus. Interface function USBHostCDC_Api_Get_IN_Data can be used to set up |
||
16 | transfer request to receive data from the device.Interface function |
||
17 | USBHostCDC_Api_Send_OUT_Data can be used to set up transfer request to send |
||
18 | data to the device. If USB_ENABLE_TRANSFER_EVENT is defined application will receive |
||
19 | an event on completion of transfer request otherwise application can poll the status |
||
20 | of transfer using function USBHostCDC_ApiTransferIsComplete. This file also provides |
||
21 | interface routine for ACM class specific requests in function USBHostCDC_Api_ACM_Request. |
||
22 | |||
23 | *******************************************************************************/ |
||
24 | //DOM-IGNORE-BEGIN |
||
25 | /******************************************************************************* |
||
26 | |||
27 | * FileName: usb_host_cdc_interface.h |
||
28 | * Dependencies: None |
||
29 | * Processor: PIC24/dsPIC30/dsPIC33/PIC32MX |
||
30 | * Compiler: C30 v2.01/C32 v0.00.18 |
||
31 | * Company: Microchip Technology, Inc. |
||
32 | |||
33 | Software License Agreement |
||
34 | |||
35 | The software supplied herewith by Microchip Technology Incorporated |
||
36 | (the Company) for its PICmicro® Microcontroller is intended and |
||
37 | supplied to you, the Companys customer, for use solely and |
||
38 | exclusively on Microchip PICmicro Microcontroller products. The |
||
39 | software is owned by the Company and/or its supplier, and is |
||
40 | protected under applicable copyright laws. All rights are reserved. |
||
41 | Any use in violation of the foregoing restrictions may subject the |
||
42 | user to criminal sanctions under applicable laws, as well as to |
||
43 | civil liability for the breach of the terms and conditions of this |
||
44 | license. |
||
45 | |||
46 | THIS SOFTWARE IS PROVIDED IN AN AS IS CONDITION. NO WARRANTIES, |
||
47 | WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED |
||
48 | TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A |
||
49 | PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT, |
||
50 | IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR |
||
51 | CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. |
||
52 | |||
53 | Change History: |
||
54 | Rev Description |
||
55 | ----- -------------------------------------------- |
||
56 | 2.6a No change |
||
57 | |||
58 | 2.7 Modified the code to allow connection of USB-RS232 dongles that do |
||
59 | not fully comply with CDC specifications |
||
60 | |||
61 | Modified API USBHostCDC_Api_Send_OUT_Data to allow data transfers |
||
62 | more than 256 bytes |
||
63 | |||
64 | 2.7a No change |
||
65 | *******************************************************************************/ |
||
66 | //DOM-IGNORE-END |
||
67 | |||
68 | //DOM-IGNORE-BEGIN |
||
69 | #ifndef _USB_HOST_CDC_INTERFACE_H_ |
||
70 | #define _USB_HOST_CDC_INTERFACE_H_ |
||
71 | //DOM-IGNORE-END |
||
72 | |||
73 | // ***************************************************************************** |
||
74 | // ***************************************************************************** |
||
75 | // Section: Constants |
||
76 | // ***************************************************************************** |
||
77 | // ***************************************************************************** |
||
78 | |||
79 | //****************************************************************************** |
||
80 | //****************************************************************************** |
||
81 | // Data Structures |
||
82 | //****************************************************************************** |
||
83 | //****************************************************************************** |
||
84 | |||
85 | // ***************************************************************************** |
||
86 | // Section: Function Prototypes |
||
87 | // ***************************************************************************** |
||
88 | |||
89 | /**************************************************************************** |
||
90 | Function: |
||
91 | BOOL USBHostCDC_Api_Get_IN_Data(BYTE no_of_bytes, BYTE* data) |
||
92 | |||
93 | Description: |
||
94 | This function is called by application to receive Input data over DATA |
||
95 | interface. This function setsup the request to receive data from the device. |
||
96 | |||
97 | Precondition: |
||
98 | None |
||
99 | |||
100 | Parameters: |
||
101 | BYTE no_of_bytes - Number of Bytes expected from the device. |
||
102 | BYTE* data - Pointer to application receive data buffer. |
||
103 | |||
104 | Return Values: |
||
105 | TRUE - Transfer request is placed successfully. |
||
106 | FALSE - Transfer request failed. |
||
107 | |||
108 | Remarks: |
||
109 | None |
||
110 | ***************************************************************************/ |
||
111 | BOOL USBHostCDC_Api_Get_IN_Data(BYTE no_of_bytes, BYTE* data); |
||
112 | |||
113 | /**************************************************************************** |
||
114 | Function: |
||
115 | BOOL USBHostCDC_Api_Send_OUT_Data(WORD no_of_bytes, BYTE* data) |
||
116 | |||
117 | Description: |
||
118 | This function is called by application to transmit out data over DATA |
||
119 | interface. This function setsup the request to transmit data to the |
||
120 | device. |
||
121 | |||
122 | Precondition: |
||
123 | None |
||
124 | |||
125 | Parameters: |
||
126 | BYTE no_of_bytes - Number of Bytes expected from the device. |
||
127 | BYTE* data - Pointer to application transmit data buffer. |
||
128 | |||
129 | |||
130 | Return Values: |
||
131 | TRUE - Transfer request is placed successfully. |
||
132 | FALSE - Transfer request failed. |
||
133 | |||
134 | Remarks: |
||
135 | None |
||
136 | ***************************************************************************/ |
||
137 | BOOL USBHostCDC_Api_Send_OUT_Data(WORD no_of_bytes, BYTE* data); |
||
138 | |||
139 | /**************************************************************************** |
||
140 | Function: |
||
141 | BOOL USBHostCDC_ApiTransferIsComplete(BYTE* errorCodeDriver,BYTE* byteCount) |
||
142 | |||
143 | Description: |
||
144 | This function is called by application to poll for transfer status. This |
||
145 | function returns true in the transfer is over. To check whether the transfer |
||
146 | was successfull or not , application must check the error code returned by |
||
147 | reference. |
||
148 | |||
149 | Precondition: |
||
150 | None |
||
151 | |||
152 | Parameters: |
||
153 | BYTE *errorCodeDriver - returns. |
||
154 | BYTE *byteCount - Number of bytes transferred. |
||
155 | |||
156 | |||
157 | Return Values: |
||
158 | TRUE - Transfer is has completed. |
||
159 | FALSE - Transfer is pending. |
||
160 | |||
161 | Remarks: |
||
162 | None |
||
163 | ***************************************************************************/ |
||
164 | BOOL USBHostCDC_ApiTransferIsComplete(BYTE* errorCodeDriver, BYTE* byteCount ); |
||
165 | |||
166 | /******************************************************************************* |
||
167 | Function: |
||
168 | BOOL USBHostCDC_ApiDeviceDetect( void ) |
||
169 | |||
170 | Description: |
||
171 | This function determines if a CDC device is attached |
||
172 | and ready to use. |
||
173 | |||
174 | Precondition: |
||
175 | None |
||
176 | |||
177 | Parameters: |
||
178 | None |
||
179 | |||
180 | Return Values: |
||
181 | TRUE - CDC present and ready |
||
182 | FALSE - CDC not present or not ready |
||
183 | |||
184 | Remarks: |
||
185 | Since this will often be called in a loop while waiting for |
||
186 | a device, we'll make sure the tasks are executed. |
||
187 | *******************************************************************************/ |
||
188 | BOOL USBHostCDC_ApiDeviceDetect( void ); |
||
189 | |||
190 | |||
191 | /******************************************************************************* |
||
192 | Function: |
||
193 | BYTE USBHostCDC_Api_ACM_Request(BYTE requestType, BYTE size, BYTE* data) |
||
194 | |||
195 | Description: |
||
196 | This function can be used by application code to dynamically access ACM specific |
||
197 | requests. This function should be used only if apllication intends to modify for |
||
198 | example the Baudrate from previouly configured rate. Data transmitted/received |
||
199 | to/from device is a array of bytes. Application must take extra care of understanding |
||
200 | the data format before using this function. |
||
201 | |||
202 | Precondition: |
||
203 | Device must be enumerated and attached successfully. |
||
204 | |||
205 | Parameters: |
||
206 | BYTE requestType These are the mandatory CDC request supported by the |
||
207 | CDC host stack. |
||
208 | - USB_CDC_SEND_ENCAPSULATED_COMMAND |
||
209 | - USB_CDC_GET_ENCAPSULATED_REQUEST |
||
210 | - USB_CDC_SET_LINE_CODING |
||
211 | - USB_CDC_SET_CONTROL_LINE_STATE |
||
212 | - USB_CDC_SET_CONTROL_LINE_STATE |
||
213 | BYTE size - Number bytes to be transferred. |
||
214 | BYTE *data - Pointer to data being transferred. |
||
215 | |||
216 | Return Values: |
||
217 | USB_SUCCESS - Request started successfully |
||
218 | USB_CDC_DEVICE_NOT_FOUND - No device with specified address |
||
219 | USB_CDC_DEVICE_BUSY - Device not in proper state for |
||
220 | performing a transfer |
||
221 | USB_CDC_COMMAND_FAILED - Request is not supported. |
||
222 | USB_CDC_ILLEGAL_REQUEST - Requested ID is invalid. |
||
223 | |||
224 | Remarks: |
||
225 | None |
||
226 | *******************************************************************************/ |
||
227 | BYTE USBHostCDC_Api_ACM_Request(BYTE requestType, BYTE size, BYTE* data); |
||
228 | |||
229 | #endif /* _USB_HOST_CDC_INTERFACE_H_ */ |
Powered by WebSVN v2.8.3