/******************************************************************** * Arduino風: 繰り返し処理 ******************************************************************** */ static inline void loop(void) { if(Serial1Available()) { int ch = Serial1GetKey(); Serial1WriteChar(ch); if(ch == '!') { test_func1(); } if(ch == '@') { test_func(); } if(ch == '#') { test_func2(); } if(ch == '\r') { Serial1WriteChar('\n'); } } int key = kbd_getchar(); if(key) { Serial1WriteChar(key); gr_putch(key); if(key == '\r') { Serial1WriteChar('\n'); gr_putch('\n'); } } }
// 機能テストのみ. static inline void loop(void) { if(Serial1Available()) { int ch = Serial1GetKey(); Serial1WriteChar(ch); if(ch == '!') { test_func1(); } if(ch == '@') { test_func(); } if(ch == '#') { test_func2(); } if(ch == '$') { PYTHON_main( 0,NULL ); } if(ch == '\r') { Serial1WriteChar('\n'); } } int key = kbd_getchar(); if( key ) { Serial1WriteChar(key); gr_putch(key); // printf("%02x\n",key); if(key == '\r') { Serial1WriteChar('\n'); gr_putch('\n'); } } }
int main (int argc, char *argv[]) { int ret; char logbuffer[4096]; Init_logdebug( getpid(), "CAPD", "/DSC/APPLOG" ); ret = INIT_CAPD_IPCS(); if(ret < 0) { sprintf(logbuffer, "FAIL[init_ipc] [%s] %d.", strerror(errno), ret); dAppWrite(LOG_CRI, logbuffer); exit(0); } if( gen_info->DebugLevel == 0 ) gen_info->DebugLevel = LOG_INFO; /* temporary code (without CHSMD) */ if((ret=set_version(SEQ_PROC_CAPD, vERSION)) < 0 ) { dAppLog( LOG_CRI, "SET_VERSION ERROR(RET=%d,IDX=%d,VER=%s)\n", ret,SEQ_PROC_CAPD,vERSION); } if( check_my_run_status("CAPD") < 0) exit(0); if( keepalivelib_init("CAPD") < 0 ) exit(1); #if 0 if( argc==3 ) { test_func(argv[1], atoi(argv[2])); } #endif if( argc == 3 ) { test_func2(argv[1], atoi(argv[2])); exit(0); } else if( argc!=1 ) { exit(0); } SetupSignal(); dAppLog(LOG_CRI, "CAPD %s %d] [PROCESS INIT SUCCESS", vERSION, getpid()); dAppLog(LOG_CRI, "CAPD %s %d] [PROCESS STARTED", vERSION, getpid()); open_device_dlpi(DEV_PATH); return 0; } /***** end of main *****/
void test_func() { test_func2(); }
/*------------------------------------------------------------------------------ | test_func +-----------------------------------------------------------------------------*/ void test_func() { test_func2(1); }
int main() { int a[N]; int i; #pragma acc parallel loop copy(a) for(i = 0; i < N; i++){ a[i] = i; } //check for(i = 0; i < N; i++){ if(a[i] != i) return 1; } #pragma acc parallel loop copyin(a) for(i = 0; i < N; i++){ a[i] = i + 1; } //check for(i = 0; i < N; i++){ if(a[i] != i) return 2; } #pragma acc parallel loop copyout(a) for(i = 0; i < N; i++){ a[i] = i + 2; } //check for(i = 0; i < N; i++){ if(a[i] != i + 2) return 3; } #pragma acc parallel loop create(a) for(i = 0; i < N; i++){ a[i] = i + 3; } //check for(i = 0; i < N; i++){ if(a[i] != i + 2) return 4; } int ret; for(i = 0; i < N; i++) a[i] = 0; ret = test_func(a, 0); if(ret != 0){ return 5; } for(i = 0; i < N; i++) a[i] = 0; #pragma acc data copy(a) ret = test_func(a, 1); if(ret != 0){ return 6; } for(i = 0; i < N; i++) a[i] = 0; #pragma acc data copy(a) #pragma acc host_data use_device(a) test_func2(a); //check for(i = 0; i < N; i++){ if(a[i] != i * 3) return 7; } printf("PASS\n"); return 0; }
void test_func(void) { printf("test func\n"); test_func2(3,5); }