ADI CCES ADSPI2156X UART DMA模式中,获取当前存到第几个数CurrXCount, 重新从头开始接收StartAddr
关键的一些寄存器
关键的寄存器 pUARTDstDMARegs
typedef struct
{
uint32_t nTmrDevNum; /* Timer assosiated to the selected UART for Autobaud */
ADI_UART_TypeDef *const pUARTRegs; /* Pointer to base address of UART Memory Mapped Registers */
ADI_PDMA_REGS *const pUARTSrcDMARegs; /* Pointer to base address of UART Source DMA channel */
ADI_PDMA_REGS *const pUARTDstDMARegs; /* Pointer to base address of UART Destination DMA channel */
uint32_t TxIntID; /* Tx DMA Interrupt ID */
uint32_t RxIntID; /* Rx DMA Interrupt ID */
uint32_t StatusIntID; /* Status Interrupt ID */
uint32_t TxDMAErrorIntID; /* Tx DMA Error Interrupt ID */
uint32_t RxDMAErrorIntID; /* Rx DMA Error Interrupt ID */
ADI_UART_DEVICE *pDevice; /* Pointer to UART device instance data */
} ADI_UART_INFO;
CurrXCount
typedef volatile struct
{
uint32_t NextDescPtr; /* Pointer to next Initial Descriptor */
uint32_t StartAddr; /* Start address of current buffer */
uint32_t Config; /* Configuration register */
uint32_t XCount; /* XCOUNT - Inner loop count start value in number of MSIZE data transfers*/
int32_t XModify; /* XMODIFY - Inner loop address increment, in bytes */
uint32_t YCount; /* YCOUNT - Outer loop count start value (2D only), in number of rows*/
int32_t YModify; /* YMODIFY - Outer loop address increment (2D only), in bytes*/
uint32_t Padding0; /* padding */
uint32_t Padding1; /* padding */
uint32_t CurrDescPtr; /* Current Descriptor Pointer */
uint32_t PrevDescPtr; /* Previous Initial Descriptor Pointer */
uint32_t CurrAddr; /* Current Address */
uint32_t Status; /* Status Register */
uint32_t CurrXCount; /* Current XCOUNT */
uint32_t CurrYCount; /* Current YCOUNT */
} ADI_PDMA_REGS;
看当前收到了多少个bytes,
ADI_PDMA_REGS.CurrXCount
自定义函数 adi_uart_Reset_dma_regiseter
void adi_uart_Reset_dma_regiseter(void* pInfo){
ADI_UART_INFO * pinfo2 = (ADI_UART_INFO *)pInfo;
// adi_pdma_ResetRegs(pinfo2->pUARTDstDMARegs);
ADI_PDMA_REGS *pReg =pinfo2->pUARTDstDMARegs;
// pReg->Config = 0u;
// pReg->NextDescPtr = 0u;
// pReg->XCount = 0u;
// pReg->XModify = 0;
// pReg->YCount = 0u;
// pReg->YModify = 0;
// pReg->Status = ADI_PDMA_CLEAR_INTERRUPTS; /* Clear any pending interrupts */
// pReg->CurrDescPtr = 0u;
// pReg->CurrXCount=0u;
printf("pReg->StartAddr %p\n",pReg->StartAddr);
printf("pReg->CurrXCount %d\n",pReg->CurrXCount);
printf("pReg->CurrAddr %p\n",pReg->CurrAddr);
// CurrAddr
pReg->StartAddr = 0u;
}
前提是接收完成,但是没有到达dma 触发个数的时候,或者想查看当前接收到哪里的时候,查看 CurrAddr 寄存器