This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

USB BULK DEVICE EXAMPLE OF TIVAWARE C SERIES



HELLO !

I HAD A PROBLEM IN UDERSTANDING OF THE FOLLOWING BOLD PORTION :

uint32_t

RxHandler(void *pvCBData, uint32_t ui32Event, uint32_t ui32MsgValue,

void *pvMsgData)

{

//

// Which event are we being sent?

//

switch(ui32Event)

{

//

// We are connected to a host and communication is now possible.

//

case USB_EVENT_CONNECTED:

{

g_bUSBConfigured = true;

g_ui32Flags |= COMMAND_STATUS_UPDATE;

//

// Flush our buffers.

//

USBBufferFlush(&g_sTxBuffer);

USBBufferFlush(&g_sRxBuffer);

break;

}

//

// The host has disconnected.

//

case USB_EVENT_DISCONNECTED:

{

g_bUSBConfigured = false;

g_ui32Flags |= COMMAND_STATUS_UPDATE;

break;

}

//

// A new packet has been received.

//

case USB_EVENT_RX_AVAILABLE:

{

tUSBDBulkDevice *psDevice;

//

// Get a pointer to our instance data from the callback data

// parameter.

//

psDevice = (tUSBDBulkDevice *)pvCBData;

//

// Read the new packet and echo it back to the host.

//

return(EchoNewDataToHost(psDevice, pvMsgData, ui32MsgValue));

}

//

// Ignore SUSPEND and RESUME for now.

//

case USB_EVENT_SUSPEND:

case USB_EVENT_RESUME:

break;

//

// Ignore all other events and return 0.

//

default:

break;

}

return(0);

 

 

WHAT IS THE MEANING OF THE *psDevice, WHY WE NEED PSDEVICE PARAMETER IN CODE, IS IT A POINTER TO STRUCTURE OR WHERE IS POINTING TO .

 

tUSBDBulkDevice *psDevice;

psDevice = (tUSBDBulkDevice *)pvCBData;

WHEN I DELETED THE psDevice above code lines , the code is ok and getting the output without any error or warnings

so why this above is written to the example code.

 

kindly briefly tell me what is the psDevice parameter and why we have to use it must.

 

Thanks in advance.