PDL for FM4  Version1.2
Peripheral Driverl Library for FM4
usb.c File Reference
#include "usb.h"
#include "usbethernetclock.h"
Include dependency graph for usb.c:

Go to the source code of this file.

Macros

#define __USB_C__   1
 
static boolean_t UsbInitDone = FALSE
 
stc_usbn_instance_data_t m_astcUsbInstanceDataLut []
 Macro to return the number of enabled USB instances. More...
 
static stc_usb_intern_data_t * UsbGetInternDataPtr (stc_usbn_t *pstcUsb)
 Return the internal data for a certain USB instance. More...
 
static en_result_t Usb_InitIrq (stc_usbn_t *pstcUsb)
 Device dependent initialization of interrupts according CMSIS with level defined in l3.h. More...
 
static en_result_t Usb_DeinitIrq (stc_usbn_t *pstcUsb)
 Device dependent deinitialization of interrupts according CMSIS with level defined in l3.h. More...
 
static void Usb_TimeoutHandler (stc_usbn_t *pstcUsb)
 
void UsbHost_DisconnectionCallback (stc_usbn_t *pstcUsb)
 
en_result_t Usb_Configure (stc_usbn_t *pstcUsb, stc_usb_config_t *pstcConfig)
 Initialize USB in general. More...
 
en_result_t Usb_Init (void)
 Initialize USB in general. More...
 
en_result_t Usb_SetupHalEndpoint (stc_usbn_t *pstcUsb, uint8_t u8EndpointAddress, uint16_t u16FifoSize, en_usb_ep_type_t enType, boolean_t bInterruptsEnabled)
 Setup USB HAL endpoint. More...
 
en_result_t Usb_SwitchUsb (stc_usbn_t *pstcUsb, en_usb_switch_t enType, uint32_t u32SwitchDelay)
 Switch "Task" between host / device mode. More...
 
en_result_t Usb_InitInstance (stc_usbn_t *pstcUsb)
 Init USB instance. More...
 
en_result_t Usb_DeinitInstance (stc_usbn_t *pstcUsb)
 Deinit USB instance. More...
 
void Usb_SetEndpointRxTxCallback (stc_usbn_endpoint_data_t *pstcEndpoint, usb_endpoint_datatransferred_func_ptr_t pfnRxTxCallback)
 Set RxTx Callback of an endpoint. More...
 
stc_usbn_endpoint_data_t * Usb_GetEndpointPtr (stc_usbn_t *pstcUsb, uint8_t u8EndpointAddress)
 Get endpoint pointer from endpointaddress. More...
 
en_result_t Usb_HalStallEndpoint (stc_usbn_endpoint_data_t *pstcEpHandle)
 Stall endpoint. More...
 
en_result_t Usb_HalUnstallEndpoint (stc_usbn_endpoint_data_t *pstcEpHandle)
 Unstall endpoint. More...
 
boolean_t Usb_HalEndpointIsBusy (stc_usbn_endpoint_data_t *pstcEpHandle)
 Unstall endpoint. More...
 
en_result_t Usb_HalSend (stc_usbn_endpoint_data_t *pstcEpHandle, uint8_t *pu8Data, uint16_t u16Size, uint16_t *pu16ByteCount)
 Send data via endpoint. More...
 
en_result_t Usb_HalReceive (stc_usbn_endpoint_data_t *pstcEpHandle, uint8_t *pu8Data, uint16_t *pu16ByteCount, boolean_t bClearDrq)
 Read data via endpoint. More...
 
en_result_t Usb_HalClearDrq (stc_usbn_endpoint_data_t *pstcEpHandle)
 Clear Drq flag of FIFO: FIFO ready for next data. More...
 
en_usb_endpoint_status_t Usb_HalEndpointStatus (stc_usbn_endpoint_data_t *pstcEpHandle)
 Get information about the specified endpoint status. More...
 
boolean_t Usb_HalEpReady (stc_usbn_endpoint_data_t *pstcEpHandle)
 Get information if the specified endpoint is ready. More...
 
uint8_t Usb_GetConfiguration (stc_usbn_t *pstcUsb)
 
boolean_t Usb_AddTimeOut (stc_usbn_t *pstcUsb, void(*Handler)(stc_usbn_t *pstcUsb), uint16_t u16TimeOut)
 
void Usb_RemoveTimeOut (stc_usbn_t *pstcUsb, void(*Handler)(stc_usbn_t *pstcUsb))
 
void Usb_Tick (void)
 
void USB_Handler (void)
 
void USB0_Handler (void)
 
void USB0_HOST_IRQHandler (void)
 
void USB1_Handler (void)
 
void Usb_OsTickHandle (void)
 
void UsbIrqHandler (stc_usbn_t *pstcUsb, stc_usb_intern_data_t *pstcUsbInternData)
 

Detailed Description

A detailed description is available at USB Module description

History:

  • 2012-08-28 2.0 MSc First version (starting at version 2.0)
  • 2012-10-02 2.1 MSc use of external interrupts without L3 implemented
  • 2012-11-13 2.2 MSc Some problems while switching from Host to Device fixed
  • 2013-01-31 2.3 MSc DMA added
  • 2013-05-07 2.4 MSc Minor optimizations
  • 2013-06-04 2.5 MSc FM4 support added
  • 2013-09-23 2.6 MSc FM4 PDL support added
  • 2013-11-29 2.7 MSc PDL adjustments done
  • 2014-02-28 2.8 MSc Fixes for FM4 (IRQ naming, mcu headerfile typedef) Fixes in SwitchUsb Routine
  • 2014-05-27 2.9 MSc IRQ double definition with use of PDL > V1.0 solved

Definition in file usb.c.

Macro Definition Documentation

#define __USB_C__   1

Definition at line 66 of file usb.c.