Data Structures | |
struct | tUSBDMAInstance |
Macros | |
#define | UDMAConfigIsRx(ui32Config) ((ui32Config & UDMA_SRC_INC_NONE) == UDMA_SRC_INC_NONE) |
#define | UDMAConfigIsTx(ui32Config) ((ui32Config & UDMA_DEST_INC_NONE) == UDMA_DEST_INC_NONE) |
#define | MAX_USB_TICK_HANDLERS 6 |
#define | USB_SOF_TICK_DIVIDE 5 |
#define | InternalUSBGetTime() g_ui32CurrentUSBTick |
#define | USBBaseToIndex(BaseAddr) (0) |
#define | USBIndexToBase(Index) (USB0_BASE) |
#define | USB_MAX_DMA_CHANNELS_0 6 |
#define | USB_MAX_DMA_CHANNELS 8 |
#define | USBLIBSTATUS_DMA_IDLE 0x00000000 |
#define | USBLIBSTATUS_DMA_COMPLETE 0x00000001 |
#define | USBLIBSTATUS_DMA_ERROR 0x00000002 |
#define | USBLIBSTATUS_DMA_PENDING 0x00000004 |
#define | USB_DMA_EP_RX 0x00000080 |
#define | USB_DMA_EP_TX 0x00000000 |
#define | USB_DMA_EP_HOST 0x00000040 |
#define | USB_DMA_EP_DEVICE 0x00000000 |
#define | USB_DMA_EP_TYPE_CTRL 0x00000000 |
#define | USB_DMA_EP_TYPE_ISOC 0x00000001 |
#define | USB_DMA_EP_TYPE_BULK 0x00000002 |
#define | USB_DMA_EP_TYPE_INT 0x00000003 |
#define | USB_DMA_EP_TYPE_M 0x00000003 |
#define | USBLibDMAChannelStatus(psUSBDMAInst, ui32Channel) psUSBDMAInst->pfnChannelStatus(psUSBDMAInst, ui32Channel) |
#define | USBLibDMAStatus(psUSBDMAInst) psUSBDMAInst->pfnStatus(psUSBDMAInst) |
#define | USBLibDMAIntStatus(psUSBDMAInst) psUSBDMAInst->pfnIntStatus(psUSBDMAInst) |
#define | USBLibDMAIntStatusClear(psUSBDMAInst, ui32Status) psUSBDMAInst->pfnIntStatusClear(psUSBDMAInst, ui32Status) |
#define | USBLibDMAChannelEnable(psUSBDMAInst, ui32Channel) psUSBDMAInst->pfnChannelEnable(psUSBDMAInst, ui32Channel) |
#define | USBLibDMAChannelDisable(psUSBDMAInst, ui32Channel) psUSBDMAInst->pfnChannelDisable(psUSBDMAInst, ui32Channel) |
#define | USBLibDMATransfer(psUSBDMAInst, ui32Channel, pvBuffer, ui32Size) |
#define | USBLibDMAIntHandler(psUSBDMAInst, ui32Status) psUSBDMAInst->pfnIntHandler(psUSBDMAInst, ui32Status) |
#define | USBLibDMAChannelAllocate(psUSBDMAInst, ui8Endpoint, ui32MaxPacketSize, ui32Config) |
#define | USBLibDMAChannelRelease(psUSBDMAInst, ui8Endpoint) psUSBDMAInst->pfnChannelRelease(psUSBDMAInst, ui8Endpoint) |
#define | USBLibDMAUnitSizeSet(psUSBDMAInst, ui32Channel, ui32BitSize) |
#define | USBLibDMAArbSizeSet(psUSBDMAInst, ui32Channel, ui32ArbSize) |
#define | USBLibDMAChannelIntEnable(psUSBDMAInst, ui32Channel) psUSBDMAInst->pfnChannelIntEnable(psUSBDMAInst, ui32Channel) |
#define | USBLibDMAChannelIntDisable(psUSBDMAInst, ui32Channel) psUSBDMAInst->pfnChannelIntDisable(psUSBDMAInst, ui32Channel) |
Typedefs | |
typedef void(* | tUSBTickHandler) (void *pvInstance, uint32_t ui32TicksmS) |
Functions | |
void * | USBLibDMAAddrGet (tUSBDMAInstance *psUSBDMAInst, uint32_t ui32Channel) |
uint32_t | USBLibDMASizeGet (tUSBDMAInstance *psUSBDMAInst, uint32_t ui32Channel) |
tUSBDMAInstance * | USBLibDMAInit (uint32_t ui32Index) |
void | USBDeviceIntHandlerInternal (uint32_t ui32Index, uint32_t ui32Status) |
void | USBHostIntHandlerInternal (uint32_t ui32Index, uint32_t ui32Status) |
void | InternalUSBTickInit (void) |
void | InternalUSBTickReset (void) |
int32_t | InternalUSBRegisterTickHandler (tUSBTickHandler pfnHandler, void *pvInstance) |
void | InternalUSBStartOfFrameTick (uint32_t ui32TicksmS) |
void | InternalUSBHCDSendEvent (uint32_t ui32Index, tEventInfo *psEvent, uint32_t ui32EvFlag) |
Variables | |
uint32_t | g_ui32CurrentUSBTick |
uint32_t | g_ui32USBSOFCount |
#define UDMAConfigIsRx | ( | ui32Config | ) | ((ui32Config & UDMA_SRC_INC_NONE) == UDMA_SRC_INC_NONE) |
#define UDMAConfigIsTx | ( | ui32Config | ) | ((ui32Config & UDMA_DEST_INC_NONE) == UDMA_DEST_INC_NONE) |
#define MAX_USB_TICK_HANDLERS 6 |
Referenced by InternalUSBRegisterTickHandler(), InternalUSBStartOfFrameTick(), and InternalUSBTickInit().
#define USB_SOF_TICK_DIVIDE 5 |
Referenced by USBDeviceIntHandlerInternal().
#define InternalUSBGetTime | ( | ) | g_ui32CurrentUSBTick |
#define USBBaseToIndex | ( | BaseAddr | ) | (0) |
Referenced by USBDBulkTerm(), USBDCDCTerm(), and USBDHIDTerm().
#define USBIndexToBase | ( | Index | ) | (USB0_BASE) |
Referenced by USBDCompositeInit().
#define USB_MAX_DMA_CHANNELS_0 6 |
#define USB_MAX_DMA_CHANNELS 8 |
#define USBLIBSTATUS_DMA_IDLE 0x00000000 |
#define USBLIBSTATUS_DMA_COMPLETE 0x00000001 |
#define USBLIBSTATUS_DMA_ERROR 0x00000002 |
#define USBLIBSTATUS_DMA_PENDING 0x00000004 |
#define USB_DMA_EP_RX 0x00000080 |
#define USB_DMA_EP_TX 0x00000000 |
#define USB_DMA_EP_HOST 0x00000040 |
#define USB_DMA_EP_DEVICE 0x00000000 |
#define USB_DMA_EP_TYPE_CTRL 0x00000000 |
#define USB_DMA_EP_TYPE_ISOC 0x00000001 |
#define USB_DMA_EP_TYPE_BULK 0x00000002 |
#define USB_DMA_EP_TYPE_INT 0x00000003 |
#define USB_DMA_EP_TYPE_M 0x00000003 |
#define USBLibDMAChannelStatus | ( | psUSBDMAInst, | |
ui32Channel | |||
) | psUSBDMAInst->pfnChannelStatus(psUSBDMAInst, ui32Channel) |
This function returns the current DMA status for a given DMA channel.
psUSBDMAInst | is the DMA structure pointer for this instance. |
ui32Channel | is the DMA channel number used to retrieve the DMA status. |
This function returns the current status of a DMA transfer on a given DMA channel. The DMA channel is specified by the ui32Channel parameter.
#define USBLibDMAStatus | ( | psUSBDMAInst | ) | psUSBDMAInst->pfnStatus(psUSBDMAInst) |
This function is used to return any global status information for USB DMA.
psUSBDMAInst | is a generic instance pointer that can be used to distinguish between different hardware instances. |
This function performs returns the global status for the USB DMA interface.
#define USBLibDMAIntStatus | ( | psUSBDMAInst | ) | psUSBDMAInst->pfnIntStatus(psUSBDMAInst) |
This function returns the current DMA interrupt status.
psUSBDMAInst | is the DMA structure pointer for this instance. |
This function returns the interrupt status for all DMA channels. The value returned is a per channel interrupt mapping with the DMA channels mapped into bits 0-31 by channel number with channel 1 starting at bit 0.
Referenced by USBDeviceIntHandlerInternal().
#define USBLibDMAIntStatusClear | ( | psUSBDMAInst, | |
ui32Status | |||
) | psUSBDMAInst->pfnIntStatusClear(psUSBDMAInst, ui32Status) |
This function clears the requested DMA interrupt status.
psUSBDMAInst | is the DMA structure pointer for this instance. |
ui32Status | contains the interrupts to clear. |
This function clears the current DMA interrupt status for the controller specified by the ui32Instance parameter. The ui32Status value has the same format as the value returned from the USBLibDMAIntStatus() function which is a per channel interrupt mapping. The DMA channels are mapped into bits 0-31 by channel number with channel 1 starting at bit 0.
#define USBLibDMAChannelEnable | ( | psUSBDMAInst, | |
ui32Channel | |||
) | psUSBDMAInst->pfnChannelEnable(psUSBDMAInst, ui32Channel) |
This function enables DMA for a given channel.
psUSBDMAInst | is the DMA structure pointer for this instance. |
ui32Channel | is the DMA channel to enable. |
This function enables DMA on the channel number passed in the ui32Channel parameter.
#define USBLibDMAChannelDisable | ( | psUSBDMAInst, | |
ui32Channel | |||
) | psUSBDMAInst->pfnChannelDisable(psUSBDMAInst, ui32Channel) |
This function disables DMA for a given DMA channel.
psUSBDMAInst | is the DMA structure pointer for this instance. |
ui32Channel | is the DMA channel to disable. |
This function disables DMA on the channel number passed in the ui32Channel parameter.
#define USBLibDMATransfer | ( | psUSBDMAInst, | |
ui32Channel, | |||
pvBuffer, | |||
ui32Size | |||
) |
This function is configures a USB transfer on a given DMA channel.
psUSBDMAInst | is the DMA structure pointer for this instance. |
ui32Channel | is the DMA channel to use. |
pvBuffer | is a pointer to the buffer to use for the transfer. |
ui32Size | is the size of the data to be transferred in bytes. |
This function is called to configure a transfer using the USB controller depending on the parameters. The ui32Channel parameter holds the channel number to use for this transfer which must have already been allocated with a call to the USBLibDMAChannelAllocate() function. The transaction is configured to transfer ui32Size bytes to/from the buffer held in the pvBuffer pointer.
#define USBLibDMAIntHandler | ( | psUSBDMAInst, | |
ui32Status | |||
) | psUSBDMAInst->pfnIntHandler(psUSBDMAInst, ui32Status) |
This function is called by the USB interrupt handler.
psUSBDMAInst | is the DMA structure pointer for this instance. |
ui32Status | is the DMA interrupt status. |
This function is called by the USB interrupt handler to allow the DMA interface to handle interrupts outside of the context of the normal USB interrupt handler. The ui32Status is the current DMA interrupt status at the time of the USB interrupt. Since some DMA controller interrupts are cleared automatically when read, this value must be retrieved by calling the USBLibDMAIntStatus() function and passed into this function.
Referenced by USBDeviceIntHandlerInternal().
#define USBLibDMAChannelAllocate | ( | psUSBDMAInst, | |
ui8Endpoint, | |||
ui32MaxPacketSize, | |||
ui32Config | |||
) |
This function is used to assign a DMA channel to an endpoint.
psUSBDMAInst | is the DMA instance data for a USB controller. |
ui8Endpoint | is the endpoint number to assign a DMA channel. |
ui32MaxPacketSize | is the maximum packet size for the endpoint assigned that is being assigned to the DMA channel. |
ui32Config | are the basic configuration options for the DMA channel. |
This function assigns a DMA channel to a given endpoint. The ui8Endpoint parameter is the zero based endpoint number that is assigned a DMA channel. The ui32Config parameter contains any configuration options for the DMA channel. The current options include the following:
#define USBLibDMAChannelRelease | ( | psUSBDMAInst, | |
ui8Endpoint | |||
) | psUSBDMAInst->pfnChannelRelease(psUSBDMAInst, ui8Endpoint) |
This function is used to free a DMA channel that was assigned to an endpoint.
psUSBDMAInst | is the DMA instance data for a USB controller. |
ui8Endpoint | is the DMA channel number to free up. |
This function frees up a DMA channel that was allocated to an endpoint by the USBLibDMAChannelAllocate() function.
#define USBLibDMAUnitSizeSet | ( | psUSBDMAInst, | |
ui32Channel, | |||
ui32BitSize | |||
) |
This function is used to set the individual transfer size of a DMA channel.
psUSBDMAInst | is the DMA instance data for a USB controller. |
ui32Channel | is the DMA channel number to modify. |
ui32BitSize | is the individual transfer size in bits(8, 16 or 32). |
This function configures the individual transfer size of the DMA channel provided in the ui32Channel parameter. The ui32Channel must already be allocated to an endpoint by calling the USBLibDMAChannelAllocate() function. The ui32BitSize parameter should be on of the following values: 8, 16 or 32.
#define USBLibDMAArbSizeSet | ( | psUSBDMAInst, | |
ui32Channel, | |||
ui32ArbSize | |||
) |
This function is used to set the arbitration size for a DMA channel.
psUSBDMAInst | is the DMA instance data for a USB controller. |
ui32Channel | is the DMA channel number to modify. |
ui32ArbSize | is the transfer arbitration size in bytes. |
This function configures the individual transfer size of the DMA channel provided in the ui32Channel parameter. The ui32Channel must already be allocated to an endpoint by calling the USBLibDMAChannelAllocate() function.
#define USBLibDMAChannelIntEnable | ( | psUSBDMAInst, | |
ui32Channel | |||
) | psUSBDMAInst->pfnChannelIntEnable(psUSBDMAInst, ui32Channel) |
This function enables the DMA interrupt for a given channel.
psUSBDMAInst | is the DMA structure pointer for this instance. |
ui32Channel | is the DMA channel interrupt to enable. |
This function enables DMA interrupt on the channel number passed in the ui32Channel parameter.
#define USBLibDMAChannelIntDisable | ( | psUSBDMAInst, | |
ui32Channel | |||
) | psUSBDMAInst->pfnChannelIntDisable(psUSBDMAInst, ui32Channel) |
This function disables DMA interrupt for a given DMA channel.
psUSBDMAInst | is the DMA structure pointer for this instance. |
ui32Channel | is the DMA channel interrupt to disable. |
This function disables the DMA interrupt on the channel number passed in the ui32Channel parameter.
typedef void(* tUSBTickHandler) (void *pvInstance, uint32_t ui32TicksmS) |
void * USBLibDMAAddrGet | ( | tUSBDMAInstance * | psUSBDMAInst, |
uint32_t | ui32Channel | ||
) |
This function is used to return the current DMA pointer for a given DMA channel.
psUSBDMAInst | is a generic instance pointer that can be used to distinguish between different hardware instances. |
ui32Channel | is the DMA channel number for this request. |
This function returns the address that is in use by the DMA channel passed in via the ui32Channel parameter. This is not the real-time pointer, but the starting address of the DMA transfer for this DMA channel.
References tUSBDMAInstance::ppui32Data.
uint32_t USBLibDMASizeGet | ( | tUSBDMAInstance * | psUSBDMAInst, |
uint32_t | ui32Channel | ||
) |
This function is used to return the current DMA transfer size for a given DMA channel.
psUSBDMAInst | is a generic instance pointer that can be used to distinguish between different hardware instances. |
ui32Channel | is the DMA channel number for this request. |
This function returns the DMA transfer size that is in use by the DMA channel passed in via the ui32Channel parameter.
References tUSBDMAInstance::pui32Count.
tUSBDMAInstance * USBLibDMAInit | ( | uint32_t | ui32Index | ) |
This function is used to initialize the DMA interface for a USB instance.
ui32Index | is the index of the USB controller for this instance. |
This function performs any initialization and configuration of the DMA portions of the USB controller. This function returns a pointer that is used with the remaining USBLibDMA APIs or the function returns zero if the requested controller cannot support DMA. If this function is called when already initialized it will not reinitialize the DMA controller and will instead return the previously initialized DMA instance.
References tUSBDMAInstance::pfnArbSizeSet, tUSBDMAInstance::ui32Base, and tUSBDMAInstance::ui32IntNum.
void USBDeviceIntHandlerInternal | ( | uint32_t | ui32Index, |
uint32_t | ui32Status | ||
) |
References g_ui32USBSOFCount, InternalUSBStartOfFrameTick(), tCustomHandlers::pfnDeviceHandler, tCustomHandlers::pfnDisconnectHandler, tCustomHandlers::pfnEndpointHandler, tCustomHandlers::pfnResumeHandler, tCustomHandlers::pfnSuspendHandler, tDeviceInfo::psCallbacks, tDCDInstance::pvCBData, tDCDInstance::ui32LPMState, USB_EVENT_LPM_ERROR, USB_EVENT_LPM_RESUME, USB_EVENT_LPM_SLEEP, USB_SOF_TICK_DIVIDE, USBDeviceEnumHandler(), USBDeviceEnumResetHandler(), USBDeviceResumeTickHandler(), USBLIB_LPM_STATE_AWAKE, USBLIB_LPM_STATE_SLEEP, USBLibDMAIntHandler, and USBLibDMAIntStatus.
Referenced by USB0_IRQDeviceHandler(), and USB0DualModeIntHandler().
void USBHostIntHandlerInternal | ( | uint32_t | ui32Index, |
uint32_t | ui32Status | ||
) |
Referenced by USB0_IRQHostHandler(), and USB0DualModeIntHandler().
void InternalUSBTickInit | ( | void | ) |
References g_bUSBTimerInitialized, g_pfnTickHandlers, g_pvTickInstance, and MAX_USB_TICK_HANDLERS.
Referenced by USBDualModeInit().
void InternalUSBTickReset | ( | void | ) |
References g_bUSBTimerInitialized.
Referenced by USBDCDTerm().
int32_t InternalUSBRegisterTickHandler | ( | tUSBTickHandler | pfnHandler, |
void * | pvInstance | ||
) |
References g_pfnTickHandlers, g_pvTickInstance, and MAX_USB_TICK_HANDLERS.
void InternalUSBStartOfFrameTick | ( | uint32_t | ui32TicksmS | ) |
References g_pfnTickHandlers, g_pvTickInstance, g_ui32CurrentUSBTick, and MAX_USB_TICK_HANDLERS.
Referenced by USBDeviceIntHandlerInternal().
void InternalUSBHCDSendEvent | ( | uint32_t | ui32Index, |
tEventInfo * | psEvent, | ||
uint32_t | ui32EvFlag | ||
) |
Referenced by USB0_IRQOTGModeHandler().
uint32_t g_ui32CurrentUSBTick |
Referenced by InternalUSBStartOfFrameTick().
uint32_t g_ui32USBSOFCount |
Referenced by USBDeviceIntHandlerInternal().