Esempio n. 1
0
/*
 *  シリアルポートのクローズ
 */
ER
serial_cls_por(ID portid)
{
    SPCB	*spcb;
    ER	ercd;

    if (sns_ctx()) {		/* コンテキストのチェック */
        return(E_CTX);
    }
    if (!(1 <= portid && portid <= TNUM_PORT)) {
        return(E_ID);		/* ポート番号のチェック */
    }
    spcb = get_spcb(portid);

    _syscall(loc_cpu());
    if (!(spcb->openflag)) {	/* オープン済みかのチェック */
        ercd = E_OBJ;
    }
    else {
        /*
         *  ハードウェア依存のクローズ処理
         */
        sio_cls_por(spcb->siopcb);
        spcb->openflag = FALSE;
        ercd = E_OK;
    }
    _syscall(unl_cpu());
    return(ercd);
}
Esempio n. 2
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);
}
Esempio n. 3
0
/*
 *  SIOドライバの終了処理
 */
void
sio_terminate(intptr_t exinf)
{
	SIOPCB	*p_siopcb;
	uint_t	i;

	/*
	 *  オープンされているシリアルI/Oポートのクローズ
	 */
	for (p_siopcb = siopcb_table, i = 0; i < TNUM_SIOP; p_siopcb++, i++) {
		if (p_siopcb->openflag) {
			sio_cls_por(p_siopcb);
		}
	}
}