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); }
void tex_task2(TEXPTN texptn, intptr_t exinf) { ER ercd; switch (texptn) { case 0x0001: check_point(29); check_state(false, false, TIPM_ENAALL, false, false, true); break; case 0x0002: check_point(31); check_state(false, false, TIPM_ENAALL, false, false, true); /* * disable dispatch, raise dispatch request */ check_point(32); ercd = dis_dsp(); check_ercd(ercd, E_OK); ercd = rot_rdq(TPRI_SELF); check_ercd(ercd, E_OK); /* * task dispatch happens when task exception routine returns */ check_point(33); break; default: check_point(0); break; } }
void task1(intptr_t exinf) { ER ercd; switch (++task1_count) { case 1: test_start(__FILE__); check_point(1); check_state(false, false, TIPM_ENAALL, false, false, true); ercd = dis_dsp(); check_ercd(ercd, E_OK); ercd = ena_tex(); check_ercd(ercd, E_OK); check_point(2); check_state(false, false, TIPM_ENAALL, true, true, false); RAISE_CPU_EXCEPTION; check_point(0); break; case 2: check_point(8); check_state(false, false, TIPM_ENAALL, false, false, true); check_finish(9); break; default: check_point(0); break; } }
ER_UINT extsvc_routine(intptr_t par1, intptr_t par2, intptr_t par3, intptr_t par4, intptr_t par5, ID cdmid) { ER ercd; switch ((uint_t) par1) { case 1: ercd = loc_cpu(); break; case 2: ercd = unl_cpu(); break; case 3: ercd = dis_dsp(); break; case 4: ercd = ena_dsp(); break; case 5: ercd = chg_ipm((PRI) par2); break; case 6: ercd = rot_rdq((PRI) par2); break; default: ercd = E_NOSPT; break; } return(ercd); }
void task1(intptr_t exinf) { ER ercd; test_start(__FILE__); check_point(1); check_state(false, false, TIPM_ENAALL, false, false, true); ercd = dis_dsp(); check_ercd(ercd, E_OK); ercd = ena_tex(); check_ercd(ercd, E_OK); check_point(2); check_state(false, false, TIPM_ENAALL, true, true, false); ercd = sta_alm(ALM1, 1U); check_ercd(ercd, E_OK); while (!(alm1_flag)); check_point(7); check_state(false, false, TIPM_ENAALL, true, true, false); check_finish(8); }
void __malloc_lock(struct _reent *ptr) { if (!iniflg || sns_dsp()) return; dis_dsp(); cxxrt_dis_dsp = 1; }
void task1(intptr_t exinf) { ER ercd; SIL_PRE_LOC; check_point(1); check_state(false, false, TIPM_ENAALL, false, false, true); ercd = dis_dsp(); check_ercd(ercd, E_OK); ercd = ena_tex(); check_ercd(ercd, E_OK); check_point(2); check_state(false, false, TIPM_ENAALL, true, true, false); SIL_LOC_INT(); RAISE_CPU_EXCEPTION; check_point(5); SIL_UNL_INT(); check_point(6); check_state(false, false, TIPM_ENAALL, true, true, false); check_finish(7); }
void task1(intptr_t exinf) { ER ercd; test_start(__FILE__); check_point(1); check_state(false, false, TIPM_ENAALL, false, false, true); ercd = dis_dsp(); check_ercd(ercd, E_OK); ercd = ena_tex(); check_ercd(ercd, E_OK); ercd = loc_cpu(); check_ercd(ercd, E_OK); check_point(2); check_state(false, true, TIPM_ENAALL, true, true, false); RAISE_CPU_EXCEPTION; check_point(5); check_state(false, true, TIPM_ENAALL, true, true, false); check_finish(6); }
void task1(intptr_t exinf) { ER_UINT ercd; test_start(__FILE__); check_point(1); check_state(false, false, false, false, false); check_ipm(TIPM_ENAALL); ercd = dis_dsp(); check_ercd(ercd, E_OK); check_point(2); check_state(false, false, true, true, false); check_ipm(TIPM_ENAALL); ercd = sta_alm(ALM1, TEST_TIME_PROC); check_ercd(ercd, E_OK); while(!alm1_flag); check_point(8); check_state(false, false, true, true, false); check_ipm(TIPM_ENAALL); check_finish(9); check_point(0); }
/* * シリアルポートのクローズ(サービスコール) */ ER serial_cls_por(ID portid) { SPCB *p_spcb; ER ercd; bool_t eflag = false; if (sns_dpn()) { /* コンテキストのチェック */ return(E_CTX); } if (!(1 <= portid && portid <= TNUM_PORT)) { return(E_ID); /* ポート番号のチェック */ } p_spcb = get_spcb(portid); SVC(dis_dsp(), gen_ercd_sys(p_spcb)); if (!(p_spcb->openflag)) { /* オープン済みかのチェック */ ercd = E_OBJ; } else { /* * ハードウェア依存のクローズ処理 */ if (loc_cpu() < 0) { eflag = true; } sio_cls_por(p_spcb->p_siopcb); p_spcb->openflag = false; if (unl_cpu() < 0) { eflag = true; } /* * セマフォの初期化 */ if (ini_sem(p_spcb->p_spinib->snd_semid) < 0) { eflag = true; } if (ini_sem(p_spcb->p_spinib->rcv_semid) < 0) { eflag = true; } /* * エラーコードの設定 */ if (eflag) { ercd = gen_ercd_sys(p_spcb); } else { ercd = E_OK; } } SVC(ena_dsp(), gen_ercd_sys(p_spcb)); error_exit: return(ercd); }
/* * シリアルポートのクローズ(受け口関数) */ ER eSerialPort_close(CELLIDX idx) { CELLCB *p_cellcb; ER ercd; bool_t eflag = false; if (sns_dpn()) { /* コンテキストのチェック */ return(E_CTX); } if (!VALID_IDX(idx)) { return(E_ID); /* ポート番号のチェック */ } p_cellcb = GET_CELLCB(idx); SVC(dis_dsp(), gen_ercd_sys(p_cellcb)); if (!VAR_openFlag) { /* オープン済みかのチェック */ ercd = E_OBJ; } else { /* * ハードウェア依存のクローズ処理 */ if (loc_cpu() < 0) { eflag = true; } cSIOPort_close(); VAR_openFlag = false; if (unl_cpu() < 0) { eflag = true; } /* * セマフォの初期化 */ if (cSendSemaphore_initialize() < 0) { eflag = true; } if (cReceiveSemaphore_initialize() < 0) { eflag = true; } /* * エラーコードの設定 */ if (eflag) { ercd = gen_ercd_sys(p_cellcb); } else { ercd = E_OK; } } SVC(ena_dsp(), gen_ercd_sys(p_cellcb)); error_exit: return(ercd); }
void tex_task3(TEXPTN texptn, intptr_t exinf) { ER ercd; /* * システムスタック領域に余裕があることを,拡張サービスコールを使っ * て確認する. * * ユーザタスクにおいて,システムスタック領域が減ることはないはず * だが,カーネルのバグにより増減する可能性はあるため,念のため確 * 認している.ただし,システムスタック領域が増えてしまうバグは, * これでは検出できない(不可解な動作をする). */ ercd = cal_svc(TFN_EXTSVC, 0, 0, 0, 0, 0); check_ercd(ercd, E_OK); #ifdef DEBUG_LOG if (tex_start_count % 50 == 0) { syslog_2(LOG_NOTICE, "%d: sp = %x", tex_start_count, &ercd); } #endif /* DEBUG_LOG */ tex_start_count += 1; if (tex_start_count < UTASK_TEX_COUNT) { switch (texptn) { case 0x0001: ercd = ras_tex(TASK3, 0x0001); check_ercd(ercd, E_OK); break; case 0x0002: ercd = dis_dsp(); check_ercd(ercd, E_OK); ercd = ena_tex(); check_ercd(ercd, E_OK); ercd = act_tsk(TASK4); check_ercd(ercd, E_OK); break; } } }
void task1(intptr_t exinf) { ER ercd; check_point(1); check_state(false, false, TIPM_ENAALL, false, false, true); ercd = dis_dsp(); check_ercd(ercd, E_OK); check_point(2); check_state(false, false, TIPM_ENAALL, true, true, true); RAISE_CPU_EXCEPTION; check_point(5); check_state(false, false, TIPM_ENAALL, true, true, true); check_finish(6); }
void task3(intptr_t exinf) { ER ercd; check_point(13); ercd = sta_alm(ALM1, 10); check_ercd(ercd, E_OK); wait_var(); check_point(16); ercd = sta_alm(ALM1, 10); check_ercd(ercd, E_OK); ercd = dis_dsp(); check_ercd(ercd, E_OK); wait_var(); check_point(18); ercd = ena_dsp(); check_ercd(ercd, E_OK); check_point(20); ercd = sta_alm(ALM1, 10); check_ercd(ercd, E_OK); ercd = sus_tsk(TASK1); check_ercd(ercd, E_OK); wait_var(); check_point(22); ercd = rsm_tsk(TASK1); check_ercd(ercd, E_OK); check_point(26); ercd = ext_tsk(); check_point(0); }
void tex_task2(TEXPTN texptn, intptr_t exinf) { ER_UINT ercd; switch (++tex_task2_count) { case 1: check_point(29); check_assert(texptn == 0x0001); check_state(false, false, TIPM_ENAALL, false, false, true); return; check_point(0); case 2: check_point(31); check_assert(texptn == 0x0002); check_state(false, false, TIPM_ENAALL, false, false, true); check_point(32); ercd = dis_dsp(); check_ercd(ercd, E_OK); ercd = rot_rdq(TPRI_SELF); check_ercd(ercd, E_OK); check_point(33); return; check_point(0); default: check_point(0); } check_point(0); }
void tex_task1(TEXPTN texptn, intptr_t exinf) { ER ercd; /* * スタック領域に余裕があることを,拡張サービスコールを使って確認 * する. */ ercd = cal_svc(TFN_EXTSVC, 0, 0, 0, 0, 0); check_ercd(ercd, E_OK); #ifdef DEBUG_LOG if (tex_start_count % 50 == 0) { syslog_2(LOG_NOTICE, "%d: sp = %x", tex_start_count, &ercd); } #endif /* DEBUG_LOG */ tex_start_count += 1; if (tex_start_count < STASK_TEX_COUNT) { switch (texptn) { case 0x0001: ercd = ras_tex(TASK1, 0x0001); check_ercd(ercd, E_OK); break; case 0x0002: ercd = dis_dsp(); check_ercd(ercd, E_OK); ercd = ena_tex(); check_ercd(ercd, E_OK); ercd = act_tsk(TASK2); check_ercd(ercd, E_OK); break; } } }
void tex_task2(TEXPTN texptn, intptr_t exinf) { ER ercd; switch (texptn) { case 0x0001: check_point(28); check_state(false, false, TIPM_ENAALL, false, false, true); break; case 0x0002: check_point(30); check_state(false, false, TIPM_ENAALL, false, false, true); /* * ディスパッチを禁止して,タスク切換えを要求する. */ check_point(31); ercd = dis_dsp(); check_ercd(ercd, E_OK); ercd = rot_rdq(TPRI_SELF); check_ercd(ercd, E_OK); /* * タスク例外処理ルーチンからのリターンで,タスク切換えが発生 * する. */ check_point(32); break; default: check_point(0); break; } }
void task1(intptr_t exinf) { ER_UINT ercd; T_RFLG rflg; FLGPTN flgptn; test_start(__FILE__); check_point(1); ercd = ref_flg(FLG1, &rflg); check_ercd(ercd, E_OK); check_assert(rflg.wtskid == TSK_NONE); check_assert(rflg.flgptn == 0x00); ercd = ref_flg(FLG2, &rflg); check_ercd(ercd, E_OK); check_assert(rflg.wtskid == TSK_NONE); check_assert(rflg.flgptn == 0x01); check_point(2); ercd = loc_cpu(); check_ercd(ercd, E_OK); ercd = set_flg(FLG1, 0x01); check_ercd(ercd, E_CTX); ercd = wai_flg(FLG1, 0x01, TWF_ORW, &flgptn); check_ercd(ercd, E_CTX); ercd = unl_cpu(); check_ercd(ercd, E_OK); ercd = dis_dsp(); check_ercd(ercd, E_OK); ercd = wai_flg(FLG1, 0x01, TWF_ORW, &flgptn); check_ercd(ercd, E_CTX); ercd = ena_dsp(); check_ercd(ercd, E_OK); ercd = chg_ipm(TMAX_INTPRI); check_ercd(ercd, E_OK); ercd = wai_flg(FLG1, 0x01, TWF_ORW, &flgptn); check_ercd(ercd, E_CTX); ercd = chg_ipm(TIPM_ENAALL); check_ercd(ercd, E_OK); ercd = set_flg(0, 0x01); check_ercd(ercd, E_ID); ercd = wai_flg(0, 0x01, TWF_ORW, &flgptn); check_ercd(ercd, E_ID); ercd = set_flg(TNUM_FLGID+1, 0x01); check_ercd(ercd, E_ID); ercd = wai_flg(TNUM_FLGID+1, 0x01, TWF_ORW, &flgptn); check_ercd(ercd, E_ID); ercd = wai_flg(FLG1, 0x00, TWF_ORW, &flgptn); check_ercd(ercd, E_PAR); ercd = wai_flg(FLG1, 0x01, 0U, &flgptn); check_ercd(ercd, E_PAR); ercd = wai_flg(FLG1, 0x01, (TWF_ORW|TWF_ANDW), &flgptn); check_ercd(ercd, E_PAR); ercd = set_flg(FLG1, 0x00); check_ercd(ercd, E_OK); ercd = ref_flg(FLG1, &rflg); check_ercd(ercd, E_OK); check_assert(rflg.wtskid == TSK_NONE); check_assert(rflg.flgptn == 0x00); ercd = set_flg(FLG1, 0x01); check_ercd(ercd, E_OK); ercd = ref_flg(FLG1, &rflg); check_ercd(ercd, E_OK); check_assert(rflg.wtskid == TSK_NONE); check_assert(rflg.flgptn == 0x01); ercd = set_flg(FLG1, 0x01); check_ercd(ercd, E_OK); ercd = ref_flg(FLG1, &rflg); check_ercd(ercd, E_OK); check_assert(rflg.wtskid == TSK_NONE); check_assert(rflg.flgptn == 0x01); ercd = set_flg(FLG1, 0x02); check_ercd(ercd, E_OK); ercd = ref_flg(FLG1, &rflg); check_ercd(ercd, E_OK); check_assert(rflg.wtskid == TSK_NONE); check_assert(rflg.flgptn == 0x03); ercd = clr_flg(FLG1, ~0x01); check_ercd(ercd, E_OK); ercd = set_flg(FLG1, 0x03); check_ercd(ercd, E_OK); ercd = ref_flg(FLG1, &rflg); check_ercd(ercd, E_OK); check_assert(rflg.wtskid == TSK_NONE); check_assert(rflg.flgptn == 0x03); check_point(3); ercd = act_tsk(TASK2); check_ercd(ercd, E_OK); check_point(6); ercd = set_flg(FLG1, 0x04); check_ercd(ercd, E_OK); check_point(9); ercd = dis_dsp(); check_ercd(ercd, E_OK); ercd = set_flg(FLG1, 0x08); check_ercd(ercd, E_OK); ercd = ref_flg(FLG1, &rflg); check_ercd(ercd, E_OK); check_assert(rflg.wtskid == TSK_NONE); check_assert(rflg.flgptn == 0x0f); check_point(10); ercd = ena_dsp(); check_ercd(ercd, E_OK); check_point(13); ercd = chg_ipm(TMAX_INTPRI); check_ercd(ercd, E_OK); ercd = set_flg(FLG2, 0x04); check_ercd(ercd, E_OK); ercd = ref_flg(FLG2, &rflg); check_ercd(ercd, E_OK); check_assert(rflg.wtskid == TSK_NONE); check_assert(rflg.flgptn == 0x00); check_point(14); ercd = chg_ipm(TIPM_ENAALL); check_ercd(ercd, E_OK); check_point(17); ercd = sus_tsk(TASK2); check_ercd(ercd, E_OK); ercd = set_flg(FLG2, 0x04); check_ercd(ercd, E_OK); ercd = ref_flg(FLG2, &rflg); check_ercd(ercd, E_OK); check_assert(rflg.wtskid == TSK_NONE); check_assert(rflg.flgptn == 0x00); check_point(18); ercd = rsm_tsk(TASK2); check_ercd(ercd, E_OK); check_point(21); ercd = wai_flg(FLG2, 0x02, TWF_ORW, &flgptn); check_ercd(ercd, E_ILUSE); ercd = set_flg(FLG2, 0x02); check_ercd(ercd, E_OK); ercd = wai_flg(FLG2, 0x02, TWF_ORW, &flgptn); check_ercd(ercd, E_ILUSE); check_point(22); ercd = set_flg(FLG2, 0x01); check_ercd(ercd, E_OK); check_point(25); ercd = wai_flg(FLG3, 0x01, TWF_ORW, &flgptn); check_ercd(ercd, E_OK); check_point(31); ercd = wai_flg(FLG4, 0x01, TWF_ORW, &flgptn); check_ercd(ercd, E_OK); check_point(37); ercd = clr_flg(FLG3, 0); check_ercd(ercd, E_OK); ercd = sta_alm(ALM1, 2 * TEST_TIME_CP); check_ercd(ercd, E_OK); check_point(38); ercd = wai_flg(FLG3, 0x01, TWF_ORW, &flgptn); check_ercd(ercd, E_OK); check_point(42); ercd = set_flg(FLG3, 0x02); check_ercd(ercd, E_OK); check_point(43); ercd = slp_tsk(); check_ercd(ercd, E_OK); check_point(0); }
void task1(intptr_t exinf) { ER_UINT ercd; test_start(__FILE__); set_bit_func(bit_mutex); check_point(1); ercd = loc_mtx(MTX1); check_ercd(ercd, E_OK); check_point(2); ercd = act_tsk(TASK2); check_ercd(ercd, E_OK); check_point(3); ercd = act_tsk(TASK5); check_ercd(ercd, E_OK); check_point(6); ercd = sus_tsk(TASK2); check_ercd(ercd, E_OK); check_point(7); ercd = loc_mtx(MTX1); check_ercd(ercd, E_OK); ercd = loc_mtx(MTX2); check_ercd(ercd, E_OK); check_point(8); ercd = act_tsk(TASK3); check_ercd(ercd, E_OK); check_point(9); ercd = dis_dsp(); check_ercd(ercd, E_OK); check_point(10); ercd = rot_rdq(MID_PRIORITY); check_ercd(ercd, E_OK); check_point(11); ercd = act_tsk(TASK4); check_ercd(ercd, E_OK); check_point(12); ercd = wup_tsk(TASK5); check_ercd(ercd, E_OK); check_point(13); ercd = ena_dsp(); check_ercd(ercd, E_OK); check_point(17); ercd = slp_tsk(); check_ercd(ercd, E_OK); check_point(20); ercd = loc_mtx(MTX3); check_ercd(ercd, E_OK); check_point(21); ercd = wup_tsk(TASK3); check_ercd(ercd, E_OK); check_point(22); ercd = dis_dsp(); check_ercd(ercd, E_OK); check_point(23); ercd = rot_rdq(MID_PRIORITY); check_ercd(ercd, E_OK); check_point(24); ercd = wup_tsk(TASK4); check_ercd(ercd, E_OK); check_point(25); ercd = wup_tsk(TASK5); check_ercd(ercd, E_OK); check_point(26); ercd = ena_dsp(); check_ercd(ercd, E_OK); check_point(30); ercd = slp_tsk(); check_ercd(ercd, E_OK); check_point(33); ercd = rsm_tsk(TASK2); check_ercd(ercd, E_OK); check_point(34); ercd = ini_mtx(MTX2); check_ercd(ercd, E_OK); check_point(37); ercd = wup_tsk(TASK5); check_ercd(ercd, E_OK); check_point(40); ercd = loc_mtx(MTX1); check_ercd(ercd, E_OK); check_point(41); ercd = loc_mtx(MTX4); check_ercd(ercd, E_OK); check_point(47); ercd = unl_mtx(MTX4); check_ercd(ercd, E_OK); check_point(48); ercd = wup_tsk(TASK5); check_ercd(ercd, E_OK); check_point(51); ercd = wup_tsk(TASK3); check_ercd(ercd, E_OK); check_point(53); ercd = loc_mtx(MTX1); check_ercd(ercd, E_OK); ercd = loc_mtx(MTX2); check_ercd(ercd, E_OK); check_point(54); ercd = loc_mtx(MTX4); check_ercd(ercd, E_OK); check_point(62); ercd = unl_mtx(MTX4); check_ercd(ercd, E_OK); check_point(65); ercd = slp_tsk(); check_ercd(ercd, E_OK); check_point(73); ercd = loc_mtx(MTX3); check_ercd(ercd, E_OK); check_point(74); ercd = loc_mtx(MTX4); check_ercd(ercd, E_OK); check_point(82); ercd = unl_mtx(MTX4); check_ercd(ercd, E_OK); check_point(85); ercd = unl_mtx(MTX2); check_ercd(ercd, E_OK); check_point(87); ercd = sus_tsk(TASK2); check_ercd(ercd, E_OK); check_point(88); ercd = loc_mtx(MTX1); check_ercd(ercd, E_OK); check_point(89); ercd = wup_tsk(TASK3); check_ercd(ercd, E_OK); check_point(90); ercd = rot_rdq(MID_PRIORITY); check_ercd(ercd, E_OK); check_point(92); ercd = wup_tsk(TASK5); check_ercd(ercd, E_OK); check_point(98); ercd = loc_mtx(MTX1); check_ercd(ercd, E_OK); check_point(99); ercd = wup_tsk(TASK3); check_ercd(ercd, E_OK); check_point(100); ercd = rot_rdq(MID_PRIORITY); check_ercd(ercd, E_OK); check_point(102); ercd = rsm_tsk(TASK2); check_ercd(ercd, E_OK); check_point(103); ercd = slp_tsk(); check_ercd(ercd, E_OK); check_point(0); }
/* * シリアルポートのオープン(サービスコール) */ ER serial_opn_por(ID portid) { SPCB *p_spcb; ER ercd; if (sns_dpn()) { /* コンテキストのチェック */ return(E_CTX); } if (!(1 <= portid && portid <= TNUM_PORT)) { return(E_ID); /* ポート番号のチェック */ } p_spcb = get_spcb(portid); SVC(dis_dsp(), gen_ercd_sys(p_spcb)); if (p_spcb->openflag) { /* オープン済みかのチェック */ ercd = E_OBJ; } else { /* * 変数の初期化 */ p_spcb->ioctl = (IOCTL_ECHO | IOCTL_CRLF | IOCTL_FCSND | IOCTL_FCRCV); p_spcb->rcv_read_ptr = 0U; p_spcb->rcv_write_ptr = 0U; p_spcb->rcv_count = 0U; p_spcb->rcv_fc_chr = '\0'; p_spcb->rcv_stopped = false; p_spcb->snd_read_ptr = 0U; p_spcb->snd_write_ptr = 0U; p_spcb->snd_count = 0U; p_spcb->snd_stopped = false; /* * これ以降,割込みを禁止する. */ if (loc_cpu() < 0) { ercd = E_SYS; goto error_exit_enadsp; } /* * ハードウェア依存のオープン処理 */ p_spcb->p_siopcb = sio_opn_por(portid, (intptr_t) p_spcb); /* * 受信通知コールバックを許可する. */ sio_ena_cbr(p_spcb->p_siopcb, SIO_RDY_RCV); p_spcb->openflag = true; p_spcb->errorflag = false; if (unl_cpu() < 0) { p_spcb->errorflag = true; ercd = E_SYS; goto error_exit_enadsp; } ercd = E_OK; } error_exit_enadsp: SVC(ena_dsp(), gen_ercd_sys(p_spcb)); error_exit: return(ercd); }
void task1( unsigned int arg ) { ER ercd; int tests = 0; CYG_TEST_INFO( "Task 1 running" ); ercd = dis_dsp(); CYG_TEST_CHECK( E_OK == ercd, "dis_dsp bad ercd" ); ercd = sta_tsk( 2, 22222 ); CYG_TEST_CHECK( E_OK == ercd, "sta_tsk bad ercd" ); ercd = chg_pri( 2, 5 ); CYG_TEST_CHECK( E_OK == ercd, "chg_pri bad ercd" ); ercd = ena_dsp(); CYG_TEST_CHECK( E_OK == ercd, "ena_dsp bad ercd" ); ercd = dly_tsk( 10 ); CYG_TEST_CHECK( E_OK == ercd, "dly_tsk bad ercd" ); #ifdef CYGPKG_UITRON_SEMAS_CREATE_DELETE tests++; #ifdef CYGSEM_UITRON_BAD_PARAMS_RETURN_ERRORS ercd = del_sem( -6 ); CYG_TEST_CHECK( E_ID == ercd, "del_sem bad ercd !E_ID" ); ercd = del_sem( 99 ); CYG_TEST_CHECK( E_ID == ercd, "del_sem bad ercd !E_ID" ); ercd = cre_sem( -6, &t_csem ); CYG_TEST_CHECK( E_ID == ercd, "cre_sem bad ercd !E_ID" ); ercd = cre_sem( 99, &t_csem ); CYG_TEST_CHECK( E_ID == ercd, "cre_sem bad ercd !E_ID" ); #endif // we can test bad param error returns // try a pre-existing object ercd = cre_sem( 3, &t_csem ); CYG_TEST_CHECK( E_OBJ == ercd, "cre_sem bad ercd !E_OBJ" ); // delete it so we can play ercd = del_sem( 3 ); CYG_TEST_CHECK( E_OK == ercd, "del_sem bad ercd" ); // check it is deleted ercd = sig_sem( 3 ); CYG_TEST_CHECK( E_NOEXS == ercd, "sig_sem bad ercd !E_NOEXS" ); ercd = preq_sem( 3 ); CYG_TEST_CHECK( E_NOEXS == ercd, "preq_sem bad ercd !E_NOEXS" ); ercd = twai_sem( 3, 10 ); CYG_TEST_CHECK( E_NOEXS == ercd, "twai_sem bad ercd !E_NOEXS" ); ercd = wai_sem( 3 ); CYG_TEST_CHECK( E_NOEXS == ercd, "wai_sem bad ercd !E_NOEXS" ); ercd = ref_sem( &t_rsem, 3 ); CYG_TEST_CHECK( E_NOEXS == ercd, "ref_sem bad ercd !E_NOEXS" ); #ifdef CYGSEM_UITRON_BAD_PARAMS_RETURN_ERRORS // now try creating it (badly) #ifndef CYGSEM_UITRON_PARAMS_NULL_IS_GOOD_PTR ercd = cre_sem( 3, NULL ); CYG_TEST_CHECK( E_PAR == ercd, "cre_sem bad ercd !E_PAR" ); #endif ercd = cre_sem( 3, NADR ); CYG_TEST_CHECK( E_PAR == ercd, "cre_sem bad ercd !E_PAR" ); t_csem.sematr = 0xfff; ercd = cre_sem( 3, &t_csem ); CYG_TEST_CHECK( E_RSATR == ercd, "cre_sem bad ercd !E_RSATR" ); t_csem.sematr = 0; #endif // we can test bad param error returns ercd = cre_sem( 3, &t_csem ); CYG_TEST_CHECK( E_OK == ercd, "cre_sem bad ercd" ); // and check we can use it ercd = sig_sem( 3 ); CYG_TEST_CHECK( E_OK == ercd, "sig_sem bad ercd" ); ercd = wai_sem( 3 ); CYG_TEST_CHECK( E_OK == ercd, "wai_sem bad ercd" ); ercd = preq_sem( 3 ); CYG_TEST_CHECK( E_TMOUT == ercd, "preq_sem bad ercd !E_TMOUT" ); ercd = twai_sem( 3, 2 ); CYG_TEST_CHECK( E_TMOUT == ercd, "twai_sem bad ercd !E_TMOUT" ); ercd = ref_sem( &t_rsem, 3 ); CYG_TEST_CHECK( E_OK == ercd, "ref_sem bad ercd" ); // now wait while task 2 deletes the wait objects ercd = wup_tsk( 2 ); CYG_TEST_CHECK( E_OK == ercd, "wup_tsk bad ercd" ); ercd = wai_sem( 1 ); CYG_TEST_CHECK( E_DLT == ercd, "wai_sem bad ercd !E_DLT" ); ercd = wup_tsk( 2 ); CYG_TEST_CHECK( E_OK == ercd, "wup_tsk bad ercd" ); ercd = twai_sem( 2, 20 ); CYG_TEST_CHECK( E_DLT == ercd, "twai_sem bad ercd !E_DLT" ); // check they are deleted ercd = sig_sem( 1 ); CYG_TEST_CHECK( E_NOEXS == ercd, "sig_sem bad ercd !E_NOEXS" ); ercd = sig_sem( 2 ); CYG_TEST_CHECK( E_NOEXS == ercd, "sig_sem bad ercd !E_NOEXS" ); // re-create and do it again ercd = cre_sem( 1, &t_csem ); CYG_TEST_CHECK( E_OK == ercd, "cre_sem bad ercd" ); ercd = cre_sem( 2, &t_csem ); CYG_TEST_CHECK( E_OK == ercd, "cre_sem bad ercd" ); // now wait while task 2 deletes the wait objects again ercd = wup_tsk( 2 ); CYG_TEST_CHECK( E_OK == ercd, "wup_tsk bad ercd" ); ercd = wai_sem( 1 ); CYG_TEST_CHECK( E_DLT == ercd, "wai_sem bad ercd !E_DLT" ); ercd = wup_tsk( 2 ); CYG_TEST_CHECK( E_OK == ercd, "wup_tsk bad ercd" ); ercd = twai_sem( 2, 20 ); CYG_TEST_CHECK( E_DLT == ercd, "twai_sem bad ercd !E_DLT" ); // check they are deleted ercd = sig_sem( 1 ); CYG_TEST_CHECK( E_NOEXS == ercd, "sig_sem bad ercd !E_NOEXS" ); ercd = sig_sem( 2 ); CYG_TEST_CHECK( E_NOEXS == ercd, "sig_sem bad ercd !E_NOEXS" ); CYG_TEST_PASS("create/delete semaphores"); #endif // CYGPKG_UITRON_SEMAS_CREATE_DELETE #ifdef CYGPKG_UITRON_FLAGS_CREATE_DELETE tests++; #ifdef CYGSEM_UITRON_BAD_PARAMS_RETURN_ERRORS ercd = del_flg( -6 ); CYG_TEST_CHECK( E_ID == ercd, "del_flg bad ercd !E_ID" ); ercd = del_flg( 99 ); CYG_TEST_CHECK( E_ID == ercd, "del_flg bad ercd !E_ID" ); ercd = cre_flg( -6, &t_cflg ); CYG_TEST_CHECK( E_ID == ercd, "cre_flg bad ercd !E_ID" ); ercd = cre_flg( 99, &t_cflg ); CYG_TEST_CHECK( E_ID == ercd, "cre_flg bad ercd !E_ID" ); #endif // we can test bad param error returns // try a pre-existing object ercd = cre_flg( 3, &t_cflg ); CYG_TEST_CHECK( E_OBJ == ercd, "cre_flg bad ercd !E_OBJ" ); // delete it so we can play ercd = del_flg( 3 ); CYG_TEST_CHECK( E_OK == ercd, "del_flg bad ercd" ); // check it is deleted ercd = set_flg( 3, 0x6789 ); CYG_TEST_CHECK( E_NOEXS == ercd, "set_flg bad ercd !E_NOEXS" ); ercd = clr_flg( 3, 0x9876 ); CYG_TEST_CHECK( E_NOEXS == ercd, "clr_flg bad ercd !E_NOEXS" ); ercd = pol_flg( &scratch, 3, 0xdddd, TWF_ANDW ); CYG_TEST_CHECK( E_NOEXS == ercd, "pol_flg bad ercd !E_NOEXS" ); ercd = twai_flg( &scratch, 3, 0x4444, TWF_ORW, 10 ); CYG_TEST_CHECK( E_NOEXS == ercd, "twai_flg bad ercd !E_NOEXS" ); ercd = wai_flg( &scratch, 3, 0xbbbb, TWF_ANDW | TWF_CLR ); CYG_TEST_CHECK( E_NOEXS == ercd, "wai_flg bad ercd !E_NOEXS" ); ercd = ref_flg( &t_rflg, 3 ); CYG_TEST_CHECK( E_NOEXS == ercd, "ref_flg bad ercd !E_NOEXS" ); #ifdef CYGSEM_UITRON_BAD_PARAMS_RETURN_ERRORS // now try creating it (badly) #ifndef CYGSEM_UITRON_PARAMS_NULL_IS_GOOD_PTR ercd = cre_flg( 3, NULL ); CYG_TEST_CHECK( E_PAR == ercd, "cre_flg bad ercd !E_PAR" ); #endif ercd = cre_flg( 3, NADR ); CYG_TEST_CHECK( E_PAR == ercd, "cre_flg bad ercd !E_PAR" ); t_cflg.flgatr = 0xfff; ercd = cre_flg( 3, &t_cflg ); CYG_TEST_CHECK( E_RSATR == ercd, "cre_flg bad ercd !E_RSATR" ); #endif // we can test bad param error returns // now create it well t_cflg.flgatr = 0; t_cflg.iflgptn = 0; ercd = cre_flg( 3, &t_cflg ); CYG_TEST_CHECK( E_OK == ercd, "cre_flg bad ercd" ); // and check we can use it ercd = clr_flg( 3, 0x7256 ); CYG_TEST_CHECK( E_OK == ercd, "clr_flg bad ercd" ); ercd = set_flg( 3, 0xff ); CYG_TEST_CHECK( E_OK == ercd, "set_flg bad ercd" ); ercd = wai_flg( &scratch, 3, 0xaa, TWF_ANDW | TWF_CLR ); CYG_TEST_CHECK( E_OK == ercd, "wai_flg bad ercd" ); ercd = pol_flg( &scratch, 3, 0xaa, TWF_ANDW | TWF_CLR ); CYG_TEST_CHECK( E_TMOUT == ercd, "pol_flg bad ercd !E_TMOUT" ); ercd = twai_flg( &scratch, 3, 0xaa, TWF_ANDW | TWF_CLR, 2 ); CYG_TEST_CHECK( E_TMOUT == ercd, "twai_flg bad ercd !E_TMOUT" ); ercd = ref_flg( &t_rflg, 3 ); CYG_TEST_CHECK( E_OK == ercd, "ref_flg bad ercd" ); CYG_TEST_CHECK( 0 == t_rflg.flgptn, "ref_flg bad ercd" ); // now create it again with a preset pattern and check that we can // detect that pattern: ercd = del_flg( 3 ); CYG_TEST_CHECK( E_OK == ercd, "del_flg bad ercd" ); t_cflg.flgatr = 0; t_cflg.iflgptn = 0x1234; ercd = cre_flg( 3, &t_cflg ); CYG_TEST_CHECK( E_OK == ercd, "cre_flg bad ercd" ); // and check we can use it ercd = wai_flg( &scratch, 3, 0x1200, TWF_ANDW ); CYG_TEST_CHECK( E_OK == ercd, "wai_flg bad ercd" ); ercd = pol_flg( &scratch, 3, 0x0034, TWF_ANDW ); CYG_TEST_CHECK( E_OK == ercd, "pol_flg bad ercd" ); ercd = twai_flg( &scratch, 3, 0x1004, TWF_ANDW, 10 ); CYG_TEST_CHECK( E_OK == ercd, "twai_flg bad ercd" ); ercd = pol_flg( &scratch, 3, 0xffedcb, TWF_ORW ); CYG_TEST_CHECK( E_TMOUT == ercd, "pol_flg bad ercd !E_TMOUT" ); ercd = ref_flg( &t_rflg, 3 ); CYG_TEST_CHECK( E_OK == ercd, "ref_flg bad ercd" ); CYG_TEST_CHECK( 0x1234 == t_rflg.flgptn, "ref_flg bad ercd" ); ercd = clr_flg( 3, 0 ); ercd = ref_flg( &t_rflg, 3 ); CYG_TEST_CHECK( E_OK == ercd, "ref_flg bad ercd" ); CYG_TEST_CHECK( 0 == t_rflg.flgptn, "ref_flg bad ercd" ); // now wait while task 2 deletes the wait objects ercd = wup_tsk( 2 ); CYG_TEST_CHECK( E_OK == ercd, "wup_tsk bad ercd" ); ercd = wai_flg( &scratch, 1, 0xaa, TWF_ANDW ); CYG_TEST_CHECK( E_DLT == ercd, "wai_flg bad ercd !E_DLT" ); ercd = wup_tsk( 2 ); CYG_TEST_CHECK( E_OK == ercd, "wup_tsk bad ercd" ); ercd = twai_flg( &scratch, 2, 0x55, TWF_ANDW, 20 ); CYG_TEST_CHECK( E_DLT == ercd, "twai_flg bad ercd !E_DLT" ); // check they are deleted ercd = set_flg( 1, 0x22 ); CYG_TEST_CHECK( E_NOEXS == ercd, "set_flg bad ercd !E_NOEXS" ); ercd = clr_flg( 2, 0xdd ); CYG_TEST_CHECK( E_NOEXS == ercd, "clr_flg bad ercd !E_NOEXS" ); // re-create and do it again t_cflg.iflgptn = 0x5555; ercd = cre_flg( 1, &t_cflg ); CYG_TEST_CHECK( E_OK == ercd, "cre_flg bad ercd" ); t_cflg.iflgptn = 0; ercd = cre_flg( 2, &t_cflg ); CYG_TEST_CHECK( E_OK == ercd, "cre_flg bad ercd" ); // now wait while task 2 deletes the wait objects again ercd = wup_tsk( 2 ); CYG_TEST_CHECK( E_OK == ercd, "wup_tsk bad ercd" ); ercd = wai_flg( &scratch, 1, 0xaaaa, TWF_ORW | TWF_CLR ); CYG_TEST_CHECK( E_DLT == ercd, "wai_flg bad ercd !E_DLT" ); ercd = wup_tsk( 2 ); CYG_TEST_CHECK( E_OK == ercd, "wup_tsk bad ercd" ); ercd = twai_flg( &scratch, 2, 0xffff, TWF_ORW, 20 ); CYG_TEST_CHECK( E_DLT == ercd, "twai_flg bad ercd !E_DLT" ); // check they are deleted ercd = clr_flg( 1, 0xd00d ); CYG_TEST_CHECK( E_NOEXS == ercd, "clr_flg bad ercd !E_NOEXS" ); ercd = set_flg( 2, 0xfff00 ); CYG_TEST_CHECK( E_NOEXS == ercd, "set_flg bad ercd !E_NOEXS" ); CYG_TEST_PASS("create/delete flags"); #endif // CYGPKG_UITRON_FLAGS_CREATE_DELETE #ifdef CYGPKG_UITRON_MBOXES_CREATE_DELETE tests++; #ifdef CYGSEM_UITRON_BAD_PARAMS_RETURN_ERRORS ercd = del_mbx( -6 ); CYG_TEST_CHECK( E_ID == ercd, "del_mbx bad ercd !E_ID" ); ercd = del_mbx( 99 ); CYG_TEST_CHECK( E_ID == ercd, "del_mbx bad ercd !E_ID" ); ercd = cre_mbx( -6, &t_cmbx ); CYG_TEST_CHECK( E_ID == ercd, "cre_mbx bad ercd !E_ID" ); ercd = cre_mbx( 99, &t_cmbx ); CYG_TEST_CHECK( E_ID == ercd, "cre_mbx bad ercd !E_ID" ); #endif // we can test bad param error returns // try a pre-existing object ercd = cre_mbx( 3, &t_cmbx ); CYG_TEST_CHECK( E_OBJ == ercd, "cre_mbx bad ercd !E_OBJ" ); // delete it so we can play ercd = del_mbx( 3 ); CYG_TEST_CHECK( E_OK == ercd, "del_mbx bad ercd" ); // check it is deleted ercd = snd_msg( 3, t_msg ); CYG_TEST_CHECK( E_NOEXS == ercd, "snd_msg bad ercd !E_NOEXS" ); ercd = rcv_msg( &msg, 3 ); CYG_TEST_CHECK( E_NOEXS == ercd, "rcv_msg bad ercd !E_NOEXS" ); ercd = trcv_msg( &msg, 3, 10 ); CYG_TEST_CHECK( E_NOEXS == ercd, "trcv_msg bad ercd !E_NOEXS" ); ercd = prcv_msg( &msg, 3 ); CYG_TEST_CHECK( E_NOEXS == ercd, "prcv_msg bad ercd !E_NOEXS" ); ercd = ref_mbx( &t_rmbx, 3 ); CYG_TEST_CHECK( E_NOEXS == ercd, "ref_mbx bad ercd !E_NOEXS" ); #ifdef CYGSEM_UITRON_BAD_PARAMS_RETURN_ERRORS // now try creating it (badly) #ifndef CYGSEM_UITRON_PARAMS_NULL_IS_GOOD_PTR ercd = cre_mbx( 3, NULL ); CYG_TEST_CHECK( E_PAR == ercd, "cre_mbx bad ercd !E_PAR" ); #endif ercd = cre_mbx( 3, NADR ); CYG_TEST_CHECK( E_PAR == ercd, "cre_mbx bad ercd !E_PAR" ); t_cmbx.mbxatr = 0xfff; ercd = cre_mbx( 3, &t_cmbx ); CYG_TEST_CHECK( E_RSATR == ercd, "cre_mbx bad ercd !E_RSATR" ); t_cmbx.mbxatr = 0; #endif // we can test bad param error returns ercd = cre_mbx( 3, &t_cmbx ); CYG_TEST_CHECK( E_OK == ercd, "cre_mbx bad ercd" ); // and check we can use it ercd = snd_msg( 3, t_msg ); CYG_TEST_CHECK( E_OK == ercd, "snd_msg bad ercd" ); ercd = rcv_msg( &msg, 3 ); CYG_TEST_CHECK( E_OK == ercd, "rcv_msg bad ercd" ); ercd = trcv_msg( &msg, 3, 2 ); CYG_TEST_CHECK( E_TMOUT == ercd, "trcv_msg bad ercd !E_TMOUT" ); ercd = prcv_msg( &msg, 3 ); CYG_TEST_CHECK( E_TMOUT == ercd, "prcv_msg bad ercd !E_TMOUT" ); ercd = ref_mbx( &t_rmbx, 3 ); CYG_TEST_CHECK( E_OK == ercd, "ref_mbx bad ercd" ); // now wait while task 2 deletes the wait objects ercd = wup_tsk( 2 ); CYG_TEST_CHECK( E_OK == ercd, "wup_tsk bad ercd" ); ercd = rcv_msg( &msg, 1 ); CYG_TEST_CHECK( E_DLT == ercd, "wai_mbx bad ercd !E_DLT" ); ercd = wup_tsk( 2 ); CYG_TEST_CHECK( E_OK == ercd, "wup_tsk bad ercd" ); ercd = trcv_msg( &msg, 2, 20 ); CYG_TEST_CHECK( E_DLT == ercd, "twai_mbx bad ercd !E_DLT" ); // check they are deleted ercd = snd_msg( 1, t_msg ); CYG_TEST_CHECK( E_NOEXS == ercd, "snd_msg bad ercd !E_NOEXS" ); ercd = snd_msg( 2, t_msg ); CYG_TEST_CHECK( E_NOEXS == ercd, "snd_msg bad ercd !E_NOEXS" ); // re-create and do it again ercd = cre_mbx( 1, &t_cmbx ); CYG_TEST_CHECK( E_OK == ercd, "cre_mbx bad ercd" ); ercd = cre_mbx( 2, &t_cmbx ); CYG_TEST_CHECK( E_OK == ercd, "cre_mbx bad ercd" ); // now wait while task 2 deletes the wait objects again ercd = wup_tsk( 2 ); CYG_TEST_CHECK( E_OK == ercd, "wup_tsk bad ercd" ); ercd = rcv_msg( &msg, 1 ); CYG_TEST_CHECK( E_DLT == ercd, "wai_mbx bad ercd !E_DLT" ); ercd = wup_tsk( 2 ); CYG_TEST_CHECK( E_OK == ercd, "wup_tsk bad ercd" ); ercd = trcv_msg( &msg, 2, 20 ); CYG_TEST_CHECK( E_DLT == ercd, "twai_mbx bad ercd !E_DLT" ); // check they are deleted ercd = snd_msg( 1, t_msg ); CYG_TEST_CHECK( E_NOEXS == ercd, "snd_msg bad ercd !E_NOEXS" ); ercd = snd_msg( 2, t_msg ); CYG_TEST_CHECK( E_NOEXS == ercd, "snd_msg bad ercd !E_NOEXS" ); CYG_TEST_PASS("create/delete mboxes"); #endif // CYGPKG_UITRON_MBOXES_CREATE_DELETE ercd = ter_tsk( 2 ); CYG_TEST_CHECK( E_OK == ercd, "ter_tsk bad ercd" ); ercd = dly_tsk( 5 ); CYG_TEST_CHECK( E_OK == ercd, "dly_tsk bad ercd" ); // all done if ( 0 == tests ) { CYG_TEST_NA( "No objects have create/delete enabled" ); } else { CYG_TEST_EXIT( "All done" ); } ext_tsk(); }
void task1(intptr_t exinf) { ER_UINT ercd; T_RMTX rmtx; test_start(__FILE__); set_bit_func(bit_mutex); check_point(1); ercd = ref_mtx(MTX1, &rmtx); check_ercd(ercd, E_OK); check_assert(rmtx.htskid == TSK_NONE); check_assert(rmtx.wtskid == TSK_NONE); ercd = loc_mtx(MTX1); check_ercd(ercd, E_OK); check_point(2); ercd = loc_mtx(MTX1); check_ercd(ercd, E_OBJ); check_point(3); ercd = ref_mtx(MTX1, &rmtx); check_ercd(ercd, E_OK); check_assert(rmtx.htskid == TASK1); check_assert(rmtx.wtskid == TSK_NONE); ercd = act_tsk(TASK2); check_ercd(ercd, E_OK); check_point(5); ercd = ref_mtx(MTX1, &rmtx); check_ercd(ercd, E_OK); check_assert(rmtx.htskid == TASK1); check_assert(rmtx.wtskid == TASK2); ercd = act_tsk(TASK3); check_ercd(ercd, E_OK); check_point(8); ercd = ref_mtx(MTX1, &rmtx); check_ercd(ercd, E_OK); check_assert(rmtx.htskid == TASK1); check_assert(rmtx.wtskid == TASK2); ercd = dis_dsp(); check_ercd(ercd, E_OK); ercd = unl_mtx(MTX1); check_ercd(ercd, E_OK); check_point(9); ercd = ref_mtx(MTX1, &rmtx); check_ercd(ercd, E_OK); check_assert(rmtx.htskid == TASK2); check_assert(rmtx.wtskid == TASK3); ercd = ena_dsp(); check_ercd(ercd, E_OK); check_point(14); ercd = ref_mtx(MTX1, &rmtx); check_ercd(ercd, E_OK); check_assert(rmtx.htskid == TASK2); check_assert(rmtx.wtskid == TSK_NONE); ercd = tloc_mtx(MTX1, 3 * TEST_TIME_CP); check_ercd(ercd, E_TMOUT); check_point(15); ercd = wup_tsk(TASK2); check_ercd(ercd, E_OK); check_finish(18); check_point(0); }
void tex_task1(TEXPTN texptn, intptr_t exinf) { ER ercd; switch (texptn) { case 0x0001: check_point(4); check_state(false, false, TIPM_ENAALL, false, false, true); /* * dispatch disabled, ipm changed, task exception enabled */ check_point(5); ercd = dis_dsp(); check_ercd(ercd, E_OK); ercd = chg_ipm(TMAX_INTPRI); check_ercd(ercd, E_OK); ercd = ena_tex(); check_ercd(ercd, E_OK); ercd = loc_cpu(); check_ercd(ercd, E_OK); check_state(false, true, TMAX_INTPRI, true, true, false); break; case 0x0002: check_point(10); check_state(false, false, TIPM_ENAALL, true, true, true); /* * raise task exception request */ check_point(11); ercd = ras_tex(TSK_SELF, 0x0001); check_ercd(ercd, E_OK); ercd = ras_tex(TSK_SELF, 0x0002); check_ercd(ercd, E_OK); /* * dispatch enabled, ipm changed, cpu locked */ check_point(12); ercd = ena_dsp(); check_ercd(ercd, E_OK); ercd = chg_ipm(TMAX_INTPRI); check_ercd(ercd, E_OK); ercd = loc_cpu(); check_ercd(ercd, E_OK); check_state(false, true, TMAX_INTPRI, false, true, true); break; case 0x0003: check_point(13); check_state(false, false, TIPM_ENAALL, true, true, true); /* * dispatch enabled, ipm changed, task exception enabled */ check_point(14); ercd = ena_dsp(); check_ercd(ercd, E_OK); ercd = chg_ipm(TMAX_INTPRI); check_ercd(ercd, E_OK); ercd = ena_tex(); check_ercd(ercd, E_OK); check_state(false, false, TMAX_INTPRI, false, true, false); ercd = chg_ipm(TIPM_ENAALL); check_ercd(ercd, E_OK); ercd = chg_ipm(TMAX_INTPRI); check_ercd(ercd, E_OK); /* * raise task exception request */ check_point(15); ercd = ras_tex(TSK_SELF, 0x0004); ercd = dis_tex(); check_ercd(ercd, E_OK); ercd = chg_ipm(TIPM_ENAALL); check_ercd(ercd, E_OK); ercd = chg_ipm(TMAX_INTPRI); check_ercd(ercd, E_OK); ercd = ena_tex(); check_ercd(ercd, E_OK); check_point(16); ercd = chg_ipm(TIPM_ENAALL); /* task exception routine runs here */ check_ercd(ercd, E_OK); /* * check the state when task exception routine returns */ check_point(19); check_state(false, false, TIPM_ENAALL, false, false, false); break; case 0x0004: check_point(17); check_state(false, false, TIPM_ENAALL, false, false, true); /* * dispatch disabled, ipm changed, cpu locked */ check_point(18); ercd = dis_dsp(); check_ercd(ercd, E_OK); ercd = chg_ipm(TMAX_INTPRI); check_ercd(ercd, E_OK); ercd = loc_cpu(); check_ercd(ercd, E_OK); check_state(false, true, TMAX_INTPRI, true, true, true); break; default: check_point(0); break; } }
static int __ui_dis_dsp(struct pt_regs *regs) { return dis_dsp(); }
void task1(intptr_t exinf) { ER_UINT ercd; T_RTEX rtex; test_start(__FILE__); check_point(1); check_state(false, false, TIPM_ENAALL, false, false, true); ercd = ref_tex(TSK_SELF, &rtex); check_ercd(ercd, E_OK); check_assert((rtex.texstat & TTEX_DIS) != 0U); check_assert(rtex.pndptn == 0U); ercd = ras_tex(TASK3, 0x0001); check_ercd(ercd, E_OBJ); ercd = ras_tex(TASK4, 0x0001); check_ercd(ercd, E_OBJ); ercd = ref_tex(TASK3, &rtex); check_ercd(ercd, E_OBJ); ercd = ref_tex(TASK4, &rtex); check_ercd(ercd, E_OBJ); check_point(2); ercd = ena_tex(); check_ercd(ercd, E_OK); check_state(false, false, TIPM_ENAALL, false, false, false); ercd = ref_tex(TSK_SELF, &rtex); check_ercd(ercd, E_OK); check_assert((rtex.texstat & TTEX_ENA) != 0U); check_assert(rtex.pndptn == 0U); check_point(3); ercd = ras_tex(TSK_SELF, 0x0001); check_ercd(ercd, E_OK); check_point(6); check_state(false, false, TIPM_ENAALL, false, false, false); check_point(7); ercd = dis_dsp(); check_ercd(ercd, E_OK); ercd = dis_tex(); check_ercd(ercd, E_OK); check_state(false, false, TIPM_ENAALL, true, true, true); check_point(8); ercd = ras_tex(TASK1, 0x0002); check_ercd(ercd, E_OK); ercd = ref_tex(TSK_SELF, &rtex); check_ercd(ercd, E_OK); check_assert((rtex.texstat & TTEX_DIS) != 0); check_assert(rtex.pndptn == 0x0002); check_point(9); ercd = ena_tex(); check_ercd(ercd, E_OK); check_point(20); check_state(false, false, TIPM_ENAALL, true, true, false); check_point(21); ercd = ena_dsp(); check_ercd(ercd, E_OK); ercd = rot_rdq(TPRI_SELF); check_ercd(ercd, E_OK); check_point(27); ercd = ras_tex(TASK2, 0x0001); check_ercd(ercd, E_OK); ercd = ref_tex(TASK2, &rtex); check_ercd(ercd, E_OK); check_point(28); ercd = rot_rdq(TPRI_SELF); check_ercd(ercd, E_OK); check_point(34); return; check_point(0); }
void task1(intptr_t exinf) { ER ercd; T_RTEX rtex; /* * check init state */ check_point(1); check_state(false, false, TIPM_ENAALL, false, false, true); ercd = ref_tex(TSK_SELF, &rtex); check_ercd(ercd, E_OK); check_assert((rtex.texstat & TTEX_DIS) != 0); check_assert(rtex.pndptn == 0); /* * error check of ras_tex */ ercd = ras_tex(TASK3, 0x0001); check_ercd(ercd, E_OBJ); ercd = ras_tex(TASK4, 0x0001); check_ercd(ercd, E_OBJ); /* * error check of ref_tex */ ercd = ref_tex(TASK3, &rtex); check_ercd(ercd, E_OBJ); ercd = ref_tex(TASK4, &rtex); check_ercd(ercd, E_OBJ); /* * enable task exception */ check_point(2); ercd = ena_tex(); check_ercd(ercd, E_OK); check_state(false, false, TIPM_ENAALL, false, false, false); ercd = ref_tex(TSK_SELF, &rtex); check_ercd(ercd, E_OK); check_assert((rtex.texstat & TTEX_ENA) != 0); check_assert(rtex.pndptn == 0); /* * raise task exception request */ check_point(3); ercd = ras_tex(TSK_SELF, 0x0001); /* task exception routine runs here */ check_ercd(ercd, E_OK); /* * check the state when task exception routine returns */ check_point(6); check_state(false, false, TIPM_ENAALL, false, false, false); /* * dispatch disabled, task exception disabled */ check_point(7); ercd = dis_dsp(); check_ercd(ercd, E_OK); ercd = dis_tex(); check_ercd(ercd, E_OK); check_state(false, false, TIPM_ENAALL, true, true, true); /* * raise task exception request */ check_point(8); ercd = ras_tex(TASK1, 0x0002); check_ercd(ercd, E_OK); ercd = ref_tex(TSK_SELF, &rtex); check_ercd(ercd, E_OK); check_assert((rtex.texstat & TTEX_DIS) != 0); check_assert(rtex.pndptn == 0x0002); /* * enable task exception */ check_point(9); ercd = ena_tex(); /* task exception routine runs here */ check_ercd(ercd, E_OK); /* * check the state when task exception routine returns */ check_point(20); check_state(false, false, TIPM_ENAALL, true, true, false); /* * switch task2 */ check_point(21); ercd = ena_dsp(); check_ercd(ercd, E_OK); ercd = rot_rdq(TPRI_SELF); /* other tasks run here */ check_ercd(ercd, E_OK); /* * raise the task exception of task2 */ check_point(27); ercd = ras_tex(TASK2, 0x0001); check_ercd(ercd, E_OK); ercd = ref_tex(TASK2, &rtex); check_ercd(ercd, E_OK); check_assert((rtex.texstat & TTEX_ENA) != 0); check_assert(rtex.pndptn == 0x0001); /* * switch to task2 */ check_point(28); ercd = rot_rdq(TPRI_SELF); /* other tasks run here */ check_ercd(ercd, E_OK); /* * task exits */ check_point(34); }
void tex_task1(TEXPTN texptn, intptr_t exinf) { ER_UINT ercd; switch (++tex_task1_count) { case 1: check_point(4); check_assert(texptn == 0x0001); check_state(false, false, TIPM_ENAALL, false, false, true); check_point(5); ercd = dis_dsp(); check_ercd(ercd, E_OK); ercd = chg_ipm(TMAX_INTPRI); check_ercd(ercd, E_OK); ercd = ena_tex(); check_ercd(ercd, E_OK); ercd = loc_cpu(); check_ercd(ercd, E_OK); check_state(false, true, TMAX_INTPRI, true, true, false); return; check_point(0); case 2: check_point(10); check_assert(texptn == 0x0002); check_state(false, false, TIPM_ENAALL, true, true, true); check_point(11); ercd = ras_tex(TASK1, 0x0001); check_ercd(ercd, E_OK); ercd = ras_tex(TASK1, 0x0002); check_ercd(ercd, E_OK); check_point(12); ercd = ena_dsp(); check_ercd(ercd, E_OK); ercd = chg_ipm(TMAX_INTPRI); check_ercd(ercd, E_OK); ercd = loc_cpu(); check_ercd(ercd, E_OK); check_state(false, true, TMAX_INTPRI, false, true, true); return; check_point(0); case 3: check_point(13); check_assert(texptn == 0x0003); check_state(false, false, TIPM_ENAALL, true, true, true); check_point(14); ercd = ena_dsp(); check_ercd(ercd, E_OK); ercd = chg_ipm(TMAX_INTPRI); check_ercd(ercd, E_OK); ercd = ena_tex(); check_ercd(ercd, E_OK); check_state(false, false, TMAX_INTPRI, false, true, false); ercd = chg_ipm(TIPM_ENAALL); check_ercd(ercd, E_OK); ercd = chg_ipm(TMAX_INTPRI); check_ercd(ercd, E_OK); check_point(15); ercd = ras_tex(TSK_SELF, 0x0004); check_ercd(ercd, E_OK); ercd = chg_ipm(TMAX_INTPRI); check_ercd(ercd, E_OK); ercd = dis_tex(); check_ercd(ercd, E_OK); ercd = chg_ipm(TIPM_ENAALL); check_ercd(ercd, E_OK); ercd = chg_ipm(TMAX_INTPRI); check_ercd(ercd, E_OK); ercd = ena_tex(); check_ercd(ercd, E_OK); check_point(16); ercd = chg_ipm(TIPM_ENAALL); check_ercd(ercd, E_OK); check_point(19); check_state(false, false, TIPM_ENAALL, false, false, false); return; check_point(0); case 4: check_point(17); check_assert(texptn == 0x0004); check_state(false, false, TIPM_ENAALL, false, false, true); check_point(18); ercd = dis_dsp(); check_ercd(ercd, E_OK); ercd = chg_ipm(TMAX_INTPRI); check_ercd(ercd, E_OK); ercd = loc_cpu(); check_ercd(ercd, E_OK); check_state(false, true, TMAX_INTPRI, true, true, true); return; check_point(0); default: check_point(0); } check_point(0); }
void task1(intptr_t exinf) { ER ercd; T_RTSK rtsk; T_RMTX rmtx; set_bit_func(bit_mutex); check_point(1); ercd = ref_mtx(MTX1, &rmtx); check_ercd(ercd, E_OK); check_assert(rmtx.htskid == TSK_NONE); check_assert(rmtx.wtskid == TSK_NONE); ercd = loc_mtx(MTX1); check_ercd(ercd, E_OK); check_point(2); ercd = ref_tsk(TASK1, &rtsk); check_ercd(ercd, E_OK); check_assert(rtsk.tskpri == HIGH_PRIORITY); check_assert(rtsk.tskbpri == LOW_PRIORITY); ercd = loc_mtx(MTX1); check_ercd(ercd, E_ILUSE); check_point(3); ercd = ref_mtx(MTX1, &rmtx); check_ercd(ercd, E_OK); check_assert(rmtx.htskid == TASK1); check_assert(rmtx.wtskid == TSK_NONE); ercd = act_tsk(TASK2); check_ercd(ercd, E_OK); check_point(4); ercd = tslp_tsk(10); check_ercd(ercd, E_TMOUT); check_point(6); ercd = ref_mtx(MTX1, &rmtx); check_ercd(ercd, E_OK); check_assert(rmtx.htskid == TASK1); check_assert(rmtx.wtskid == TASK2); ercd = act_tsk(TASK3); check_ercd(ercd, E_OK); check_point(7); ercd = tslp_tsk(10); check_ercd(ercd, E_TMOUT); check_point(10); ercd = ref_mtx(MTX1, &rmtx); check_ercd(ercd, E_OK); check_assert(rmtx.htskid == TASK1); check_assert(rmtx.wtskid == TASK3); ercd = dis_dsp(); check_ercd(ercd, E_OK); ercd = unl_mtx(MTX1); check_ercd(ercd, E_OK); check_point(11); ercd = ref_tsk(TASK1, &rtsk); check_ercd(ercd, E_OK); check_assert(rtsk.tskpri == LOW_PRIORITY); check_assert(rtsk.tskbpri == LOW_PRIORITY); ercd = ref_mtx(MTX1, &rmtx); check_ercd(ercd, E_OK); check_assert(rmtx.htskid == TASK3); check_assert(rmtx.wtskid == TASK2); ercd = ena_dsp(); check_ercd(ercd, E_OK); check_point(16); ercd = ref_mtx(MTX1, &rmtx); check_ercd(ercd, E_OK); check_assert(rmtx.htskid == TASK2); check_assert(rmtx.wtskid == TSK_NONE); ercd = tloc_mtx(MTX1, 10); check_ercd(ercd, E_TMOUT); check_point(17); ercd = wup_tsk(TASK2); check_ercd(ercd, E_OK); check_finish(20); check_point(0); }
void task1(intptr_t exinf) { ER_UINT ercd; PRI tskpri; test_start(__FILE__); set_bit_func(bit_mutex); check_point(1); ercd = dis_dsp(); check_ercd(ercd, E_OK); check_point(2); ercd = act_tsk(TASK2); check_ercd(ercd, E_OK); ercd = act_tsk(TASK4); check_ercd(ercd, E_OK); check_point(3); ercd = ploc_mtx(MTX2); check_ercd(ercd, E_OK); ercd = get_pri(TSK_SELF, &tskpri); check_ercd(ercd, E_OK); check_assert(tskpri == HIGH_PRIORITY); check_point(4); ercd = ena_dsp(); check_ercd(ercd, E_OK); check_point(5); ercd = unl_mtx(MTX2); check_ercd(ercd, E_OK); check_point(8); ercd = get_pri(TSK_SELF, &tskpri); check_ercd(ercd, E_OK); check_assert(tskpri == MID_PRIORITY); check_point(9); ercd = dis_dsp(); check_ercd(ercd, E_OK); check_point(10); ercd = rot_rdq(MID_PRIORITY); check_ercd(ercd, E_OK); check_point(11); ercd = act_tsk(TASK3); check_ercd(ercd, E_OK); check_point(12); ercd = ploc_mtx(MTX1); check_ercd(ercd, E_OK); ercd = get_pri(TSK_SELF, &tskpri); check_ercd(ercd, E_OK); check_assert(tskpri == MID_PRIORITY); check_point(13); ercd = ena_dsp(); check_ercd(ercd, E_OK); check_point(15); ercd = slp_tsk(); check_ercd(ercd, E_OK); check_point(18); ercd = wup_tsk(TASK2); check_ercd(ercd, E_OK); check_point(19); ercd = dis_dsp(); check_ercd(ercd, E_OK); check_point(20); ercd = rot_rdq(MID_PRIORITY); check_ercd(ercd, E_OK); check_point(21); ercd = wup_tsk(TASK3); check_ercd(ercd, E_OK); check_point(22); ercd = unl_mtx(MTX1); check_ercd(ercd, E_OK); ercd = get_pri(TSK_SELF, &tskpri); check_ercd(ercd, E_OK); check_assert(tskpri == MID_PRIORITY); check_point(23); ercd = ena_dsp(); check_ercd(ercd, E_OK); check_point(25); ercd = slp_tsk(); check_ercd(ercd, E_OK); check_point(28); ercd = dis_dsp(); check_ercd(ercd, E_OK); check_point(29); ercd = wup_tsk(TASK4); check_ercd(ercd, E_OK); check_point(30); ercd = ploc_mtx(MTX2); check_ercd(ercd, E_OK); check_point(31); ercd = rot_rdq(HIGH_PRIORITY); check_ercd(ercd, E_OK); check_point(32); ercd = act_tsk(TASK5); check_ercd(ercd, E_OK); check_point(33); ercd = ploc_mtx(MTX1); check_ercd(ercd, E_OK); ercd = get_pri(TSK_SELF, &tskpri); check_ercd(ercd, E_OK); check_assert(tskpri == HIGH_PRIORITY); check_point(34); ercd = ena_dsp(); check_ercd(ercd, E_OK); check_point(36); ercd = slp_tsk(); check_ercd(ercd, E_OK); check_point(39); ercd = dis_dsp(); check_ercd(ercd, E_OK); check_point(40); ercd = wup_tsk(TASK4); check_ercd(ercd, E_OK); check_point(41); ercd = rot_rdq(HIGH_PRIORITY); check_ercd(ercd, E_OK); check_point(42); ercd = wup_tsk(TASK5); check_ercd(ercd, E_OK); check_point(43); ercd = unl_mtx(MTX1); check_ercd(ercd, E_OK); ercd = get_pri(TSK_SELF, &tskpri); check_ercd(ercd, E_OK); check_assert(tskpri == HIGH_PRIORITY); check_point(44); ercd = ena_dsp(); check_ercd(ercd, E_OK); check_point(46); ercd = slp_tsk(); check_ercd(ercd, E_OK); check_point(49); ercd = wup_tsk(TASK2); check_ercd(ercd, E_OK); ercd = wup_tsk(TASK3); check_ercd(ercd, E_OK); ercd = slp_tsk(); check_ercd(ercd, E_OK); check_point(52); ercd = unl_mtx(MTX2); check_ercd(ercd, E_OK); ercd = get_pri(TASK2, &tskpri); check_ercd(ercd, E_OK); check_assert(tskpri == HIGH_PRIORITY); check_point(53); ercd = loc_mtx(MTX3); check_ercd(ercd, E_OK); ercd = chg_pri(TASK1, TPRI_INI); check_ercd(ercd, E_OK); check_point(54); ercd = loc_mtx(MTX1); check_ercd(ercd, E_OK); check_point(55); ercd = slp_tsk(); check_ercd(ercd, E_OK); check_point(58); ercd = unl_mtx(MTX1); check_ercd(ercd, E_OK); ercd = get_pri(TASK2, &tskpri); check_ercd(ercd, E_OK); check_assert(tskpri == HIGH_PRIORITY); check_point(59); ercd = unl_mtx(MTX3); check_ercd(ercd, E_OK); check_point(64); ercd = loc_mtx(MTX1); check_ercd(ercd, E_OK); check_finish(69); check_point(0); }
void task4(intptr_t exinf) { ER_UINT ercd; ID somid; check_point(17); ercd = get_som(&somid); check_ercd(ercd, E_OK); check_assert(somid == TSOM_STP); ercd = stp_cyc(CYC1); check_ercd(ercd, E_OK); ercd = dly_tsk(TEST_TIME_PROC); check_ercd(ercd, E_OK); check_point(18); ercd = chg_som(SOM1); check_ercd(ercd, E_OK); check_point(22); ercd = get_som(&somid); check_ercd(ercd, E_OK); check_assert(somid == TSOM_STP); ercd = stp_cyc(CYC1); check_ercd(ercd, E_OK); ercd = chg_pri(TSK_SELF, HIGH_PRIORITY); check_ercd(ercd, E_OK); check_point(23); ercd = chg_som(SOM1); check_ercd(ercd, E_OK); check_point(24); ercd = sta_cyc(CYC1); check_ercd(ercd, E_OK); ercd = get_som(&somid); check_ercd(ercd, E_OK); check_assert(somid == SOM1); ercd = chg_pri(TSK_SELF, LOW_PRIORITY); check_ercd(ercd, E_OK); check_point(28); ercd = get_som(&somid); check_ercd(ercd, E_OK); check_assert(somid == TSOM_STP); ercd = stp_cyc(CYC1); check_ercd(ercd, E_OK); ercd = dis_dsp(); check_ercd(ercd, E_OK); check_point(29); ercd = chg_som(SOM1); check_ercd(ercd, E_OK); ercd = sta_cyc(CYC1); check_ercd(ercd, E_OK); ercd = get_som(&somid); check_ercd(ercd, E_OK); check_assert(check_somid(somid)); ercd = ena_dsp(); check_ercd(ercd, E_OK); check_point(0); }