cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
goodlman
Visitor
Visitor
402 Views
Registered: ‎07-28-2019

sdk usbpsuv_3 c code understanding

Hi 

I am new to HW development. And working on usb interface between the host (windows) and zcu102 ultrascale+. 

When I look at usbpsuv1.3 driver code, I have a few questions

 

1.  After USB gets started, the FPGA waiting for interrupting by the host as shown below code. 

XUsbPsu_Start(&UsbInstance);

while(1) {
/* Rest is taken care by interrupts */
}

 

Then, if the host sends data to FPGA, FPGA calls XUsbPsu_BulkOutHandler

Can anyone explain how it works?

For example, what is USB_EP_STATE_COMMAND?

what does ParseCBW do? etc..

void XUsbPsu_BulkOutHandler(void *CallBackRef, u32 RequestedBytes,
u32 BytesTxed)
{
struct XUsbPsu *InstancePtr = CallBackRef;

if (Phase == USB_EP_STATE_COMMAND) {
ParseCBW(InstancePtr);
} else if (Phase == USB_EP_STATE_DATA) {
/* WRITE command */
switch (CBW.CBWCB[0]) {
case USB_RBC_WRITE:
VirtFlashWritePointer += BytesTxed;
rxBytesLeft -= BytesTxed;
break;
default:
break;
}
SendCSW(InstancePtr, 0);
}
}

 

 

Tags (2)
0 Kudos
0 Replies