Reply by Marat Sh. May 28, 20082008-05-28
Dear friends!
I’m work with C6416, CCS-3.3 DSP/BIOS and DDK version 1.20.
I had been wrote the mini-port IOM-driver for my A/D converter.

HW dependent layer of this driver use automatically reloaded EDMA.
For reception of the “current ready” buffer, in my program, I’m use
a variable, which address transferred to GIO_read() and by IOM_class
driver, forming a IOM_Packet structure, receives by SubmitRead function().
SubmitRead() function is obliged to write into this variable the address of
the “ready” buffer in case that buffer really filled by EDMA or queue
up this packet for later processing in case that buffer isn’t filled.

For detect status – buffer ready/not-ready used global flag. This flag
is set in EDMA ISR in case of if the buffer is filled and there are no
“postponed/queued packet” and reset back in SubmitRead().

In case of the postponed packet exist – EDMA dispatcher get from the
packet’ queue queued packet, fill by ready buffer address and change
packet status on IOM_COMPLETED. “Buffer ready” flag isn’t set in this
After attempt to work with this driver I have noticed the following:
1) HW layer works fine. EDMA fills buffers ok.
2) First call of GIO_read() – return me timeout. 
Log records show me next scenario:
1) SubmitRead() receives the packet
2) Buffer isn’t filled by EDMA
3) This packet puts into queue
4) EDMA dispatcher sends interrupt
5) Into EDMA ISR this packet extracted from queue and processed – saved
address of ready buffer and status of the pakcet was changed on
6) GIO_read() returned with timeout and EDMA continue fill buffers and
sends IRQ.

Below the fragment of code of my driver:
EDMA IRQ routine:
IOM_Packet* packet = 
  reinterpret_cast<IOM_Packet*>(QUE_get (&hChan->pend_list));

 /* if nextPacket points to head of the queue, then the list is
    empty so there's no pending I/O packets */
 if (packet != reinterpret_cast<IOM_Packet*>(&hChan->pend_list))
  *(reinterpret_cast<Ptr*>(packet->addr)) = ready_buf;
  packet->status = IOM_COMPLETED;
    rcv_ready = 1;


/* disable interrupts since several of these variables are
 * shared with the ISR */

 VOLATILE Uns imask = HWI_disable();

/* if buffer isn&rsquo;t ready put the packet into queue */
 if (0 == rcv_ready)
   QUE_enqueue (&hChan->pend_list, packet);
   HWI_restore (imask);
   return (IOM_PENDING);

/* buffer ready &ndash; process this packet and reset "ready flag" */
 *(reinterpret_cast<Ptr*>(packet->addr)) == buf_queue[cnt];
 packet->status = IOM_COMPLETED;
 rcv_ready = 0;

 HWI_restore (imask);

 if (cnt >= hwParams->buf_queue_size)
  cnt = 0;

 return (IOM_COMPLETED);   

For simplification of the driver I do not use flush and abort packets. I
hope their absence non critically for the driver functionality.
My application isn&rsquo;t use GIO_abort and GIO_flush.
I shall be very grateful if you will help me fix the problem with

Marat Sh...