Ejemplo n.º 1
0
static int __ui_ref_flg(struct pt_regs *regs)
{
	ID flgid = __xn_reg_arg2(regs);
	T_RFLG pk_rflg;
	ER err;

	err = ref_flg(&pk_rflg, flgid);

	if (err == E_OK &&
	    __xn_safe_copy_to_user((void __user *)__xn_reg_arg1(regs), &pk_rflg,
				   sizeof(pk_rflg)))
		return -EFAULT;

	return err;
}
Ejemplo n.º 2
0
void
task2(intptr_t exinf)
{
	ER_UINT	ercd;
	FLGPTN	flgptn;
	T_RFLG	rflg;

	check_point(4);
	ercd = wai_flg(FLG1, 0x05, TWF_ORW, &flgptn);
	check_ercd(ercd, E_OK);

	check_assert(flgptn == 0x03);

	check_point(5);
	ercd = wai_flg(FLG1, 0x04, TWF_ORW, &flgptn);
	check_ercd(ercd, E_OK);

	check_point(7);
	check_assert(flgptn == 0x07);

	ercd = wai_flg(FLG1, 0x03, TWF_ANDW, &flgptn);
	check_ercd(ercd, E_OK);

	check_assert(flgptn == 0x07);

	check_point(8);
	ercd = wai_flg(FLG1, 0x0c, TWF_ANDW, &flgptn);
	check_ercd(ercd, E_OK);

	check_point(11);
	check_assert(flgptn == 0x0f);

	ercd = wai_flg(FLG2, 0x05, TWF_ORW, &flgptn);
	check_ercd(ercd, E_OK);

	check_assert(flgptn == 0x01);

	ercd = ref_flg(FLG2, &rflg);
	check_ercd(ercd, E_OK);

	check_assert(rflg.wtskid == TSK_NONE);

	check_assert(rflg.flgptn == 0x00);

	ercd = set_flg(FLG2, 0x01);
	check_ercd(ercd, E_OK);

	check_point(12);
	ercd = wai_flg(FLG2, 0x04, TWF_ORW, &flgptn);
	check_ercd(ercd, E_OK);

	check_point(15);
	check_assert(flgptn == 0x05);

	ercd = ref_flg(FLG2, &rflg);
	check_ercd(ercd, E_OK);

	check_assert(rflg.wtskid == TSK_NONE);

	check_assert(rflg.flgptn == 0x00);

	ercd = set_flg(FLG2, 0x03);
	check_ercd(ercd, E_OK);

	ercd = wai_flg(FLG2, 0x03, TWF_ANDW, &flgptn);
	check_ercd(ercd, E_OK);

	check_assert(flgptn == 0x03);

	ercd = ref_flg(FLG2, &rflg);
	check_ercd(ercd, E_OK);

	check_assert(rflg.wtskid == TSK_NONE);

	check_assert(rflg.flgptn == 0x00);

	ercd = set_flg(FLG2, 0x03);
	check_ercd(ercd, E_OK);

	check_point(16);
	ercd = wai_flg(FLG2, 0x05, TWF_ANDW, &flgptn);
	check_ercd(ercd, E_OK);

	check_point(19);
	check_assert(flgptn == 0x07);

	check_point(20);
	ercd = wai_flg(FLG2, 0x01, TWF_ORW, &flgptn);
	check_ercd(ercd, E_OK);

	check_point(23);
	check_assert(flgptn == 0x03);

	ercd = act_tsk(TASK3);
	check_ercd(ercd, E_OK);

	check_point(24);
	ercd = slp_tsk();
	check_ercd(ercd, E_OK);

	check_point(27);
	ercd = wai_flg(FLG3, 0x02, TWF_ORW, &flgptn);
	check_ercd(ercd, E_OK);

	check_point(29);
	ercd = wai_flg(FLG3, 0x02, TWF_ORW, &flgptn);
	check_ercd(ercd, E_OK);

	check_point(33);
	ercd = wai_flg(FLG4, 0x02, TWF_ORW, &flgptn);
	check_ercd(ercd, E_OK);

	check_point(35);
	ercd = wai_flg(FLG4, 0x02, TWF_ORW, &flgptn);
	check_ercd(ercd, E_OK);

	check_point(0);
}
Ejemplo n.º 3
0
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);
}
Ejemplo n.º 4
0
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();
}