/** To Register the ISRs with the underlying OS, if required */ void registerEdma3Interrupts (unsigned int edma3Id) { static UInt32 cookie = 0; Int eventId = 0; /* GEM event id */ unsigned int numTc = 0; /* Disabling the global interrupts */ cookie = Hwi_disable(); /* Transfer completion ISR */ CpIntc_dispatchPlug(ccXferCompInt[edma3Id][dsp_num], lisrEdma3ComplHandler0, edma3Id, TRUE); CpIntc_mapSysIntToHostInt(0, ccXferCompInt[edma3Id][dsp_num], ccXferHostInt[edma3Id][dsp_num]); CpIntc_enableHostInt(0, ccXferHostInt[edma3Id][dsp_num]); eventId = CpIntc_getEventId(ccXferHostInt[edma3Id][dsp_num]); EventCombiner_dispatchPlug (eventId, CpIntc_dispatch, ccXferHostInt[edma3Id][dsp_num], TRUE); EventCombiner_enableEvent(eventId); /* CC Error ISR */ CpIntc_dispatchPlug(ccErrorInt[edma3Id], lisrEdma3CCErrHandler0, edma3Id, TRUE); CpIntc_mapSysIntToHostInt(0, ccErrorInt[edma3Id], edma3ErrHostInt[edma3Id][dsp_num]); /* TC Error ISR */ while (numTc < numEdma3Tc[edma3Id]) { CpIntc_dispatchPlug(tcErrorInt[edma3Id][numTc], (CpIntc_FuncPtr )(ptrEdma3TcIsrHandler[numTc]), edma3Id, TRUE); CpIntc_mapSysIntToHostInt(0, tcErrorInt[edma3Id][numTc], edma3ErrHostInt[edma3Id][dsp_num]); numTc++; } /* Enable the host interrupt which is common for both CC and TC error */ CpIntc_enableHostInt(0, edma3ErrHostInt[edma3Id][dsp_num]); eventId = CpIntc_getEventId(edma3ErrHostInt[edma3Id][dsp_num]); EventCombiner_dispatchPlug (eventId, CpIntc_dispatch, edma3ErrHostInt[edma3Id][dsp_num], TRUE); EventCombiner_enableEvent(eventId); Hwi_enableInterrupt(hwiInterrupt); /* enable the 'global' switch */ CpIntc_enableAllHostInts(0); /* Restore interrupts */ Hwi_restore(cookie); }
/** To Unregister the ISRs with the underlying OS, if previously registered. */ void unregisterEdma3Interrupts (unsigned int edma3Id) { static UInt32 cookie = 0; Int eventId = 0; /* GEM event id */ /* Disabling the global interrupts */ cookie = Hwi_disable(); /* Transfer completion ISR */ CpIntc_disableHostInt(0, ccXferHostInt[edma3Id][dsp_num]); eventId = CpIntc_getEventId(ccXferHostInt[edma3Id][dsp_num]); EventCombiner_disableEvent(eventId); /* CC/TC Error ISR */ CpIntc_disableHostInt(0, edma3ErrHostInt[edma3Id][dsp_num]); eventId = CpIntc_getEventId(edma3ErrHostInt[edma3Id][dsp_num]); EventCombiner_disableEvent(eventId); /* Restore interrupts */ Hwi_restore(cookie); }
BOOL Intr_Init(Intr *pThis, IntrItem eIntrItem, Intr_Handler pfnIntr_Handler, VOID *pIntrHandlerArg) //(*pIntr_Handler)(void *),\ { //CSL_Status intStat; //guru:may be not required for C6678 #if 1 //Initialize Global interrupts //Intr_EnableGlobalInterrupts(); Hwi_enable(); #endif //Initialize Global interrupts //CSL_intcGlobalEnable(NULL); //Get the values from Interrupt Table DataBase IntrDB_GetIntrTableParam(&pThis->oIntrTableParam, eIntrItem); Hwi_Params_init(&pThis->oHwi); Error_init(&pThis->eb); //Check whether the Interrupt source uses CIC Module if(pThis->oIntrTableParam.bCicRequired == TRUE) { /* Map the System Interrupt i.e. the Interrupt Destination 0 interrupt to the DIO ISR Handler. */ CpIntc_dispatchPlug(pThis->oIntrTableParam.SysInt,(ti_sysbios_family_c66_tci66xx_CpIntc_FuncPtr) pfnIntr_Handler, (xdc_UArg)pIntrHandlerArg, FALSE); /* The configuration is for CPINTC0. We map system interrupt 112 to Host Interrupt 8. */ CpIntc_mapSysIntToHostInt(0,pThis->oIntrTableParam.SysInt,pThis->oIntrTableParam.HostInt ); /* Get the event id associated with the host interrupt. */ pThis->oHwi.eventId = CpIntc_getEventId(pThis->oIntrTableParam.HostInt); pThis->oHwi.arg = pThis->oIntrTableParam.HostInt; pThis->oHwi.maskSetting = Hwi_MaskingOption_NONE; //pThis->oHwi.priority = 3; pThis->oHwiHandle = Hwi_create((Int)pThis->oIntrTableParam.eIntcVectorId, (Hwi_FuncPtr)CpIntc_dispatch, &pThis->oHwi, &pThis->eb);// SYSBIOS API if(pThis->oHwiHandle==NULL) { #ifdef DEBUG LOG_TRACE0("INTR: Hwi not created ... Failed.\n"); #endif } } else { pThis->oHwi.eventId=pThis->oIntrTableParam.nIntcEventId; pThis->oHwi.maskSetting = Hwi_MaskingOption_NONE; //pThis->oHwi.priority = 3; //register the argument to be passed with the ISR pThis->oHwi.arg = (UArg)pIntrHandlerArg; pThis->oHwiHandle = Hwi_create((Int)pThis->oIntrTableParam.eIntcVectorId, (Hwi_FuncPtr)pfnIntr_Handler, &pThis->oHwi, &pThis->eb);// SYSBIOS API if(pThis->oHwiHandle==NULL) { #ifdef DEBUG LOG_TRACE0("INTR: Hwi not created ... Failed.\n"); #endif } } #ifdef _STE_APP //Initialize the oHwi object #endif #ifdef _STE_BOOT //Csl APIs or Hooking the Interrupt Event pThis->oIntcHandle = CSL_intcOpen (&pThis->oIntcObj, pThis->oIntrTableParam.nIntcEventId, &pThis->oIntrTableParam.eIntcVectorId, NULL); if ((pThis->oIntcHandle == NULL)) { #ifdef DEBUG printf ("INTR: Open... Failed.\n"); printf ("hIntc = 0x%x]\n", pThis->oIntcHandle); #endif } else { #ifdef DEBUG printf ("INTR: Open... Passed.\n"); #endif } pThis->oEventRecord.handler = (CSL_IntcEventHandler)pfnIntr_Handler; pThis->oEventRecord.arg = pIntrHandlerArg; CSL_intcPlugEventHandler(pThis->oIntcHandle, &pThis->oEventRecord); #endif return TRUE; }