/** * INTERNAL * This function is capable of supporting invocations from both a fiber and an * ISR context. However, the nano_isr_sem_give and nano_fiber_sem_give aliases * are created to support any required implementation differences in the future * without introducing a source code migration issue. */ void _sem_give_non_preemptible(struct nano_sem *sem) { tCCS *ccs; unsigned int imask; imask = irq_lock_inline(); ccs = _nano_wait_q_remove(&sem->wait_q); if (!ccs) { sem->nsig++; } else { _nano_timeout_abort(ccs); set_sem_available(ccs); } irq_unlock_inline(imask); }
/** INTERNAL * * This function is capable of supporting invocations from both a fiber and an * ISR context. However, the nano_isr_lifo_put and nano_fiber_lifo_put aliases * are created to support any required implementation differences in the future * without introducing a source code migration issue. */ void _lifo_put_non_preemptible(struct nano_lifo *lifo, void *data) { tCCS *ccs; unsigned int imask; imask = irq_lock_inline(); ccs = _nano_wait_q_remove(&lifo->wait_q); if (ccs) { _nano_timeout_abort(ccs); fiberRtnValueSet(ccs, (unsigned int) data); } else { *(void **) data = lifo->list; lifo->list = data; } irq_unlock_inline(imask); }
void nano_task_sem_give(struct nano_sem *sem) { tCCS *ccs; unsigned int imask; imask = irq_lock_inline(); ccs = _nano_wait_q_remove(&sem->wait_q); if (ccs) { _nano_timeout_abort(ccs); set_sem_available(ccs); _Swap(imask); return; } else { sem->nsig++; } irq_unlock_inline(imask); }
void nano_task_lifo_put(struct nano_lifo *lifo, void *data) { struct tcs *tcs; unsigned int imask; imask = irq_lock(); tcs = _nano_wait_q_remove(&lifo->wait_q); if (tcs) { _nano_timeout_abort(tcs); fiberRtnValueSet(tcs, (unsigned int) data); _Swap(imask); return; } *(void **) data = lifo->list; lifo->list = data; irq_unlock(imask); }