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.

AM5726: RTOS USB driver CPU load optimization

Part Number: AM5726

I noticed that when calling USBHostRead() function from USB driver it fires DMA and loops in xhci_wait_for_event(). It's actually not only this call doing that but whole driver designed on this principle. Is there easy way to rewrite this code using interrupt so the task will sleep on event?

Is there plans to fix "TODO: need to get the actual read bytes from the pipe" in USBHCDPipeRead() function?

Or may be I miss more right way to use the RTOS USB driver?

Thanks in advance.

Best regards,
Alexander

  • Hi Alexander,

    I've notified a colleague concerning your inquiry, he'll get back with you.

    Regards,
    Frank

  • Hi Alexander,

    The reason we used the CPU pulling for event waiting is to keep the high performance on the USB host. There is a simple way to change that to free the CPU to handle any higher priority task without reduce the USB host performance too much:

    Change

    while ((HW_RD_REG32(baseAddr + DWC_USB_IMAN(1)) & DWC_USB_IMAN_IP_MASK)
            != DWC_USB_IMAN_IP_PENDING);

    Into  

    while ((HW_RD_REG32(baseAddr + DWC_USB_IMAN(1)) & DWC_USB_IMAN_IP_MASK)
            != DWC_USB_IMAN_IP_PENDING)

    {

       Task_yield();

    }

    "TODO: need to get the actual read bytes from the pipe" in USBHCDPipeRead() function is to handle the case where the USB device is not sending what it supposedly to send. Currently we have no plan to implement it yet.

    Ming