예제 #1
0
ER
ista_alm(ID almid, RELTIM almtim)
{
	ALMCB	*p_almcb;
	ER		ercd;

	LOG_ISTA_ALM_ENTER(almid, almtim);
	CHECK_INTCTX_UNL();
	CHECK_ALMID(almid);
	CHECK_PAR(almtim <= TMAX_RELTIM);
	p_almcb = get_almcb(almid);

	i_lock_cpu();
	if (p_almcb->p_alminib->almatr == TA_NOEXS) {
		ercd = E_NOEXS;
	}
	else if (p_almcb->almsta) {
		tmevtb_dequeue(&(p_almcb->tmevtb));
	}
	else {
		p_almcb->almsta = true;
	}
	tmevtb_enqueue(&(p_almcb->tmevtb), almtim,
								(CBACK) call_almhdr, (void *) p_almcb);
	ercd = E_OK;
	i_unlock_cpu();

  error_exit:
	LOG_ISTA_ALM_LEAVE(ercd);
	return(ercd);
}
예제 #2
0
파일: task_sync.c 프로젝트: qreal/nxt-tools
SYSCALL ER
dly_tsk(RELTIM dlytim)
{
	WINFO	winfo;
	TMEVTB	tmevtb;
	ER	ercd;

	LOG_DLY_TSK_ENTER(dlytim);
	CHECK_DISPATCH();
	CHECK_PAR(dlytim <= TMAX_RELTIM);

	t_lock_cpu();
	runtsk->tstat = TS_WAITING;
	make_non_runnable(runtsk);
	runtsk->winfo = &winfo;
	winfo.tmevtb = &tmevtb;
	tmevtb_enqueue(&tmevtb, dlytim, (CBACK) wait_tmout_ok, (VP) runtsk);
	LOG_TSKSTAT(runtsk);
	dispatch();
	ercd = winfo.wercd;
	t_unlock_cpu();

    exit:
	LOG_DLY_TSK_LEAVE(ercd);
	return(ercd);
}
예제 #3
0
ER
dly_tsk(RELTIM dlytim)
{
	WINFO	winfo;
	TMEVTB	tmevtb;
	ER		ercd;

	LOG_DLY_TSK_ENTER(dlytim);
	CHECK_DISPATCH();
	CHECK_PAR(VALID_RELTIM(dlytim));

	lock_cpu_dsp();
	if (p_runtsk->raster) {
		ercd = E_RASTER;
	}
	else {
		p_runtsk->tstat = TS_WAITING_DLY;
		make_non_runnable(p_runtsk);
		p_runtsk->p_winfo = &winfo;
		winfo.p_tmevtb = &tmevtb;
		tmevtb.callback = (CBACK) wait_tmout_ok;
		tmevtb.arg = (void *) p_runtsk;
		tmevtb_enqueue(&tmevtb, dlytim);
		LOG_TSKSTAT(p_runtsk);
		dispatch();
		ercd = winfo.wercd;
	}
	unlock_cpu_dsp();

  error_exit:
	LOG_DLY_TSK_LEAVE(ercd);
	return(ercd);
}
예제 #4
0
ER
sta_alm(ID almid, RELTIM almtim)
{
    ALMCB	*p_almcb;
    ER		ercd;

    LOG_STA_ALM_ENTER(almid, almtim);
    CHECK_UNL();
    CHECK_ID(VALID_ALMID(almid));
    CHECK_PAR(VALID_RELTIM(almtim));
    p_almcb = get_almcb(almid);

    lock_cpu();
    if (p_almcb->almsta) {
        tmevtb_dequeue(&(p_almcb->tmevtb));
    }
    else {
        p_almcb->almsta = true;
    }
    tmevtb_enqueue(&(p_almcb->tmevtb), almtim);
    ercd = E_OK;
    unlock_cpu();

error_exit:
    LOG_STA_ALM_LEAVE(ercd);
    return(ercd);
}
예제 #5
0
ER
dly_tsk(RELTIM dlytim)
{
	WINFO	winfo;
	TMEVTB	tmevtb;
	ER		ercd;

	LOG_DLY_TSK_ENTER(dlytim);
	CHECK_DISPATCH();
	CHECK_PAR(dlytim <= TMAX_RELTIM);

	t_lock_cpu();
	if (p_runtsk->waifbd) {
		ercd = E_RLWAI;
	}
	else {
		p_runtsk->tstat = (TS_WAITING | TS_WAIT_DLY);
		(void) make_non_runnable(p_runtsk);
		p_runtsk->p_winfo = &winfo;
		winfo.p_tmevtb = &tmevtb;
		tmevtb_enqueue(&tmevtb, dlytim, (CBACK) wait_tmout_ok,
												(void *) p_runtsk);
		LOG_TSKSTAT(p_runtsk);
		dispatch();
		ercd = winfo.wercd;
	}
	t_unlock_cpu();

  error_exit:
	LOG_DLY_TSK_LEAVE(ercd);
	return(ercd);
}
예제 #6
0
파일: wait.c 프로젝트: zaurus04/cortexm3
void
make_wait_tmout(WINFO *p_winfo, TMEVTB *p_tmevtb, TMO tmout)
{
	(void) make_non_runnable(p_runtsk);
	p_runtsk->p_winfo = p_winfo;
	if (tmout > 0) {
		p_winfo->p_tmevtb = p_tmevtb;
		tmevtb_enqueue(p_tmevtb, (RELTIM) tmout,
						(CBACK) wait_tmout, (void *) p_runtsk);
	}
	else {
		assert(tmout == TMO_FEVR);
		p_winfo->p_tmevtb = NULL;
	}
}
예제 #7
0
파일: wait.c 프로젝트: Ashatta/tools
void
make_wait_tmout(WINFO *winfo, TMEVTB *tmevtb, TMO tmout)
{
	make_non_runnable(runtsk);
	runtsk->winfo = winfo;
	if (tmout > 0) {
		winfo->tmevtb = tmevtb;
		tmevtb_enqueue(tmevtb, (RELTIM) tmout,
					(CBACK) wait_tmout, (VP) runtsk);
	}
	else {
		assert(tmout == TMO_FEVR);
		winfo->tmevtb = NULL;
	}
}
예제 #8
0
void
make_wait_tmout(WINFO *p_winfo, TMEVTB *p_tmevtb, TMO tmout)
{
	make_non_runnable(p_runtsk);
	p_runtsk->p_winfo = p_winfo;
	if (tmout == TMO_FEVR) {
		p_winfo->p_tmevtb = NULL;
	}
	else {
		assert(tmout <= TMAX_RELTIM);
		p_winfo->p_tmevtb = p_tmevtb;
		p_tmevtb->callback = (CBACK) wait_tmout;
		p_tmevtb->arg = (void *) p_runtsk;
		tmevtb_enqueue(p_tmevtb, (RELTIM) tmout);
	}
}