static BOOL Intr_EnableGlobalInterrupts(VOID)
{
	CSL_Status          intStat;
	CSL_CPINTC_Handle    hnd;
	//If already initialized return to caller
	if( bIntcInitialized )
	{
		return TRUE;
	}
	#ifdef _STE_BOOT

	context.numEvtEntries = 12; 
    context.eventhandlerRecord = EventHandler;
	
	//Enable CSL Intc Module
	intStat = CSL_intcInit(&context);
	if (intStat != CSL_SOK)
	{
		#ifdef DEBUG 
		printf("INTR: Initialization error.\n");
		#endif
	}    
	/* Enable NMIs */	
	intStat = CSL_intcGlobalNmiEnable();
	if (intStat != CSL_SOK) 
	{
		#ifdef DEBUG
		printf("INTR: Error while enabling NMI.\n");
		#endif
	}

	/* Enable all interrupts */
	intStat = CSL_intcGlobalEnable(&state);
	if (intStat != CSL_SOK)
	{
		#ifdef DEBUG 
		printf("INTR: Error while enabling interrupt.\n");
		#endif
	}
	#endif
	//Enable CIC Module
	bIntcInitialized = TRUE;

	//Initialize the CSL CIC Module 
	//intStat = CSL_cicInit(&CicContext); //commented by nachi
	hnd = CSL_CPINTC_open (0);    // Inserted for new chip (Opens CPINTC Instance 0)

	if (hnd != CSL_SOK)
	{
		#ifdef _STE_APP
		LOG_TRACE0( "INTR : CIC init error");
		#endif
		return FALSE;
	}	
	return TRUE;
}
예제 #2
0
//配置uPP的中断
void upp_intc_setup_my(int (*isr)(void *))
{
	//初始化开始
	intcContext_uPP.eventhandlerRecord = EventHandler_uPP;		//事件句柄记录指针
	intcContext_uPP.numEvtEntries = 50;						//事件入口数目

    CSL_intcInit(&intcContext_uPP);							//初始化中断上下文对象变量,返回状态CSL_SOK

    // Enable NMIs使能非可屏蔽中断
    CSL_intcGlobalNmiEnable();

    //Enable global interrupts使能全局中断
    CSL_intcGlobalEnable(&intc_state_uPP);

	/***************** interrupt configration for UPP接口  **************************/
	/* open CPINTC0 to map the UPP completetion ISR event to the host interrupt */
	hnd_UPP = CSL_CPINTC_open(0);
	if (hnd_UPP == 0)
	{
		printf ("Error: Unable to open CPINTC-1\n");
		return;
	}
	glbCpintcHnd[2] = (CSL_CPINTC_RegsOvly)hnd_UPP;
	//需要根据应用修改UPP产生的事件编号及CPINTC输出channel号
	CSL_CPINTC_mapSystemIntrToChannel (hnd_UPP, CSL_INTC0_RPINT, 9);
	CSL_CPINTC_enableSysInterrupt (hnd_UPP, CSL_INTC0_RPINT);
	CSL_CPINTC_enableHostInterrupt (hnd_UPP, 9);
	CSL_CPINTC_enableAllHostInterrupt(hnd_UPP);

	vectId_uPP = CSL_INTC_VECTID_4;

	hIntcUpp= CSL_intcOpen (&intcObjUpp, CSL_GEM_INTC0_OUT_9_PLUS_20_MUL_N, &vectId_uPP , NULL);

	gpioHandler.handler = (CSL_IntcEventHandler)&upp_isr;//事件句柄指针
	gpioHandler.arg = 0;										//传递给参数的句柄指针
	CSL_intcPlugEventHandler(hIntcUpp, &gpioHandler);					//建立事件和句柄的映射关系

	CSL_intcHwControl(hIntcUpp,CSL_INTC_CMD_EVTCLEAR,NULL);

	CSL_intcHwControl(hIntcUpp, CSL_INTC_CMD_EVTENABLE, NULL);

	/***************** interrupt configration for UPP接口  **************************/
}
예제 #3
0
파일: main.c 프로젝트: fangbaolei/EC700IR
void main()
{
	CSL_IntcGlobalEnableState state;

	CSL_sysInit();
	CSL_intcGlobalEnable(&state);

	*((volatile unsigned int *)DSPINTCLR)|=0xF; // clear all DSP INT
	init_cache();

	DmaInit();		// ³õʼ»¯DMA¿â
	CLK_start();	// Æô¶¯Ê±ÖÓ

	linkObj.armReg = (DSPLinkRegHandle)DSPLINK_MEM_ARM;
	linkObj.dspReg = (DSPLinkRegHandle)DSPLINK_MEM_DSP;
	linkObj.trigerInt = DSPINTARM;

	DSPLinkWrite(0);
	tskMessageDispatch(MessageProc);
}
예제 #4
0
/*
 * =============================================================================
 *   @func  IntcInit
 *
 *   @arg
 *      NONE
 *
 *   @desc
 *      初始化中断
 *
 *   @return
 *      NONE
 *
 * =============================================================================
 */
void IntcInit()
{
	/*初始化开始*/
	intcContext_uPP.eventhandlerRecord = EventHandler_uPP;		//事件句柄记录指针
	intcContext_uPP.numEvtEntries = 50;						//事件入口数目

	/* 初始化结束,前面的初始化过程只需要一次,如果需要增加中断处理,直接添加中断矢量
	和事件号即可,无需再次初始化,否则会覆盖掉前面的配置(包括事件和其中断服务程序的映射表等)*/

   	/*初始化中断上下文对象变量,返回状态CSL_SOK*/
	 CSL_intcInit(&intcContext_uPP);
    /*使能非可屏蔽中断*/
    CSL_intcGlobalNmiEnable();
    /*使能全局中断*/
    CSL_intcGlobalEnable(&intc_state_uPP);

	if(coreNum == 0)
	{

		/************************ 1.中断配置-----收图 **************************/
        ///////////////////////////第一步:EDMACC_GINT事件作为system interrupt通过CPINTC映射到host interrupt////////////
		/* open CPINTC0 to map the EDMA completetion ISR event to the host interrupt */
		hnd_EDMA_uPP = CSL_CPINTC_open(0);
		if (hnd_EDMA_uPP == 0)
		{
			printf ("Error: Unable to open CPINTC-1\n");
			return;
		}
		glbCpintcHnd[1] = (CSL_CPINTC_RegsOvly)hnd_EDMA_uPP;
		//需要根据应用修改EDMA产生的事件编号及CPINTC输出channel号
		//tms320c6657.pdf中"EDMA产生的事件编号"对应"CIC0 Event Inputs的22号",System Event Mapping的CIC0_OUT(8+20*n)的"8"为host interrupt
		CSL_CPINTC_mapSystemIntrToChannel (hnd_EDMA_uPP, CSL_INTC0_CPU_3_2_EDMACC_GINT, 8);//system interrupt maping  to host interrupt
		CSL_CPINTC_enableSysInterrupt (hnd_EDMA_uPP, CSL_INTC0_CPU_3_2_EDMACC_GINT);
		CSL_CPINTC_enableHostInterrupt (hnd_EDMA_uPP, 8);
		CSL_CPINTC_enableAllHostInterrupt(hnd_EDMA_uPP);

		/***************** interrupt configration for EDMA completed ***************/
		//////////////////////////////////////第二步:host interrupt号转换为Event ID号,并绑定中断向量号/////////////////////////
		/* Opening a intc handle for edma event */
		vectId_uPP = CSL_INTC_VECTID_7;
		//打开中断向量句柄,建立事件与中断之间的映射关系
		//CSL_GEM_INTC0_OUT_8_PLUS_20_MUL_N  即CIC0_OUT(8+20*n)中8+20*n为Event ID
		hIntcEdma_uPP = CSL_intcOpen (&intcObjEdma_uPP, CSL_GEM_INTC0_OUT_8_PLUS_20_MUL_N, \
								  &vectId_uPP , NULL);

		/* Association of an EDMA event handler with the INTC routine 关联EDMA事件句柄到INTC程序*/
		EventRecord_uPP.handler = &eventEdmaHandler;//EDMA事件句柄指针
		EventRecord_uPP.arg = (void*)(hModule_uPP);//hModule_uPP是EMDA通道句柄
		CSL_intcPlugEventHandler(hIntcEdma_uPP,&EventRecord_uPP);		//建立事件和句柄的映射关系

		CSL_intcHwControl(hIntcEdma_uPP,CSL_INTC_CMD_EVTCLEAR,NULL);
		/* Enabling event edma 使能EDMA收图完成中断 */
		CSL_intcHwControl(hIntcEdma_uPP,CSL_INTC_CMD_EVTENABLE,NULL);

		/* Hook up the EDMA event with an completion code function handler */
		EdmaEventHook(CSL_EDMA3_CHA_GPINT0, ImgEDMARecCompleted_INT);//收图完成中断
		/***************** interrupt configration for EDMA completed ***************/

		/*****************2.中断配置-----UPP接口  **************************/
		////////////////////////////////////////////////用来与FPGA通信,接收图像//////////////////////////////////////////////////////////////////
		/* open CPINTC0 to map the UPP completetion ISR event to the host interrupt */
		hnd_UPP = CSL_CPINTC_open(0);
		if (hnd_UPP == 0)
		{
			printf ("Error: Unable to open CPINTC-1\n");
			return;
		}
		glbCpintcHnd[2] = (CSL_CPINTC_RegsOvly)hnd_UPP;
		//需要根据应用修改UPP产生的事件编号及CPINTC输出channel号
		//CSL_INTC0_RPINT为upp的system interrupt ,9为CIC0_OUT(9+20*n)中的host interrupt
		CSL_CPINTC_mapSystemIntrToChannel (hnd_UPP, CSL_INTC0_RPINT, 9);
		CSL_CPINTC_enableSysInterrupt (hnd_UPP, CSL_INTC0_RPINT);
		CSL_CPINTC_enableHostInterrupt (hnd_UPP, 9);
		CSL_CPINTC_enableAllHostInterrupt(hnd_UPP);

		vectId_uPP = CSL_INTC_VECTID_4;
        //绑定中断向量,即host interrupt转换为event id之后进入INTC绑定vectId_uPP
		hIntcUpp= CSL_intcOpen (&intcObjUpp, CSL_GEM_INTC0_OUT_9_PLUS_20_MUL_N, &vectId_uPP , NULL);

		gpioHandler.handler = (CSL_IntcEventHandler)&upp_isr;//事件句柄指针
		gpioHandler.arg = 0;										//传递给参数的句柄指针
		CSL_intcPlugEventHandler(hIntcUpp, &gpioHandler);					//建立事件和句柄的映射关系

		CSL_intcHwControl(hIntcUpp,CSL_INTC_CMD_EVTCLEAR,NULL);

		CSL_intcHwControl(hIntcUpp, CSL_INTC_CMD_EVTENABLE, NULL);

		/***************** interrupt configration for UPP接口  **************************/
	}
}