void PDMA_init(void)
{
STR_PDMA_T sPDMA;
uint32_t UARTPort;
uint8_t i;
for(i=0;i<64;i++)
{
SrcArray[i]=i;
}
IsTestOver =FALSE;
UARTPort = UART0_BASE;
PDMA_Init();
PDMA_DISABLE_CH1();
PDMA_EnableChannelClock(PDMAGCR_CSR_CLK1);/* Enable Channel 1 Clock */
sPDMA.SrcAddr = (uint32_t)SrcArray;
sPDMA.DestAddr = (uint32_t)UARTPort;
sPDMA.SrcCtrl = PDMA_CSR_SAD_INC;
sPDMA.DestCtrl = PDMA_CSR_DAD_FIX;
sPDMA.TransWidth = PDMA_CSR_APB_TWS_8BIT;
sPDMA.Mode = PDMA_CSR_MEM2IP; //存储器到外设
sPDMA.ByteCnt = PDMA_TEST_LENGTH;
sPDMA.IsTimeOutEnable = 0;
PDMA_UART0_TX_TO_CH1();
PDMA_Open(PDMA1, &sPDMA);
PDMA_EnableInt(PDMA1, PDMA_IER_TD);
PDMA_CHEnableTransfer(PDMA1);
PDMA_DISABLE_CH2();
PDMA_EnableChannelClock(PDMAGCR_CSR_CLK2);/* Enable Channel 2 Clock */
PDMA_SetTimeOutCount(PDMA2,1000); //定时100ms
sPDMA.SrcAddr = (uint32_t)UARTPort;
sPDMA.DestAddr = (uint32_t)DestArray;
sPDMA.SrcCtrl = PDMA_CSR_SAD_FIX;
sPDMA.DestCtrl = PDMA_CSR_DAD_INC;
sPDMA.TransWidth = PDMA_CSR_APB_TWS_8BIT;
sPDMA.Mode = PDMA_CSR_IP2MEM; //外设到存储器
sPDMA.ByteCnt = 64;
sPDMA.IsTimeOutEnable = 1; //使能PDMA超时定时器
PDMA_UART0_RX_TO_CH2();
PDMA_Open(PDMA2, &sPDMA);
PDMA_EnableInt(PDMA2, PDMA_IER_TD);
PDMA_CHEnableTransfer(PDMA2);
DrvUART_EnablePDMA(UART0);
memset(DestArray,0xff,64);
}
u32ISR = PDMA2->ISR;
if(u32ISR & 0x01)
/* Check Target Abort INT and clear */
{
PDMA2->ISR = 0x01;
}
else if(u32ISR & 0x02)
{
/* Transfer Done INT and clear */
PDMA2->ISR = 0x2;
IsTestOver = TRUE;
}
else if(u32ISR & 0x04)
{
/* Wrap around Transfer complete and clear */
PDMA2->ISR = 0x04;
}
else if(u32ISR & 0x10)
{
/* Wrap around Transfer Half and clear */
PDMA2->ISR = 0x10;
}
else if(u32ISR & 0x40)
{
/* Transfer Timeout INT and clear */
PDMA2->ISR = 0x40;
IsTestOver = TRUE;
}
我希望100MS没数据中断 但是PDMA的ISR一直没有中断 咋回事 |