[code] //使能DMA串口发送
PDMA_Open(1 << 1);
PDMA_UART1_TxTest() ;
PDMA_UART2_TxTest() ;
void PDMA_UART1_TxTest(void)
{
/* UART Tx PDMA channel configuration */
/* Set transfer width (8 bits) and transfer count */
PDMA_SetTransferCnt(1, PDMA_WIDTH_8, 64);
my_strncpy(SrcArray,buf1,64) ;
/* Set source/destination address and attributes */
PDMA_SetTransferAddr(1, (uint32_t)SrcArray, PDMA_SAR_INC, (uint32_t)&UART0->DAT, PDMA_DAR_FIX);
// PDMA_SetTransferAddr(1, (uint32_t)buf1, PDMA_SAR_INC, (uint32_t)&UART0->DAT, PDMA_DAR_FIX);
/* Set request source; set basic mode. */
PDMA_SetTransferMode(1, PDMA_UART0_TX, FALSE, 0);
/* Single request type */
PDMA_SetBurstType(1, PDMA_REQ_SINGLE, 0);
/* Disable table interrupt */
PDMA->DSCT[1].CTL |= PDMA_DSCT_CTL_TBINTDIS_Msk;
UART0->INTEN |= UART_INTEN_TXPDMAEN_Msk ;
}
void PDMA_UART2_TxTest(void)
{
/* UART Tx PDMA channel configuration */
/* Set transfer width (8 bits) and transfer count */
PDMA_SetTransferCnt(1, PDMA_WIDTH_8, 64);
my_strncpy(SrcArray,buf2,64) ;
/* Set source/destination address and attributes */
PDMA_SetTransferAddr(1, (uint32_t)SrcArray, PDMA_SAR_INC, (uint32_t)&UART0->DAT, PDMA_DAR_FIX);
/* Set request source; set basic mode. */
PDMA_SetTransferMode(1, PDMA_UART0_TX, FALSE, 0);
/* Single request type */
PDMA_SetBurstType(1, PDMA_REQ_SINGLE, 0);
/* Disable table interrupt */
PDMA->DSCT[1].CTL |= PDMA_DSCT_CTL_TBINTDIS_Msk;
UART0->INTEN |= UART_INTEN_TXPDMAEN_Msk ;
} |