void PDMA_Init()
{
/* Enable PDMA clock source */
CLK_EnableModuleClock(PDMA_MODULE);
/* Reset PDMA module */
SYS_ResetModule(PDMA_RST);
PDMA_Open(0x4);
PDMA_SetTransferCnt(2, PDMA_WIDTH_8, 256);
PDMA_SetTransferAddr(2, (uint32_t)&UART0->DAT, PDMA_SAR_FIX, (uint32_t)DestArray, PDMA_DAR_INC);
PDMA_SetTransferMode(2, PDMA_UART0_RX, FALSE, 0);
PDMA_SetBurstType(2, PDMA_REQ_SINGLE, PDMA_BURST_1);
PDMA_EnableInt(2, PDMA_INT_TRANS_DONE);
NVIC_EnableIRQ(PDMA_IRQn);
UART0->INTEN = UART0->INTEN | (1<<15);//UARTO DMA receive enable
}
void PDMA_Set()
{
PDMA_SetTransferCnt(2, PDMA_WIDTH_8, 256);
PDMA_SetTransferAddr(2, (uint32_t)&UART0->DAT, PDMA_SAR_FIX, (uint32_t)DestArray, PDMA_DAR_INC);
PDMA_SetTransferMode(2, PDMA_UART0_RX, FALSE, 0);
PDMA_SetBurstType(2, PDMA_REQ_SINGLE, PDMA_BURST_1);
PDMA_EnableInt(2, PDMA_INT_TRANS_DONE);
NVIC_EnableIRQ(PDMA_IRQn);
UART0->INTEN = UART0->INTEN | (1<<15);//UARTO DMA receive enable
}
这个函数是这个例子的关键。
|