Hello,
I'm having a problem with some code that is attempting to verify a DMA transfer of code from external SDRAM to L1P RAM.
The code starts off with interrupts enabled, and L1P, L1D and L2 configured as cache. Here is the general sequence of events from that point:
HWI_disable();
BCACHE_wbInvAll();
BCACHE_getSize( &oldSizes );
newSizes.l1psize = BCACHE_L1_0K;
newSizes.l1dsize = BCACHE_L1_0K;
newSizes.l2size = BCACHE_L2_0K;
BCACHE_setSize( &newSizes );
BCACHE_invL1pAll();
BCACHE_wbInvAll(); /* because I'm paranoid */
/* EDMA transfer setup occurs here... transfer from SDRAM address to 0x11E00000 primed */
BCACHE_wbInvAll(); /* because I'm paranoid (again) */
BCACHE_invL1pAll(); /* and again... */
/* EDMA transfer is manually triggered... code then busy-waits for EDMA transfer to complete... */
BCACHE_wbInvAll(); /* this is getting silly... */
BCACHE_invL1pAll(); /* sillier... */
After the above sequence, the code then tries to read back L1P and compare it against the source buffer:
if( LoadAddress == 0x11E00000 )
{
Uint32 i;
for(i = 0 ; i < Size ; i++) /* Size is number of 32-bit words in source buffer */
{
const Uint32 jj = ((Uint32*) LoadAddress)[i];
const Uint32 kk = ((Uint32*) (SourceBuffer)[i];
if( jj != kk )
{
asm volatile(" nop;"); /* debugger landing zone... something went wrong... */
asm volatile(" nop;");
asm volatile(" nop;");
asm volatile(" nop;");
}
}
}
The odd thing is, the comparisons between the source and destination (jj and kk) fail on virtually every word, yet...
--The code in L1P still executes properly when I branch to it. That is, by all indications, the transfer succeeded.
--Code Composers Memory window shows that the contents of 0x11E00000 and &SourceBuffer match up perfectly. (Again, indication that the transfer succeeded)
The data sheet says that I should be able to read L1P directly. So what am I doing wrong?
Thanks.