ER pol_flg(ID flgid, FLGPTN waiptn, MODE wfmode, FLGPTN *p_flgptn) { FLGCB *p_flgcb; ER ercd; LOG_POL_FLG_ENTER(flgid, waiptn, wfmode, p_flgptn); CHECK_TSKCTX_UNL(); CHECK_FLGID(flgid); CHECK_PAR(waiptn != 0U); CHECK_PAR(wfmode == TWF_ORW || wfmode == TWF_ANDW); p_flgcb = get_flgcb(flgid); t_lock_cpu(); if (p_flgcb->p_flginib->flgatr == TA_NOEXS) { ercd = E_NOEXS; } else if ((p_flgcb->p_flginib->flgatr & TA_WMUL) == 0U && !queue_empty(&(p_flgcb->wait_queue))) { ercd = E_ILUSE; } else if (check_flg_cond(p_flgcb, waiptn, wfmode, p_flgptn)) { ercd = E_OK; } else { ercd = E_TMOUT; } t_unlock_cpu(); error_exit: LOG_POL_FLG_LEAVE(ercd, *p_flgptn); return(ercd); }
SYSCALL ER pol_flg(ID flgid, FLGPTN waiptn, MODE wfmode, FLGPTN *p_flgptn) { FLGCB *flgcb; ER ercd; LOG_POL_FLG_ENTER(flgid, waiptn, wfmode, p_flgptn); CHECK_TSKCTX_UNL(); CHECK_FLGID(flgid); CHECK_PAR(waiptn != 0); CHECK_PAR((wfmode & ~TWF_ORW) == 0); flgcb = get_flgcb(flgid); t_lock_cpu(); if (!(queue_empty(&(flgcb->wait_queue)))) { ercd = E_ILUSE; } else if (eventflag_cond(flgcb, waiptn, wfmode, p_flgptn)) { ercd = E_OK; } else { ercd = E_TMOUT; } t_unlock_cpu(); exit: LOG_POL_FLG_LEAVE(ercd, *p_flgptn); return(ercd); }