Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Next »

OS_SEM_CTR  OSTaskSemPost (OS_TCB    *p_tcb,
                           OS_OPT     opt,
                           OS_ERR    *p_err)

File

Called from

Code enabled by

os_task.c

Task or ISR

Always enabled

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 opt is set to OS_OPT_POST_NONE, because the OS_OPT_POST_NO_SCHED option does not cause the scheduler to be called.

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.

opt

provides options to the call.

OS_OPT_POST_NONE

No option, by default the scheduler will be called.

OS_OPT_POST_NO_SCHED

Do not call the scheduler after the post, therefore the caller is resumed.

You would use this option if the task (or ISR) calling OSTaskSemPost() will be doing additional posts, reschedule waits until all is done, and multiple posts are to take effect simultaneously.

p_err

is a pointer to a variable that will contain an error code returned by this function.

OS_ERR_NONE

if the call was successful and the signal was sent.

OS_ERR_SEM_OVF

the post would have caused the semaphore counter to overflow.

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 1.

Notes/Warnings

None

Example

  • No labels