int spw_connect(int dd) { ER er; UW data, div; int asize; int n; printf("connecting ...\n"); data = ((UW)txclk_div << 8) & 0x00003f00; data |= 0x00000001; er = tk_swri_dev(dd, DN_LINKC, &data, sizeof(data), &asize); for (n = 0; n < 100; n ++) { slp_tsk(50); er = tk_srea_dev(dd, DN_LINKS, &data, sizeof(data), &asize); if (er == E_PAR) printf("spw_connect : E_PAR"); printf("status = 0x%08x\n", data); if ((data & 0x0000001c) == 0x0000001c) { printf("connected.\n"); return 0; } slp_tsk(100); } return 1; }
void task1(intptr_t exinf) { ER_UINT ercd; test_start(__FILE__); check_point(1); ercd = act_tsk(TASK2); check_ercd(ercd, E_OK); ercd = act_tsk(TASK4); check_ercd(ercd, E_OK); ercd = slp_tsk(); check_ercd(ercd, E_OK); check_point(4); ercd = snd_mbf(MBF1, string2, 25); check_ercd(ercd, E_OK); check_point(6); check_assert(strncmp(buf1, string2, 25) == 0); ercd = act_tsk(TASK3); check_ercd(ercd, E_OK); ercd = slp_tsk(); check_ercd(ercd, E_OK); check_point(13); ercd = snd_mbf(MBF1, string2, 10); check_ercd(ercd, E_OK); ercd = rcv_mbf(MBF1, buf1); check_ercd(ercd, 10); check_assert(strncmp(buf1, string2, 10) == 0); ercd = slp_tsk(); check_ercd(ercd, E_OK); check_point(24); ercd = chg_pri(TASK3, LOW_PRIORITY); check_ercd(ercd, E_OK); ercd = slp_tsk(); check_ercd(ercd, E_OK); check_point(34); ercd = chg_pri(TASK2, HIGH_PRIORITY); check_ercd(ercd, E_OK); ercd = slp_tsk(); check_ercd(ercd, E_OK); check_point(0); }
void task1(intptr_t exinf) { ER ercd; check_point(1); ercd = act_tsk(TASK2); check_ercd(ercd, E_OK); check_point(3); ercd = act_tsk(TASK3); check_ercd(ercd, E_OK); check_point(4); ercd = act_tsk(TASK4); check_ercd(ercd, E_OK); check_point(5); ercd = slp_tsk(); check_ercd(ercd, E_OK); check_point(9); ercd = act_tsk(TASK5); check_ercd(ercd, E_OK); check_point(10); ercd = act_tsk(TASK6); check_ercd(ercd, E_OK); check_point(11); ercd = sus_tsk(TASK6); check_ercd(ercd, E_OK); check_point(12); ercd = sus_tsk(TASK5); check_ercd(ercd, E_OK); check_point(13); ercd = rsm_tsk(TASK5); check_ercd(ercd, E_OK); check_point(14); ercd = rsm_tsk(TASK6); check_ercd(ercd, E_OK); check_point(15); ercd = slp_tsk(); check_ercd(ercd, E_OK); check_point(31); ercd = slp_tsk(); check_ercd(ercd, E_OK); check_finish(38); check_point(0); }
void task2(intptr_t exinf) { ER_UINT ercd; PRI tskpri; check_point(14); ercd = slp_tsk(); check_ercd(ercd, E_OK); check_point(24); ercd = slp_tsk(); check_ercd(ercd, E_OK); check_point(50); ercd = loc_mtx(MTX2); check_ercd(ercd, E_OK); check_point(56); ercd = wup_tsk(TASK1); check_ercd(ercd, E_OK); check_point(57); ercd = loc_mtx(MTX1); check_ercd(ercd, E_OK); check_point(60); ercd = unl_mtx(MTX1); check_ercd(ercd, E_OK); check_point(61); ercd = unl_mtx(MTX2); check_ercd(ercd, E_OK); check_point(62); ercd = loc_mtx(MTX1); check_ercd(ercd, E_OK); check_point(63); ercd = rot_rdq(MID_PRIORITY); check_ercd(ercd, E_OK); check_point(66); ercd = unl_mtx(MTX1); check_ercd(ercd, E_OK); ercd = get_pri(TASK1, &tskpri); check_ercd(ercd, E_OK); check_assert(tskpri == MID_PRIORITY); check_point(67); ercd = ext_tsk(); check_point(0); }
void task3(intptr_t exinf) { ER_UINT ercd; check_point(16); ercd = slp_tsk(); check_ercd(ercd, E_OK); check_point(29); ercd = slp_tsk(); check_ercd(ercd, E_OK); check_point(52); ercd = loc_mtx(MTX4); check_ercd(ercd, E_OK); check_point(61); ercd = unl_mtx(MTX4); check_ercd(ercd, E_OK); check_point(66); ercd = slp_tsk(); check_ercd(ercd, E_OK); check_point(71); ercd = loc_mtx(MTX4); check_ercd(ercd, E_OK); check_point(81); ercd = unl_mtx(MTX4); check_ercd(ercd, E_OK); check_point(86); ercd = slp_tsk(); check_ercd(ercd, E_OK); check_point(91); ercd = loc_mtx(MTX1); check_ercd(ercd, E_DLT); check_point(97); ercd = slp_tsk(); check_ercd(ercd, E_OK); check_point(101); ercd = loc_mtx(MTX1); check_ercd(ercd, E_DLT); check_point(105); ercd = ext_tsk(); check_point(0); }
void task2( unsigned int arg ) { ER ercd; int i; CYG_TEST_INFO( "Task 2 running" ); ercd = get_tid( &i ); CYG_TEST_CHECK( E_OK == ercd, "get_tid bad ercd" ); CYG_TEST_CHECK( 2 == i, "tid not 2" ); if ( 22222 != arg ) CYG_TEST_FAIL( "Task 2 arg not 22222" ); ercd = slp_tsk(); CYG_TEST_CHECK( E_OK == ercd, "slp_tsk bad ercd" ); #ifdef CYGPKG_UITRON_MEMPOOLFIXED_CREATE_DELETE ercd = del_mpf( 1 ); CYG_TEST_CHECK( E_OK == ercd, "del_mpf bad ercd" ); ercd = slp_tsk(); CYG_TEST_CHECK( E_OK == ercd, "slp_tsk bad ercd" ); ercd = del_mpf( 2 ); CYG_TEST_CHECK( E_OK == ercd, "del_mpf bad ercd" ); ercd = slp_tsk(); CYG_TEST_CHECK( E_OK == ercd, "slp_tsk bad ercd" ); ercd = del_mpf( 1 ); CYG_TEST_CHECK( E_OK == ercd, "del_mpf bad ercd" ); ercd = slp_tsk(); CYG_TEST_CHECK( E_OK == ercd, "slp_tsk bad ercd" ); ercd = del_mpf( 2 ); CYG_TEST_CHECK( E_OK == ercd, "del_mpf bad ercd" ); ercd = slp_tsk(); CYG_TEST_CHECK( E_OK == ercd, "slp_tsk bad ercd" ); #endif // CYGPKG_UITRON_MEMPOOLFIXED_CREATE_DELETE #ifdef CYGPKG_UITRON_MEMPOOLVAR_CREATE_DELETE ercd = del_mpl( 1 ); CYG_TEST_CHECK( E_OK == ercd, "del_mpl bad ercd" ); ercd = slp_tsk(); CYG_TEST_CHECK( E_OK == ercd, "slp_tsk bad ercd" ); ercd = del_mpl( 2 ); CYG_TEST_CHECK( E_OK == ercd, "del_mpl bad ercd" ); ercd = slp_tsk(); CYG_TEST_CHECK( E_OK == ercd, "slp_tsk bad ercd" ); ercd = del_mpl( 1 ); CYG_TEST_CHECK( E_OK == ercd, "del_mpl bad ercd" ); ercd = slp_tsk(); CYG_TEST_CHECK( E_OK == ercd, "slp_tsk bad ercd" ); ercd = del_mpl( 2 ); CYG_TEST_CHECK( E_OK == ercd, "del_mpl bad ercd" ); ercd = slp_tsk(); CYG_TEST_CHECK( E_OK == ercd, "slp_tsk bad ercd" ); #endif // CYGPKG_UITRON_MEMPOOLVAR_CREATE_DELETE // we expect task2 to be killed here CYG_TEST_FAIL( "Task 2 ran to completion!" ); }
/* * 計測タスク1(高優先度) */ void task1(intptr_t exinf) { uint_t i; slp_tsk(); end_measure(1); for (i = 1; i < NO_MEASURE; i++) { begin_measure(2); slp_tsk(); end_measure(1); } begin_measure(2); slp_tsk(); }
void task3(intptr_t exinf) { ER ercd; check_point(6); ercd = slp_tsk(); check_ercd(ercd, E_OK); check_point(25); ercd = slp_tsk(); check_ercd(ercd, E_OK); check_point(0); }
void task2(intptr_t exinf) { ER_UINT ercd; check_point(4); ercd = ploc_mtx(MTX1); check_ercd(ercd, E_TMOUT); ercd = loc_mtx(MTX1); check_ercd(ercd, E_OK); check_point(10); ercd = unl_mtx(MTX1); check_ercd(ercd, E_OK); check_point(12); ercd = loc_mtx(MTX1); check_ercd(ercd, E_OK); check_point(13); ercd = slp_tsk(); check_ercd(ercd, E_OK); check_point(16); ercd = unl_mtx(MTX1); check_ercd(ercd, E_OK); check_point(17); ercd = ext_tsk(); check_point(0); }
/* * 初期化 * * o 要求受けつけ用のメッセージバッファ ID をポートマネージャに登録 */ W init_console (void) { int i; ER error; /* * 要求受けつけ用のポートを初期化する。 */ recvport = get_port (sizeof (DDEV_REQ), sizeof (DDEV_REQ)); if (recvport <= 0) { dbg_printf ("CONSOLE: cannot make receive port.\n"); slp_tsk (); /* メッセージバッファ生成に失敗 */ } error = regist_port (CONSOLE_DRIVER, recvport); if (error != E_OK) { dbg_printf ("console: cannot regist port (error = %d)\n", error); } initialized = 1; clear_console (); }
void avoid_task(intptr_t){ while(1) { //cycle_print((char*)"Sleep Avoid"); slp_tsk(); aa->perform(); } }
void task4(intptr_t exinf) { ER_UINT ercd; T_RTSK rtsk; T_RMTX rmtx; check_point(19); ercd = loc_mtx(MTX1); check_ercd(ercd, E_OK); check_point(22); ercd = ref_tsk(TASK3, &rtsk); check_ercd(ercd, E_OK); check_assert(rtsk.tskstat == TTS_DMT); ercd = ref_mtx(MTX1, &rmtx); check_ercd(ercd, E_OK); check_assert(rmtx.htskid == TASK4); check_assert(rmtx.wtskid == TSK_NONE); check_point(23); ercd = slp_tsk(); check_ercd(ercd, E_OK); check_point(0); }
/* * FatFs用SDCARDIO制御関数 */ DRESULT disk_ioctl(BYTE Drive, BYTE Func, void* Buffer) { StorageDevice_t *psdev = SDMGetStorageDevice(Drive); DRESULT result; if(psdev == NULL) return RES_ERROR; if((psdev->_sdev_attribute & (SDEV_EMPLOY|SDEV_NOTUSE)) != SDEV_EMPLOY) return RES_ERROR; switch(Func){ case CTRL_SYNC: result = RES_OK; /* no action */ break; case GET_SECTOR_COUNT: *((DWORD *)Buffer) = psdev->_sdev_maxsec; syslog_2(LOG_NOTICE, "ioctl notuse (%d)(%d) ", (int)Func, psdev->_sdev_maxsec); result = RES_OK; break; case GET_BLOCK_SIZE: *((DWORD *)Buffer) = 135; /* ERASE_BLK */ syslog_1(LOG_NOTICE, "call disk_ioctl(GET_BLOCK_SIZE, %08x)", (int)(*((DWORD *)Buffer))); result = RES_OK; break; default: syslog_2(LOG_NOTICE, "call disk_ioctl(%d, %08x)", (int)psdev->_sdev_devno, (int)Buffer); slp_tsk(); result = RES_PARERR; break; } return result; }
void tcp_echo_srv_task (intptr_t exinf) { ID tskid, cepid, repid; ER error = E_OK; syscall(get_tid(&tskid)); syslog(LOG_NOTICE, "[TCP ECHO SRV:%d] started.", tskid); while (true) { syscall(slp_tsk()); if ((error = get_tcp_cep (&cepid)) != E_OK) { syslog(LOG_NOTICE, "[TES:00 EXT] CEP create error: %s", itron_strerror(error)); continue; } while (true) { if ((error = get_tcp_rep (&repid)) != E_OK) { syslog(LOG_NOTICE, "[TES:00 EXT] REP create error: %s", itron_strerror(error)); break; } else if ((error = tcp_echo_srv(cepid, repid)) != E_OK) { error = free_tcp_rep(repid, error != E_DLT); break; } } if ((error = free_tcp_cep(cepid)) != E_OK) syslog(LOG_NOTICE, "[TES:%02d EXT] CEP delete error: %s", cepid, itron_strerror(error)); } }
/*********************************************************************************** * keyboard_task --- * */ void keyboard_task (void) { struct key_entry *p; for (;;) { slp_tsk (); /* 割り込みによって目覚めるのを待つ */ if (input_buffer.first) { p = input_buffer.first; if (input_buffer.first == input_buffer.last) { input_buffer.first = input_buffer.last = NULL; } else { input_buffer.first = input_buffer.first->next; } snd_mbf (ITRON_KEYBOARD_MBF, sizeof (struct key_entry), p); /** */ dealloc_key (p); /* printk ("-- %d --\n", p->ch); /** **/ } } }
void walk_task(intptr_t){ while(1) { //cycle_print((char*)"Sleep Walk"); slp_tsk(); wa->perform(); } }
void color_task(intptr_t){ while(1) { //cycle_print((char*)"Sleep Color"); slp_tsk(); ca->perform(); } }
void task2(intptr_t exinf) { ER_UINT ercd; switch (++task2_count) { case 1: check_point(2); ercd = slp_tsk(); check_ercd(ercd, E_NOSPT); ercd = tslp_tsk(TEST_TIME_PROC); check_ercd(ercd, E_NOSPT); ercd = dly_tsk(TEST_TIME_PROC); check_ercd(ercd, E_NOSPT); ercd = wai_sem(SEM1); check_ercd(ercd, E_NOSPT); ercd = pol_sem(SEM1); check_ercd(ercd, E_OK); ercd = pol_sem(SEM1); check_ercd(ercd, E_TMOUT); ercd = twai_sem(SEM1, TEST_TIME_PROC); check_ercd(ercd, E_NOSPT); ercd = ext_tsk(); check_ercd(ercd, E_OK); check_point(0); case 2: check_point(6); ercd = rot_rdq(MID_PRIORITY); check_ercd(ercd, E_NOSPT); ercd = ext_tsk(); check_ercd(ercd, E_OK); check_point(0); case 3: check_point(10); ercd = rot_rdq(MID_PRIORITY); check_ercd(ercd, E_OK); ercd = ext_tsk(); check_ercd(ercd, E_OK); check_point(0); default: check_point(0); } check_point(0); }
void task6(intptr_t exinf) { ER ercd; check_point(17); ercd = dis_dsp(); check_ercd(ercd, E_OK); check_point(18); ercd = wup_tsk(TASK1); check_ercd(ercd, E_OK); check_point(19); ercd = wup_tsk(TASK2); check_ercd(ercd, E_OK); check_point(20); ercd = sus_tsk(TASK2); check_ercd(ercd, E_OK); check_point(21); ercd = wup_tsk(TASK3); check_ercd(ercd, E_OK); check_point(22); ercd = wup_tsk(TASK4); check_ercd(ercd, E_OK); check_point(23); ercd = sus_tsk(TASK1); check_ercd(ercd, E_OK); check_point(24); ercd = ena_dsp(); check_ercd(ercd, E_OK); check_point(27); ercd = dis_dsp(); check_ercd(ercd, E_OK); check_point(28); ercd = rsm_tsk(TASK1); check_ercd(ercd, E_OK); check_point(29); ercd = wup_tsk(TASK5); check_ercd(ercd, E_OK); check_point(30); ercd = ena_dsp(); check_ercd(ercd, E_OK); check_point(32); ercd = slp_tsk(); check_ercd(ercd, E_OK); check_point(0); }
/* TCP/IP プロトコルスタックの main ルーチン */ ER startup () { if (init_tcpip () != E_OK) { /* 起動に失敗(メッセージ出力) */ dbg_printf ("TCP/IP: Can not start task(s).\n"); slp_tsk (); } /* 後の処理は、子タスクが行う。 */ for (;;) { slp_tsk (); } }
/* * 並行実行されるタスク */ void task(VP_INT exinf) { _toppers_cxxrt_reset_specific(); volatile UW i; INT n = 0; INT tskno = (INT) exinf; char *graph[] = { "|", " +", " *" }; char c; ena_tex(); while (1) { syslog(LOG_NOTICE, "task%d is running (%03d). %s", tskno, ++n, graph[tskno-1]); for (i = 0; i < task_loop; i++); c = message[tskno-1]; message[tskno-1] = 0; switch (c) { case 'e': syslog(LOG_INFO, "#%d#ext_tsk()", tskno); ext_tsk(); case 's': syslog(LOG_INFO, "#%d#slp_tsk()", tskno); syscall(slp_tsk()); break; case 'S': syslog(LOG_INFO, "#%d#tslp_tsk(10000)", tskno); syscall(tslp_tsk(10000)); break; case 'd': syslog(LOG_INFO, "#%d#dly_tsk(10000)", tskno); syscall(dly_tsk(10000)); break; case 'y': syslog(LOG_INFO, "#%d#dis_tex()", tskno); syscall(dis_tex()); break; case 'Y': syslog(LOG_INFO, "#%d#ena_tex()", tskno); syscall(ena_tex()); break; #ifdef CPUEXC1 case 'z': syslog(LOG_NOTICE, "#%d#raise CPU exception", tskno); RAISE_CPU_EXCEPTION; break; case 'Z': loc_cpu(); syslog(LOG_NOTICE, "#%d#raise CPU exception", tskno); RAISE_CPU_EXCEPTION; unl_cpu(); break; #endif /* CPUEXC1 */ default: break; } } }
void task1(intptr_t exinf) { ER_UINT ercd; test_start(__FILE__); check_point(1); ercd = act_tsk(TASK2); check_ercd(ercd, E_OK); check_point(6); ercd = chg_pri(TASK3, HIGH_PRIORITY); check_ercd(ercd, E_NOSPT); check_point(7); ercd = wup_tsk(TASK3); check_ercd(ercd, E_NOSPT); check_point(8); ercd = can_wup(TASK3); check_ercd(ercd, E_NOSPT); check_point(9); ercd = rel_wai(TASK3); check_ercd(ercd, E_NOSPT); check_point(10); ercd = sus_tsk(TASK3); check_ercd(ercd, E_NOSPT); check_point(11); ercd = rsm_tsk(TASK3); check_ercd(ercd, E_NOSPT); check_point(12); ercd = sta_alm(ALM1, 10); check_ercd(ercd, E_OK); check_point(13); ercd = slp_tsk(); check_ercd(ercd, E_OK); check_point(27); ercd = act_tsk(TASK3); check_ercd(ercd, E_OK); check_point(28); ercd = act_tsk(TASK4); check_ercd(ercd, E_OK); check_point(29); ercd = act_tsk(TASK2); check_ercd(ercd, E_OK); check_finish(34); check_point(0); }
/* * 並行実行されるタスク */ void task(intptr_t exinf) { volatile ulong_t i; int_t n = 0; int_t tskno = (int_t) exinf; const char *graph[] = { "|", " +", " *" }; char c; SVC_PERROR(ena_tex()); while (true) { syslog(LOG_NOTICE, "task%d is running (%03d). %s", tskno, ++n, graph[tskno-1]); for (i = 0; i < task_loop; i++); c = message[tskno-1]; message[tskno-1] = 0; switch (c) { case 'e': syslog(LOG_INFO, "#%d#ext_tsk()", tskno); SVC_PERROR(ext_tsk()); assert(0); case 's': syslog(LOG_INFO, "#%d#slp_tsk()", tskno); SVC_PERROR(slp_tsk()); break; case 'S': syslog(LOG_INFO, "#%d#tslp_tsk(10000)", tskno); SVC_PERROR(tslp_tsk(10000)); break; case 'd': syslog(LOG_INFO, "#%d#dly_tsk(10000)", tskno); SVC_PERROR(dly_tsk(10000)); break; case 'y': syslog(LOG_INFO, "#%d#dis_tex()", tskno); SVC_PERROR(dis_tex()); break; case 'Y': syslog(LOG_INFO, "#%d#ena_tex()", tskno); SVC_PERROR(ena_tex()); break; #ifdef CPUEXC1 case 'z': syslog(LOG_NOTICE, "#%d#raise CPU exception", tskno); RAISE_CPU_EXCEPTION; break; case 'Z': SVC_PERROR(loc_cpu()); syslog(LOG_NOTICE, "#%d#raise CPU exception", tskno); RAISE_CPU_EXCEPTION; SVC_PERROR(unl_cpu()); break; #endif /* CPUEXC1 */ default: break; } } }
/* init_log - ログ出力機構を初期化する * * */ void init_log (void) { if (find_port (CONSOLE_DRIVER, &log_port) != E_PORT_OK) { dbg_printf ("POSIX: Cannot open console device.\n"); slp_tsk (); /* DO NOT REACHED */ } dev_recv = get_port (sizeof (DDEV_RES), sizeof (DDEV_RES)); if (dev_recv <= 0) { dbg_printf ("POSIX: Cannot allocate port\n"); slp_tsk (); /* DO NOT REACHED */ } }
void task4(intptr_t exinf) { ER ercd; check_point(7); ercd = wup_tsk(TASK1); check_ercd(ercd, E_OK); check_point(8); ercd = slp_tsk(); check_ercd(ercd, E_OK); check_point(26); ercd = slp_tsk(); check_ercd(ercd, E_OK); check_point(0); }
/* _assert - ASSERT マクロによって呼び出される関数 * * メッセージを出力し、プログラムを終了する。 * */ void _assert (B *msg) { printf ("ASSERT: "); printf ("%s\n", msg); for (;;) { slp_tsk (); } }
void task5(intptr_t exinf) { ER ercd; check_point(16); ercd = slp_tsk(); check_ercd(ercd, E_OK); check_point(33); ercd = sta_alm(ALM1, 10); check_ercd(ercd, E_OK); check_point(34); ercd = slp_tsk(); check_ercd(ercd, E_OK); check_point(0); }
void task1(intptr_t exinf) { ER_UINT ercd; T_RTSK rtsk; T_RMTX rmtx; PRI intpri; test_start(__FILE__); check_point(1); ercd = sta_alm(ALM1, TEST_TIME_CP); check_ercd(ercd, E_OK); ercd = slp_tsk(); check_ercd(ercd, E_OK); check_point(3); ercd = act_tsk(TASK2); check_ercd(ercd, E_OK); check_point(5); ercd = ref_tsk(TASK2, &rtsk); check_ercd(ercd, E_OK); check_assert(rtsk.tskstat == TTS_DMT); ercd = ref_mtx(MTX1, &rmtx); check_ercd(ercd, E_OK); check_assert(rmtx.htskid == TSK_NONE); check_assert(rmtx.wtskid == TSK_NONE); ercd = act_tsk(TASK2); check_ercd(ercd, E_OK); check_point(16); ercd = get_ipm(&intpri); check_ercd(ercd, E_OK); check_assert(intpri == TIPM_ENAALL); ercd = act_tsk(TASK2); check_ercd(ercd, E_OK); check_point(23); check_assert(sns_dsp() == false); ercd = act_tsk(TASK2); check_ercd(ercd, E_OK); check_finish(28); check_point(0); }
static ER send_udp_echo (ID cepid, T_IN_ADDR *ipaddr, uint16_t portno, char *line) { ER_UINT error; uint_t len; dst.ipaddr = *ipaddr; dst.portno = portno; len = strlen(line); if ((error = UDP_SND_DAT(cepid, &dst, line, len, TMO_NBLK)) != E_WBLK) { syslog(LOG_NOTICE, "[UEC:%02d SND] error: %s", cepid, itron_strerror(error)); return error; } else syslog(LOG_NOTICE, "[UEC:%02d SND] sending: to: %s.%d: %s", cepid, IP2STR(NULL, &dst.ipaddr), dst.portno, line); syscall(slp_tsk()); if (nblk_len < 0) { /* 0 以下の場合は、エラーコード */ syslog(LOG_NOTICE, "[UEC:%02d CBR] error: %s", cepid, itron_strerror(nblk_len)); return nblk_len; } if ((error = UDP_RCV_DAT(cepid, &dst, udp_buf, sizeof(udp_buf), TMO_NBLK)) != E_WBLK) { syslog(LOG_NOTICE, "[UEC:%02d RCV] error: %s", cepid, itron_strerror(error)); return error; } syscall(slp_tsk()); if (nblk_len < 0) { /* 0 以下の場合は、エラーコード */ syslog(LOG_NOTICE, "[UEC:%02d RCV] error: %s", cepid, itron_strerror(nblk_len)); return nblk_len; } else { udp_buf[nblk_len] = '\0'; syslog(LOG_NOTICE, "[UEC:%02d RCV] received: from: %s.%d: %s", cepid, IP2STR(NULL, &dst.ipaddr), dst.portno, udp_buf); nblk_len = E_OK; } return nblk_len; }
/* * 並行実行されるタスク */ void task(VP_INT exinf) { volatile UW i; INT n = 0; INT tskno = (INT) exinf; const char *graph[] = { "|", " +", " *" }; char c; ena_tex(); while (1) { syslog(LOG_NOTICE, "task%d is running (%03d). %s", tskno, ++n, graph[tskno-1]); for (i = 0; i < task_loop; i++); c = message[tskno-1]; message[tskno-1] = 0; switch (c) { case 'e': syslog(LOG_INFO, "#%d#ext_tsk()", tskno); ext_tsk(); case 's': syslog(LOG_INFO, "#%d#slp_tsk()", tskno); syscall(slp_tsk()); break; case 'S': syslog(LOG_INFO, "#%d#tslp_tsk(10000)", tskno); syscall(tslp_tsk(10000)); break; case 'd': syslog(LOG_INFO, "#%d#dly_tsk(10000)", tskno); syscall(dly_tsk(10000)); break; case 'y': syslog(LOG_INFO, "#%d#dis_tex()", tskno); syscall(dis_tex()); break; case 'Y': syslog(LOG_INFO, "#%d#ena_tex()", tskno); syscall(ena_tex()); break; #ifdef CPUEXC1 case 'z': syslog(LOG_NOTICE, "#%d#raise CPU exception", tskno); RAISE_CPU_EXCEPTION; break; #endif /* CPUEXC1 */ case 'Z': syslog(LOG_NOTICE, "Sample program ends with exception."); kernel_exit(); break; default: break; } } }