Refactor to use new protocol module and sipo.
[bertos.git] / bertos / kern / proc.h
index d4284ffd7210cb5af71451c61e3b2be6a872c228..19bb5efaa23a4ec10338382ff61de286b238cc55 100644 (file)
  * Copyright 1999, 2000, 2001, 2008 Bernie Innocenti <bernie@codewiz.org>
  * -->
  *
- * \defgroup kern Kernel facilities
- * \{
- *
  * \defgroup kern_proc Process (Threads) management
+ * \ingroup kern
  * \{
  *
  * \brief BeRTOS Kernel core (Process scheduler).
@@ -97,6 +95,7 @@
 #include "cfg/cfg_proc.h"
 #include "cfg/cfg_signal.h"
 #include "cfg/cfg_monitor.h"
+#include "sem.h"
 
 #include <struct/list.h> // Node, PriNode
 
 #include <cpu/types.h> // cpu_stack_t
 #include <cpu/frame.h> // CPU_SAVED_REGS_CNT
 
+/* The following silents warnings on nightly tests. We need to regenerate
+ * all the projects before this can be removed.
+ */
+#ifndef CONFIG_KERN_PRI_INHERIT
+#define CONFIG_KERN_PRI_INHERIT 0
+#endif
+
 /*
  * WARNING: struct Process is considered private, so its definition can change any time
  * without notice. DO NOT RELY on any field defined here, use only the interface
@@ -117,6 +123,12 @@ typedef struct Process
 {
 #if CONFIG_KERN_PRI
        PriNode      link;        /**< Link Process into scheduler lists */
+# if CONFIG_KERN_PRI_INHERIT
+       PriNode      inh_link;    /**< Link Process into priority inheritance lists */
+       List         inh_list;    /**< Priority inheritance list for this Process */
+       Semaphore    *inh_blocked_by;  /**< Semaphore blocking this Process */
+       int          orig_pri;    /**< Process priority without considering inheritance */
+# endif
 #else
        Node         link;        /**< Link Process into scheduler lists */
 #endif
@@ -124,8 +136,7 @@ typedef struct Process
        iptr_t       user_data;   /**< Custom data passed to the process */
 
 #if CONFIG_KERN_SIGNALS
-       sigmask_t    sig_wait;    /**< Signals the process is waiting for */
-       sigmask_t    sig_recv;    /**< Received signals */
+       Signal       sig;
 #endif
 
 #if CONFIG_KERN_HEAP
@@ -243,10 +254,20 @@ INLINE struct Process *proc_current(void)
 
 #if CONFIG_KERN_PRI
        void proc_setPri(struct Process *proc, int pri);
+
+       INLINE int proc_pri(struct Process *proc)
+       {
+               return proc->link.pri;
+       }
 #else
        INLINE void proc_setPri(UNUSED_ARG(struct Process *,proc), UNUSED_ARG(int, pri))
        {
        }
+
+       INLINE int proc_pri(UNUSED_ARG(struct Process *, proc))
+       {
+               return 0;
+       }
 #endif
 
 #if CONFIG_KERN_PREEMPT
@@ -448,6 +469,5 @@ INLINE struct Process *proc_current(void)
        #endif
 #endif
 /** \} */ //defgroup kern_proc
-/** \} */ //defgroup kern
 
 #endif /* KERN_PROC_H */