Hi,
I have written a very basic USB Driver for DSP/BIOS. I have 2 endpoints EP 2 for receiving EP 1 for transmitting.
Now I experience a problem when I run out of buffers for receiving.
I currently do the following when I get a receive Interrupt:
DeviceObj.input.dataPacket = QUE_get(&DeviceObj.input.pendList);
//Check if the queue was not empty
if(DeviceObj.input.dataPacket != (IOM_Packet*)&DeviceObj.input.pendList)
{
LOG_printf(&trace, "Setting up DMA for receiving on packet %p\n", DeviceObj.input.dataPacket->addr);
USB_confDmaRx(&hpdrx, CSL_USB_EP2_PACKET_SIZE_HS, DeviceObj.input.dataPacket->addr);
USB_dmaRxStart(CSL_USB_EP2);
}
else
{
DeviceObj.input.overrun = TRUE;
}
In the Channel submit function I check for the overrun flag:
static Int mdSubmitChan(Ptr chanp, IOM_Packet *packet)
{
....
if(chan->overrun)
{
if(chan->mode == IOM_INPUT)
{
USB_confDmaRx(&hpdrx, CSL_USB_EP2_PACKET_SIZE_HS, chan->dataPacket->addr);
USB_dmaRxStart(CSL_USB_EP2);
chan->overrun = FALSE;
}
}
.....
}
Now when I get to the mdSubmitChan function and call the USB_dmaRxStart function from there I do not receive the data I sended from the HOST. Instead I get the data I have sended from the DEVICE to the HOST sometime earlier. I also made sure that no Transmit is in progress when calling dmaRxStart. But shortly before I get to the mdSubmitChan function I get an interrupted for a Transmit request but I do NOT call confDmaTx/dmaTxStart then. I dont know if that matters.