目的: 用DMA 把串口9的接收数据放到一个数组代码:
CHAR buf[]={0x03,0x03,0x9C,0x4B,0x00,0x01};
outpw(REG_GDMA_CTL0, 0x0);
outpw(REG_GDMA_SRCB0,REG_UART9_RBR);//source
outpw(REG_GDMA_DSTB0,(uint32_t)DMARecBuf);//destination
outpw(REG_GDMA_TCNT0,7);
outpw(REG_GDMA_CTL0,(1<<7) | (1<<16));
outpw(REG_GDMA_CTL0,inpw(REG_GDMA_CTL0)|1);
comSend(buf,6);
while(!(inpw(REG_GDMA_INTCS) & 0x100));
outpw(REG_GDMA_INTCS,0x100);
问题点 bug = DMARecBuf[0]; //如果增加这一句代码后,就没有接收数据到DMARecBuf
|