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.

TMS320F280039C: cla_task配置

Part Number: TMS320F280039C


你好我想通过PWM4来启用CLA_TASK1,目前发现只能执行1次  是否能给我提供一个实例

void csw_initCLA(void)
{

//
// setup CLA to register an interrupt
//

memcpy((uint32_t *)&Cla1ProgRunStart, (uint32_t *)&Cla1ProgLoadStart,
(uint32_t)&Cla1ProgLoadSize );
//
// First assign memory to CLA
// RAM LS2 and RAM LS3
//

// MemCfg_setLSRAMMasterSel(MEMCFG_SECT_LS0, MEMCFG_LSRAMMASTER_CPU_CLA1);
// MemCfg_setLSRAMMasterSel(MEMCFG_SECT_LS1, MEMCFG_LSRAMMASTER_CPU_CLA1);
MemCfg_setLSRAMMasterSel(MEMCFG_SECT_LS2, MEMCFG_LSRAMMASTER_CPU_CLA1);
MemCfg_setLSRAMMasterSel(MEMCFG_SECT_LS3, MEMCFG_LSRAMMASTER_CPU_CLA1);
// MemCfg_setLSRAMMasterSel(MEMCFG_SECT_LS4, MEMCFG_LSRAMMASTER_CPU_CLA1);
// MemCfg_setLSRAMMasterSel(MEMCFG_SECT_LS5, MEMCFG_LSRAMMASTER_CPU_CLA1);

// MemCfg_setCLAMemType(MEMCFG_SECT_LS0, MEMCFG_CLA_MEM_DATA);
// MemCfg_setCLAMemType(MEMCFG_SECT_LS1, MEMCFG_CLA_MEM_DATA);
MemCfg_setCLAMemType(MEMCFG_SECT_LS3, MEMCFG_CLA_MEM_DATA);
MemCfg_setCLAMemType(MEMCFG_SECT_LS2, MEMCFG_CLA_MEM_PROGRAM);
// MemCfg_setCLAMemType(MEMCFG_SECT_LS4, MEMCFG_CLA_MEM_PROGRAM);
// MemCfg_setCLAMemType(MEMCFG_SECT_LS5, MEMCFG_CLA_MEM_PROGRAM);

//
// Suppressing #770-D conversion from pointer to smaller integer
// The CLA address range is 16 bits so the addresses passed to the MVECT
// registers will be in the lower 64KW address space. Turn the warning
// back on after the MVECTs are assigned addresses
//
#pragma diag_suppress = 770

CLA_mapTaskVector(CLA1_BASE , CLA_MVECT_1, (uint16_t)&Cla1Task1); /* BUCK Control */
// CLA_mapTaskVector(CLA1_BASE , CLA_MVECT_2, (uint16_t)&Cla1Task2);
// CLA_mapTaskVector(CLA1_BASE , CLA_MVECT_3, (uint16_t)&Cla1Task3);
// CLA_mapTaskVector(CLA1_BASE , CLA_MVECT_4, (uint16_t)&Cla1Task4);
// CLA_mapTaskVector(CLA1_BASE , CLA_MVECT_5, (uint16_t)&Cla1Task5);
// CLA_mapTaskVector(CLA1_BASE , CLA_MVECT_6, (uint16_t)&Cla1Task6);
CLA_mapTaskVector(CLA1_BASE , CLA_MVECT_7, (uint16_t)&Cla1Task7); /* Var initial*/
// CLA_mapTaskVector(CLA1_BASE , CLA_MVECT_8, (uint16_t)&Cla1Task8);

// CLA_mapBackgroundTaskVector(CLA1_BASE, (uint16_t)&Cla1BackgroundTask);

#pragma diag_warning = 770


//
//Used to debug, the below line is intentionally commented
//CLA_forceTasks(CLA1_BASE,CLA_TASKFLAG_1);
//

CLA_setTriggerSource(CLA_TASK_1, CLA_TRIGGER_EPWM4INT);
CLA_setTriggerSource(CLA_TASK_7, CLA_TRIGGER_SOFTWARE);

// TTPLPFC_HAL_enablePWMInterruptGeneration(EPWM1_BASE);
// TTPLPFC_HAL_clearPWMInterruptFlag(
// TTPLPFC_C28x_CONTROLISR_INTERRUPT_TRIG_PWM_BASE);

CLA_enableIACK(CLA1_BASE);

CLA_enableTasks(CLA1_BASE, CLA_TASKFLAG_1);
CLA_enableTasks(CLA1_BASE, CLA_TASKFLAG_7);

/* FIXME : Iinit CLA Variable */
Cla1ForceTask7andWait();
Cla1ForceTask1andWait();
}