X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=bertos%2Fkern%2Fcoop.c;h=078724b42a8e38095fb93e3c6e226d2e2b5e2d70;hb=57fa5e371a8b40afc99b922731b77d17c55330a4;hp=542ed67844a7dc0acddb63196369c68572a50c31;hpb=f149112c04843df99b2c9e9fd2ef47d9cacae8a4;p=bertos.git diff --git a/bertos/kern/coop.c b/bertos/kern/coop.c index 542ed678..078724b4 100644 --- a/bertos/kern/coop.c +++ b/bertos/kern/coop.c @@ -26,78 +26,7 @@ * invalidate any other reasons why the executable file might be covered by * the GNU General Public License. * - * Copyright 2001, 2004, 2008 Develer S.r.l. (http://www.develer.com/) - * Copyright 1999, 2000, 2001, 2008 Bernie Innocenti - * --> - * - * \brief Simple cooperative multitasking scheduler. - * - * \version $Id$ - * \author Bernie Innocenti - * \author Stefano Fedrigo - */ - -#include "proc_p.h" -#include "proc.h" - -// Log settings for cfg/log.h. -#define LOG_LEVEL KERN_LOG_LEVEL -#define LOG_FORMAT KERN_LOG_FORMAT -#include - -#include -#include -#include -#include - -/** - * Define function prototypes exported outside. - * - * Required to silent gcc "no previous prototype" warnings. - */ -void coop_yield(void); -void coop_switch(void); -void coop_wakeup(Process *proc); - -/** - * Give the control of the CPU to another process. - * - * \note Assume the current process has been already added to a wait queue. + * \note This file is deprecated and kept only for backward compatibility. * - * \warning This should be considered an internal kernel function, even if it - * is allowed, usage from application code is strongly discouraged. - */ -void coop_switch(void) -{ - ATOMIC(proc_schedule()); -} - -/** - * Immediately wakeup a process, dispatching it to the CPU. - */ -void coop_wakeup(Process *proc) -{ - ASSERT(proc_preemptAllowed()); - ASSERT(current_process); - IRQ_ASSERT_DISABLED(); - - if (prio_proc(proc) >= prio_curr()) - { - Process *old_process = current_process; - - SCHED_ENQUEUE(current_process); - current_process = proc; - proc_switchTo(current_process, old_process); - } - else - SCHED_ENQUEUE_HEAD(proc); -} - -/** - * Co-operative context switch + * --> */ -void coop_yield(void) -{ - ATOMIC(SCHED_ENQUEUE(current_process)); - coop_switch(); -}