Hi everyone:
I try to send data from the RC device to the EP device throught DMA. So I creat 512 word ordinal number(from 0 to 511)-srcbuf[512]- in the RC device. Then call the transdata funtion to send the data. the EP device can receive the data ,but dstbuf[0-7]' value are 0 and so do dstbuf[504-511]. the rest dstbuf[8-503] can receive the right data.
the code as fellow:
#pragma DATA_SECTION(dstBuf, ".dstBufSec")
#pragma DATA_ALIGN(dstBuf, 256
/* last element in the buffer is a marker that indicates the buffer status: full/empty */
#define PCIE_EXAMPLE_MAX_CACHE_LINE_SIZE 128
#define PCIE_EXAMPLE_UINT32_SIZE 4 /* preprocessor #if requires a real constant, not a sizeof() */
//#define PCIE_EXAMPLE_DSTBUF_BYTES ((PCIE_BUFSIZE_APP + 1) * PCIE_EXAMPLE_UINT32_SIZE)
#define PCIE_EXAMPLE_DSTBUF_BYTES ((PCIE_BUFSIZE_APP ) * PCIE_EXAMPLE_UINT32_SIZE)
#define PCIE_EXAMPLE_DSTBUF_REM (PCIE_EXAMPLE_DSTBUF_BYTES % PCIE_EXAMPLE_MAX_CACHE_LINE_SIZE)
#define PCIE_EXAMPLE_DSTBUF_PAD (PCIE_EXAMPLE_DSTBUF_REM ? (PCIE_EXAMPLE_MAX_CACHE_LINE_SIZE - PCIE_EXAMPLE_DSTBUF_REM) : 0)
struct dstBuf_s {
//volatile uint32_t buf[PCIE_BUFSIZE_APP + 1];
volatile uint32_t buf[PCIE_BUFSIZE_APP];
/* Cache coherence: Must pad to cache line size in order to enable cacheability */
#if PCIE_EXAMPLE_DSTBUF_PAD
uint8_t padding[PCIE_EXAMPLE_DSTBUF_PAD];
#endif
} dstBuf;
void main()
{
..........
TransData(srcaddr, 0x60000000, 2, 2, 0);
...........
}
函数名:
Bool TransData(Uint32 sAddr, Uint32 dAddr, Uint16 Len_KB, Bool dstIsFifo, Bool intrEn)
sAddr: source address
dAddr: destination address
Len_KB: length of data to be sended
dstIsFifo:
=1:destination is fifo;=0:source is fifo;=其他值:both source and destination RAM;
intrEn:
=1:enable interrupt; =0: disable interrupt;
true: transport succeed
false:transport fail
acout = 128byte, bcount =(length)/acout; ccount =1; transport mode :AB.
which reason can lead to this problem.