This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS320F280049 CLA Background任务启用,无法进入

Other Parts Discussed in Thread: C2000WARE


//大家好,我在配置CLA_Background  Task时
//发现通过Debug监控Cla1BackgroundTask函数中
//的index(外部定义的全局变量)发现程序执行过程之中
//未曾进入过Cla1BackgroundTask函数,
//以下是我对CLA的配置,请问有什么问题吗?


// Turn on all peripherals 
EALLOW; 
CpuSysRegs.PCLKCR0.bit.CLA1 = 1; 
CpuSysRegs.PCLKCR0.bit.CPUTIMER0 = 1; 
CpuSysRegs.PCLKCR0.bit.CPUTIMER1 = 1; 
CpuSysRegs.PCLKCR0.bit.CPUTIMER2 = 1; 
... 
EDIS; 

//Configuring CPUTimer 
ConfigCpuTimer(&CpuTimer0, 100, TIMER_1MS); 
ConfigCpuTimer(&CpuTimer1, 100, TIMER_50US); 
ConfigCpuTimer(&CpuTimer2, 100, TIMER_100US); 

void CLAInit(void)
{
	//
    // Copy the program and constants from FLASH to RAM before configuring
    // the CLA
    //
	 memcpy((Uint32 *)&Cla1funcsRunStart, (Uint32 *)&Cla1funcsLoadStart,
        (Uint32)&Cla1funcsLoadSize );
	 memcpy((Uint32 *)&Cla1ConstRunStart, (Uint32 *)&Cla1ConstLoadStart,
			(Uint32)&Cla1ConstLoadSize );

	//
	// CLA Program will reside in RAMLS3,RAML4
	//
    MemCfg_setCLAMemType((MEMCFG_SECT_LS3 | MEMCFG_SECT_LS4), MEMCFG_CLA_MEM_PROGRAM);
	
	MemCfg_setLSRAMMasterSel(MEMCFG_SECT_LS3, MEMCFG_LSRAMMASTER_CPU_CLA1);
	MemCfg_setLSRAMMasterSel(MEMCFG_SECT_LS4, MEMCFG_LSRAMMASTER_CPU_CLA1);

	// CPU and CLA1 share RAMLS5
	MemCfg_setCLAMemType(MEMCFG_SECT_LS5, MEMCFG_CLA_MEM_DATA);
	// RAMLS5 as Data memory
    MemCfg_setLSRAMMasterSel(MEMCFG_SECT_LS5, MEMCFG_LSRAMMASTER_CPU_CLA1);

	CLA_mapTaskVector(CLA1_BASE, CLA_MVECT_1, (Uint16)&Cla1Task1);
    CLA_mapTaskVector(CLA1_BASE, CLA_MVECT_2, (Uint16)&Cla1Task2);

	CLA_setTriggerSource(CLA_TASK_1, CLA_TRIGGER_TINT1);	
    CLA_setTriggerSource(CLA_TASK_2, CLA_TRIGGER_SOFTWARE);

	CLA_enableTasks(CLA1_BASE, (CLA_TASKFLAG_1|CLA_TASKFLAG_2));
	
	// Configuring Background task
	CLA_mapBackgroundTaskVector(CLA1_BASE,(Uint16)&Cla1BackgroundTask);
	CLA_disableHardwareTrigger(CLA1_BASE);
	CLA_setTriggerSource(CLA_TASK_8, CLA_TRIGGER_SOFTWARE);
	CLA_enableBackgroundTask(CLA1_BASE);
	CLA_startBackgroundTask(CLA1_BASE);
	
	// Main cpu start CLA task
    CLA_enableIACK(CLA1_BASE);  
    CLA_forceTasks(CLA1_BASE, CLA_TASKFLAG_2);	
}

__attribute__((interrupt("background")))  void Cla1BackgroundTask ( void )
{
	while(1)
	{
	//CLA_TEST1_TOG();
		index++;
		if( CpuTimer0Regs.TCR.bit.TIF ==1)
   	   { 
   	     CpuTimer0Regs.TCR.bit.TIF =1;
   	   }
	}
}