void initEdma(void) { CSL_Edma3HwSetup hwSetup; CSL_Edma3Obj edmaObj; CSL_Edma3ParamHandle hParamBasic; CSL_Edma3ChannelObj chObj; CSL_Edma3CmdIntr regionIntr; CSL_Edma3ParamSetup myParamSetup; CSL_Edma3Context context; CSL_Edma3ChannelAttr chAttr; CSL_Edma3HwDmaChannelSetup dmahwSetup; Uint32 loopIndex; CSL_Status status; unsigned long long llTemp; //Module initialization status = CSL_edma3Init(&context); if (status != CSL_SOK) { printf ("Edma module initialization failed\n"); return; } // Intc module initialization intcContext.eventhandlerRecord = EventHandler; intcContext.numEvtEntries = 10; CSL_intcInit(&intcContext); // Enable NMIs CSL_intcGlobalNmiEnable(); // Enable global interrupts CSL_intcGlobalEnable(&state); // Opening a intc handle for edma event vectId = CSL_INTC_VECTID_4; hIntcEdma = CSL_intcOpen (&intcObjEdma, CSL_INTC_EVENTID_RINT0, &vectId , NULL); hModule = CSL_edma3Open(&edmaObj,CSL_EDMA3,NULL,&status); if ( (hModule == NULL) || (status != CSL_SOK)) { printf ("Edma module open failed\n"); return; } gRcvTCC = CSL_EDMA3_CHA_REVT0; // Edma module setup dmahwSetup.paramNum = 0; dmahwSetup.que = CSL_EDMA3_QUE_0; hwSetup.dmaChaSetup = &dmahwSetup; hwSetup.qdmaChaSetup = NULL; status = CSL_edma3HwSetup(hModule,&hwSetup); if (status != CSL_SOK) { printf ("Hardware setup failed\n"); CSL_edma3Close (hModule); return; } /* Setup the DRAE masks */ regionAccess.region = CSL_EDMA3_REGION_0; regionAccess.drae = 0xFFFF ; regionAccess.draeh = 0xff0000; status = CSL_edma3HwControl(hModule,CSL_EDMA3_CMD_DMAREGION_ENABLE, ®ionAccess); if (status != CSL_SOK) { printf("Edma region enable command failed\n"); return; } /* Channel open */ chAttr.regionNum = CSL_EDMA3_REGION_0; chAttr.chaNum = gRcvTCC; hChannel = CSL_edma3ChannelOpen(&chObj, CSL_EDMA3, &chAttr, &status); if ( (hChannel == NULL) || (status != CSL_SOK)) { printf ("Edma channel open failed\n"); return; } /* Get the parameter handle */ hParamBasic = CSL_edma3GetParamHandle(hChannel,0,&status); if (hParamBasic == NULL) { printf("Edma get param handle failed\n"); return; } /* Edma parameter entry Setup */ myParamSetup.option = CSL_EDMA3_OPT_MAKE(CSL_EDMA3_ITCCH_DIS, \ CSL_EDMA3_TCCH_DIS, \ CSL_EDMA3_ITCINT_DIS, \ CSL_EDMA3_TCINT_EN,\ gRcvTCC,\ CSL_EDMA3_TCC_NORMAL,\ CSL_EDMA3_FIFOWIDTH_NONE, \ CSL_EDMA3_STATIC_DIS, \ CSL_EDMA3_SYNC_A, \ CSL_EDMA3_ADDRMODE_INCR, \ CSL_EDMA3_ADDRMODE_INCR); myParamSetup.srcAddr = (Uint32)0x30000000; //McBSP Receive Address myParamSetup.aCntbCnt = CSL_EDMA3_CNT_MAKE(1,1); myParamSetup.dstAddr = (Uint32)recvbuf; myParamSetup.srcDstBidx = CSL_EDMA3_BIDX_MAKE(0,0); myParamSetup.linkBcntrld = CSL_EDMA3_LINKBCNTRLD_MAKE (hParamBasic,0); myParamSetup.srcDstCidx = CSL_EDMA3_CIDX_MAKE(0,0); myParamSetup.cCnt = 1; status = CSL_edma3ParamSetup(hParamBasic,&myParamSetup); if (status != CSL_SOK) { printf ("Edma param setup failed\n"); return; } /* Association of an EDMA event handler with the INTC routine */ EventRecord.handler = &eventEdmaHandler; EventRecord.arg = (void*)(hModule); CSL_intcPlugEventHandler(hIntcEdma,&EventRecord); /* Enabling event edma */ CSL_intcHwControl(hIntcEdma,CSL_INTC_CMD_EVTENABLE,NULL); /* Hook up the EDMA event with an completion code function handler */ EdmaEventHook(gRcvTCC, tcc13Fxn); /* Enable interrupts */ regionIntr.region = CSL_EDMA3_REGION_0; llTemp |= (unsigned long long)1 << gRcvTCC; regionIntr.intr = _loll(llTemp); regionIntr.intrh = _hill(llTemp); status = CSL_edma3HwControl(hModule,CSL_EDMA3_CMD_INTR_ENABLE,®ionIntr); if (status != CSL_SOK) { printf ("Edma interrupt enable command failed\n"); return; } /* Manually trigger the channel */ status = CSL_edma3HwChannelControl(hChannel,CSL_EDMA3_CMD_CHANNEL_SET,NULL); if (status != CSL_SOK) { printf ("Edma channel set command failed\n"); return; } }