AnsweredAssumed Answered

How do I work with external port DMA?

Question asked by bookevg on Nov 2, 2011
Latest reply on Dec 7, 2011 by bookevg

I want to work with external port DMA without interrupt

So I want to start DMA and polling status than I want to stop DMA and repeat

I have a code:

 

typedef unsigned int u32;

typedef int s32;

volatile u32 extmem_read_watchdog_cnt     = 0;
s32 read_extmem_with_ack(u32 *pData, u32 addr, u32 size)
{
extmem_read_watchdog_cnt     = 0;
*pDMAC0     &= (~DEN);
*pCPEP0     = 0;
*pEMEP0     = 1;
*pIMEP0     = 1;
*pICEP0     = size;
*pIIEP0     = (u32)pData;
*pEIEP0     = addr;
*pDMAC0     = DEN     | DFLSH;
while ( (*pDMAC0 & EXTS) == 0)
{
if     (extmem_read_watchdog_cnt <= (u32)1000000)    
{     extmem_read_watchdog_cnt++;                                             }
else                                                      
{     extmem_read_watchdog_cnt     = (u32)1000001;
break;
}
}

#if 1

// External port works wrong - why???
*pDMAC0     &= (~DEN);
*pDMAC0     |= DFLSH;

#else

// External port works ok

endif

return 1;
}

u32 data[512];

void main (void)

{

... // init PLL, SDRAM and others

for (u32 i = 0; i < 20; i++)

{

      read_extmem_with_ack(&data[0],0x00020000 + i*512; 512);

     ... // do something

}

}

Outcomes