nanokernel: Add routines for waking a fiber
Adds the following routines for waking a fiber that was previously put to sleep using fiber_sleep(). isr_fiber_wakeup() fiber_fiber_wakeup() task_fiber_wakeup() Change-Id: I7d78ee6997163d71b92f388a7b4c484f2e97862b Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
This commit is contained in:
parent
cee79a7ca9
commit
b4313cef6f
|
@ -244,6 +244,42 @@ extern void fiber_abort(void);
|
|||
*/
|
||||
extern void fiber_sleep(int32_t timeout_in_ticks);
|
||||
|
||||
/**
|
||||
* @brief Wake the specified fiber from sleep
|
||||
*
|
||||
* This routine wakes the fiber specified by @a fiber from its sleep.
|
||||
* It may only be called from an ISR.
|
||||
*
|
||||
* @param fiber Identifies fiber to wake
|
||||
*
|
||||
* @return N/A
|
||||
*/
|
||||
extern void isr_fiber_wakeup(nano_thread_id_t fiber);
|
||||
|
||||
/**
|
||||
* @brief Wake the specified fiber from sleep
|
||||
*
|
||||
* This routine wakes the fiber specified by @a fiber from its sleep.
|
||||
* It may only be called from a fiber.
|
||||
*
|
||||
* @param fiber Identifies fiber to wake
|
||||
*
|
||||
* @return N/A
|
||||
*/
|
||||
extern void fiber_fiber_wakeup(nano_thread_id_t fiber);
|
||||
|
||||
/**
|
||||
* @brief Wake the specified fiber from sleep
|
||||
*
|
||||
* This routine wakes the fiber specified by @a fiber from its sleep.
|
||||
* It may only be called from a task.
|
||||
*
|
||||
* @param fiber Identifies fiber to wake
|
||||
*
|
||||
* @return N/A
|
||||
*/
|
||||
extern void task_fiber_wakeup(nano_thread_id_t fiber);
|
||||
|
||||
#ifndef CONFIG_MICROKERNEL
|
||||
/**
|
||||
* @brief Put the task to sleep.
|
||||
|
|
|
@ -41,6 +41,29 @@ void fiber_sleep(int32_t timeout_in_ticks)
|
|||
_Swap(key);
|
||||
}
|
||||
|
||||
FUNC_ALIAS(_fiber_wakeup, isr_fiber_wakeup, void);
|
||||
FUNC_ALIAS(_fiber_wakeup, fiber_fiber_wakeup, void);
|
||||
|
||||
void _fiber_wakeup(nano_thread_id_t fiber)
|
||||
{
|
||||
int key;
|
||||
|
||||
key = irq_lock();
|
||||
_nano_timeout_abort(fiber);
|
||||
_nano_fiber_ready(fiber);
|
||||
irq_unlock(key);
|
||||
}
|
||||
|
||||
void task_fiber_wakeup(nano_thread_id_t fiber)
|
||||
{
|
||||
int key;
|
||||
|
||||
key = irq_lock();
|
||||
_nano_timeout_abort(fiber);
|
||||
_nano_fiber_ready(fiber);
|
||||
_Swap(key);
|
||||
}
|
||||
|
||||
#ifndef CONFIG_MICROKERNEL
|
||||
void task_sleep(int32_t timeout_in_ticks)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue