//***************************************************************************** // //! Start a DMA transfer and wait for it to finish. //! //! This function will perform the steps necessary to initiate a DMA transfer //! It waits until the transfer is complete before returning to the caller. //! //! \param ulChannel DMA Channel //! //! \return Zero if there is no error // //***************************************************************************** unsigned long StartAndCompleteSWTransfer(unsigned long ulChannel) { unsigned long ulIdx; // // Clear interrupt status // MAP_uDMAIntClear(0xffffffff); MAP_uDMAChannelRequest(ulChannel); // // Wait for the mode to change to stopped // ulIdx = 0; while(MAP_uDMAChannelModeGet(ulChannel) != UDMA_MODE_STOP) { ulIdx++; if(ulIdx > 200000) { break; } } if(MAP_uDMAChannelIsEnabled(ulChannel)) { UART_PRINT("Error, channel was enabled at end of transfer\n"); return 1; } UART_PRINT("Transfer complete \n\r"); return(0); }
//***************************************************************************** // //! DMA software interrupt handler //! //! \param None //! //! This function //! 1. Invoked when DMA operation is complete //! //! \return None. // //***************************************************************************** void DmaSwIntHandler(void) { unsigned long uiIntStatus; iDone = 1; uiIntStatus = MAP_uDMAIntStatus(); MAP_uDMAIntClear(uiIntStatus); }
//***************************************************************************** // //! DMA error interrupt handler //! //! \param None //! //! This function //! 1. Invoked when DMA operation is in error //! //! \return None. // //***************************************************************************** void DmaErrorIntHandler(void) { MAP_uDMAIntClear(MAP_uDMAIntStatus()); }