I'm having some trouble setting up a DMA transfer to be triggered from a GPIO interrupt on a C6678. From what I can tell from the example code provided in the MCSDK, as well as the CSL docs and SPRS691E but the event is still not being triggered. The setup code I'm using is pasted below.
// Variables for configuring the EDMA CSL_Edma3Handle hModule; CSL_Edma3Obj edmaObj; CSL_Status status; CSL_Edma3CmdDrae regionAccess; CSL_Edma3ChannelAttr chAttr; CSL_Edma3ChannelObj chObj; CSL_Edma3ChannelHandle hChannel; CSL_Edma3ParamHandle hParamBasic; CSL_Edma3ParamSetup myParamSetup; unsigned int reloadAddress; CSL_CPINTC_Handle cpintcHandle; cpintcHandle = CSL_CPINTC_open (CSL_EDMA3CC_2); // Disable all host interrupts. CSL_CPINTC_disableAllHostInterrupt(cpintcHandle); // Configure no nesting support in the CPINTC Module CSL_CPINTC_setNestingMode (cpintcHandle, CPINTC_NO_NESTING); // Clear GPINT9 system interrupt number 111 // We get the interrupt number from Table 7-40 in the 6678 // data manual at www.ti.com/.../sprs691c.pdf CSL_CPINTC_clearSysInterrupt (cpintcHandle, CSL_INTC2_GPINT9); // Map System Interrupt to Channel CSL_CPINTC_mapSystemIntrToChannel(cpintcHandle, CSL_INTC2_GPINT9, DMA_FPGA_RX_EVENT); CSL_CPINTC_mapChannelToHostInterrupt(cpintcHandle, DMA_FPGA_RX_EVENT, DMA_FPGA_RX_EVENT); CSL_CPINTC_enableHostInterrupt(cpintcHandle, DMA_FPGA_RX_EVENT); // Enable GPINT9 system interrupt number 1 on CIC2 CSL_CPINTC_enableSysInterrupt(cpintcHandle, CSL_INTC2_GPINT9); // Enable CIC2_OUT48 CSL_CPINTC_enableHostInterrupt(cpintcHandle, DMA_FPGA_RX_EVENT); CSL_CPINTC_enableAllHostInterrupt(cpintcHandle); // Initialize the EDMA3 Module. CSL_edma3Init(NULL); // Module Level Open hModule = CSL_edma3Open(&edmaObj, CSL_EDMA3CC_2, NULL, &status); // Enable shadow region access? regionAccess.region = CSL_EDMA3_REGION_GLOBAL; regionAccess.drae = (0x1 << DMA_FPGA_TX_EVENT); regionAccess.draeh = (0x1 << (DMA_FPGA_RX_EVENT - 32)); CSL_edma3HwControl(hModule, CSL_EDMA3_CMD_DMAREGION_ENABLE, ®ionAccess); // FPGA RX DMA Configuration. This will be triggered by the 48kHz servo interrupt. // Open FPGA RX DMA in context of all regions? chAttr.regionNum = CSL_EDMA3_REGION_GLOBAL; chAttr.chaNum = DMA_FPGA_RX_EVENT; hChannel = CSL_edma3ChannelOpen(&chObj, CSL_EDMA3CC_2, &chAttr, &status); // Map the channel to initial PARAM Entry CSL_edma3HwChannelSetupParam(hChannel, DMA_FPGA_RX_EVENT); // Configure FPGA RX DMA initial PARAM entry // Obtain a handle to PARAM Entry hParamBasic = CSL_edma3GetParamHandle(hChannel, DMA_FPGA_RX_EVENT, &status); // Configure PARAM, corresponding register fields are listed on the right. // OPT Register fields myParamSetup.option = CSL_EDMA3_OPT_MAKE(CSL_EDMA3_ITCCH_DIS, // ITCCHEN: Intermediate transfer completion chaining disabled CSL_EDMA3_TCCH_DIS, // TCCHEN: Transfer completion chaining disabled CSL_EDMA3_ITCINT_DIS, // ITCINTEN: Intermediate transfer completion interrupt disabled CSL_EDMA3_TCINT_EN, // TCINTEN: Transfer completion interrupt enabled. This allows us to detect when the DMA completes by peering into the IPR. DMA_FPGA_RX_EVENT, // TCC: Transfer completion code. This specifies which bit in the IPR will be set when the DMA completes. CSL_EDMA3_TCC_NORMAL, // TCCMODE: Normal transfer complete code mode. CSL_EDMA3_FIFOWIDTH_NONE, // FWID: Incrementing addressing mode, so no FIFOs CSL_EDMA3_STATIC_DIS, // STATIC: PARAM set is not static, we will link upon completion. CSL_EDMA3_SYNC_AB, // SYNCDIM: AB synchronized transfer CSL_EDMA3_ADDRMODE_INCR, // DAM: Destination address is not static CSL_EDMA3_ADDRMODE_INCR); // SAM: Source address is not static myParamSetup.srcAddr = (Uint32)POS_FBK_COUNT_BASE; // Source address myParamSetup.aCntbCnt = CSL_EDMA3_CNT_MAKE(sizeof(fpgaReceiveData), 1); // 31:16, B dimension count. 15:0, A dimension count. myParamSetup.dstAddr = (Uint32)&fpgaReceiveData; // Destination address myParamSetup.srcDstBidx = CSL_EDMA3_BIDX_MAKE(0, 0); // 31:16, destination B dimension increment. 15:0, source B dimension increment. reloadAddress = 0x4000 + 0x20*DMA_FPGA_RX_CHAIN_PARAM; myParamSetup.linkBcntrld = CSL_EDMA3_LINKBCNTRLD_MAKE(reloadAddress, 0); // 31:16, reload PARAM link. 15:0, B count reload value. myParamSetup.srcDstCidx = CSL_EDMA3_CIDX_MAKE(0, 0); // 31:16, destination C dimension increment. 15:0, source C dimension increment. myParamSetup.cCnt = 1; // C dimension count // Configure the PARAM Entry with the setup information. CSL_edma3ParamSetup(hParamBasic, &myParamSetup); // Duplicate the above setup for the reload parameter entry. // Obtain a handle to PARAM Entry hParamBasic = CSL_edma3GetParamHandle(hChannel, DMA_FPGA_RX_CHAIN_PARAM, &status); // Configure the PARAM Entry with the setup information. CSL_edma3ParamSetup(hParamBasic, &myParamSetup); // Enable Channel. This sets the corresponding bit in the EER which allows the corresponding interrupt to trigger the DMA. CSL_edma3HwChannelControl(hChannel, CSL_EDMA3_CMD_CHANNEL_ENABLE, NULL); // Close channel CSL_edma3ChannelClose(hChannel);
In the code above DMA_FPGA_RX_EVENT is defined as CSL_EDMA3CC2_INTC2_OUT48 which is 0x26. Is there a step I'm missing in this setup or is my host interrupt number incorrect? If so how would I go about calculating it?