/* ** This function allocates EDMA3 channels to McSPI0 for trasmisssion and ** reception purposes. */ static void RequestEDMA3Channels(void) { /* Request DMA Channel and TCC for SPI Transmit*/ EDMA3RequestChannel(SOC_EDMA30CC_0_REGS, EDMA3_CHANNEL_TYPE_DMA, \ MCSPI_TX_EVENT, MCSPI_TX_EVENT, EVT_QUEQUE_NUM); /* Request DMA Channel and TCC for SPI Receive*/ EDMA3RequestChannel(SOC_EDMA30CC_0_REGS, EDMA3_CHANNEL_TYPE_DMA, \ MCSPI_RX_EVENT, MCSPI_RX_EVENT, EVT_QUEQUE_NUM); }
/* ** This function allocates EDMA3 channels to SPI1 for trasmisssion and ** reception purposes. */ static void RequestEDMA3Channels(void) { /* Request DMA Channel and TCC for SPI Transmit*/ EDMA3RequestChannel(SOC_EDMA30CC_0_REGS, EDMA3_CHANNEL_TYPE_DMA, \ EDMA3_CHA_SPI1_TX, EDMA3_CHA_SPI1_TX, evtQ); /* Request DMA Channel and TCC for SPI Receive*/ EDMA3RequestChannel(SOC_EDMA30CC_0_REGS, EDMA3_CHANNEL_TYPE_DMA, \ EDMA3_CHA_SPI1_RX, EDMA3_CHA_SPI1_RX, evtQ); }
/* ** Function to initialize the looping of tone. */ static void ToneLoopInit(void) { EDMA3Init(EDMA_INST_BASE, 0); EDMA3RequestChannel(EDMA_INST_BASE, EDMA3_CHANNEL_TYPE_DMA, EDMA_CHANNEL_IN_USE, EDMA_CHANNEL_IN_USE, 0); /* ** To maintain portability, between GCC and TMS470, we initialize the ** BCNT for dmaPar[1] here. Else if the initialization is done above, ** TMS470 throws up error: expression must have a constant value */ dmaPar[1].bCnt = PARAM2_BCNT; /* Initialize the DMA parameters */ EDMA3SetPaRAM(EDMA_INST_BASE, EDMA_CHANNEL_IN_USE, (struct EDMA3CCPaRAMEntry *)(&(dmaPar[0]))); EDMA3SetPaRAM(EDMA_INST_BASE, 70, (struct EDMA3CCPaRAMEntry *)(&(dmaPar[1]))); EDMA3SetPaRAM(EDMA_INST_BASE, 71, (struct EDMA3CCPaRAMEntry *)(&(dmaPar[2]))); /* Configure the McASP for I2S with two channels */ McASPI2STwoChanConfig(); }
static void HSMMCSDEdmaInit(void) { /* Initializing the EDMA. */ EDMA3Initialize(); /* Request DMA Channel and TCC for MMCSD Transmit*/ EDMA3RequestChannel(EDMA_INST_BASE, EDMA3_CHANNEL_TYPE_DMA, MMCSD_TX_EDMA_CHAN, MMCSD_TX_EDMA_CHAN, EVT_QUEUE_NUM); /* Registering Callback Function for TX*/ cb_Fxn[MMCSD_TX_EDMA_CHAN] = &callback; /* Request DMA Channel and TCC for UART Receive */ EDMA3RequestChannel(EDMA_INST_BASE, EDMA3_CHANNEL_TYPE_DMA, MMCSD_RX_EDMA_CHAN, MMCSD_RX_EDMA_CHAN, EVT_QUEUE_NUM); /* Registering Callback Function for RX*/ cb_Fxn[MMCSD_RX_EDMA_CHAN] = &callback; }
static void MMCSDEdmaInit(void) { #if 0 #if DEBUG_PRINT UARTprintf("%s()\r\n", __FUNCTION__); #endif /* Initializing the EDMA. */ EDMA3Initialize(); /* Request DMA Channel and TCC for MMCSD Transmit*/ EDMA3RequestChannel(EDMA_INST_BASE, EDMA3_CHANNEL_TYPE_DMA, MMCSD_TX_EDMA_CHAN, MMCSD_TX_EDMA_CHAN, EVT_QUEUE_NUM); /* Registering Callback Function for TX*/ cb_Fxn[MMCSD_TX_EDMA_CHAN] = &Edma3ComplCallback; /* Request DMA Channel and TCC for UART Receive */ EDMA3RequestChannel(EDMA_INST_BASE, EDMA3_CHANNEL_TYPE_DMA, MMCSD_RX_EDMA_CHAN, MMCSD_RX_EDMA_CHAN, EVT_QUEUE_NUM); /* Registering Callback Function for RX*/ cb_Fxn[MMCSD_RX_EDMA_CHAN] = &Edma3ComplCallback; #endif /* Request DMA Channel and TCC for MMCSD Transmit*/ EDMA3RequestChannel(EDMA_INST_BASE, EDMA3_CHANNEL_TYPE_DMA, MMCSD_TX_EDMA_CHAN, MMCSD_TX_EDMA_CHAN, EVT_QUEUE_NUM); EDMA30SetComplIsr(MMCSD_TX_EDMA_CHAN, complCallback, MMCSD_TX_EDMA_CHAN); /* Request DMA Channel and TCC for MMCSD Receive */ EDMA3RequestChannel(EDMA_INST_BASE, EDMA3_CHANNEL_TYPE_DMA, MMCSD_RX_EDMA_CHAN, MMCSD_RX_EDMA_CHAN, EVT_QUEUE_NUM); EDMA30SetComplIsr(MMCSD_RX_EDMA_CHAN, complCallback, MMCSD_RX_EDMA_CHAN); }
/* ** Main function. */ int main(void) { unsigned int numByteChunks = 0; unsigned char *pBuffer = NULL; unsigned int remainBytes = 0; /* Configure and enable the MMU. */ MMUConfigAndEnable(); /* Enable all levels of Cache. */ CacheEnable(CACHE_ALL); /* Configuring the system clocks for EDMA. */ EDMAModuleClkConfig(); /* Configuring the system clocks for UART0 instance. */ UART0ModuleClkConfig(); /* Performing Pin Multiplexing for UART0 instance. */ UARTPinMuxSetup(0); /* Enabling IRQ in CPSR of ARM processor. */ IntMasterIRQEnable(); /* Initializing the ARM Interrupt Controller. */ IntAINTCInit(); /* Initializing the EDMA. */ EDMA3Initialize(); /* Initializing the UART0 instance for use. */ UARTInitialize(); /* Select the console type based on compile time check */ ConsoleUtilsSetType(CONSOLE_UART); /* ** Configuring the EDMA. */ /* Request DMA Channel and TCC for UART Transmit*/ EDMA3RequestChannel(SOC_EDMA30CC_0_REGS, EDMA3_CHANNEL_TYPE_DMA, EDMA3_UART_TX_CHA_NUM, EDMA3_UART_TX_CHA_NUM, EVT_QUEUE_NUM); /* Registering Callback Function for TX*/ cb_Fxn[EDMA3_UART_TX_CHA_NUM] = &callback; /* Request DMA Channel and TCC for UART Receive */ EDMA3RequestChannel(SOC_EDMA30CC_0_REGS, EDMA3_CHANNEL_TYPE_DMA, EDMA3_UART_RX_CHA_NUM, EDMA3_UART_RX_CHA_NUM, EVT_QUEUE_NUM); /* Registering Callback Function for RX*/ cb_Fxn[EDMA3_UART_RX_CHA_NUM] = &callback; /******************** Transmission of a string **************************/ numByteChunks = (sizeof(welcome) - 1) / txBytesPerEvent; remainBytes = (sizeof(welcome) - 1) % txBytesPerEvent; /* Configuring EDMA PaRAM sets to transmit data. */ UARTTxEDMAPaRAMSetConfig(welcome, numByteChunks * txBytesPerEvent, EDMA3_UART_TX_CHA_NUM, EDMA3CC_OPT(DUMMY_CH_NUM), EDMA3_UART_TX_CHA_NUM); /* Configuring the PaRAM set for Dummy Transfer. */ TxDummyPaRAMConfEnable(); /* Enable EDMA Transfer */ EDMA3EnableTransfer(SOC_EDMA30CC_0_REGS, EDMA3_UART_TX_CHA_NUM, EDMA3_TRIG_MODE_EVENT); /* Wait for return from callback */ while(0 == clBackFlag); clBackFlag = 0; /* Remaining bytes are transferred through polling method. */ if(0 != remainBytes) { pBuffer = welcome + (sizeof(welcome) - 1) - remainBytes; UARTPuts((char*)pBuffer, remainBytes); } /******************** Transmission of a string **************************/ numByteChunks = (sizeof(intent) - 1) / txBytesPerEvent; remainBytes = (sizeof(intent) - 1) % txBytesPerEvent; /* Enabling DMA Mode 1. */ UARTDMAEnable(UART_INSTANCE_BASE_ADD, UART_DMA_MODE_1_ENABLE); /* Configuring EDMA PaRAM sets to transmit data. */ UARTTxEDMAPaRAMSetConfig(intent, numByteChunks * txBytesPerEvent, EDMA3_UART_TX_CHA_NUM, EDMA3CC_OPT(DUMMY_CH_NUM), EDMA3_UART_TX_CHA_NUM); /* Configuring the PaRAM set for Dummy Transfer. */ TxDummyPaRAMConfEnable(); /* Enable EDMA Transfer */ EDMA3EnableTransfer(SOC_EDMA30CC_0_REGS, EDMA3_UART_TX_CHA_NUM, EDMA3_TRIG_MODE_EVENT); /* Wait for return from callback */ while(0 == clBackFlag); clBackFlag = 0; /* Remaining bytes are transferred through polling method. */ if(0 != remainBytes) { pBuffer = intent + (sizeof(intent) - 1) - remainBytes; UARTPuts((char*)pBuffer, remainBytes); } /******************** Transmission of a string **************************/ numByteChunks = (sizeof(enter) - 1) / txBytesPerEvent; remainBytes = (sizeof(enter) - 1) % txBytesPerEvent; /* Enabling DMA Mode 1. */ UARTDMAEnable(UART_INSTANCE_BASE_ADD, UART_DMA_MODE_1_ENABLE); /* Configuring EDMA PaRAM sets to transmit data. */ UARTTxEDMAPaRAMSetConfig(enter, numByteChunks * txBytesPerEvent, EDMA3_UART_TX_CHA_NUM, EDMA3CC_OPT(DUMMY_CH_NUM), EDMA3_UART_TX_CHA_NUM); /* Configuring the PaRAM set for Dummy Transfer. */ TxDummyPaRAMConfEnable(); /* Enable EDMA Transfer */ EDMA3EnableTransfer(SOC_EDMA30CC_0_REGS, EDMA3_UART_TX_CHA_NUM, EDMA3_TRIG_MODE_EVENT); /* Wait for return from callback */ while(0 == clBackFlag); clBackFlag = 0; /* Remaining bytes are transferred through polling method. */ if(0 != remainBytes) { pBuffer = enter + (sizeof(enter) - 1) - remainBytes; UARTPuts((char*)pBuffer, remainBytes); } /********************* Receiving Data from User *************************/ /* Enabling DMA Mode 1. */ UARTDMAEnable(UART_INSTANCE_BASE_ADD, UART_DMA_MODE_1_ENABLE); /* Configuring the PaRAM set for reception. */ UARTRxEDMAPaRAMSetConfig(rxBuffer, NUM_RX_BYTES, EDMA3_UART_RX_CHA_NUM, 0xFFFF, EDMA3_UART_RX_CHA_NUM); /* Enable EDMA Transfer */ EDMA3EnableTransfer(SOC_EDMA30CC_0_REGS, EDMA3_UART_RX_CHA_NUM, EDMA3_TRIG_MODE_EVENT); /* Wait for return from callback */ while(0 == clBackFlag); clBackFlag = 0; /******************* Echoing received bytes *****************************/ numByteChunks = (NUM_RX_BYTES) / txBytesPerEvent; remainBytes = (NUM_RX_BYTES) % txBytesPerEvent; /* Enabling DMA Mode 1. */ UARTDMAEnable(UART_INSTANCE_BASE_ADD, UART_DMA_MODE_1_ENABLE); /* Configuring EDMA PaRAM sets to transmit data. */ UARTTxEDMAPaRAMSetConfig(rxBuffer, numByteChunks * txBytesPerEvent, EDMA3_UART_TX_CHA_NUM, EDMA3CC_OPT(DUMMY_CH_NUM), EDMA3_UART_TX_CHA_NUM); /* Configuring the PaRAM set for Dummy Transfer. */ TxDummyPaRAMConfEnable(); /* Enable EDMA Transfer */ EDMA3EnableTransfer(SOC_EDMA30CC_0_REGS, EDMA3_UART_TX_CHA_NUM, EDMA3_TRIG_MODE_EVENT); /* Wait for return from callback */ while(0 == clBackFlag); clBackFlag = 0; /* Remaining bytes are transferred through polling method. */ if(0 != remainBytes) { pBuffer = rxBuffer + NUM_RX_BYTES - remainBytes; UARTPuts((char*)pBuffer, remainBytes); } /******************* Freeing of allocated channels **********************/ /* Free EDMA3 Channels for TX and RX */ EDMA3FreeChannel(SOC_EDMA30CC_0_REGS, EDMA3_CHANNEL_TYPE_DMA, EDMA3_UART_TX_CHA_NUM, EDMA3_TRIG_MODE_EVENT, EDMA3_UART_TX_CHA_NUM, EVT_QUEUE_NUM); EDMA3FreeChannel(SOC_EDMA30CC_0_REGS, EDMA3_CHANNEL_TYPE_DMA, EDMA3_UART_RX_CHA_NUM, EDMA3_TRIG_MODE_EVENT, EDMA3_UART_RX_CHA_NUM, EVT_QUEUE_NUM); /* Support for Automation Testing. */ PRINT_STATUS(S_PASS); while(1); }
int main(void) { /* Configuring the system clocks for EDMA. */ EDMAModuleClkConfig(); /* Configuring the system clocks for UART0 instance. */ UART0ModuleClkConfig(); /* Performing Pin Multiplexing for UART0 instance. */ UARTPinMuxSetup(0); /* Enabling IRQ in CPSR of ARM processor. */ IntMasterIRQEnable(); /* Initializing the ARM Interrupt Controller. */ IntAINTCInit(); /* Initializing the EDMA. */ EDMA3Initialize(); /* Initializing the UART0 instance for use. */ UARTInitialize(); /* ** Configuring the EDMA. */ /* Request DMA Channel and TCC for UART Transmit*/ EDMA3RequestChannel(SOC_EDMA30CC_0_REGS, EDMA3_CHANNEL_TYPE_DMA, EDMA3_UART_TX_CHA_NUM, EDMA3_UART_TX_CHA_NUM, EVT_QUEUE_NUM); /* Registering Callback Function for TX*/ cb_Fxn[EDMA3_UART_TX_CHA_NUM] = &callback; /* Request DMA Channel and TCC for UART Receive */ EDMA3RequestChannel(SOC_EDMA30CC_0_REGS, EDMA3_CHANNEL_TYPE_DMA, EDMA3_UART_RX_CHA_NUM, EDMA3_UART_RX_CHA_NUM, EVT_QUEUE_NUM); /* Registering Callback Function for RX*/ cb_Fxn[EDMA3_UART_RX_CHA_NUM] = &callback; /******************** Transmission of a string **************************/ /* Configuring EDMA PaRAM sets to transmit 'welcome' message. */ UartEDMATxConfTransfer(EDMA3_UART_TX_CHA_NUM, EDMA3_UART_TX_CHA_NUM, welcome, sizeof(welcome) - 1); /* Wait for return from callback */ while(0 == clBackFlag); clBackFlag = 0; /******************** Transmission of a string **************************/ /* Enabling DMA Mode 1. */ UARTDMAEnable(UART_INSTANCE_BASE_ADD, UART_DMA_MODE_1_ENABLE); /* Configuring EDMA PaRAM sets to transmit 'enter' message. */ UartEDMATxConfTransfer(EDMA3_UART_TX_CHA_NUM, EDMA3_UART_TX_CHA_NUM, enter, sizeof(enter) - 1); /* Wait for return from callback */ while(0 == clBackFlag); clBackFlag = 0; /********************* Receiving Data from User *************************/ /* Enabling DMA Mode 1. */ UARTDMAEnable(UART_INSTANCE_BASE_ADD, UART_DMA_MODE_1_ENABLE); /* Configuring the PaRAM set for reception. */ UartEDMARxConfTransfer(EDMA3_UART_RX_CHA_NUM, EDMA3_UART_RX_CHA_NUM, rxBuffer, sizeof(rxBuffer)); /* Wait for return from callback */ while(0 == clBackFlag); clBackFlag = 0; /******************* Echoing received bytes *****************************/ /* Enabling DMA Mode 1. */ UARTDMAEnable(UART_INSTANCE_BASE_ADD, UART_DMA_MODE_1_ENABLE); /* Configuring the PaRAM set to transmit the bytes that were received. */ UartEDMATxConfTransfer(EDMA3_UART_TX_CHA_NUM, EDMA3_UART_TX_CHA_NUM, rxBuffer, sizeof(rxBuffer)); /* Wait for return from callback */ while(0 == clBackFlag); clBackFlag = 0; /******************* Freeing of allocated channels **********************/ /* Free EDMA3 Channels for TX and RX */ EDMA3FreeChannel(SOC_EDMA30CC_0_REGS, EDMA3_CHANNEL_TYPE_DMA, EDMA3_UART_TX_CHA_NUM, EDMA3_TRIG_MODE_EVENT, EDMA3_UART_TX_CHA_NUM, EVT_QUEUE_NUM); EDMA3FreeChannel(SOC_EDMA30CC_0_REGS, EDMA3_CHANNEL_TYPE_DMA, EDMA3_UART_RX_CHA_NUM, EDMA3_TRIG_MODE_EVENT, EDMA3_UART_RX_CHA_NUM, EVT_QUEUE_NUM); while(1); }
/* ** The main function. Application starts here. */ int main(void) { unsigned short parToSend; unsigned short parToLink; /* Set up pin mux for I2C module 0 */ I2CPinMuxSetup(0); McASPPinMuxSetup(); /* Power up the McASP module */ PSCModuleControl(SOC_PSC_1_REGS, HW_PSC_MCASP0, PSC_POWERDOMAIN_ALWAYS_ON, PSC_MDCTL_NEXT_ENABLE); /* Power up EDMA3CC_0 and EDMA3TC_0 */ PSCModuleControl(SOC_PSC_0_REGS, HW_PSC_CC0, PSC_POWERDOMAIN_ALWAYS_ON, PSC_MDCTL_NEXT_ENABLE); PSCModuleControl(SOC_PSC_0_REGS, HW_PSC_TC0, PSC_POWERDOMAIN_ALWAYS_ON, PSC_MDCTL_NEXT_ENABLE); #ifdef _TMS320C6X // Initialize the DSP interrupt controller IntDSPINTCInit(); #else /* Initialize the ARM Interrupt Controller.*/ IntAINTCInit(); #endif /* Initialize the I2C 0 interface for the codec AIC31 */ I2CCodecIfInit(SOC_I2C_0_REGS, INT_CHANNEL_I2C, I2C_SLAVE_CODEC_AIC31); EDMA3Init(SOC_EDMA30CC_0_REGS, 0); EDMA3IntSetup(); McASPErrorIntSetup(); #ifdef _TMS320C6X IntGlobalEnable(); #else /* Enable the interrupts generation at global level */ IntMasterIRQEnable(); IntGlobalEnable(); IntIRQEnable(); #endif /* ** Request EDMA channels. Channel 0 is used for reception and ** Channel 1 is used for transmission */ EDMA3RequestChannel(SOC_EDMA30CC_0_REGS, EDMA3_CHANNEL_TYPE_DMA, EDMA3_CHA_MCASP0_TX, EDMA3_CHA_MCASP0_TX, 0); EDMA3RequestChannel(SOC_EDMA30CC_0_REGS, EDMA3_CHANNEL_TYPE_DMA, EDMA3_CHA_MCASP0_RX, EDMA3_CHA_MCASP0_RX, 0); /* Initialize the DMA parameters */ I2SDMAParamInit(); /* Configure the Codec for I2S mode */ AIC31I2SConfigure(); /* Configure the McASP for I2S */ McASPI2SConfigure(); /* Activate the audio transmission and reception */ I2SDataTxRxActivate(); /* ** Looop forever. if a new buffer is received, the lastFullRxBuf will be ** updated in the rx completion ISR. if it is not the lastSentTxBuf, ** buffer is to be sent. This has to be mapped to proper paRAM set. */ while(1) { if(lastFullRxBuf != lastSentTxBuf) { /* ** Start the transmission from the link paramset. The param set ** 1 will be linked to param set at PAR_TX_START. So do not ** update paRAM set1. */ parToSend = PAR_TX_START + (parOffTxToSend % NUM_PAR); parOffTxToSend = (parOffTxToSend + 1) % NUM_PAR; parToLink = PAR_TX_START + parOffTxToSend; lastSentTxBuf = (lastSentTxBuf + 1) % NUM_BUF; ByteBuftoFloatBuf(rxBufPtr[lastFullRxBuf]); /* Copy the buffer */ memcpy((void *)txBufPtr[lastSentTxBuf], (void *)rxBufPtr[lastFullRxBuf], AUDIO_BUF_SIZE); /* ** Send the buffer by setting the DMA params accordingly. ** Here the buffer to send and number of samples are passed as ** parameters. This is important, if only transmit section ** is to be used. */ BufferTxDMAActivate(lastSentTxBuf, NUM_SAMPLES_PER_AUDIO_BUF, (unsigned short)parToSend, (unsigned short)parToLink); } } }
/* ** QDMA Application */ void EDMAAppQDMA3Test() { volatile unsigned int index = 0u; volatile unsigned int count = 0u; EDMA3CCPaRAMEntry paramSet; unsigned char data = 0u; unsigned int retVal = 0u; unsigned int isTestPassed = false; unsigned int numEnabled = 0u; unsigned int aCount = EDMAAPP_MAX_ACOUNT; unsigned int bCount = EDMAAPP_MAX_BCOUNT; unsigned int cCount = EDMAAPP_MAX_CCOUNT; unsigned int DstBuffAddr = 0u; volatile unsigned int opt = 0u; unsigned int paramId = 32u; /* Initalize source and destination buffers */ for(count = 0u; count < (aCount * bCount * cCount); count++) { SrcBuff[count] = data++; /* ** No need to initialize the destination buffer ** as it is being invalidated. */ } /* Request DMA channel and TCC */ retVal = EDMA3RequestChannel(EDMAAPP_EDMACC_BASE_ADDRESS, EDMAAPP_DMA_CH_TYPE, EDMAAPP_DMA_CH_NUM, EDMAAPP_DMA_TCC_NUM, EDMAAPP_DMA_EVTQ); EDMA3MapQdmaChToPaRAM(EDMAAPP_EDMACC_BASE_ADDRESS, EDMAAPP_DMA_CH_NUM, ¶mId); EDMA3SetQdmaTrigWord(EDMAAPP_EDMACC_BASE_ADDRESS, EDMAAPP_DMA_CH_NUM, EDMA3CC_PARAM_ENTRY_DST); /* Registering Callback Function */ EDMAAppCallbackFxn[EDMAAPP_DMA_TCC_NUM] = &EDMAAppCallback; if(TRUE == retVal) { /* Fill the PaRAM Set with transfer specific information */ paramSet.srcAddr = (unsigned int)(SrcBuff); paramSet.destAddr = (unsigned int)(DstBuff); paramSet.aCnt = (unsigned short)aCount; paramSet.bCnt = (unsigned short)bCount; paramSet.cCnt = (unsigned short)cCount; /* Setting up the SRC/DES Index */ paramSet.srcBIdx = (short)aCount; paramSet.destBIdx = (short)aCount; if(EDMA3_SYNC_A == EDMAAPP_DMA_SYNC_TYPE) { /* A Sync Transfer Mode */ paramSet.srcCIdx = (short)aCount; paramSet.destCIdx = (short)aCount; } else { /* AB Sync Transfer Mode */ paramSet.srcCIdx = ((short)aCount * (short)bCount); paramSet.destCIdx = ((short)aCount * (short)bCount); } /* Configure the paramset with NULL link */ paramSet.linkAddr = (unsigned short)0xFFFFu; paramSet.bCntReload = (unsigned short)0u; paramSet.opt = 0u; /* Src & Dest are in INCR modes */ paramSet.opt &= ~(EDMA3CC_OPT_SAM | EDMA3CC_OPT_DAM); /* Program the TCC */ paramSet.opt |= ((EDMAAPP_DMA_TCC_NUM << EDMA3CC_OPT_TCC_SHIFT) & EDMA3CC_OPT_TCC); /* Enable Intermediate & Final transfer completion interrupt */ paramSet.opt |= (1u << EDMA3CC_OPT_ITCINTEN_SHIFT); paramSet.opt |= (1u << EDMA3CC_OPT_TCINTEN_SHIFT); if(EDMA3_SYNC_A == EDMAAPP_DMA_SYNC_TYPE) { paramSet.opt &= ~EDMA3CC_OPT_SYNCDIM; } else { /* AB Sync Transfer Mode */ paramSet.opt |= (1u << EDMA3CC_OPT_SYNCDIM_SHIFT); } opt = paramSet.opt; /* Now, write the PaRAM Set. */ EDMA3QdmaSetPaRAM(EDMAAPP_EDMACC_BASE_ADDRESS, EDMAAPP_DMA_CH_NUM, paramId, ¶mSet); } retVal = EDMA3EnableTransfer(EDMAAPP_EDMACC_BASE_ADDRESS, EDMAAPP_DMA_CH_NUM, EDMAAPP_DMA_TRIG_MODE); /* ** Since the transfer is going to happen in Manual mode of EDMA3 ** operation, we have to 'Enable the Transfer' multiple times. ** Number of times depends upon the Mode (A/AB Sync) ** and the different counts. */ if(TRUE == retVal) { /* Need to activate next param */ if(EDMA3_SYNC_A == EDMAAPP_DMA_SYNC_TYPE) { numEnabled = bCount * cCount; } else { /* AB Sync Transfer Mode */ numEnabled = cCount; } for(index = 0u; index < numEnabled; index++) { IrqRaised = EDMAAPP_IRQ_STATUS_XFER_INPROG; if(index == (numEnabled - 1u)) { /** ** Since OPT.STATIC field should be SET for isolated QDMA ** transfers or for the final transfer in a linked list of QDMA ** transfers, do the needful for the last request. */ opt |= EDMA3CC_OPT_STATIC; EDMA3QdmaSetPaRAMEntry(EDMAAPP_EDMACC_BASE_ADDRESS, paramId, EDMA3CC_PARAM_ENTRY_OPT, opt); } opt |= EDMA3CC_OPT_FWID_8BIT; EDMA3QdmaSetPaRAMEntry(EDMAAPP_EDMACC_BASE_ADDRESS, paramId, EDMA3CC_PARAM_ENTRY_OPT, opt); /* ** Now trigger the QDMA channel by writing to the Trigger ** Word which is set as Destination Address. */ DstBuffAddr = (unsigned int)EDMA3QdmaGetPaRAMEntry( EDMAAPP_EDMACC_BASE_ADDRESS, paramId, EDMA3CC_PARAM_ENTRY_DST); EDMA3QdmaSetPaRAMEntry(EDMAAPP_EDMACC_BASE_ADDRESS, paramId, EDMA3CC_PARAM_ENTRY_DST, DstBuffAddr); /* Wait for the Completion ISR. */ while(EDMAAPP_IRQ_STATUS_XFER_INPROG == IrqRaised) { /* ** Wait for the Completion ISR on Master Channel. ** You can insert your code here to do something ** meaningful. */ } /* Check the status of the completed transfer */ if(IrqRaised < (int)EDMAAPP_IRQ_STATUS_XFER_INPROG) { /* Some error occured, break from the FOR loop. */ ConsoleUtilsPrintf("\r\nQDMA3Test: Event Miss Occured!!!\r\n"); /* Clear the error bits first */ EDMA3ClearErrorBits(EDMAAPP_EDMACC_BASE_ADDRESS, EDMAAPP_DMA_CH_NUM, EDMAAPP_DMA_EVTQ); break; } } } /* Match the Source and Destination Buffers. */ if(TRUE == retVal) { for(index = 0u; index < (aCount * bCount * cCount); index++) { if(SrcBuff[index] != DstBuff[index]) { isTestPassed = false; ConsoleUtilsPrintf("QDMA3Test: Data write-read matching FAILED.\r\n"); ConsoleUtilsPrintf("The mismatch happened at index : %d\r\n", ((int)index + 1u)); break; } } if(index == (aCount * bCount * cCount)) { isTestPassed = true; ConsoleUtilsPrintf("QDMA3Test: Data write-read matching PASSED.\r\n"); } /* Free the previously allocated channel. */ retVal = EDMA3FreeChannel(EDMAAPP_EDMACC_BASE_ADDRESS, EDMAAPP_DMA_CH_TYPE, EDMAAPP_DMA_CH_NUM, EDMAAPP_DMA_TRIG_MODE, EDMAAPP_DMA_TCC_NUM, EDMAAPP_DMA_EVTQ); /* Unregister Callback Function */ EDMAAppCallbackFxn[EDMAAPP_DMA_TCC_NUM] = NULL; if(TRUE != retVal) { ConsoleUtilsPrintf("QDMA3Test: EDMA3_DRV_freeChannel() FAILED.\r\n"); } } if(true == isTestPassed) { ConsoleUtilsPrintf("QDMA3Test PASSED.\r\n"); } else { ConsoleUtilsPrintf("QDMA3Test FAILED.\r\n"); } }