Hi everyone,
I have successfully implemented a simple block transfer using EDMA with an interruption.
However I think that my ISR isn't complete. Can anyone help me figure out what is missing ?
Here's a stripped down version of the code.
By the way what does GEM mean ?
Global variables
CSL_IntcHandle hIntc;
CSL_CPINTC_Handle hnd;
Main
void main(void) {
...
gem_intc_config();
cp_intc_config();
Edma_block_transfer(block_src,block_dst);
...
}
gem_intc_config
void gem_intc_config( void ){
CSL_IntcContext intcContext;
CSL_IntcGlobalEnableState state;
CSL_IntcObj intcObj;
CSL_IntcParam vectId;
CSL_IntcEventHandlerRecord EventRecord;
CSL_IntcEventHandlerRecord EventHandler[30];
intcContext.eventhandlerRecord = EventHandler;
intcContext.numEvtEntries = 10;
/* Initiate INTC module */
CSL_intcInit(&intcContext)
/* Enable NMIs : Non Maskable Interrups*/
CSL_intcGlobalNmiEnable()
/* Enable global interrupts */
CSL_intcGlobalEnable(&state)
/* Open the INTC Module for Vector ID: 4 and Event ID: 29 (C6678) */
/* Instance 1 (EDMACC1), Core 0 */
vectId = CSL_INTC_VECTID_4;
hIntc = CSL_intcOpen (&intcObj, 29, &vectId , NULL);
/* Register an call-back handler which is invoked when the event occurs. */
EventRecord.handler = &edma_isr_handler;
EventRecord.arg = 0;
CSL_intcPlugEventHandler(hIntc,&EventRecord)
/* Enabling the events. */
CSL_intcHwControl(hIntc,CSL_INTC_CMD_EVTENABLE, NULL)
}
cp_intc_config
void cp_intc_config( void ){
// chip-level INTC0 is for CorePac0~3
hnd = CSL_CPINTC_open(CSL_CP_INTC_0); // edma3 events are mapped to CPINTC0
/* Disable all host interrupts. */
CSL_CPINTC_disableAllHostInterrupt(hnd);
/* Configure no nesting support in the CPINTC Module. */
CSL_CPINTC_setNestingMode (hnd, CPINTC_NO_NESTING);
/* Map System Interrupt 6 (EDMACC GINT) to channel 40 */
CSL_CPINTC_mapSystemIntrToChannel (hnd, 6, 40);
/* Map channel 40 to host interrupt 40 */
CSL_CPINTC_mapChannelToHostInterrupt (hnd, 40 , 40);
/* Enable system interrupt 6 */
CSL_CPINTC_enableSysInterrupt (hnd, 6);
/* We enable host interrupts. */
CSL_CPINTC_enableHostInterrupt (hnd, 40);
/* Enable all host interrupts also. */
CSL_CPINTC_enableAllHostInterrupt(hnd);
}
edma_isr_handler
static void edma_isr_handler (void* handle)
{
CSL_CPINTCHostInterrupt hostIntr;
CSL_CPINTCSystemInterrupt sysIntr;
/* Disable CPINTC0 Host interrupt (CPINTC output) */
CSL_CPINTC_disableHostInterrupt(hnd, hostIntr);
/* Clear the CPINTC0 Interrupt */
CSL_CPINTC_clearSysInterrupt(hnd, sysIntr);
/* Clear the CorePac Interrupt */
CSL_intcHwControl(hIntc,CSL_INTC_CMD_EVTCLEAR,NULL);
/* ISR EVENTUAL TASKS */
/* ****************** */
/* Enable CPINTC0 Host interrupt (CPINTC output) */
CSL_CPINTC_enableHostInterrupt(hnd, hostIntr);
}
Edma_block_transfer
int Edma_block_transfer(float* block_src, float* block_dst) Uint8 coreNum, Int32 instNum, Uint8 channelNum)
{
(...)
Uint8 coreNum = 0;
Int32 instNum = 1;
Uint8 channelNum = 1;
// instNum = 1; -> p161/232 data manual EDMACC1_GINT is tied to Event #6
(...)
/* Setup the param set */
myParamSetup.option = CSL_EDMA3_OPT_MAKE( CSL_EDMA3_ITCCH_DIS, \
CSL_EDMA3_TCCH_DIS, \
CSL_EDMA3_ITCINT_DIS, \
CSL_EDMA3_TCINT_EN, \
6, \
CSL_EDMA3_TCC_NORMAL, \
CSL_EDMA3_FIFOWIDTH_NONE, \
CSL_EDMA3_STATIC_EN, \
CSL_EDMA3_SYNC_A, \
CSL_EDMA3_ADDRMODE_INCR, \
CSL_EDMA3_ADDRMODE_INCR
);
(...)
/* Setup the block1 entry */
CSL_edma3ParamSetup(hParamBlock1,&myParamSetup)
/* Interrupt enable for the global region interrupts */
regionIntr.region = CSL_EDMA3_REGION_GLOBAL;
regionIntr.intr = (1<<6);
regionIntr.intrh = 0;
CSL_edma3HwControl(hModule,CSL_EDMA3_CMD_INTR_ENABLE,®ionIntr);
/* *************************************************************************** */
/* Manually trigger the channel 1 */
/* *************************************************************************** */
CSL_edma3HwChannelControl(hChannel,CSL_EDMA3_CMD_CHANNEL_SET,NULL)
/* ISR */
/* Close channel */
CSL_edma3ChannelClose(hChannel)
/* Close EDMA module */
CSL_edma3Close(hModule)
}
Thank you
CM