Exemple #1
0
ER GPSRec_Open(UART_BAUDRATE BaudRate)
{

    if (bGPSRecOpened)
        return E_SYS;

    #if (RECEIVE_FROM_UART2)
    if (uart2_open() == E_OK)
    #else
    if (uart_open() == E_OK)
    #endif
    {
        debug_msg("\r\nUART2: Open success\r\n");
        #if (RECEIVE_FROM_UART2)
        uart2_init(BaudRate, UART_LEN_L8_S1, UART_PARITY_NONE);
        #else
        uart_init(BaudRate, UART_LEN_L8_S1, UART_PARITY_NONE);
        #endif

    }
    else
    {
        debug_err(("UART2: open fail!\r\n"));
        return E_SYS;
    }

    debug_msg("Start GPS receive task\r\n");
    sta_tsk(GPSRECEIVE_ID,0);

    loc_cpu();
    bGPSRecOpened = TRUE;
    unl_cpu();

    return E_OK;
}
Exemple #2
0
void _ITRON_Task_Initialize_user_tasks_body( void )
{
  uint32_t                          index;
  uint32_t                          maximum;
  ER                                return_value;
  itron_initialization_tasks_table *user_tasks;

  user_tasks = Configuration_ITRON_API.User_initialization_tasks_table;
  maximum    = Configuration_ITRON_API.number_of_initialization_tasks;

  if ( !user_tasks || maximum == 0 )
    return;

  for ( index=0 ; index < maximum ; index++ ) {

    return_value = cre_tsk(
       user_tasks[ index ].id,
       &user_tasks[ index ].attributes
    );

    if ( return_value != E_OK )
      _Internal_error_Occurred( INTERNAL_ERROR_ITRON_API, true, return_value );

    return_value = sta_tsk( user_tasks[ index ].id, 0 );

    if ( return_value != E_OK )
      _Internal_error_Occurred( INTERNAL_ERROR_ITRON_API, true, return_value );

  }
}
Exemple #3
0
/**
  Open Lens Control task

  Open Lens Control task.
  The parameter is not using now, just for compliance

  Return value is listed below:
  E_SYS: Task is already opened
  E_OK: No error

  @param LENSCTRL_APPOBJ pLensCtrlObj: Lens Control application object
  @return ER
*/
ER LensCtrl_Open(PLENSCTRL_APPOBJ pLensCtrlObj)
{
    if (bLensCtrlOpened == TRUE)
    {
        return E_SYS;
    }

    memcpy(&gLensCtrlObj, pLensCtrlObj, sizeof(LENSCTRL_APPOBJ));

    clr_flg(FLG_ID_LENS, FLGLENS_ZOOMFWD |
                         FLGLENS_ZOOMREV |
                         FLGLENS_ZOOMBRK |
                         FLGLENS_ZOOMOFF |
                         FLGLENS_ZOOMCHANGE |
                         FLGLENS_FOCUSFWD   |
                         FLGLENS_FOCUSREV   |
                         FLGLENS_APERTUREMOVE |
                         FLGLENS_SHUTTERMOVE  |
                         FLGLENS_POWEROFF     |
                         FLGLENS_IDLE);

    bLensCtrlOpened = TRUE;

    sta_tsk(LENSCTRLTSK_ID);

    return E_OK;
}
Exemple #4
0
static int __ui_sta_tsk(struct pt_regs *regs)
{
	ID tskid = __xn_reg_arg1(regs);
	INT stacd = __xn_reg_arg2(regs);

	return sta_tsk(tskid, stacd);
}
Exemple #5
0
void
run (W entry)
{
  W	i;
  struct boot_header	*info;
  struct module_info	*modulep;
  ID			rid;
  T_CTSK		pktsk;
  T_TCB			*new_taskp;

  info = (struct boot_header *)MODULE_TABLE;
  if ((entry < 1) || (entry >= info->count))
    {
      printf ("module is overflow.\n");
      return;
    }
  modulep = info->modules;
  pktsk.tskatr = TA_HLNG;
  pktsk.itskpri = 2;
  pktsk.stksz = PAGE_SIZE * 2;
  pktsk.addrmap = NULL;
  pktsk.startaddr = (FP)modulep[entry].entry;
  if (new_task (&pktsk, &rid, FALSE) != E_OK)
    {
      printf ("Can not make new task.\n");
      return;
    }
  printf ("Task id = %d, eip = 0x%x\n", rid, modulep[entry].entry);
  new_taskp = get_tskp (rid);
  if (new_taskp == NULL)
    {
      printf ("new task is NULL.\n");
      return;
    }

  /* 生成したタスクの仮想メモリにモジュールをマッピング */
  /* ただしドライバの場合には、マッピングしない */
  if (modulep[entry].type == driver)
    {
      printf ("This module is driver. not mapped\n");
    }
  else
    {
      for (i = 0; i < ROUNDUP (modulep[entry].length, PAGE_SIZE) / PAGE_SIZE; i++)
	{
	  if (vmap (new_taskp,
		    modulep[entry].vaddr + i * PAGE_SIZE, 
		    modulep[entry].paddr + i * PAGE_SIZE) == FALSE)
	    {
	      printf ("Cannot memory map: virtual addr: 0x%x, phisical addr = 0x%x\n",
		      modulep[entry].vaddr + i * PAGE_SIZE, 
		      modulep[entry].paddr + i * PAGE_SIZE);
	    }
	}
    }
  sta_tsk (rid, 0);
  task_switch (TRUE);
}
Exemple #6
0
void main()
{
	sysini();		/* システム初期化 */
	BSC.ABWCR.BIT.ABW2 = 0; /* CS2 16bit ACCESS */
	BSC.PFCR.BIT.AE0 = 0;
	BSC.PFCR.BIT.AE1 = 0;
	BSC.PFCR.BIT.AE2 = 0;
	BSC.PFCR.BIT.AE3 = 0;
	PG.DDR = 0x1C;	/* CS0,1,2 Active */
//	cre_tsk(ID_TASK1, &_ID_TASK1);	/* Task1作成 */
	cre_tsk(ID_TASK2, &_ID_TASK2);	/* Task2作成 */
	cre_tsk(ID_TASK3, &_ID_TASK3);	/* Task3作成 */
	cre_tsk(ID_TASK4, &_ID_TASK4);	/* Task4作成 */
	sta_tsk(ID_TASK3, 0);		/* Task3起動 */
//	sta_tsk(ID_TASK2, 0);		/* Task2起動 */
//	sta_tsk(ID_TASK1, 0);		/* Task1起動 */
	sta_tsk(ID_TASK4, 0);		/* Task4起動 */

	ser_init();		/* SCI0初期化 */
	intsta();		/* クロック起動 */
	syssta();		/* システム起動 */
}
Exemple #7
0
/* SCI0受信割込み処理 */
INTHDR rcvser0(void)
{
	ent_int();
	rtemp[rp] = SCI0.SSR.BYTE;	/* 割込みステータス読み込み */
	rtemp[rp] = SCI0.RDR;		/* データ読み込み */
	SCI0.SSR.BIT.RDRF = 0;		/* 割込み解除 */
	if(rtemp[rp] == ';') {
		rtemp[rp] = '\0';
		rp = 0;
		sta_tsk(ID_TASK2, 0);	/* コマンド受信完了時タスク起動 */
		wd = 1;
	} else if(rtemp[rp] != 0x0d && rtemp[rp] != 0x0a){
		rp++;
	} else {
		rp = 0;
	}
	ret_int();
}
Exemple #8
0
/****************************************************************************
 * init_keyboard --- 
 *
 */
ER
init_keyboard ()
{
  INT		i;
  T_CTSK	par_task;
  T_CMBF	par_msg;

  for (i = 0; i < MAX_KEYENTRY - 1; i++)
    {
      keyentry[i].next = &keyentry[i + 1];
    }
  keyentry[MAX_KEYENTRY - 1].next = NULL;
  freeentry = keyentry;

  /* KBD の初期化 --- 8251A の初期化 */
  set_idt (INT_KEYBOARD, 0x08, (int)int33_handler, INTERRUPT_DESC, 0);
  reset_intr_mask (1);

  outb (KEY_COM, 0);
  outb (KEY_COM, 0);
  outb (KEY_COM, 0);
  outb (KEY_COM, 0x40);
  outb (KEY_COM, 0x5e);
  outb (KEY_COM, 0x3a);
/*  busywait (20); */
  outb (KEY_COM, 0x32);
/*  busywait (20); */
  outb (KEY_COM, 0x16);
/*  string_shift_to_tron (device_table[id].name); */
  shiftkey_code = NORMAL;

  par_msg.mbfatr = TA_TFIFO;
  par_msg.bufsz = (INT)(sizeof (struct key_entry) * 100);
  par_msg.maxmsz = (INT)sizeof (struct key_entry);
  cre_mbf (ITRON_KEYBOARD_MBF, &par_msg);
  par_task.exinf = 0;
  par_task.startaddr = keyboard_task;
  par_task.itskpri = 1;
  par_task.stksz = PAGE_SIZE;
  par_task.addrmap = NULL;
  cre_tsk (ITRON_KEYBOARD, &par_task);
  sta_tsk (ITRON_KEYBOARD, NULL);
  return (E_OK);
}
Exemple #9
0
ER GPSRec_Open(UART_BAUDRATE BaudRate)
{

    if (bGPSRecOpened)
        return E_SYS;

    #if (RECEIVE_FROM_UART2)
    if (uart2_open() == E_OK)
    #else
    if (uart_open() == E_OK)
    #endif
    {
        debug_msg("\r\nUART2: Open success\r\n");
        #if (RECEIVE_FROM_UART2)
        uart2_init(BaudRate, UART_LEN_L8_S1, UART_PARITY_NONE);
        #else
        uart_init(BaudRate, UART_LEN_L8_S1, UART_PARITY_NONE);
        #endif

    }
    else
    {
        debug_err(("UART2: open fail!\r\n"));
        return E_SYS;
    }

    debug_msg("Start GPS receive task\r\n");

    //#NT#2011/1/14#philex Lin-begin
    // init/toggle GPS Data buffer index,
    // GPS log buffer is double buffering mechanism.
    GPSRec_DataBufInit();
    //#NT#2011/1/14#philex Lin-end
    sta_tsk(GPSRECEIVE_ID);

    loc_cpu();
    bGPSRecOpened = TRUE;
    unl_cpu();

    return E_OK;

}
Exemple #10
0
/*******************************************************************
 * itron --- メイン関数
 *
 */
ER
itron (void)
{
  T_CTSK	par_debug_task;

  if (init_itron () != E_OK)
    {
      falldown ("main: cannot initialize.\n");
    }

  init_device ();

  par_debug_task.exinf = 0;
  par_debug_task.startaddr = debugger;
  par_debug_task.itskpri = 10;
  par_debug_task.stksz = PAGE_SIZE * 2;
  par_debug_task.addrmap = NULL;
  if (cre_tsk (ITRON_DEBUG, &par_debug_task) != E_OK)
    {
      printf ("cannot create task for debugger.\n");
    }
  if (sta_tsk (ITRON_DEBUG, NULL) != E_OK)
    {
      printf ("cannot start task for debugger.\n");
    }

#ifdef AUTO_START
  run_init_program ();
#endif

  for (;;)		/* Idle タスクとなる。 */
    {
      task_switch (TRUE);
#ifdef notdef
      ena_int ();	/* Idle タスクを実行している時は、割り込みはイネーブル
			 * していなければいけない */
#endif /* notdef */
    }
  falldown ("falldown.");

/* not return */
}
BOOL MsdcVendorNvt_Bk_RunCmd(void (*pCall)(void))
{    
    INT32 nRetry = 10;
    tMSDCVENDOR_BACKGROUND_CTRL* pBk = &MsdcVendorNvt_GetCtrl()->tBkCtrl;

    if(pBk->bCmdRunning)
    {
        debug_err(("MsdcVendorNvt_Bk_RunCmd(): Is Running\r\n"));
        return FALSE;
    }
    
    pBk->bCmdRunning = TRUE;
    pBk->pCall = pCall;
    while(sta_tsk(pBk->TaskID)!=E_OK && nRetry-- && pBk->bCmdRunning)
    {
        TimerDelayMs(10);
    }

    if(nRetry<0)
        return FALSE;

    return TRUE;
}
Exemple #12
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();
}
Exemple #13
0
void task1( unsigned int arg )
{
    ER ercd;
    int i;
    T_RSYS rsys;

    CYG_TEST_INFO( "Task 1 running" );

    // check initial state
    ercd = ref_sys( &rsys );
    CYG_TEST_CHECK( E_OK == ercd, "ref_sys bad ercd" );
    CYG_TEST_CHECK( TSS_TSK == rsys.sysstat, "system state not TSS_TSK" );
    // disable intrs and check state
    ercd = loc_cpu();
    CYG_TEST_CHECK( E_OK == ercd, "loc_cpu bad ercd" );
    ercd = ref_sys( &rsys );
    CYG_TEST_CHECK( E_OK == ercd, "ref_sys bad ercd" );
    CYG_TEST_CHECK( TSS_LOC == rsys.sysstat, "system state not TSS_LOC" );
#ifdef CYGSEM_UITRON_BAD_PARAMS_RETURN_ERRORS
    // try an illegal op
    ercd = dly_tsk( 10 );
    CYG_TEST_CHECK( E_CTX == ercd, "dly_tsk bad ercd !E_CTX" );
#endif // CYGSEM_UITRON_BAD_PARAMS_RETURN_ERRORS
    // enable intrs and check state and a legal sleep
    ercd = unl_cpu();
    CYG_TEST_CHECK( E_OK == ercd, "unl_cpu bad ercd" );
    ercd = ref_sys( &rsys );
    CYG_TEST_CHECK( E_OK == ercd, "ref_sys bad ercd" );
    CYG_TEST_CHECK( TSS_TSK == rsys.sysstat, "system state not TSS_TSK" );
    ercd = dly_tsk( 1 );
    CYG_TEST_CHECK( E_OK == ercd, "dly_tsk bad ercd" );
    // disable intrs and try scheduler illegal ops
    ercd = loc_cpu();
    CYG_TEST_CHECK( E_OK == ercd, "loc_cpu bad ercd" );
    ercd = ref_sys( &rsys );
    CYG_TEST_CHECK( E_OK == ercd, "ref_sys bad ercd" );
    CYG_TEST_CHECK( TSS_LOC == rsys.sysstat, "system state not TSS_LOC" );
#ifdef CYGSEM_UITRON_BAD_PARAMS_RETURN_ERRORS
    ercd = dis_dsp();
    CYG_TEST_CHECK( E_CTX == ercd, "dis_dsp bad ercd !E_CTX" );
    ercd = ena_dsp();
    CYG_TEST_CHECK( E_CTX == ercd, "ena_dsp bad ercd !E_CTX" );
#endif // CYGSEM_UITRON_BAD_PARAMS_RETURN_ERRORS
    // enable again and check state
    ercd = unl_cpu();
    CYG_TEST_CHECK( E_OK == ercd, "unl_cpu bad ercd" );
    ercd = ref_sys( &rsys );
    CYG_TEST_CHECK( E_OK == ercd, "ref_sys bad ercd" );
    CYG_TEST_CHECK( TSS_TSK == rsys.sysstat, "system state not TSS_TSK" );
    // disable the scheduler and check state
    ercd = dis_dsp();
    CYG_TEST_CHECK( E_OK == ercd, "dis_dsp bad ercd" );
    ercd = ref_sys( &rsys );
    CYG_TEST_CHECK( E_OK == ercd, "ref_sys bad ercd" );
    CYG_TEST_CHECK( TSS_DDSP == rsys.sysstat, "system state not TSS_DDSP" );
    // disable intrs and check state
    ercd = loc_cpu();
    CYG_TEST_CHECK( E_OK == ercd, "loc_cpu bad ercd" );
    ercd = ref_sys( &rsys );
    CYG_TEST_CHECK( E_OK == ercd, "ref_sys bad ercd" );
    CYG_TEST_CHECK( TSS_LOC == rsys.sysstat, "system state not TSS_LOC" );
    // then unlock and check state
    ercd = unl_cpu();
    CYG_TEST_CHECK( E_OK == ercd, "unl_cpu bad ercd" );
    ercd = ref_sys( &rsys );
    CYG_TEST_CHECK( E_OK == ercd, "ref_sys bad ercd" );
    CYG_TEST_CHECK( TSS_TSK == rsys.sysstat, "system state not TSS_TSK" );

    CYG_TEST_PASS( "Interrupt dis/enabling and interactions" );

    // and now we can do the rest of the test

#ifdef CYGSEM_UITRON_BAD_PARAMS_RETURN_ERRORS
    ercd = rel_wai( 2 );
    CYG_TEST_CHECK( E_OBJ == ercd, "rel_wai bad ercd !E_OBJ" );
    ercd = rel_wai( 1 );
    CYG_TEST_CHECK( E_OBJ == ercd, "rel_wai(me) bad ercd !E_OBJ" );
    ercd = rel_wai( -6 );
    CYG_TEST_CHECK( E_ID == ercd, "rel_wai bad ercd !E_ID" );
    ercd = rel_wai( 99 );
    CYG_TEST_CHECK( E_ID == ercd, "rel_wai bad ercd !E_ID" );
#endif // we can test bad param error returns

    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" );

#ifdef CYGSEM_UITRON_BAD_PARAMS_RETURN_ERRORS
    ercd = rel_wai( 2 );
    CYG_TEST_CHECK( E_OBJ == ercd, "rel_wai bad ercd !E_OBJ" );
    ercd = rel_wai( 1 );
    CYG_TEST_CHECK( E_OBJ == ercd, "rel_wai(me) bad ercd !E_OBJ" );
#endif // we can test bad param error returns

    ercd = wai_sem( 1 );
    CYG_TEST_CHECK( E_RLWAI == ercd, "wai_sem bad ercd !E_RLWAI" );

    ercd = twai_sem( 1, 20 );
    CYG_TEST_CHECK( E_RLWAI == ercd, "twai_sem bad ercd !E_RLWAI" );

    ercd = wai_flg( &scratch, 1, 9999, 0 );
    CYG_TEST_CHECK( E_RLWAI == ercd, "wai_flg bad ercd !E_RLWAI" );

    ercd = twai_flg( &scratch, 1, 9999, 0, 10 );
    CYG_TEST_CHECK( E_RLWAI == ercd, "twai_flg bad ercd !E_RLWAI" );

    ercd = rcv_msg( &t_msg, 1 );
    CYG_TEST_CHECK( E_RLWAI == ercd, "rcv_msg bad ercd !E_RLWAI" );

    ercd = trcv_msg( &t_msg, 1, 10 );
    CYG_TEST_CHECK( E_RLWAI == ercd, "trcv_msg bad ercd !E_RLWAI" );

    // these are loops so as to consume the whole of the mempool
    // in order to wait at the end
    for ( i = 0; i < 10; i++ )
        if ( E_OK != (ercd = get_blf( &vp, 3 ) ) )
            break;
    CYG_TEST_CHECK( E_RLWAI == ercd, "get_blf bad ercd !E_RLWAI" );

    for ( i = 0; i < 10; i++ )
        if ( E_OK != (ercd = tget_blf( &vp, 3, 10 ) ) )
            break;
    CYG_TEST_CHECK( E_RLWAI == ercd, "tget_blf bad ercd !E_RLWAI" );

    for ( i = 0; i < 10; i++ )
        if ( E_OK != (ercd = get_blk( &vp, 1, 1000 ) ) )
            break;
    CYG_TEST_CHECK( E_RLWAI == ercd, "get_blk bad ercd !E_RLWAI" );

    for ( i = 0; i < 10; i++ )
        if ( E_OK != (ercd = tget_blk( &vp, 1, 1000, 10 ) ) )
            break;
    CYG_TEST_CHECK( E_RLWAI == ercd, "tget_blk bad ercd !E_RLWAI" );

    ercd = dly_tsk( 10 );
    CYG_TEST_CHECK( E_RLWAI == ercd, "dly_tsk bad ercd !E_RLWAI" );

    ercd = tslp_tsk( 10 );
    CYG_TEST_CHECK( E_RLWAI == ercd, "tslp_tsk bad ercd !E_RLWAI" );

    ercd = slp_tsk();
    CYG_TEST_CHECK( E_RLWAI == ercd, "slp_tsk bad ercd !E_RLWAI" );

    ercd = ter_tsk( 2 );
    CYG_TEST_CHECK( E_OK == ercd, "ter_tsk bad ercd" );
    ercd = dly_tsk( 10 );
    CYG_TEST_CHECK( E_OK == ercd, "dly_tsk bad ercd" );

    CYG_TEST_PASS("release wait: various waiting calls");

    // all done
    CYG_TEST_EXIT( "All done" );
    ext_tsk();
}
Exemple #14
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_MEMPOOLFIXED_CREATE_DELETE
    tests++;
#ifdef CYGSEM_UITRON_BAD_PARAMS_RETURN_ERRORS
    ercd = del_mpf( -6 );
    CYG_TEST_CHECK( E_ID == ercd, "del_mpf bad ercd !E_ID" );
    ercd = del_mpf( 99 );
    CYG_TEST_CHECK( E_ID == ercd, "del_mpf bad ercd !E_ID" );
    ercd = cre_mpf( -6, &t_cmpf );
    CYG_TEST_CHECK( E_ID == ercd, "cre_mpf bad ercd !E_ID" );
    ercd = cre_mpf( 99, &t_cmpf );
    CYG_TEST_CHECK( E_ID == ercd, "cre_mpf bad ercd !E_ID" );
#endif // we can test bad param error returns
    // try a pre-existing object
    // [first get a valid block from it for the freeing test later]
    ercd = pget_blf( &vp, 3 );
    CYG_TEST_CHECK( E_OK == ercd, "pget_blf bad ercd" );
    ercd = cre_mpf( 3, &t_cmpf );
    CYG_TEST_CHECK( E_OBJ == ercd, "cre_mpf bad ercd !E_OBJ" );
    // delete it so we can play
    ercd = del_mpf( 3 );
    CYG_TEST_CHECK( E_OK == ercd, "del_mpf bad ercd" );
    // check it is deleted
    ercd = rel_blf( 3, vp );            // vp did come from this pool
    CYG_TEST_CHECK( E_NOEXS == ercd, "rel_blf bad ercd !E_NOEXS" );
    ercd = pget_blf( &vp, 3 );
    CYG_TEST_CHECK( E_NOEXS == ercd, "pget_blf bad ercd !E_NOEXS" );
    ercd = tget_blf( &vp, 3, 10 );
    CYG_TEST_CHECK( E_NOEXS == ercd, "tget_blf bad ercd !E_NOEXS" );
    ercd = get_blf( &vp, 3 );
    CYG_TEST_CHECK( E_NOEXS == ercd, "get_blf bad ercd !E_NOEXS" );
    ercd = ref_mpf( &t_rmpf, 3 );
    CYG_TEST_CHECK( E_NOEXS == ercd, "ref_mpf 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_mpf( 3, NULL );
    CYG_TEST_CHECK( E_PAR == ercd, "cre_mpf bad ercd !E_PAR" );
#endif
    ercd = cre_mpf( 3, NADR );
    CYG_TEST_CHECK( E_PAR == ercd, "cre_mpf bad ercd !E_PAR" );
    t_cmpf.mpfatr = 0xfff;
    ercd = cre_mpf( 3, &t_cmpf );
    CYG_TEST_CHECK( E_RSATR == ercd, "cre_mpf bad ercd !E_RSATR" );
#endif // we can test bad param error returns
    t_cmpf.mpfatr = 0;
    t_cmpf.mpfcnt = 10000;
    t_cmpf.blfsz = 100;
    ercd = cre_mpf( 3, &t_cmpf );
    CYG_TEST_CHECK( E_NOMEM == ercd, "cre_mpf bad ercd" );
    t_cmpf.mpfcnt = 100;
    t_cmpf.blfsz = 100000;
    ercd = cre_mpf( 3, &t_cmpf );
    CYG_TEST_CHECK( E_NOMEM == ercd, "cre_mpf bad ercd" );
    // now create it well
    t_cmpf.mpfatr = 0;
    t_cmpf.mpfcnt = 10;
    t_cmpf.blfsz = 100;
    ercd = cre_mpf( 3, &t_cmpf );
    CYG_TEST_CHECK( E_OK == ercd, "cre_mpf bad ercd" );
    // and check we can use it
    ercd = pget_blf( &vp, 3 );
    CYG_TEST_CHECK( E_OK == ercd, "pget_blf bad ercd" );
    ercd = tget_blf( &vp, 3, 10 );
    CYG_TEST_CHECK( E_OK == ercd, "tget_blf bad ercd" );
    ercd = get_blf( &vp, 3 );
    CYG_TEST_CHECK( E_OK == ercd, "get_blf bad ercd" );
    ercd = rel_blf( 3, vp );            // vp did come from new pool
    CYG_TEST_CHECK( E_OK == ercd, "rel_blf bad ercd" );
    ercd = rel_blf( 3, vp );            // vp already freed
    CYG_TEST_CHECK( E_PAR == ercd, "rel_blf bad ercd !E_PAR" );
    ercd = ref_mpf( &t_rmpf, 3 );
    CYG_TEST_CHECK( E_OK == ercd, "ref_mpf bad ercd" );

    // In order to wait on the pools, we must first consume all they have:
    while ( E_OK == (ercd = pget_blf( &vp, 1 )) ) /* nothing */;
    CYG_TEST_CHECK( E_TMOUT == ercd, "pget_blf bad ercd !E_TMOUT" );
    while ( E_OK == (ercd = tget_blf( &vp, 2, 1 )) ) /* nothing */;
    CYG_TEST_CHECK( E_TMOUT == ercd, "tget_blf bad ercd !E_TMOUT" );
    // now wait while task 2 deletes the wait objects
    ercd = wup_tsk( 2 );
    CYG_TEST_CHECK( E_OK == ercd, "wup_tsk bad ercd" );
    ercd = get_blf( &vp, 1 );
    CYG_TEST_CHECK( E_DLT == ercd, "get_blf bad ercd !E_DLT" );
    ercd = wup_tsk( 2 );
    CYG_TEST_CHECK( E_OK == ercd, "wup_tsk bad ercd" );
    ercd = tget_blf( &vp, 2, 20 );
    CYG_TEST_CHECK( E_DLT == ercd, "tget_blf bad ercd !E_DLT" );
    // check they are deleted
    ercd = get_blf( &vp, 1 );
    CYG_TEST_CHECK( E_NOEXS == ercd, "get_blf bad ercd !E_NOEXS" );
    ercd = pget_blf( &vp, 2 );
    CYG_TEST_CHECK( E_NOEXS == ercd, "pget_blf bad ercd !E_NOEXS" );

    // re-create and do it again
    t_cmpf.mpfcnt = 90;
    t_cmpf.blfsz = 20;
    ercd = cre_mpf( 1, &t_cmpf );
    CYG_TEST_CHECK( E_OK == ercd, "cre_mpf bad ercd" );
    t_cmpf.mpfcnt = 5;
    t_cmpf.blfsz = 200;
    ercd = cre_mpf( 2, &t_cmpf );
    CYG_TEST_CHECK( E_OK == ercd, "cre_mpf bad ercd" );

    // In order to wait on the pools, we must first consume all they have:
    while ( E_OK == (ercd = pget_blf( &vp, 1 )) ) /* nothing */;
    CYG_TEST_CHECK( E_TMOUT == ercd, "pget_blf bad ercd !E_TMOUT" );
    while ( E_OK == (ercd = tget_blf( &vp, 2, 1 )) ) /* nothing */;
    CYG_TEST_CHECK( E_TMOUT == ercd, "tget_blf bad ercd !E_TMOUT" );
    // now wait while task 2 deletes the wait objects
    ercd = wup_tsk( 2 );
    CYG_TEST_CHECK( E_OK == ercd, "wup_tsk bad ercd" );
    ercd = get_blf( &vp, 1 );
    CYG_TEST_CHECK( E_DLT == ercd, "get_blf bad ercd !E_DLT" );
    ercd = wup_tsk( 2 );
    CYG_TEST_CHECK( E_OK == ercd, "wup_tsk bad ercd" );
    ercd = tget_blf( &vp, 2, 10 );
    CYG_TEST_CHECK( E_DLT == ercd, "tget_blf bad ercd !E_DLT" );
    // check they are deleted
    ercd = tget_blf( &vp, 1, 1 );
    CYG_TEST_CHECK( E_NOEXS == ercd, "get_blf bad ercd !E_NOEXS" );
    ercd = get_blf( &vp, 2 );
    CYG_TEST_CHECK( E_NOEXS == ercd, "pget_blf bad ercd !E_NOEXS" );

    CYG_TEST_PASS("create/delete fixed mempools");
#endif // CYGPKG_UITRON_MEMPOOLFIXED_CREATE_DELETE

#ifdef CYGPKG_UITRON_MEMPOOLVAR_CREATE_DELETE
    tests++;
#ifdef CYGSEM_UITRON_BAD_PARAMS_RETURN_ERRORS
    ercd = del_mpl( -6 );
    CYG_TEST_CHECK( E_ID == ercd, "del_mpl bad ercd !E_ID" );
    ercd = del_mpl( 99 );
    CYG_TEST_CHECK( E_ID == ercd, "del_mpl bad ercd !E_ID" );
    ercd = cre_mpl( -6, &t_cmpl );
    CYG_TEST_CHECK( E_ID == ercd, "cre_mpl bad ercd !E_ID" );
    ercd = cre_mpl( 99, &t_cmpl );
    CYG_TEST_CHECK( E_ID == ercd, "cre_mpl bad ercd !E_ID" );
#endif // we can test bad param error returns
    // try a pre-existing object
    // [first get a valid block from it for the freeing test later]
    ercd = pget_blk( &vp, 3, 100 );
    CYG_TEST_CHECK( E_OK == ercd, "pget_blk bad ercd" );
    ercd = cre_mpl( 3, &t_cmpl );
    CYG_TEST_CHECK( E_OBJ == ercd, "cre_mpl bad ercd !E_OBJ" );
    // delete it so we can play
    ercd = del_mpl( 3 );
    CYG_TEST_CHECK( E_OK == ercd, "del_mpl bad ercd" );
    // check it is deleted
    ercd = rel_blk( 3, vp );            // vp did come from this pool
    CYG_TEST_CHECK( E_NOEXS == ercd, "rel_blk bad ercd !E_NOEXS" );
    ercd = pget_blk( &vp, 3, 100 );
    CYG_TEST_CHECK( E_NOEXS == ercd, "pget_blk bad ercd !E_NOEXS" );
    ercd = tget_blk( &vp, 3, 100, 10 );
    CYG_TEST_CHECK( E_NOEXS == ercd, "tget_blk bad ercd !E_NOEXS" );
    ercd = get_blk( &vp, 3, 100 );
    CYG_TEST_CHECK( E_NOEXS == ercd, "get_blk bad ercd !E_NOEXS" );
    ercd = ref_mpl( &t_rmpl, 3 );
    CYG_TEST_CHECK( E_NOEXS == ercd, "ref_mpl 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_mpl( 3, NULL );
    CYG_TEST_CHECK( E_PAR == ercd, "cre_mpl bad ercd !E_PAR" );
#endif
    ercd = cre_mpl( 3, NADR );
    CYG_TEST_CHECK( E_PAR == ercd, "cre_mpl bad ercd !E_PAR" );
    t_cmpl.mplatr = 0xfff;
    ercd = cre_mpl( 3, &t_cmpl );
    CYG_TEST_CHECK( E_RSATR == ercd, "cre_mpl bad ercd !E_RSATR" );
#endif // we can test bad param error returns
    t_cmpl.mplatr = 0;
    t_cmpl.mplsz = 100000000;
    ercd = cre_mpl( 3, &t_cmpl );
    CYG_TEST_CHECK( E_NOMEM == ercd, "cre_mpl bad ercd" );
    // now create it well
    t_cmpl.mplatr = 0;
    t_cmpl.mplsz = 1000;
    ercd = cre_mpl( 3, &t_cmpl );
    CYG_TEST_CHECK( E_OK == ercd, "cre_mpl bad ercd" );
    // and check we can use it
    ercd = pget_blk( &vp, 3, 100 );
    CYG_TEST_CHECK( E_OK == ercd, "pget_blk bad ercd" );
    ercd = pget_blk( &vp, 3, 100000000 ); // way too large
    CYG_TEST_CHECK( E_TMOUT == ercd, "pget_blk bad ercd !E_TMOUT" );
    ercd = tget_blk( &vp, 3, 100, 10 );
    CYG_TEST_CHECK( E_OK == ercd, "tget_blk bad ercd" );
    ercd = get_blk( &vp, 3, 100 );
    CYG_TEST_CHECK( E_OK == ercd, "get_blk bad ercd" );
    ercd = rel_blk( 3, vp );            // vp did come from new pool
    CYG_TEST_CHECK( E_OK == ercd, "rel_blk bad ercd" );
    ercd = rel_blk( 3, vp );            // vp already freed
    CYG_TEST_CHECK( E_PAR == ercd, "rel_blk bad ercd !E_PAR" );
    ercd = ref_mpl( &t_rmpl, 3 );
    CYG_TEST_CHECK( E_OK == ercd, "ref_mpl bad ercd" );

    // In order to wait on the pools, we must first consume all they have:
    while ( E_OK == (ercd = pget_blk( &vp, 1, 100 )) ) /* nothing */;
    CYG_TEST_CHECK( E_TMOUT == ercd, "pget_blk bad ercd !E_TMOUT" );
    while ( E_OK == (ercd = tget_blk( &vp, 2, 100, 1 )) ) /* nothing */;
    CYG_TEST_CHECK( E_TMOUT == ercd, "tget_blk bad ercd !E_TMOUT" );
    // now wait while task 2 deletes the wait objects
    ercd = wup_tsk( 2 );
    CYG_TEST_CHECK( E_OK == ercd, "wup_tsk bad ercd" );
    ercd = get_blk( &vp, 1, 200 );
    CYG_TEST_CHECK( E_DLT == ercd, "get_blk bad ercd !E_DLT" );
    ercd = wup_tsk( 2 );
    CYG_TEST_CHECK( E_OK == ercd, "wup_tsk bad ercd" );
    ercd = tget_blk( &vp, 2, 100, 20 );
    CYG_TEST_CHECK( E_DLT == ercd, "tget_blk bad ercd !E_DLT" );
    // check they are deleted
    ercd = get_blk( &vp, 1, 200 );
    CYG_TEST_CHECK( E_NOEXS == ercd, "get_blk bad ercd !E_NOEXS" );
    ercd = pget_blk( &vp, 2, 20 );
    CYG_TEST_CHECK( E_NOEXS == ercd, "pget_blk bad ercd !E_NOEXS" );

    // re-create and do it again
    ercd = cre_mpl( 1, &t_cmpl );
    CYG_TEST_CHECK( E_OK == ercd, "cre_mpl bad ercd" );
    ercd = cre_mpl( 2, &t_cmpl );
    CYG_TEST_CHECK( E_OK == ercd, "cre_mpl bad ercd" );

    // In order to wait on the pools, we must first consume all they have:
    while ( E_OK == (ercd = pget_blk( &vp, 1, 20 )) ) /* nothing */;
    CYG_TEST_CHECK( E_TMOUT == ercd, "pget_blk bad ercd !E_TMOUT" );
    while ( E_OK == (ercd = tget_blk( &vp, 2, 400, 1 )) ) /* nothing */;
    CYG_TEST_CHECK( E_TMOUT == ercd, "tget_blk bad ercd !E_TMOUT" );
    // now wait while task 2 deletes the wait objects
    ercd = wup_tsk( 2 );
    CYG_TEST_CHECK( E_OK == ercd, "wup_tsk bad ercd" );
    ercd = get_blk( &vp, 1, 200 );
    CYG_TEST_CHECK( E_DLT == ercd, "get_blk bad ercd !E_DLT" );
    ercd = wup_tsk( 2 );
    CYG_TEST_CHECK( E_OK == ercd, "wup_tsk bad ercd" );
    ercd = tget_blk( &vp, 2, 500, 20 );
    CYG_TEST_CHECK( E_DLT == ercd, "tget_blk bad ercd !E_DLT" );
    // check they are deleted
    ercd = tget_blk( &vp, 1, 200, 1 );
    CYG_TEST_CHECK( E_NOEXS == ercd, "get_blk bad ercd !E_NOEXS" );
    ercd = get_blk( &vp, 2, 20 );
    CYG_TEST_CHECK( E_NOEXS == ercd, "pget_blk bad ercd !E_NOEXS" );

    CYG_TEST_PASS("create/delete variable mempools");
#endif // CYGPKG_UITRON_MEMPOOLVAR_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();
}