/*
 *  シリアルI/Oポートのオープン
 */
SIOPCB *
sio_opn_por(ID siopid, intptr_t exinf)
{
	SIOPCB    *p_siopcb;
	ER        ercd;

	/*
	 *  シリアルI/O割込みをマスクする.
	 */
	ercd = dis_int(get_intno_sio_rxi(siopid));
	assert(ercd == E_OK);
	ercd = dis_int(get_intno_sio_txi(siopid));
	assert(ercd == E_OK);

	/*
	 *  デバイス依存のオープン処理.
	 */
	p_siopcb = scif_opn_por(siopid, exinf);

	/*
	 *  シリアルI/O割込みのマスクを解除する.
	 */
	ercd = ena_int(get_intno_sio_rxi(siopid));
	assert(ercd == E_OK);
	ercd = ena_int(get_intno_sio_txi(siopid));
	assert(ercd == E_OK);

	return(p_siopcb);
}
Beispiel #2
0
/*
 *   致命的な失敗に対する対処ルーチン
 */
void FatalAssertion(int exp, LPCSTR format, ...)
{
	extern HANDLE PrimaryThreadHandle;
	extern HANDLE CurrentRunningThreadHandle;

	if(!exp)
	{
		va_list vl;
		char    buffer[1024];

			/* エラーが起きた原因を突き止める */
		wsprintf(buffer, "Critical assertion fail occured !!\nGetLastError = 0x%08x\n\n", GetLastError());

			/* カーネルが動き出していたら... */		
		if(PrimaryThreadHandle != NULL)
		{
				/* カーネルの実行を止める */
			dis_int(0);
			if(CurrentRunningThreadHandle != NULL)
				SuspendThread(CurrentRunningThreadHandle);
			hw_timer_terminate();
		}

			/* 警告表示 */
		va_start(vl, format);
		wvsprintf(buffer + lstrlen(buffer), format, vl);
		MessageBox(PrimaryDialogHandle, buffer, "Assertion Failed", MB_OK|MB_ICONERROR);

			/* カーネル停止 */
		HALQuitRequest();
	}
}
Beispiel #3
0
/*
 * reset_intr_mask 
 *
 * 引数:	intn	割り込み番号
 *
 * 返値:	なし
 *
 * 処理:	割り込みマスクをリセットする。
 *
 */
void
reset_intr_mask (W intn)
{
  dis_int ();
  if (intn < 8)
    outb (MASTER_8259A_DATA, inb (MASTER_8259A_DATA) & ~(1 << intn));
  else
    outb (SLAVE_8259A_DATA, inb (SLAVE_8259A_DATA) & ~(1 << (intn - 8)));
  ena_int ();
}
static intptr_t uart_cls_por(intptr_t exinf) {
    SIOPCB *p_siopcb = (SIOPCB*)exinf;

    uart_close(&UART1);

    p_siopcb->openflag = false;

    ER ercd = dis_int(UART1_INT);
    assert(ercd == E_OK);

    return true;
}
/*
 *  close sio port
 */
void
sio_cls_por(SIOPCB *p_siopcb)
{
    /*
     * device dependent close
     */
	p_siopcb->openflag = false;
    
    /*
     * disable sio port interrupt
     */
	dis_int(p_siopcb->p_siopinib->intno);
}
/*
 *  シリアルI/Oポートのクローズ
 */
void
sio_cls_por(SIOPCB *p_siopcb)
{
    /*
     *  デバイス依存のクローズ処理.
     */
    p_siopcb->openflag = false;
    
    /*
     *  シリアルI/O割込みをマスクする.
     */
    dis_int(INTNO_SIO);
}
Beispiel #7
0
/*
 *  シリアルI/Oポートのクローズ
 */
void
sio_cls_por(SIOPCB *p_siopcb)
{
	/*
	 *  デバイス依存のクローズ処理.
	 */


	/*
	 *  シリアルI/O割込みをマスクする.
	 */
	if (!(p_siopcb->opnflg)) {
		dis_int(p_siopcb->p_siopinib->intno);
	}
}
/*
 *  シリアルI/Oポートのクローズ
 */
void
sio_cls_por(SIOPCB *p_siopcb)
{
	ER ercd;
	ID siopid;

	/*
	 *  シリアルI/OポートIDの取得
	 */
	siopid = scif_get_siopid(p_siopcb);

	/*
	 *  デバイス依存のクローズ処理.
	 */
	scif_cls_por(p_siopcb);

	/*
	 *  シリアルI/O割込みをマスクする.
	 */
	ercd = dis_int(intno_sio_rxi[siopid]);
	assert(ercd == E_OK);
	ercd = dis_int(intno_sio_txi[siopid]);
	assert(ercd == E_OK);
}
static intptr_t uart_opn_por(intptr_t unused) {
    ER ercd;

    ercd = dis_int(UART1_INT);
    assert(ercd == E_OK);

    uart_snd_cbflg = false;
    uart_rcv_cbflg = false;
    uart_tx_fifo_sem = 0;
    uart_init(&UART1);

    ercd = ena_int(UART1_INT);
    assert(ercd == E_OK);

    return true;
}
Beispiel #10
0
/* falldown --- ITRON での [panic] 関数。
 *
 * @desc
 *	falldown() は、引数で指定されたフォーマットに従い、(コンソール)画面に
 *	メッセージを表示する。
 *	フォーマットの意味は、printk () と同じ。
 *
 *	メッセージを表示した後は、無限ループに入る。
 *
 */
void
falldown (B *fmt, ...)
{
  VP arg0;
  vprintk (fmt, (VP)&arg0);

/* もし、ITRON_DBG マクロが定義されていれば、デバッガを起動する。
 */
#ifdef ITRON_DBG
  itron_debugger ();
#else
  dis_int ();
  for (;;)
    ;
#endif /* ITRON_DBG */
}
Beispiel #11
0
/*
 *  シリアルI/Oポートのクローズ
 */
void
sio_cls_por(SIOPCB *p_siopcb)
{
	/*
	 *  デバイス依存のクローズ処理.
	 */
	const SIOPINIB  *p_siopinib;

	p_siopinib = p_siopcb->p_siopinib;
	p_siopcb->openflag = false;
    
	/*
	 *  シリアルI/O割込みをマスクする.
	 */
	dis_int(p_siopcb->p_siopinib->intno);
}
Beispiel #12
0
/*
 *  シリアルI/Oポートのクローズ
 */
void
sio_cls_por(SIOPCB *p_siopcb)
{
	ER		ercd;

	/*
	 *  デバイス依存のクローズ処理.
	 */
	upd72001_cls_por(p_siopcb);

	/*
	 *  シリアルI/O割込みをマスクする.
	 */
	if (!upd72001_openflag()) {
		ercd = dis_int(INTNO_SIO);
		assert(ercd == E_OK);
	}
}
Beispiel #13
0
/*
 * キーボード割り込みによって起動される関数。
 *
 * キーボードデバイスからキーイベントを読み取り、入力バッファ (input_buffer) 
 * に追加する。
 */
W
intr_kbd ()
{
  W			key_code;
  W			ch;
  struct key_entry	*key;
  ER			error;
  
  while ((inb (KEY_STAT) & 0x02) == 0)
    ;
  outb (KEY_COM, 0x16);
  key_code = inb (0x41);

  if ((key_code & 0x70) == 0x70)
    {
      switch (key_code)
	{
	case 0x70:
	  shiftkey_code |= SHIFT_DOWN;
	  break;
	case 0x71:
	  capskey = CAPS_DOWN;
	  break;
	case 0x73:
	  shiftkey_code |= GRAPH_DOWN;
	  break;
	case 0x74:
	  shiftkey_code |= CONTROL_DOWN;
	  break;
	case 0xf0:
	  shiftkey_code &= ~SHIFT_DOWN;
	  break;
	case 0xf1:
	  capskey = NORMAL;
	  break;
	case 0xf3:
	  shiftkey_code &= ~GRAPH_DOWN;
	  break;

	case 0xf4:
	  shiftkey_code &= ~CONTROL_DOWN;
	  break;
	}
      return;
    }
  
  /* もし、キーを離したところならば、無視する */
  if (key_code & 0x80)
    return;
  
  /* マトリックステーブルから、キーコードを取り出す。
   */
  if (shiftkey_code & CONTROL_DOWN)
    ch = key_table[CONTROL_CODE][key_code];
  else if (capskey)
    {
      if (shiftkey_code & SHIFT_DOWN)
	ch = key_table[NORMAL_CODE][key_code];
      else
	ch = key_table[SHIFT_CODE][key_code];
    }
  else if (shiftkey_code & SHIFT_DOWN)
    ch = key_table[SHIFT_DOWN][key_code];
  else
    ch = key_table[NORMAL_CODE][key_code];

  if (ch == NULL)
    return;
  
  dis_int ();
  key = alloc_key (ch);
  if (key == NULL)		/* キーがない */
    {
      ena_int ();
      return;
    }

  if (input_buffer.last)
    {
      input_buffer.last->next = key;
      input_buffer.last = key;
    }
  else
    {
      input_buffer.first = input_buffer.last = key;
    }
  ena_int ();

/*  printk ("key code = 0x%x, char = 0x%x", key_code, ch);	/* */
#if 0  
  if (ch != 0)
    {
      B buf[2];

      buf[0] = ch;
      buf[1] = '\0';
      printk ("(");
      printk (buf);
      printk (")\n");
    }
  else
    printk ("(NULL)\n", ch);
#endif /* 0 */
  if (ch == ('s' - 'a' + 1))
    {
      falldown ("control S\n");
    }
  else if (ch == ('l' - 'a' + 1))
    {
      print_task_list ();
    }

  if ((error = wup_tsk (ITRON_KEYBOARD)) != E_OK)
    {
      printk ("errno = %d\n", error);
      falldown ("intr_kbd: error on wup_tsk.\n");
    }
}
Beispiel #14
0
uint32_t utils::rand_int(int M) {
    return dis_int(gen) % M;
}