/*
 *  シリアル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);
}
示例#2
0
/*
 *  シリアルI/Oポートのオープン
 */
SIOPCB *
sio_opn_por(ID siopid, intptr_t exinf)
{
	SIOPCB	*p_siopcb;
	bool_t	opnflg;
	ER		ercd;

	/*
	 *  オープンしたポートがあるかをopnflgに読んでおく.
	 */
	opnflg = upd72001_openflag();

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

	/*
	 *  シリアルI/O割込みのマスクを解除する.
	 */
	if (!opnflg) {
		ercd = ena_int(INTNO_SIO);
		assert(ercd == E_OK);
	}
	return(p_siopcb);
}
/*
 *  シリアルI/Oポートのオープン
 */
SIOPCB *
sio_opn_por(ID siopid, intptr_t exinf)
{
    SIOPCB  *p_siopcb = get_siopcb(siopid);
    bool_t    opnflg;
    ER      ercd;

    /*
     *  オープンしたポートがあるかをopnflgに読んでおく.
     */
    opnflg = p_siopcb->openflag;

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

    /*
     *  シリアルI/O割込みのマスクを解除する.
     */
    if (!opnflg) {
        ercd = ena_int(INTNO_SIO);
        assert(ercd == E_OK);
    }
    return(p_siopcb);
}
示例#4
0
/*
 *  シリアルI/Oポートのオープン
 */
SIOPCB *
sio_opn_por(ID siopid, intptr_t exinf)
{
	SIOPCB          *p_siopcb;
	const SIOPINIB  *p_siopinib;
	bool_t  opnflg;
	ER      ercd;

	p_siopcb = get_siopcb(siopid);
	p_siopinib = p_siopcb->p_siopinib;

	/*
	 *  オープンしたポートがあるかをopnflgに読んでおく.
	 */
	opnflg = p_siopcb->opnflg;

	p_siopcb->exinf = exinf;

	/*
	 *  ハードウェアの初期化
	 */
	UARTConfigSetExpClk(p_siopinib->base, SysCtlClockGet(), 115200,
						(UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE |
						 UART_CONFIG_PAR_NONE));

	/*
	 *  シリアルI/O割込みのマスクを解除する.
	 */
	if (!opnflg) {
		ercd = ena_int(p_siopinib->intno);
		assert(ercd == E_OK);
	}

	return(p_siopcb);
}
示例#5
0
文件: interrupt.c 项目: monaka/B-Free
/*
 * 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 ();
}
示例#6
0
/**
 * @fn			static int exec_by_interrupt(const SpiDeviceConfigurator_t* config, const void* pTx, int nTx,  void* pRx, int nRx )
 * @brief		SPI execute using interrupt
 * @param		config a SPI Configuration
 * @param		pTx Tx Buffer pointer
 * @param		nTx number of the send units
 * @param		pRx Rx Buffer pointer
 * @param		nRx number of the receive units
 */
static int exec_by_interrupt(const SpiDeviceConfigurator_t* config, const void* pTx, int nTx,  void* pRx, int nRx )
{
	int ret = (nTx > nRx)? nTx : nRx;
	spi_start(config,pTx,nTx,pRx,nRx);	
	
	ena_int(INHNO_SPI0);

	if( twai_sem( SPI_COMPLETE_SIG , SPI_TIMEOUT_PER_BYTE * ret) != E_OK )
	{
		sig_sem( SPI_COMPLETE_SIG );
		ret = 0;
	}
			
	return ret;
}
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;
}
/*
 *  open sio port
 */
SIOPCB *
sio_opn_por(ID siopid, intptr_t exinf)
{
	SIOPCB  *p_siopcb = get_siopcb(siopid);
	
	p_siopcb->exinf = exinf;

	/*
	 *  the device dependent open
	*/
	emstartkit_uart_init(p_siopcb->p_siopinib->regs, 
			LCR_WORD_LEN8 | LCR_1_STOP_BIT | LCR_PARITY_NONE, 115200);
	p_siopcb->getready = p_siopcb->putready = false;
	p_siopcb->openflag = true;

	ena_int(p_siopcb->p_siopinib->intno);

	return p_siopcb;
}
示例#9
0
文件: ostimer.c 项目: ryuz/hos-v4a
/** %jp{OS用タイマ初期化ルーチン} */
void OsTimer_Initialize(void)
{
	T_CISR cisr;
	
	/* %jp{割込みサービスルーチン生成} */
	cisr.isratr = TA_HLNG;
	cisr.exinf  = 0;
	cisr.intno  = INTNO_TIMER;
	cisr.isr    = (FP)OsTimer_Isr;
	acre_isr(&cisr);
	
	/* 開始 */
	*REG_TIMER_TLR0  = 100000 - 1;		/* 1ms 100MHz */
	*REG_TIMER_TCSR0 = 0x0132;			/* clear int, load counter */
	*REG_TIMER_TCSR0 = 0x00d2;			/* start */
	
	/* 割込み許可 */
	ena_int(INTNO_TIMER);
}
示例#10
0
文件: main.c 项目: monaka/B-Free
/*******************************************************************
 * 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 */
}
示例#11
0
文件: keyboard.c 项目: monaka/B-Free
/*
 * キーボード割り込みによって起動される関数。
 *
 * キーボードデバイスからキーイベントを読み取り、入力バッファ (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");
    }
}
示例#12
0
void SysInt_Enable(int iIntNum)
{
	ena_int((INTNO)iIntNum);
}