usb
Vitis Drivers API Documentation
|
This file has the USB example Mass storage device application function with SCSI command processing and related response preparation being implemented as a part of the interrupt handler.
MODIFICATION HISTORY:
Ver Who Date Changes
1.00a hvm 2/22/07 First release. 4.00a hvm 06/01/11 Signature parameter of Command Status word is initialized with 'U''S''B''S' in ProcessRxCmd function. CR611761 fix. 4.01a bss 11/01/11 Modified UsbIfIntrHandler function to unconditionally reset when USB reset is asserted (CR 627574). 4.03a bss 02/05/13 Updated the example to support Zynq 5.6 pm 07/05/23 Removed powerpc support. 5.6 pm 07/05/23 Added support for system device-tree flow.
Functions | |
void | ReadTransfer (XUsb *InstancePtr) |
This function implements the reception of data in the USB device for the READ request from the USB Host. More... | |
void | WriteTransfer (XUsb *InstancePtr) |
This function implements the reception of data in the USB device for the WRITE request from the USB Host. More... | |
void | DmaIntrHandler (void *CallBackRef, u32 IntrStatus) |
This function is the interrupt handler for the USB DMA events. More... | |
int | main () |
This main function starts the USB application. More... | |
void | InitUsbInterface (XUsb *InstancePtr) |
This is the USB initialization function. More... | |
void | UsbIfIntrHandler (void *CallBackRef, u32 IntrStatus) |
This function is the interrupt handler for the USB mass storage device application. More... | |
void | Ep0IntrHandler (void *CallBackRef, u8 EpNum, u32 IntrStatus) |
This function is the interrupt handler for the USB End point Zero events. More... | |
void | Ep1IntrHandler (void *CallBackRef, u8 EpNum, u32 IntrStatus) |
This function is the interrupt handler for the USB End point one events. More... | |
void | Ep2IntrHandler (void *CallBackRef, u8 EpNum, u32 IntrStatus) |
This function is the interrupt handler for the USB End point two events. More... | |
void | ProcessRxCmd (XUsb *InstancePtr) |
This function processes mass storage specific commands and sends the required response. More... | |
void | Read10 (XUsb *InstancePtr, PUSBCBW pCmdBlock, PUSBCSW pStatusBlock) |
This function implements the transmission of data from the device to the READ request from the USB Host. More... | |
void | Write10 (XUsb *InstancePtr, PUSBCBW pCmdBlock, PUSBCSW pStatusBlock) |
This function implements the reception of data in the USB device for the write request from the USB Host. More... | |
void | MassStorageReset (XUsb *InstancePtr) |
This routine is called when a RESET class command is received. More... | |
void | GetMaxLUN (XUsb *InstancePtr) |
This routine is called when a GETMAXLUN class command is received. More... | |
void DmaIntrHandler | ( | void * | CallBackRef, |
u32 | IntrStatus | ||
) |
This function is the interrupt handler for the USB DMA events.
CallBackRef | is the callback reference passed from the interrupt handler, which in our case is a pointer to the driver instance. |
IntrStatus | is a bit mask indicating pending interrupts. |
References XUsb::DeviceConfig, ProcessRxCmd(), ReadTransfer(), XUsb_DeviceConfig::Status, WriteTransfer(), XUSB_DISCONNECTED, XUsb_EpDataSend(), XUSB_STATUS_DMA_DONE_MASK, and XUSB_STATUS_DMA_ERROR_MASK.
Referenced by main().
void Ep0IntrHandler | ( | void * | CallBackRef, |
u8 | EpNum, | ||
u32 | IntrStatus | ||
) |
This function is the interrupt handler for the USB End point Zero events.
CallBackRef | is the callback reference passed from the interrupt. handler, which in our case is a pointer to the driver instance. |
EpNum | is the end point number. |
IntrStatus | is a bit mask indicating pending interrupts. |
Referenced by main(), UsbKbdExample(), and UsbMouseExample().
void Ep1IntrHandler | ( | void * | CallBackRef, |
u8 | EpNum, | ||
u32 | IntrStatus | ||
) |
This function is the interrupt handler for the USB End point one events.
CallBackRef | is the callback reference passed from the interrupt handler, which in our case is a pointer to the driver instance. |
EpNum | is the end point number. |
IntrStatus | is a bit mask indicating pending interrupts. |
Referenced by main(), UsbKbdExample(), and UsbMouseExample().
void Ep2IntrHandler | ( | void * | CallBackRef, |
u8 | EpNum, | ||
u32 | IntrStatus | ||
) |
This function is the interrupt handler for the USB End point two events.
CallBackRef | is the callback reference passed from the interrupt handler, which in our case is a pointer to the driver instance. |
EpNum | is the end point number. |
IntrStatus | is a bit mask indicating pending interrupts. |
Referenced by main().
void GetMaxLUN | ( | XUsb * | InstancePtr | ) |
This routine is called when a GETMAXLUN class command is received.
InstancePtr | is a pointer to the XUsb instance of the controller. |
Referenced by Ep0IntrHandler().
void InitUsbInterface | ( | XUsb * | InstancePtr | ) |
This is the USB initialization function.
This example initializes the device for Mass Storage Application. The following configuration is done.
InstancePtr | is a pointer to the XUsb instance. |
int main | ( | void | ) |
This main function starts the USB application.
None. |
References XUsb_Config::BaseAddress, XUsb_DeviceConfig::CurrentConfiguration, XUsb::DeviceConfig, DmaIntrHandler(), Ep0IntrHandler(), Ep1IntrHandler(), Ep2IntrHandler(), InitUsbInterface(), UsbIfIntrHandler(), XUsb_CfgInitialize(), XUsb_DmaIntrSetHandler(), XUsb_EpSetHandler(), XUsb_IntrEnable(), XUsb_IntrHandler(), XUsb_IntrSetHandler(), XUsb_LookupConfig(), XUsb_SetDeviceAddress(), XUsb_Start(), XUSB_STATUS_DISCONNECT_MASK, XUSB_STATUS_EP0_BUFF1_COMP_MASK, XUSB_STATUS_EP1_BUFF1_COMP_MASK, XUSB_STATUS_EP1_BUFF2_COMP_MASK, XUSB_STATUS_EP2_BUFF1_COMP_MASK, XUSB_STATUS_EP2_BUFF2_COMP_MASK, XUSB_STATUS_FIFO_BUFF_FREE_MASK, XUSB_STATUS_FIFO_BUFF_RDY_MASK, XUSB_STATUS_GLOBAL_INTR_MASK, XUSB_STATUS_RESET_MASK, and XUSB_STATUS_SUSPEND_MASK.
void MassStorageReset | ( | XUsb * | InstancePtr | ) |
This routine is called when a RESET class command is received.
InstancePtr | is a pointer to the XUsb instance of the controller. |
Referenced by Ep0IntrHandler().
void ProcessRxCmd | ( | XUsb * | InstancePtr | ) |
This function processes mass storage specific commands and sends the required response.
InstancePtr | is a pointer to the XUsb instance. |
Referenced by DmaIntrHandler(), and main().
void Read10 | ( | XUsb * | InstancePtr, |
PUSBCBW | pCmdBlock, | ||
PUSBCSW | pStatusBlock | ||
) |
This function implements the transmission of data from the device to the READ request from the USB Host.
InstancePtr | is a pointer to the XUsb instance. |
pCmdBlock | is a pointer to the Mass Storage Command Block wrapper. |
pStatusBlock | is a pointer to the Mass Storage Status wrapper. |
Referenced by ProcessRxCmd().
void ReadTransfer | ( | XUsb * | InstancePtr | ) |
This function implements the reception of data in the USB device for the READ request from the USB Host.
InstancePtr | is a pointer to the XUsb instance. |
References XUsb_DeviceConfig::CurrentSpeed, XUsb::DeviceConfig, XUSB_EP_HIGH_SPEED, and XUsb_EpDataSend().
Referenced by DmaIntrHandler(), and Ep1IntrHandler().
void UsbIfIntrHandler | ( | void * | CallBackRef, |
u32 | IntrStatus | ||
) |
This function is the interrupt handler for the USB mass storage device application.
CallBackRef | is the callback reference passed from the interrupt handler, which in our case is a pointer to the driver instance. |
IntrStatus | is a bit mask indicating pending interrupts. |
Referenced by main(), UsbKbdExample(), and UsbMouseExample().
void Write10 | ( | XUsb * | InstancePtr, |
PUSBCBW | pCmdBlock, | ||
PUSBCSW | pStatusBlock | ||
) |
This function implements the reception of data in the USB device for the write request from the USB Host.
InstancePtr | is a pointer to the XUsb instance. |
pCmdBlock | is a pointer to the Mass Storage Command Block wrapper. |
pStatusBlock | is a pointer to the Mass Storage Status wrapper. |
Referenced by ProcessRxCmd().
void WriteTransfer | ( | XUsb * | InstancePtr | ) |
This function implements the reception of data in the USB device for the WRITE request from the USB Host.
InstancePtr | is a pointer to the XUsb instance. |
References XUsb_DeviceConfig::CurrentSpeed, XUsb::DeviceConfig, XUSB_EP_HIGH_SPEED, XUsb_EpDataRecv(), and XUsb_EpDataSend().
Referenced by DmaIntrHandler(), and Ep2IntrHandler().