void main(void *arg) { volatile int i = (int)arg; volatile int pid; int fd, sd; uint32_t *temp; int testval = 42; /* c-lib and init test */ temp = (uint32_t *)malloc(32); free(temp); /* open/close test */ fd = open("/dev/null", 0, 0); printf("/dev/null %s a tty.\r\n",isatty(fd)?"is":"is not"); close(fd); /* socket/close test */ sd = socket(AF_UNIX, SOCK_DGRAM, 0); close(sd); /* Thread create test */ if (thread_create(idling, &testval, 1) < 0) IDLE(); if (thread_create(fresh, &testval, 1) < 0) IDLE(); while(1) { sleep(500); pid = getpid(); } (void)i; }
void loop() { while (true) { STOP(); STOP(); STOP(); STOP(); STOP(); STOP(); STOP(); STOP(); STOP(); IDLE(); BIT0(); BIT0(); BIT1(); BIT1(); BIT0(); BIT1(); BIT1(); BIT0(); STOP(); } }
int __wrap__xlsmpBarrier_TPO(long x, long y) { int ret; TMSG(IDLE, "enter barrier"); IDLE(); ret = __real__xlsmpBarrier_TPO(x, y); WORKING(); TMSG(IDLE, "exit barrier"); return ret; }
int __wrap_pthread_yield() { int ret; TMSG(IDLE, "enter yield"); IDLE(); ret = __real_pthread_yield(); WORKING(); TMSG(IDLE, "exit yield"); return ret; }
int __wrap_pthread_cond_wait(pthread_cond_t *c, pthread_mutex_t *m) { int ret; TMSG(IDLE, "enter cond"); IDLE(); ret = __real_pthread_cond_wait(c, m); WORKING(); TMSG(IDLE, "exit cond"); return ret; }
int __wrap__xlsmpSyncRegionItemL2Fence(long x, long y, long z) { int ret; TMSG(IDLE, "enter fence"); IDLE(); ret = __real__xlsmpSyncRegionItemL2Fence(x,y,z); WORKING(); TMSG(IDLE, "exit fence"); return ret; }
int __wrap__xlsmpSyncWorkShareItemL2(long x, long y, long z, long other) { int ret; TMSG(IDLE, "enter sync"); IDLE(); ret = __real__xlsmpSyncWorkShareItemL2(x,y,z,other); WORKING(); TMSG(IDLE, "exit sync"); return ret; }
int __wrap__xlsmpWSDoSetup_TPO(long a1, long a2, long a3, long a4, long a5, long a6, long a7, long a8) { int ret; TMSG(IDLE, "enter dosetup"); IDLE(); ret = __real__xlsmpWSDoSetup_TPO(a1, a2, a3, a4, a5, a6, a7, a8); WORKING(); TMSG(IDLE, "exit dosetup"); return ret; }
//Enter HALT mode (dual CPU). Puts CPU2 in IDLE mode first. void HALT() { #if defined(CPU2) IDLE(); #elif defined(CPU1) EALLOW; CpuSysRegs.LPMCR.bit.LPM = LPM_HALT; EDIS; while (DevCfgRegs.LPMSTAT.bit.CPU2LPMSTAT != 0x1 ) {;} EALLOW; ClkCfgRegs.SYSPLLCTL1.bit.PLLCLKEN = 0; ClkCfgRegs.SYSPLLCTL1.bit.PLLEN = 0; EDIS; asm(" IDLE"); #endif }
int __wrap__xlsmp_DynamicChunkCall(long a1, long a2, long a3, long a4, long a5) { int ret; #ifdef BLAME_DYN_CHUNK TMSG(IDLE, "enter chunk"); WORKING(); #endif ret = __real__xlsmp_DynamicChunkCall(a1, a2, a3, a4, a5); #ifdef BLAME_DYN_CHUNK IDLE(); TMSG(IDLE, "exit chunk"); #endif return ret; }