From a789d4e97b114551c4d63437497e84189332b997 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Thu, 16 Apr 2015 12:28:37 +0300 Subject: [PATCH] nanokernel: Add scheduling context-independent API for starting fibers When the exact scheduling context is not known it's convenient not to have to spell out the context in the name of the *_fiber_start() function. All of the fiber starting APIs map to the same _FiberStart() implementation, so all we have to do is to declare another alias for it. Change-Id: Ic6862383422f89ad7dc4f401e76d610826163bb9 Signed-off-by: Johan Hedberg --- include/nanokernel.h | 9 +++++++++ kernel/nanokernel/core/nanofiber.c | 1 + 2 files changed, 10 insertions(+) diff --git a/include/nanokernel.h b/include/nanokernel.h index 740ef2f6989..5e82cfff7ff 100644 --- a/include/nanokernel.h +++ b/include/nanokernel.h @@ -68,6 +68,15 @@ extern int _context_essential_check(tCCS *pCtx); /* fiber APIs */ +/* scheduling context independent method (when context is not known) */ +void fiber_start(char *stack, + unsigned stack_size, + nano_fiber_entry_t entry, + int arg1, + int arg2, + unsigned prio, + unsigned options); + /* methods for fibers */ extern void fiber_fiber_start(char *pStack, unsigned int stackSize, diff --git a/kernel/nanokernel/core/nanofiber.c b/kernel/nanokernel/core/nanofiber.c index 0b1099574cd..1eb17ec5c30 100644 --- a/kernel/nanokernel/core/nanofiber.c +++ b/kernel/nanokernel/core/nanofiber.c @@ -140,6 +140,7 @@ int _context_essential_check(tCCS *pCtx /* pointer to context */ FUNC_ALIAS(_fiber_start, fiber_fiber_start, void); FUNC_ALIAS(_fiber_start, task_fiber_start, void); +FUNC_ALIAS(_fiber_start, fiber_start, void); /******************************************************************************* *