u32 enqueue_evt(struct evt_priv *pevtpriv, struct evt_obj *obj) { _irqL irqL; int res; _queue *queue = &(pevtpriv->evt_queue); _func_enter_; res = _SUCCESS; if(obj == NULL) { res = _FAIL; goto exit; } _enter_critical_ex(&(queue->lock), &irqL); list_insert_tail(&(obj->list),&(queue->queue)); _exit_critical_ex(&(queue->lock), &irqL); //evt_notify_isr(pevtpriv); exit: _func_exit_; return res; }
struct evt_obj* dequeue_evt(_queue *queue) { _irqL irqL; struct evt_obj *pevtobj; _func_enter_; _enter_critical_ex(&queue->lock, &irqL); if (is_list_empty(&(queue->queue))) pevtobj = NULL; else { pevtobj = LIST_CONTAINOR(get_next(&(queue->queue)), struct evt_obj, list); list_delete(&pevtobj->list); } _exit_critical_ex(&queue->lock, &irqL); _func_exit_; return pevtobj; }