PDL for FM4
Version1.2
Peripheral Driverl Library for FM4
Main Page
Modules
Data Structures
Files
File List
Globals
usbdevice.h
Go to the documentation of this file.
1
/*******************************************************************************
2
* Copyright (C) 2013 Spansion LLC. All Rights Reserved.
3
*
4
* This software is owned and published by:
5
* Spansion LLC, 915 DeGuigne Dr. Sunnyvale, CA 94088-3453 ("Spansion").
6
*
7
* BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
8
* BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
9
*
10
* This software contains source code for use with Spansion
11
* components. This software is licensed by Spansion to be adapted only
12
* for use in systems utilizing Spansion components. Spansion shall not be
13
* responsible for misuse or illegal use of this software for devices not
14
* supported herein. Spansion is providing this software "AS IS" and will
15
* not be responsible for issues arising from incorrect user implementation
16
* of the software.
17
*
18
* SPANSION MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
19
* REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS),
20
* ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING,
21
* WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED
22
* WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED
23
* WARRANTY OF NONINFRINGEMENT.
24
* SPANSION SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT,
25
* NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT
26
* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
27
* LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR
28
* INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT,
29
* INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA,
30
* SAVINGS OR PROFITS,
31
* EVEN IF SPANSION HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
32
* YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
33
* INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED
34
* FROM, THE SOFTWARE.
35
*
36
* This software may be replicated in part or whole for the licensed use,
37
* with the restriction that this Disclaimer and Copyright notice must be
38
* included with each copy of this software, whether used in part or whole,
39
* at all times.
40
*/
41
/******************************************************************************/
61
#ifndef __USBDEVICE_H__
62
#define __USBDEVICE_H__
63
64
#include "
usb.h
"
65
66
/******************************************************************************/
67
/* Include files */
68
/******************************************************************************/
69
70
/* C binding of definitions if building with C++ compiler */
71
#ifdef __cplusplus
72
extern
"C"
73
{
74
#endif
75
96
97
98
99
#define USBDEVICE_MAXCLASSES 5
100
110
typedef
void (*
usbdevice_setuprequest_func_ptr_t
)(stc_usbn_t* pstcUsb,
stc_usb_request_t
* pstcSetup);
111
121
typedef
void (*
usbdevice_controltranfered_func_ptr_t
)(stc_usbn_t* pstcUsb,
stc_usbn_endpoint_data_t
* pstcEndpoint);
122
130
typedef
void (*
usbdevice_initclasses_func_ptr_t
)(stc_usbn_t* pstcUsb);
131
132
133
141
typedef
struct
stc_usbdevice_class_config
142
{
143
uint8_t
u8InterfaceNumber
;
144
uint8_t
u8InterfaceClass
;
145
uint8_t
u8InterfaceSubClass
;
146
uint8_t
u8InterfaceProtocoll
;
147
usbdevice_setuprequest_func_ptr_t
pfnSetupRequestCallback
;
148
usb_connect_func_ptr_t
pfnConnectionCallback
;
149
usb_disconnect_func_ptr_t
pfnDisconnectionCallback
;
150
usb_conf_isr_func_ptr_t
pfnConfCallback
;
151
}
stc_usbdevice_class_config_t
;
152
160
typedef
struct
stc_usbdevice_intern_data
161
{
162
uint8_t
u8Dummy
;
163
en_usb_status_t
enStatus
;
164
uint8_t*
pu8DeviceDescriptor
;
165
uint8_t*
pu8ConfigDescriptor
;
166
stc_usbdevice_reportdescriptor_t
*
astcReportDescriptors
;
167
stc_usbdevice_stringdescriptor_t
*
pstcStringDescriptors
;
168
uint8_t
u8StringDescriptorCount
;
169
stc_usbn_endpoint_data_t
*
pstcEp0OUT
;
170
stc_usbn_endpoint_data_t
*
pstcEp0IN
;
171
en_usb_control_stage_t
enControlStage
;
172
uint8_t
pu8ControlReceiveBuffer
[64];
173
stc_usbn_endpoint_buffer_t
stcEndpointBuffer
;
174
stc_usbdevice_class_config_t
stcUsbClasses
[
USBDEVICE_MAXCLASSES
];
175
usbdevice_initclasses_func_ptr_t
pfnInitClassesCallback
;
176
usbdevice_controltranfered_func_ptr_t
pfnControlTransferred
;
177
volatile
uint8_t*
pu8LastControlTransfer
;
178
}
stc_usbdevice_intern_data_t
;
179
185
typedef
struct
stc_usbdevice_config
186
{
187
uint8_t*
pu8DeviceDescriptor
;
188
uint8_t*
pu8ConfigDescriptor
;
189
stc_usbdevice_reportdescriptor_t
*
astcReportDescriptors
;
190
stc_usbdevice_stringdescriptor_t
*
pstcStringDescriptors
;
191
uint8_t
u8StringDescriptorCount
;
192
usbdevice_initclasses_func_ptr_t
pfnInitClassesCallback
;
193
}
stc_usbdevice_config_t
;
194
195
201
typedef
struct
stc_usbdevice_endpoint_config
202
{
203
uint8_t
u8EndpointAddress
;
204
volatile
usb_endpoint_datatransferred_func_ptr_t
pfnRxTxCallback
;
205
stc_usbn_endpoint_buffer_t
*
pstcEndpointBuffer
;
206
}
stc_usbdevice_endpoint_config_t
;
207
208
209
215
typedef
struct
stc_usbdevicen_instance_data
216
{
217
volatile
stc_usbn_t*
pstcInstance
;
218
stc_usbdevice_intern_data_t
stcInternData
;
219
}
stc_usbdevicen_instance_data_t
;
220
226
typedef
enum
en_usbsend_mode
227
{
228
UsbPOLL
= 0,
229
UsbIRQ
= 1,
230
UsbDMA
= 2,
231
}
en_usbsend_mode_t
;
232
233
234
235
236
en_result_t
UsbDevice_ReceiveData
(stc_usbn_t* pstcUsb,
stc_usbn_endpoint_data_t
* pstcEndpoint, uint8_t* pu8Buffer, uint32_t u32DataSize,
en_usbsend_mode_t
enMode);
237
238
en_result_t
UsbDevice_SendData
(stc_usbn_t* pstcUsb,
stc_usbn_endpoint_data_t
* pstcEndpoint, uint8_t* pu8Buffer, uint32_t u32DataSize,
en_usbsend_mode_t
enMode);
239
240
void
UsbDevice_SendDataControl
(stc_usbn_t * pstcUsb,uint8_t* pu8Buffer, uint32_t u32DataLength);
241
242
void
UsbDevice_ReceiveDataControl
(stc_usbn_t * pstcUsb,
usbdevice_controltranfered_func_ptr_t
pfnCompletionCallback);
243
244
en_result_t
UsbDevice_RegisterVendorClass
(stc_usbn_t* pstcUsb,
stc_usbdevice_class_config_t
* pstcUsbClassConfig, uint8_t** ppu8Buffer, uint8_t* pu8InterfaceLength);
245
246
en_usb_status_t
UsbDevice_GetStatus
(stc_usbn_t* pstcUsb);
247
248
en_usb_endpoint_status_t
UsbDevice_HalEndpointStatus
(
stc_usbn_endpoint_data_t
* pstcEpHandle);
249
250
void
UsbDevice_InitCallback
(stc_usbn_t* pstcUsb,
stc_usb_config_t
* pstcUsbConfig);
251
252
void
UsbDevice_Init
(stc_usbn_t* pstcUsb,
stc_usb_config_t
* pstcUsbConfig,
stc_usbdevice_config_t
* pstcConfig);
253
254
stc_usbn_endpoint_data_t
*
UsbDevice_SetupEndpoint
(stc_usbn_t* pstcUsb,
stc_usbdevice_endpoint_config_t
* pstcConfig);
255
256
#define UsbDevice_HalEndpointStatus(x) Usb_HalEndpointStatus(x)
257
258
#define UsbDevice_HalEndpointIsBusy(x) Usb_HalEndpointIsBusy(x)
259
260
#define UsbDevice_HalStallEndpoint(x) Usb_HalStallEndpoint(x)
261
262
#define UsbDevice_HalUnstallEndpoint(x) Usb_HalUnstallEndpoint(x)
263
264
#if (L3_PERIPHERAL_ENABLE_USB0 == L3_ON)
265
void
UsbDevice_Usb0ExintCallback
(
void
);
266
#endif
267
#if (L3_PERIPHERAL_ENABLE_USB1 == L3_ON)
268
void
UsbDevice_Usb1ExintCallback
(
void
);
269
#endif
270
#ifdef __cplusplus
271
}
272
#endif
273
274
#endif
PDL_1_2
library
driver
usb
usbdevice.h
Generated on Wed May 28 2014 09:28:11 for PDL for FM4 by
1.8.3.1