X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=bertos%2Fkern%2Fproc.h;h=e1181747326224a6d4439cbf7298d5a4656a3601;hb=bfe473a7e8951b16edbd6559b828a37e6ce378aa;hp=390099da4b771789c5aa55741526f25284163330;hpb=d9d931610bca1df6ceb9227eacc9ff2c7f89b77a;p=bertos.git diff --git a/bertos/kern/proc.h b/bertos/kern/proc.h index 390099da..e1181747 100644 --- a/bertos/kern/proc.h +++ b/bertos/kern/proc.h @@ -32,12 +32,11 @@ * * \brief BeRTOS Kernel core (Process scheduler). * - * \version $Id$ * \author Bernie Innocenti * * $WIZ$ module_name = "kernel" * $WIZ$ module_configuration = "bertos/cfg/cfg_proc.h" - * $WIZ$ module_depends = "switch_ctx", "coop", "preempt" + * $WIZ$ module_depends = "switch_ctx" * $WIZ$ module_supports = "not atmega103" */ @@ -51,11 +50,7 @@ #include // Node, PriNode #include - -#if CONFIG_KERN_PREEMPT - #include // ASSERT() - #include -#endif +#include // ASSERT() #include // cpu_stack_t #include // CPU_SAVED_REGS_CNT @@ -146,38 +141,19 @@ void proc_exit(void); * Public scheduling class methods. */ void proc_yield(void); -void proc_preempt(void); -int proc_needPreempt(void); -/** - * Dummy function that defines unimplemented scheduler class methods. - */ -INLINE void __proc_noop(void) +#if CONFIG_KERN_PREEMPT +bool proc_needPreempt(void); +void proc_preempt(void); +#else +INLINE bool proc_needPreempt(void) { + return false; } -#if CONFIG_KERN_PREEMPT - /** - * Preemptive scheduler public methods. - */ - #define preempt_yield proc_yield - #define preempt_needPreempt proc_needPreempt - #define preempt_preempt proc_preempt - /** - * Preemptive scheduler: private methods. - */ - #define preempt_switch proc_switch -#else - /** - * Co-operative scheduler: public methods. - */ - #define coop_yield proc_yield - #define proc_needPreempt __proc_noop - #define proc_preempt __proc_noop - /** - * Co-operative scheduler: private methods. - */ - #define coop_switch proc_switch +INLINE void proc_preempt(void) +{ +} #endif void proc_rename(struct Process *proc, const char *name); @@ -191,7 +167,11 @@ const char *proc_currentName(void); * the returned pointer to the correct type. * \return Pointer to the user data of the current process. */ -iptr_t proc_currentUserData(void); +INLINE iptr_t proc_currentUserData(void) +{ + extern struct Process *current_process; + return current_process->user_data; +} int proc_testSetup(void); int proc_testRun(void);