Example #1
0
void
initialize_mutex(void)
{
	uint_t	i, j;
	MTXCB	*p_mtxcb;
	MTXINIB	*p_mtxinib;
	
	mtxhook_check_ceilpri = mutex_check_ceilpri;
	mtxhook_scan_ceilmtx = mutex_scan_ceilmtx;
	mtxhook_release_all = mutex_release_all;

	for (i = 0; i < tnum_mtx; i++) {
		p_mtxcb = &(mtxcb_table[i]);
		queue_initialize(&(p_mtxcb->wait_queue));
		p_mtxcb->p_mtxinib = &(mtxinib_table[i]);
		p_mtxcb->p_loctsk = NULL;
	}
	queue_initialize(&free_mtxcb);
	for (j = 0; i < tnum_mtx; i++, j++) {
		p_mtxcb = &(mtxcb_table[i]);
		p_mtxinib = &(amtxinib_table[j]);
		p_mtxinib->mtxatr = TA_NOEXS;
		p_mtxcb->p_mtxinib = ((const MTXINIB *) p_mtxinib);
		queue_insert_prev(&free_mtxcb, &(p_mtxcb->wait_queue));
	}	
}
Example #2
0
/*
 *  優先度データキュー機能の初期化
 */
void
initialize_pridataq(void)
{
	uint_t	i, j;
	PDQCB	*p_pdqcb;
	PDQINIB	*p_pdqinib;

	for (i = 0; i < tnum_spdq; i++) {
		p_pdqcb = &(pdqcb_table[i]);
		queue_initialize(&(p_pdqcb->swait_queue));
		p_pdqcb->p_pdqinib = &(pdqinib_table[i]);
		queue_initialize(&(p_pdqcb->rwait_queue));
		p_pdqcb->count = 0U;
		p_pdqcb->p_head = NULL;
		p_pdqcb->unused = 0U;
		p_pdqcb->p_freelist = NULL;
	}
	queue_initialize(&free_pdqcb);
	for (j = 0; i < tnum_pdq; i++, j++) {
		p_pdqcb = &(pdqcb_table[i]);
		p_pdqinib = &(apdqinib_table[j]);
		p_pdqinib->pdqatr = TA_NOEXS;
		p_pdqcb->p_pdqinib = ((const PDQINIB *) p_pdqinib);
		queue_insert_prev(&free_pdqcb, &(p_pdqcb->swait_queue));
	}
}
Example #3
0
/*
 *  タスク管理モジュールの初期化
 */
void
initialize_task(void)
{
	uint_t	i, j;
	TCB		*p_tcb;

	p_runtsk = NULL;
	p_schedtsk = NULL;
	reqflg = false;
	ipmflg = true;
	disdsp = false;
	dspflg = true;

	for (i = 0; i < TNUM_TPRI; i++) {
		queue_initialize(&(ready_queue[i]));
	}
	ready_primap = 0U;

	for (i = 0; i < tnum_tsk; i++) {
		j = INDEX_TSK(torder_table[i]);
		p_tcb = &(tcb_table[j]);
		p_tcb->p_tinib = &(tinib_table[j]);
		p_tcb->actque = false;
		make_dormant(p_tcb);
		queue_initialize(&(p_tcb->mutex_queue));
		if ((p_tcb->p_tinib->tskatr & TA_ACT) != 0U) {
			(void) make_active(p_tcb);
		}
	}
}
Example #4
0
void
initialize_semaphore(void)
{
	uint_t			i, j, k;
	ID				domid;
	SEMCB			*p_semcb;
	const DOMINIB	*p_dominib;

	for (i = 0; i < tnum_ssem; i++) {
		p_semcb = &(semcb_table[i]);
		queue_initialize(&(p_semcb->wait_queue));
		p_semcb->p_seminib = &(seminib_table[i]);
		p_semcb->semcnt = p_semcb->p_seminib->isemcnt;
	}

	queue_initialize(&(dominib_kernel.p_domcb->free_semcb));
	for (j = 0; j < dominib_kernel.tnum_asemid; i++, j++) {
		initialize_semcb(&(semcb_table[i]), &(aseminib_table[j]),
													&dominib_kernel);
	}
	for (domid = TMIN_DOMID; domid <= tmax_domid; domid++) {
		p_dominib = get_dominib(domid);
		queue_initialize(&(p_dominib->p_domcb->free_semcb));
		for (k = 0; k < p_dominib->tnum_asemid; i++, j++, k++) {
			initialize_semcb(&(semcb_table[i]), &(aseminib_table[j]),
															p_dominib);
		}
	}
	for (k = 0; k < dominib_none.tnum_asemid; i++, j++, k++) {
		initialize_semcb(&(semcb_table[i]), &(aseminib_table[j]),
													&dominib_none);
	}
}
Example #5
0
ER_UINT
acre_pdq(const T_CPDQ *pk_cpdq)
{
    PDQCB	*p_pdqcb;
    PDQINIB	*p_pdqinib;
    ATR		pdqatr;
    PDQMB	*p_pdqmb;
    ER		ercd;

    LOG_ACRE_PDQ_ENTER(pk_cpdq);
    CHECK_TSKCTX_UNL();
    CHECK_RSATR(pk_cpdq->pdqatr, TA_TPRI);
    CHECK_DPRI(pk_cpdq->maxdpri);
    pdqatr = pk_cpdq->pdqatr;
    p_pdqmb = pk_cpdq->pdqmb;

    t_lock_cpu();
    if (queue_empty(&free_pdqcb)) {
        ercd = E_NOID;
    }
    else {
        if (pk_cpdq->pdqcnt != 0 && p_pdqmb == NULL) {
            p_pdqmb = kernel_malloc(sizeof(PDQMB) * pk_cpdq->pdqcnt);
            pdqatr |= TA_MBALLOC;
        }
        if (pk_cpdq->pdqcnt != 0 && p_pdqmb == NULL) {
            ercd = E_NOMEM;
        }
        else {
            p_pdqcb = ((PDQCB *) queue_delete_next(&free_pdqcb));
            p_pdqinib = (PDQINIB *)(p_pdqcb->p_pdqinib);
            p_pdqinib->pdqatr = pdqatr;
            p_pdqinib->pdqcnt = pk_cpdq->pdqcnt;
            p_pdqinib->maxdpri = pk_cpdq->maxdpri;
            p_pdqinib->p_pdqmb = p_pdqmb;

            queue_initialize(&(p_pdqcb->swait_queue));
            queue_initialize(&(p_pdqcb->rwait_queue));
            p_pdqcb->count = 0U;
            p_pdqcb->p_head = NULL;
            p_pdqcb->unused = 0U;
            p_pdqcb->p_freelist = NULL;
            ercd = PDQID(p_pdqcb);
        }
    }
    t_unlock_cpu();

error_exit:
    LOG_ACRE_PDQ_LEAVE(ercd);
    return(ercd);
}
Example #6
0
void
initialize_dataqueue(void)
{
	uint_t	i;
	DTQCB	*p_dtqcb;

	for (p_dtqcb = dtqcb_table, i = 0; i < tnum_dtq; p_dtqcb++, i++) {
		queue_initialize(&(p_dtqcb->swait_queue));
		p_dtqcb->p_dtqinib = &(dtqinib_table[i]);
		queue_initialize(&(p_dtqcb->rwait_queue));
		p_dtqcb->count = 0U;
		p_dtqcb->head = 0U;
		p_dtqcb->tail = 0U;
	}
}
Example #7
0
ER_UINT
acre_dtq(const T_CDTQ *pk_cdtq)
{
	DTQCB		*p_dtqcb;
	DTQINIB		*p_dtqinib;
	ATR			dtqatr;
	DTQMB		*p_dtqmb;
	ER			ercd;

	LOG_ACRE_DTQ_ENTER(pk_cdtq);
	CHECK_TSKCTX_UNL();
	CHECK_RSATR(pk_cdtq->dtqatr, TA_TPRI);
	dtqatr = pk_cdtq->dtqatr;
	p_dtqmb = pk_cdtq->dtqmb;

	t_lock_cpu();
	if (queue_empty(&free_dtqcb)) {
		ercd = E_NOID;
	}
	else {
		if (pk_cdtq->dtqcnt != 0 && p_dtqmb == NULL) {
			p_dtqmb = kernel_malloc(sizeof(DTQMB) * pk_cdtq->dtqcnt);
			dtqatr |= TA_MBALLOC;
		}
		if (pk_cdtq->dtqcnt != 0 && p_dtqmb == NULL) {
			ercd = E_NOMEM;
		}
		else {
			p_dtqcb = ((DTQCB *) queue_delete_next(&free_dtqcb));
			p_dtqinib = (DTQINIB *)(p_dtqcb->p_dtqinib);
			p_dtqinib->dtqatr = dtqatr;
			p_dtqinib->dtqcnt = pk_cdtq->dtqcnt;
			p_dtqinib->p_dtqmb = p_dtqmb;

			queue_initialize(&(p_dtqcb->swait_queue));
			queue_initialize(&(p_dtqcb->rwait_queue));
			p_dtqcb->count = 0U;
			p_dtqcb->head = 0U;
			p_dtqcb->tail = 0U;
			ercd = DTQID(p_dtqcb);
		}
	}
	t_unlock_cpu();

  error_exit:
	LOG_ACRE_DTQ_LEAVE(ercd);
	return(ercd);
}
ER_UINT
acre_flg(const T_CFLG *pk_cflg)
{
	FLGCB	*p_flgcb;
	FLGINIB	*p_flginib;
	ER		ercd;

	LOG_ACRE_FLG_ENTER(pk_cflg);
	CHECK_TSKCTX_UNL();
	CHECK_RSATR(pk_cflg->flgatr, TA_TPRI|TA_WMUL|TA_CLR);

	t_lock_cpu();
	if (tnum_flg == 0 || queue_empty(&free_flgcb)) {
		ercd = E_NOID;
	}
	else {
		p_flgcb = ((FLGCB *) queue_delete_next(&free_flgcb));
		p_flginib = (FLGINIB *)(p_flgcb->p_flginib);
		p_flginib->flgatr = pk_cflg->flgatr;
		p_flginib->iflgptn = pk_cflg->iflgptn;

		queue_initialize(&(p_flgcb->wait_queue));
		p_flgcb->flgptn = p_flgcb->p_flginib->iflgptn;
		ercd = FLGID(p_flgcb);
	}
	t_unlock_cpu();

  error_exit:
	LOG_ACRE_FLG_LEAVE(ercd);
	return(ercd);
}
Example #9
0
/*
 *   task management module initialization
 */
void
initialize_task(void)
{
	uint_t	i, j;
	TCB		*p_tcb;

	p_runtsk = p_schedtsk = NULL;
	reqflg = false;
	ipmflg = true;
	disdsp = false;
	dspflg = true;

	for (i = 0; i < TNUM_TPRI; i++) {
		queue_initialize(&(ready_queue[i]));
	}
#ifdef PRIMAP_LEVEL_1
	ready_primap = 0U;
#else /* PRIMAP_LEVEL_1 */
	ready_primap1 = 0U;
	for (i = 0; i < TNUM_PRIMAP2; i++) {
		ready_primap2[i] = 0U;
	}
#endif /* PRIMAP_LEVEL_1 */

	for (i = 0; i < tnum_tsk; i++) {
		j = INDEX_TSK(torder_table[i]);
		p_tcb = &(tcb_table[j]);
		p_tcb->p_tinib = &(tinib_table[j]);
		p_tcb->actque = false;
		make_dormant(p_tcb);
		if ((p_tcb->p_tinib->tskatr & TA_ACT) != 0U) {
			make_active(p_tcb);
		}
	}
}
Example #10
0
ER_UINT
acre_sem(const T_CSEM *pk_csem)
{
	SEMCB	*p_semcb;
	SEMINIB	*p_seminib;
	ER		ercd;

	LOG_ACRE_SEM_ENTER(pk_csem);
	CHECK_TSKCTX_UNL();
	CHECK_RSATR(pk_csem->sematr, TA_TPRI);
	CHECK_PAR(0 <= pk_csem->isemcnt && pk_csem->isemcnt <= pk_csem->maxsem);
	CHECK_PAR(1 <= pk_csem->maxsem && pk_csem->maxsem <= TMAX_MAXSEM);

	t_lock_cpu();
	if (tnum_sem == 0 || queue_empty(&free_semcb)) {
		ercd = E_NOID;
	}
	else {
		p_semcb = ((SEMCB *) queue_delete_next(&free_semcb));
		p_seminib = (SEMINIB *)(p_semcb->p_seminib);
		p_seminib->sematr = pk_csem->sematr;
		p_seminib->isemcnt = pk_csem->isemcnt;
		p_seminib->maxsem = pk_csem->maxsem;

		queue_initialize(&(p_semcb->wait_queue));
		p_semcb->semcnt = p_semcb->p_seminib->isemcnt;
		ercd = SEMID(p_semcb);
	}
	t_unlock_cpu();

  error_exit:
	LOG_ACRE_SEM_LEAVE(ercd);
	return(ercd);
}
Example #11
0
SYSCALL ER
i_vtrcv_tmb(T_MSG **ppk_msg, TMO tmout)
	{
	ER	ercd = E_OK;
    
	CHECK_TMOUT(tmout);
	CHECK_DISPATCH();

	BEGIN_CRITICAL_SECTION;
	if ( ctxtsk->tmq_head ) 
		{
		*ppk_msg = ctxtsk->tmq_head;
		ctxtsk->tmq_head = nextmsg(*ppk_msg);
		}
	else 
		{
		ercd = E_TMOUT;
		if ( tmout != TMO_POL ) 
			{
			ctxtsk->wspec = &wspec_tmb_tfifo;
			ctxtsk->wgcb = (GCB *) 0;
			ctxtsk->wercd = &ercd;
			ctxtsk->winfo.tmb.ppk_msg = ppk_msg;
			make_wait(tmout);
			queue_initialize(&(ctxtsk->tskque));
			}
		}
	END_CRITICAL_SECTION;
	return(ercd);
	}
Example #12
0
/*
 *  アラーム通知機能の初期化
 */
void
initialize_alarm(void)
{
	uint_t	i, j;
	ALMCB	*p_almcb;
	ALMINIB	*p_alminib;

	for (i = 0; i < tnum_salm; i++) {
		p_almcb = &(almcb_table[i]);
		p_almcb->p_alminib = &(alminib_table[i]);
		p_almcb->almsta = false;
		p_almcb->tmevtb.callback = (CBACK) call_alarm;
		p_almcb->tmevtb.arg = (void *) p_almcb;
	}
	queue_initialize(&free_almcb);
	for (j = 0; i < tnum_alm; i++, j++) {
		p_almcb = &(almcb_table[i]);
		p_alminib = &(aalminib_table[j]);
		p_alminib->almatr = TA_NOEXS;
		p_almcb->p_alminib = ((const ALMINIB *) p_alminib);
		p_almcb->tmevtb.callback = (CBACK) call_alarm;
		p_almcb->tmevtb.arg = (void *) p_almcb;
		queue_insert_prev(&free_almcb, ((QUEUE *) &(p_almcb->tmevtb)));
	}
}
Example #13
0
/*
 *  周期ハンドラ機能の初期化
 */
void
initialize_cyclic(void)
{
	uint_t	i, j;
	CYCCB	*p_cyccb;
	CYCINIB	*p_cycinib;

	for (i = 0; i < tnum_scyc; i++) {
		p_cyccb = &(cyccb_table[i]);
		p_cyccb->p_cycinib = &(cycinib_table[i]);
		if ((p_cyccb->p_cycinib->cycatr & TA_STA) != 0U) {
			p_cyccb->cycsta = true;
			tmevtb_enqueue_cyc(p_cyccb, (EVTTIM)(p_cyccb->p_cycinib->cycphs));
		}
		else {
			p_cyccb->cycsta = false;
		}
	}
	queue_initialize(&free_cyccb);
	for (j = 0; i < tnum_cyc; i++, j++) {
		p_cyccb = &(cyccb_table[i]);
		p_cycinib = &(acycinib_table[j]);
		p_cycinib->cycatr = TA_NOEXS;
		p_cyccb->p_cycinib = ((const CYCINIB *) p_cycinib);
		queue_insert_prev(&free_cyccb, ((QUEUE *) &(p_cyccb->tmevtb)));
	}
}
Example #14
0
void
initialize_pridataq(void)
{
	uint_t	i;
	PDQCB	*p_pdqcb;

	for (i = 0; i < tnum_pdq; i++) {
		p_pdqcb = &(pdqcb_table[i]);
		queue_initialize(&(p_pdqcb->swait_queue));
		p_pdqcb->p_pdqinib = &(pdqinib_table[i]);
		queue_initialize(&(p_pdqcb->rwait_queue));
		p_pdqcb->count = 0U;
		p_pdqcb->p_head = NULL;
		p_pdqcb->unused = 0U;
		p_pdqcb->p_freelist = NULL;
	}
}
Example #15
0
void
initialize_time_event(void)
{
	/* 変数の初期化 */
	current_time = 0U;
	min_time = 0U;
	
	/* タイムイベントキューの初期化 */
	queue_initialize(&TMEVT_HEAD() , (QUEIDX)tnum_tmevt_queue);
}
Example #16
0
void
initialize_messagebuf(void)
{
	uint_t	i;
	MBFCB	*p_mbfcb;

	mbfhook_dequeue_wobj = messagebuf_dequeue_wobj;
	mbfhook_change_priority = messagebuf_change_priority;

	for (i = 0; i < tnum_mbf; i++) {
		p_mbfcb = &(mbfcb_table[i]);
		queue_initialize(&(p_mbfcb->swait_queue));
		p_mbfcb->p_mbfinib = &(mbfinib_table[i]);
		queue_initialize(&(p_mbfcb->rwait_queue));
		p_mbfcb->fmbfsz = p_mbfcb->p_mbfinib->mbfsz;
		p_mbfcb->head = 0U;
		p_mbfcb->tail = 0U;
		p_mbfcb->smbfcnt = 0U;
	}
}
Example #17
0
/*
 *  eventflag initialization
 */
void
initialize_eventflag(void)
{
	uint_t	i, j;
	FLGCB	*p_flgcb;
	FLGINIB	*p_flginib;

	for (p_flgcb = flgcb_table, i = 0; i < tnum_sflg; p_flgcb++, i++) {
		queue_initialize(&(p_flgcb->wait_queue));
		p_flgcb->p_flginib = &(flginib_table[i]);
		p_flgcb->flgptn = p_flgcb->p_flginib->iflgptn;
	}
	queue_initialize(&free_flgcb);
	for (j = 0; i < tnum_flg; p_flgcb++, i++, j++) {
		p_flginib = &(aflginib_table[j]);
		p_flginib->flgatr = TA_NOEXS;
		p_flgcb->p_flginib = ((const FLGINIB *) p_flginib);
		queue_insert_prev(&free_flgcb, &(p_flgcb->wait_queue));
	}
}
Example #18
0
void
eventflag_initialize(void)
{
    UINT	i;
    FLGCB	*flgcb;

    for (flgcb = flgcb_table, i = 0; i < TNUM_FLG; flgcb++, i++) {
        queue_initialize(&(flgcb->wait_queue));
        flgcb->flginib = &(flginib_table[i]);
        flgcb->flgptn = flgcb->flginib->iflgptn;
    }
}
Example #19
0
void
semaphore_initialize()
{
	UINT	i;
	SEMCB	*semcb;

	for (semcb = semcb_table, i = 0; i < TNUM_SEM; semcb++, i++) {
		queue_initialize(&(semcb->wait_queue));
		semcb->seminib = &(seminib_table[i]);
		semcb->semcnt = semcb->seminib->isemcnt;
	}
}
Example #20
0
void
mailbox_initialize()
{
	UINT	i;
	MBXCB	*mbxcb;

	for (mbxcb = mbxcb_table, i = 0; i < TNUM_MBX; mbxcb++, i++) {
		queue_initialize(&(mbxcb->wait_queue));
		mbxcb->mbxinib = &(mbxinib_table[i]);
		mbxcb->head = NULL;
	}
}
Example #21
0
void
initialize_eventflag(void)
{
	uint_t	i;
	FLGCB	*p_flgcb;

	for (p_flgcb = flgcb_table, i = 0; i < tnum_flg; p_flgcb++, i++) {
		queue_initialize(&(p_flgcb->wait_queue));
		p_flgcb->p_flginib = &(flginib_table[i]);
		p_flgcb->flgptn = p_flgcb->p_flginib->iflgptn;
	}
}
Example #22
0
void
initialize_mailbox(void)
{
	uint_t	i;
	MBXCB	*p_mbxcb;

	for (p_mbxcb = mbxcb_table, i = 0; i < tnum_mbx; p_mbxcb++, i++) {
		queue_initialize(&(p_mbxcb->wait_queue));
		p_mbxcb->p_mbxinib = &(mbxinib_table[i]);
		p_mbxcb->pk_head = NULL;
	}
}
Example #23
0
/*
 *  initial the interrupt service routine
 */
void
initialize_isr(void)
{
	uint_t	i, j;
	ISRCB	*p_isrcb;
	ISRINIB	*p_isrinib;

	for (i = 0; i < tnum_isr_queue; i++) {
		queue_initialize(&(isr_queue_table[i]));
	}
	for (p_isrcb = isrcb_table, i = 0; i < tnum_sisr; p_isrcb++, i++) {
		p_isrcb->p_isrinib = &(sisrinib_table[i]);
		enqueue_isr(p_isrcb->p_isrinib->p_isr_queue, p_isrcb);
	}
	queue_initialize(&free_isrcb);
	for (j = 0; i < tnum_isr; p_isrcb++, i++, j++) {
		p_isrinib = &(aisrinib_table[j]);
		p_isrinib->isratr = TA_NOEXS;
		p_isrcb->p_isrinib = ((const ISRINIB *) p_isrinib);
		queue_insert_prev(&free_isrcb, &(p_isrcb->isr_queue));
	}
}
Example #24
0
/* 
 *  セマフォ機能の初期化
 */
void
initialize_semaphore(void)
{
	uint_t	i, j;
	SEMCB	*p_semcb;
	SEMINIB	*p_seminib;

	for (i = 0; i < tnum_ssem; i++) {
		p_semcb = &(semcb_table[i]);
		queue_initialize(&(p_semcb->wait_queue));
		p_semcb->p_seminib = &(seminib_table[i]);
		p_semcb->semcnt = p_semcb->p_seminib->isemcnt;
	}
	queue_initialize(&free_semcb);
	for (j = 0; i < tnum_sem; i++, j++) {
		p_semcb = &(semcb_table[i]);
		p_seminib = &(aseminib_table[j]);
		p_seminib->sematr = TA_NOEXS;
		p_semcb->p_seminib = ((const SEMINIB *) p_seminib);
		queue_insert_prev(&free_semcb, &(p_semcb->wait_queue));
	}
}
Example #25
0
void
initialize_messagebuf(void)
{
	uint_t			i, j, k;
	ID				domid;
	MBFCB			*p_mbfcb;
	const DOMINIB	*p_dominib;

	mbfhook_dequeue_wobj = messagebuf_dequeue_wobj;

	for (i = 0; i < tnum_smbf; i++) {
		p_mbfcb = &(mbfcb_table[i]);
		queue_initialize(&(p_mbfcb->swait_queue));
		p_mbfcb->p_mbfinib = &(mbfinib_table[i]);
		queue_initialize(&(p_mbfcb->rwait_queue));
		p_mbfcb->fmbfsz = p_mbfcb->p_mbfinib->mbfsz;
		p_mbfcb->head = 0U;
		p_mbfcb->tail = 0U;
		p_mbfcb->smbfcnt = 0U;
	}

	queue_initialize(&(dominib_kernel.p_domcb->free_mbfcb));
	for (j = 0; j < dominib_kernel.tnum_ambfid; i++, j++) {
		initialize_mbfcb(&(mbfcb_table[i]), &(ambfinib_table[j]),
													&dominib_kernel);
	}
	for (domid = TMIN_DOMID; domid <= tmax_domid; domid++) {
		p_dominib = get_dominib(domid);
		queue_initialize(&(p_dominib->p_domcb->free_mbfcb));
		for (k = 0; k < p_dominib->tnum_ambfid; i++, j++, k++) {
			initialize_mbfcb(&(mbfcb_table[i]), &(ambfinib_table[j]),
															p_dominib);
		}
	}
	for (k = 0; k < dominib_none.tnum_ambfid; i++, j++, k++) {
		initialize_mbfcb(&(mbfcb_table[i]), &(ambfinib_table[j]),
													&dominib_none);
	}
}
Example #26
0
void
initialize_mempfix(void)
{
	uint_t	i;
	MPFCB	*p_mpfcb;

	for (p_mpfcb = mpfcb_table, i = 0; i < tnum_mpf; p_mpfcb++, i++) {
		queue_initialize(&(p_mpfcb->wait_queue));
		p_mpfcb->p_mpfinib = &(mpfinib_table[i]);
		p_mpfcb->fblkcnt = p_mpfcb->p_mpfinib->blkcnt;
		p_mpfcb->unused = 0U;
		p_mpfcb->freelist = INDEX_NULL;
	}
}
Example #27
0
/*
 *  データキュー機能の初期化
 */
void
initialize_dataqueue(void)
{
	uint_t	i, j;
	DTQCB	*p_dtqcb;
	DTQINIB	*p_dtqinib;

	for (p_dtqcb = dtqcb_table, i = 0; i < tnum_sdtq; p_dtqcb++, i++) {
		queue_initialize(&(p_dtqcb->swait_queue));
		p_dtqcb->p_dtqinib = &(dtqinib_table[i]);
		queue_initialize(&(p_dtqcb->rwait_queue));
		p_dtqcb->count = 0U;
		p_dtqcb->head = 0U;
		p_dtqcb->tail = 0U;
	}
	queue_initialize(&free_dtqcb);
	for (j = 0; i < tnum_dtq; p_dtqcb++, i++, j++) {
		p_dtqinib = &(adtqinib_table[j]);
		p_dtqinib->dtqatr = TA_NOEXS;
		p_dtqcb->p_dtqinib = ((const DTQINIB *) p_dtqinib);
		queue_insert_prev(&free_dtqcb, &(p_dtqcb->swait_queue));
	}
}
Example #28
0
int main(void)
{
	queue_t *queue;
	int errcode;
	size_t counter = 0,integer,integer_;
	queue = queue_initialize(sizeof(int),NULL);
	if(!queue){
		fputs("Error!\n",stderr);
		return -1;
	}
	while(counter != 128){
		integer = counter+10;
		errcode = queue_enqueue(queue,&integer);
		if(errcode){
			fputs("Error!\n",stderr);
			queue_release(queue);
			return -1;
		}
		counter++;
	}
	counter = 0;
	while(counter != 32){
		errcode = queue_dequeue(queue,&integer);
		if(errcode){
			fputs("Error!\n",stderr);
			queue_release(queue);
			return -1;
		}
		counter++;
	}
	counter = 0;
	while(counter != queue_size(queue)){
		errcode = queue_refer_from_front(queue,counter,&integer);
		if(errcode){
			fputs("Error!\n",stderr);
			queue_release(queue);
			return -1;
		}
		errcode = queue_refer_from_back(queue,counter,&integer_);
		if(errcode){
			fputs("Error!\n",stderr);
			queue_release(queue);
			return -1;
		}
		fprintf(stdout,"%03d : %03d %03d\n",counter,integer,integer_);
		counter++;
	}
	queue_release(queue);
	return 0;
}
Example #29
0
void
initialize_mutex(void)
{
	uint_t			i, j, k;
	ID				domid;
	MTXCB			*p_mtxcb;
	const DOMINIB	*p_dominib;

	mtxhook_check_ceilpri = mutex_check_ceilpri;
	mtxhook_scan_ceilmtx = mutex_scan_ceilmtx;
	mtxhook_release_all = mutex_release_all;

	for (i = 0; i < tnum_smtx; i++) {
		p_mtxcb = &(mtxcb_table[i]);
		queue_initialize(&(p_mtxcb->wait_queue));
		p_mtxcb->p_mtxinib = &(mtxinib_table[i]);
		p_mtxcb->p_loctsk = NULL;
	}

	queue_initialize(&(dominib_kernel.p_domcb->free_mtxcb));
	for (j = 0; j < dominib_kernel.tnum_amtxid; i++, j++) {
		initialize_mtxcb(&(mtxcb_table[i]), &(amtxinib_table[j]),
													&dominib_kernel);
	}
	for (domid = TMIN_DOMID; domid <= tmax_domid; domid++) {
		p_dominib = get_dominib(domid);
		queue_initialize(&(p_dominib->p_domcb->free_mtxcb));
		for (k = 0; k < p_dominib->tnum_amtxid; i++, j++, k++) {
			initialize_mtxcb(&(mtxcb_table[i]), &(amtxinib_table[j]),
															p_dominib);
		}
	}
	for (k = 0; k < dominib_none.tnum_amtxid; i++, j++, k++) {
		initialize_mtxcb(&(mtxcb_table[i]), &(amtxinib_table[j]),
													&dominib_none);
	}
}
Example #30
0
/*
 *  固定長メモリプール機能の初期化
 */
void
initialize_mempfix(void)
{
	uint_t	i, j;
	MPFCB	*p_mpfcb;
	MPFINIB	*p_mpfinib;

	for (i = 0; i < tnum_smpf; i++) {
		p_mpfcb = &(mpfcb_table[i]);
		queue_initialize(&(p_mpfcb->wait_queue));
		p_mpfcb->p_mpfinib = &(mpfinib_table[i]);
		p_mpfcb->fblkcnt = p_mpfcb->p_mpfinib->blkcnt;
		p_mpfcb->unused = 0U;
		p_mpfcb->freelist = INDEX_NULL;
	}
	queue_initialize(&free_mpfcb);
	for (j = 0; i < tnum_mpf; i++, j++) {
		p_mpfcb = &(mpfcb_table[i]);
		p_mpfinib = &(ampfinib_table[j]);
		p_mpfinib->mpfatr = TA_NOEXS;
		p_mpfcb->p_mpfinib = ((const MPFINIB *) p_mpfinib);
		queue_insert_prev(&free_mpfcb, &(p_mpfcb->wait_queue));
	}
}