// ***************** prog.c ****************************************** // SBC-DBG sample program for ARMCortex-A9. // The program demonstrates memory store in infinite loop. // // (c) OJSC ELVEES, multicore.ru // // ******************************************************************* #define UINT unsigned int #define CORE0_Val *((UINT volatile *)0x20000100) #define CORE1_Val *((UINT volatile *)0x20000104) #define CORE0_WholeLoopCnt *((volatile UINT*)0x20000108) #define CORE1_WholeLoopCnt *((volatile UINT*)0x2000010c) extern int _get_cpu_id(); void infLoop(volatile int *valToWrite, volatile int *wholeLoopCnt ) { int counter = 0; static int maxCountVal = 0xffff; while(1) { if (counter == maxCountVal) { counter = 0; (*wholeLoopCnt)++; } *valToWrite = counter++; } } int main() { volatile UINT* pVal = 0; volatile UINT* pWholeLoopCnt = 0; if (_get_cpu_id() == 0) { pVal = &CORE0_Val; pWholeLoopCnt = &CORE0_WholeLoopCnt; } else { pVal = &CORE1_Val; pWholeLoopCnt = &CORE1_WholeLoopCnt; } *pVal = 0; *pWholeLoopCnt = 0; infLoop(pVal, pWholeLoopCnt); }