Hi,
I have a problem with an application which reads data from the aemif module in sram mode (e.g. data from the cpld on the evmdm365 eval board) via edma (DVSDK version 3.10.00.16).
First I use the edmak module to get a free channel. Next I set up the param set for that channel and set the bit corresponding to that channel in the event set register. After the transfer is completed, the destination variable is sometimes empty and sometimes written with the correct value. It seems that if I read a block of data (e.g. 256 byte), sometimes the last bytes are not written correctly. And if I read only 4 bytes for example, sometimes all 4 bytes are not written correctly and sometimes they are. Maybe the transfer was not completed yet. How can I be sure, that an edma transfer is complete and all data was written to the destination variable?
My source code for better understanding:
...
stat = EDMA_getResource(EDMA_EDMAANY, &tcc, &channel, ¶m, nparam);
stat = EDMA_registerResource(channel);
stat = EDMA_mapBaseAddress(&ptr);
paramset_base = ptr + 0x4000 + (0x20 * param);
*paramset_base = 0x00100004; /* OPT */
*(paramset_base + 0x1) = 0x04000008; /* SRC = CPLD Test Register */
*(paramset_base + 0x2) = 0x00010001; /* A_B_CNT */
*(paramset_base + 0x3) = (unsigned int) Memory_getBufferPhysicalAddress(&value, sizeof(value), NULL);
*(paramset_base + 0x4) = 0x00000000; /* SRC_DST_BIDX */
*(paramset_base + 0x5) = 0x0000ffff; /* LINK_BCNTRLD */
*(paramset_base + 0x6) = 0x00000000; /*SRC_DST_CIDX */
*(paramset_base + 0x7) = 0x00000001; /* C_CNT */
edma_esr_void = ptr + 0x1010; /* Event Set Register */
edma_esr = edma_esr_void;
*edma_esr |= 0x00000001; /* free resource is always channel 0 */
usleep(10);
while(((*edma_esr) & 0x00000001) != 0x00000000); /* wait until esr bit is reset ( = transfer completion) */
printf("value: %x\n", value);