PDL for FM4  Version1.2
Peripheral Driverl Library for FM4
USB Device Mode Functionality

Data Structures

struct  stc_usbdevice_class_config
 USB device class configuration. More...
 
struct  stc_usbdevice_intern_data
 USB device class configuration. More...
 
struct  stc_usbdevice_config
 USB device configuration. More...
 
struct  stc_usbdevice_endpoint_config
 USB device endpoint configuration. More...
 
struct  stc_usbdevicen_instance_data
 USB device instance. More...
 

Macros

#define USBDEVICE_MAXCLASSES   5
 
#define UsbDevice_HalEndpointStatus(x)   Usb_HalEndpointStatus(x)
 
#define UsbDevice_HalEndpointIsBusy(x)   Usb_HalEndpointIsBusy(x)
 
#define UsbDevice_HalStallEndpoint(x)   Usb_HalStallEndpoint(x)
 
#define UsbDevice_HalUnstallEndpoint(x)   Usb_HalUnstallEndpoint(x)
 

Typedefs

typedef void(* usbdevice_setuprequest_func_ptr_t )(stc_usbn_t *pstcUsb, stc_usb_request_t *pstcSetup)
 setup request callback handle More...
 
typedef void(* usbdevice_controltranfered_func_ptr_t )(stc_usbn_t *pstcUsb, stc_usbn_endpoint_data_t *pstcEndpoint)
 control data transferred More...
 
typedef void(* usbdevice_initclasses_func_ptr_t )(stc_usbn_t *pstcUsb)
 init class callback More...
 
typedef struct
stc_usbdevice_class_config 
stc_usbdevice_class_config_t
 USB device class configuration. More...
 
typedef struct
stc_usbdevice_intern_data 
stc_usbdevice_intern_data_t
 USB device class configuration. More...
 
typedef struct stc_usbdevice_config stc_usbdevice_config_t
 USB device configuration. More...
 
typedef struct
stc_usbdevice_endpoint_config 
stc_usbdevice_endpoint_config_t
 USB device endpoint configuration. More...
 
typedef struct
stc_usbdevicen_instance_data 
stc_usbdevicen_instance_data_t
 USB device instance. More...
 
typedef enum en_usbsend_mode en_usbsend_mode_t
 USB device sending mode. More...
 

Enumerations

enum  en_usbsend_mode {
  UsbPOLL = 0,
  UsbIRQ = 1,
  UsbDMA = 2
}
 USB device sending mode. More...
 

Functions

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)
 
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)
 
void UsbDevice_SendDataControl (stc_usbn_t *pstcUsb, uint8_t *pu8Buffer, uint32_t u32DataLength)
 
void UsbDevice_ReceiveDataControl (stc_usbn_t *pstcUsb, usbdevice_controltranfered_func_ptr_t pfnCompletionCallback)
 
en_result_t UsbDevice_RegisterVendorClass (stc_usbn_t *pstcUsb, stc_usbdevice_class_config_t *pstcUsbClassConfig, uint8_t **ppu8Buffer, uint8_t *pu8InterfaceLength)
 
en_usb_status_t UsbDevice_GetStatus (stc_usbn_t *pstcUsb)
 
en_usb_endpoint_status_t UsbDevice_HalEndpointStatus (stc_usbn_endpoint_data_t *pstcEpHandle)
 
void UsbDevice_InitCallback (stc_usbn_t *pstcUsb, stc_usb_config_t *pstcUsbConfig)
 
void UsbDevice_Init (stc_usbn_t *pstcUsb, stc_usb_config_t *pstcUsbConfig, stc_usbdevice_config_t *pstcConfig)
 
stc_usbn_endpoint_data_t * UsbDevice_SetupEndpoint (stc_usbn_t *pstcUsb, stc_usbdevice_endpoint_config_t *pstcConfig)
 
void UsbDevice_Usb0ExintCallback (void)
 
void UsbDevice_Usb1ExintCallback (void)
 

Detailed Description

Provided functions of USB module:

Used to transfer data with EP0..EP5, to do enumeration process and support different USB class drivers.

Macro Definition Documentation

#define UsbDevice_HalEndpointIsBusy (   x)    Usb_HalEndpointIsBusy(x)

Definition at line 258 of file usbdevice.h.

#define UsbDevice_HalEndpointStatus (   x)    Usb_HalEndpointStatus(x)

Definition at line 256 of file usbdevice.h.

#define UsbDevice_HalStallEndpoint (   x)    Usb_HalStallEndpoint(x)

Definition at line 260 of file usbdevice.h.

#define UsbDevice_HalUnstallEndpoint (   x)    Usb_HalUnstallEndpoint(x)

Definition at line 262 of file usbdevice.h.

#define USBDEVICE_MAXCLASSES   5

Definition at line 99 of file usbdevice.h.

Typedef Documentation

USB device sending mode.

USB device class configuration.

used to setup USB classes

USB device configuration.

USB device endpoint configuration.

USB device class configuration.

used to setup USB classes

USB device instance.

typedef void(* usbdevice_controltranfered_func_ptr_t)(stc_usbn_t *pstcUsb, stc_usbn_endpoint_data_t *pstcEndpoint)

control data transferred

Parameters
pstcUsbUSB handle
pstcEndpointEndpoint handle

Definition at line 121 of file usbdevice.h.

typedef void(* usbdevice_initclasses_func_ptr_t)(stc_usbn_t *pstcUsb)

init class callback

Parameters
pstcUsbUSB handle

Definition at line 130 of file usbdevice.h.

typedef void(* usbdevice_setuprequest_func_ptr_t)(stc_usbn_t *pstcUsb, stc_usb_request_t *pstcSetup)

setup request callback handle

Parameters
pstcUsbUSB handle
pstcSetupPointer to setup request

Definition at line 110 of file usbdevice.h.

Enumeration Type Documentation

USB device sending mode.

Enumerator
UsbPOLL 

send polled

UsbIRQ 

send IRQ

UsbDMA 

send DMA

Definition at line 226 of file usbdevice.h.

Function Documentation

en_usb_status_t UsbDevice_GetStatus ( stc_usbn_t *  pstcUsb)

Referenced by ConfCallback(), SendData(), UsbDeviceLibUsb_SendDataVia2(), and UsbDevicePrinter_SendData().

Here is the caller graph for this function:

en_usb_endpoint_status_t UsbDevice_HalEndpointStatus ( stc_usbn_endpoint_data_t *  pstcEpHandle)
void UsbDevice_Init ( stc_usbn_t *  pstcUsb,
stc_usb_config_t *  pstcUsbConfig,
stc_usbdevice_config_t *  pstcConfig 
)
void UsbDevice_InitCallback ( stc_usbn_t *  pstcUsb,
stc_usb_config_t *  pstcUsbConfig 
)
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 
)
void UsbDevice_ReceiveDataControl ( stc_usbn_t *  pstcUsb,
usbdevice_controltranfered_func_ptr_t  pfnCompletionCallback 
)

Referenced by DecodeSetupRequest().

Here is the caller graph for this function:

en_result_t UsbDevice_RegisterVendorClass ( stc_usbn_t *  pstcUsb,
stc_usbdevice_class_config_t *  pstcUsbClassConfig,
uint8_t **  ppu8Buffer,
uint8_t *  pu8InterfaceLength 
)
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 
)
void UsbDevice_SendDataControl ( stc_usbn_t *  pstcUsb,
uint8_t *  pu8Buffer,
uint32_t  u32DataLength 
)

Referenced by DecodeSetupRequest(), and SendLineCoding().

Here is the caller graph for this function:

void UsbDevice_Usb0ExintCallback ( void  )
void UsbDevice_Usb1ExintCallback ( void  )