Other Parts Discussed in Thread: OMAP-L138
OMAP-L138, DSP/BIOS5, McBSP driver as part of the pspdrivers 1.30.01
I'm looking at the following lines of code in the Mcbsp_edma.c file, function Mcbsp_localEdmaCallback (Mcbsp_LOOPJOB_ENABLE is defined):
if (TRUE != QUE_empty(&(chanHandle->queueFloatingList)))
{
/* should always have a packet present because this callback is *
* due to that packet */
/* Get the packet from the top of the queue (atommic operation) */
chanHandle->tempPacket = QUE_get(&(chanHandle->queueFloatingList));
/* get the param table information of transfer channel */
EDMA3_DRV_getPaRAM(chanHandle->edmaHandle,chanHandle->xferChan,&pramTbl);
/* Handle the IOP packets appropriately in case of an breakpoint *
* in case of an breakpoint.either of the packets (2 link param Pkts) *
* could have caused a callback as both of them as linkedto each other*
* Hence we will handle that condition here */
if (chanHandle->mode == IOM_INPUT)
{
/* Check if destination address falls into the range of 1st req *
* in the floating queue. */
if ((pramTbl.destAddr >= (Uint32)chanHandle->tempPacket->addr)
&& (pramTbl.destAddr < (Uint32)chanHandle->tempPacket->addr
+ chanHandle->tempPacket->size))
{
/* Since we have already dequeue the 1st request, dequeue *
* 2nd io request from floating queue */
ioPacket = (IOM_Packet *)QUE_get(
&chanHandle->queueFloatingList);
/* Queue the tempPacket (i.e. 1st io request) as this pkt *
* should be first in a queue */
QUE_put(
&chanHandle->queueFloatingList,
(Ptr)chanHandle->tempPacket);
/* Queue the ioPacket i.e. 2nd request in floating queue */
QUE_put(&chanHandle->queueFloatingList,(Ptr)ioPacket);
}
}
I'm confused what exactly the purpose of this code is. Also, it does not look like it functions properly. It is assuming there are 2 items in the queue, and if there are not, really bad things happen (like adding the queue back to itself). Even if there are 2 items in the queue, the chanHandle->tempPacket variable ends up pointing to an item that is still in the queue, which I don't think it should. This code is largely not hit (and the equivalent case for IOM_OUTPUT), but when it is, things stop working.
Can someone take a look at this and let me know what the proper fix is?