* Copyright 1999, 2000, 2001, 2008 Bernie Innocenti <bernie@codewiz.org>
* -->
*
+ * \defgroup kern Kernel facilities
+ * \{
+ *
+ * \defgroup kern_proc Process (Threads) management
+ * \{
+ *
* \brief BeRTOS Kernel core (Process scheduler).
*
- * \version $Id$
* \author Bernie Innocenti <bernie@codewiz.org>
*
* $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"
*/
#include <struct/list.h> // Node, PriNode
#include <cfg/compiler.h>
-
-#if CONFIG_KERN_PREEMPT
- #include <cfg/debug.h> // ASSERT()
- #include <kern/preempt.h>
-#endif
+#include <cfg/debug.h> // ASSERT()
#include <cpu/types.h> // cpu_stack_t
#include <cpu/frame.h> // CPU_SAVED_REGS_CNT
* 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
- #define preempt_init proc_schedInit
-#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
- #define proc_schedInit __proc_noop
+INLINE void proc_preempt(void)
+{
+}
#endif
void proc_rename(struct Process *proc, const char *name);
* 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);
#error No cpu_stack_t size supported!
#endif
#endif
+/** \} */ //defgroup kern_proc
+/** \} */ //defgroup kern
#endif /* KERN_PROC_H */