/* * メインタスク */ void main_task(VP_INT exinf) { char c; ID tskid = TASK1; volatile UW i; INT tskno = 1; ER_UINT ercd; PRI tskpri; SYSTIM stime1, stime2; #ifndef OMIT_VGET_TIM SYSUTIM utime1, utime2; #endif /* OMIT_VGET_TIM */ vmsk_log(LOG_UPTO(LOG_INFO), LOG_UPTO(LOG_EMERG)); syslog(LOG_NOTICE, "Sample program starts (exinf = %d).", (int)exinf); syscall(serial_ctl_por(TASK_PORTID, (IOCTL_CRLF | IOCTL_FCSND | IOCTL_FCRCV))); /* * ループ回数の設定 */ task_loop = LOOP_REF; get_tim(&stime1); for (i = 0; i < task_loop; i++); get_tim(&stime2); task_loop = LOOP_REF * 400 / (stime2 - stime1); tex_loop = task_loop / 5; /* * タスクの起動 */ act_tsk(TASK1); act_tsk(TASK2); act_tsk(TASK3); /* * メインループ */ do { syscall(serial_rea_dat(TASK_PORTID, &c, 1)); switch (c) { case 'e': case 's': case 'S': case 'd': case 'y': case 'Y': case 'z': case 'Z': message[tskno-1] = c; break; case '1': tskno = 1; tskid = TASK1; break; case '2': tskno = 2; tskid = TASK2; break; case '3': tskno = 3; tskid = TASK3; break; case 'a': syslog(LOG_INFO, "#act_tsk(%d)", tskno); syscall(act_tsk(tskid)); break; case 'A': syslog(LOG_INFO, "#can_act(%d)", tskno); syscall(ercd = can_act(tskid)); if (ercd >= 0) { syslog(LOG_NOTICE, "can_act(%d) returns %d", tskno, ercd); } break; case 't': syslog(LOG_INFO, "#ter_tsk(%d)", tskno); syscall(ter_tsk(tskid)); break; case '>': syslog(LOG_INFO, "#chg_pri(%d, HIGH_PRIORITY)", tskno); chg_pri(tskid, HIGH_PRIORITY); break; case '=': syslog(LOG_INFO, "#chg_pri(%d, MID_PRIORITY)", tskno); chg_pri(tskid, MID_PRIORITY); break; case '<': syslog(LOG_INFO, "#chg_pri(%d, LOW_PRIORITY)", tskno); chg_pri(tskid, LOW_PRIORITY); break; case 'G': syslog(LOG_INFO, "#get_pri(%d, &tskpri)", tskno); syscall(ercd = get_pri(tskid, &tskpri)); if (ercd >= 0) { syslog(LOG_NOTICE, "priority of task %d is %d", tskno, tskpri); } break; case 'w': syslog(LOG_INFO, "#wup_tsk(%d)", tskno); syscall(wup_tsk(tskid)); break; case 'W': syslog(LOG_INFO, "#can_wup(%d)", tskno); syscall(ercd = can_wup(tskid)); if (ercd >= 0) { syslog(LOG_NOTICE, "can_wup(%d) returns %d", tskno, ercd); } break; case 'l': syslog(LOG_INFO, "#rel_wai(%d)", tskno); syscall(rel_wai(tskid)); break; case 'u': syslog(LOG_INFO, "#sus_tsk(%d)", tskno); syscall(sus_tsk(tskid)); break; case 'm': syslog(LOG_INFO, "#rsm_tsk(%d)", tskno); syscall(rsm_tsk(tskid)); break; case 'M': syslog(LOG_INFO, "#frsm_tsk(%d)", tskno); syscall(frsm_tsk(tskid)); break; case 'x': syslog(LOG_INFO, "#ras_tex(%d, 0x0001)", tskno); syscall(ras_tex(tskid, 0x0001)); break; case 'X': syslog(LOG_INFO, "#ras_tex(%d, 0x0002)", tskno); syscall(ras_tex(tskid, 0x0002)); break; case 'r': syslog(LOG_INFO, "#rot_rdq(three priorities)"); rot_rdq(HIGH_PRIORITY); rot_rdq(MID_PRIORITY); rot_rdq(LOW_PRIORITY); break; case 'c': sta_cyc(CYCHDR1); break; case 'C': stp_cyc(CYCHDR1); break; #ifndef OMIT_VGET_TIM case 'V': syscall(vxget_tim(&utime1)); syscall(vxget_tim(&utime2)); syslog(LOG_NOTICE, "utime1 = %d, utime2 = %d", (UINT) utime1, (UINT) utime2); break; #endif /* OMIT_VGET_TIM */ case 'v': vmsk_log(LOG_UPTO(LOG_INFO), LOG_UPTO(LOG_EMERG)); break; case 'q': vmsk_log(LOG_UPTO(LOG_NOTICE), LOG_UPTO(LOG_EMERG)); break; default: break; } } while (c != '\003' && c != 'Q'); syslog(LOG_NOTICE, "Sample program ends."); kernel_exit(); }
static int __ui_frsm_tsk(struct pt_regs *regs) { ID tskid = __xn_reg_arg1(regs); return frsm_tsk(tskid); }