OS_SEM_CTR OSTaskSemPost (OS_TCB *p_tcb,
OS_OPT opt,
OS_ERR *p_err)
File | Called from | Code enabled by |
---|---|---|
| Task or ISR | Always enabled |
...
Description
OSTaskSemPost()
sends a signal to a task through it’s local semaphore.
If the task receiving the signal is actually waiting for a signal to be received, it will be made ready-to-run and, if the receiving task has a higher priority than the task sending the signal, the higher-priority task resumes, and the task sending the signal is suspended; that is, a context switch occurs. Note that scheduling only occurs if if opt
is is set to to OS_OPT_POST_NONE
, because the the OS_OPT_POST_NO_SCHED
option option does not cause the scheduler to be called.
Files
os.h/os_task.c
Prototype
Arguments
p_tcb
is a pointer to the TCB of the task being signaled. A NULL
pointer indicates that the user is sending a signal to itself.
...
If the call was successful and the signal was sent.
OS_ERR_INT_Q_FULL
If OS_CFG_ISR_POST_DEFERRED_EN
is to DEF_ENABLED
in os_cfg.h
: If the deferred interrupt post queue is full.
OS_ERR_OPT_INVALID
If OS_CFG_ARG_CHK_EN
is set to DEF_ENABLED
in os_cfg.h
: if a valid option is not specified.
OS_ERR_OS_NOT_RUNNING
If OS_CFG_INVALID_OS_CALLS_CHK_EN
is set to DEF_ENABLED
in os_cfg.h
: if µC/OS-III is not running yet.
OS_ERR_SEM_OVF
the post would have caused the semaphore counter to overflow.
OS_ERR_STATE_INVALID
If the task is in an invalid state.
Returned Value
The current value of the task’s signal counter, or 0
if called from an ISR and OS_CFG_ISR_POST_DEFERRED_EN
is set to 1to DEF_ENABLED
.
Required Configuration
Always enabled.
Callers
Application and ISRs.
Notes/Warnings
...
- Do not call
OSTaskSemPost()
from an ISR.