Other Parts Discussed in Thread: C2000WARE
Hi,
When initializing memory for the CLA1 in CPU1, the functions below can be called:
void CLA_configClaMemory(void)
{
// From F28377D reset no memory resources are allocated to CLA so it needs to be done here
EALLOW;
// Set CPU1 <=> CLA1 message RAMs
MemCfgRegs.MSGxINIT.bit.INIT_CLA1TOCPU = 1; // Initialise CLA1ToCPUMsgRAM
while(MemCfgRegs.MSGxINITDONE.bit.INITDONE_CLA1TOCPU != 1) {}; // Wait until done
MemCfgRegs.MSGxINIT.bit.INIT_CPUTOCLA1 = 1; // Initialise CPUToCLA1MsgRAM
while(MemCfgRegs.MSGxINITDONE.bit.INITDONE_CPUTOCLA1 != 1) {}; // Wait until done
// Set up program and data memory blocks for use by CLA1
MemCfgRegs.LSxMSEL.bit.MSEL_LS4 = 1; // Allocate LS4 RAM to CLA1
MemCfgRegs.LSxCLAPGM.bit.CLAPGM_LS4 = 1; // Set LS4 as program memory
MemCfgRegs.LSxMSEL.bit.MSEL_LS5 = 1; // Allocate LS5 RAM to CLA1
MemCfgRegs.LSxCLAPGM.bit.CLAPGM_LS5 = 1; // Set LS5 as program memory
MemCfgRegs.LSxMSEL.bit.MSEL_LS0 = 1; // Allocate LS0 RAM to CLA1
MemCfgRegs.LSxCLAPGM.bit.CLAPGM_LS0 = 0; // Set LS0 as data memory
MemCfgRegs.LSxMSEL.bit.MSEL_LS1 = 1; // Allocate LS1 RAM to CLA1
MemCfgRegs.LSxCLAPGM.bit.CLAPGM_LS1 = 0; // Set LS1 as data memory
EDIS;
}
I have a few questions:
How can one do the exact same, but for the CLA that is in CPU2? I cannot find in the technical menu any functions which are used for CPU2 and CLA2. Are these functions able to be called within both CPU1 and CPU2 without issue?
Additionally, how do we know that the memory blocks we are setting up, are enough to account for the actual CLA program we will write, if the memory will include all variables and the actual code to be executed on the CLA?
Finally, what is the best way to trigger the CLA to begin execution on the CPU2? I initailize everything on CPU1, and generate INT1 and INT2 which originally trigger task1 and task2 of CLA1 - but I now want that second interrupt to trigger a task on a seperate CLA, contained in CPU2, and feed that information back to the CPU1, such that both tasks on each CLA can run in parallel and independent of each other. Is there a way to send the status of an interrupt from CPU1 to CPU2, or is there a better way to do this?
Regards,
Joel