X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=bertos%2Fkern%2Fproc.h;h=f8de758ffeec511879400f20d750311d3b3c992b;hb=1cdcadf620678aca50bc36a0ff24986140720f3b;hp=a2a7b283e9d93c6622e523bc4e5ca3650d88b734;hpb=40c25a4b1d0f1c23478c2d681b74662de968f671;p=bertos.git diff --git a/bertos/kern/proc.h b/bertos/kern/proc.h index a2a7b283..f8de758f 100644 --- a/bertos/kern/proc.h +++ b/bertos/kern/proc.h @@ -46,6 +46,7 @@ #endif #include // cpustack_t +#include // CPU_SAVED_REGS_CNT /* * Forward declaration. The definition of struct Process is private to the @@ -65,7 +66,6 @@ struct Process *proc_new_with_name(const char* name, void (*entry)(void), iptr_t void proc_exit(void); void proc_yield(void); -#define proc_switch proc_yield /* OBSOLETE */ int proc_testSetup(void); int proc_testRun(void); @@ -77,6 +77,17 @@ void proc_rename(struct Process *proc, const char *name); const char *proc_name(struct Process *proc); const char *proc_currentName(void); +#if CONFIG_KERN_PRI + void proc_setPri(struct Process *proc, int pri); +#else + INLINE void proc_setPri(UNUSED_ARG(struct Process *,proc), UNUSED_ARG(int, pri)) + { + } +#endif + +/** Global preemption disable nesting counter. */ +extern int preempt_forbid_cnt; + /** * Disable preemptive task switching. * @@ -98,7 +109,6 @@ INLINE void proc_forbid(void) { #if CONFIG_KERN_PREEMPT // No need to protect against interrupts here. - extern int preempt_forbid_cnt; ++preempt_forbid_cnt; /* @@ -125,7 +135,6 @@ INLINE void proc_permit(void) MEMORY_BARRIER; /* No need to protect against interrupts here. */ - extern int preempt_forbid_cnt; --preempt_forbid_cnt; ASSERT(preempt_forbid_cnt >= 0); @@ -138,7 +147,6 @@ INLINE void proc_permit(void) #endif } - /** * Execute a block of \a CODE atomically with respect to task scheduling. */ @@ -149,11 +157,11 @@ INLINE void proc_permit(void) proc_permit(); \ } while(0) -#ifndef CONFIG_PROC_DEFSTACKSIZE +#ifndef CONFIG_KERN_MINSTACKSIZE #if (ARCH & ARCH_EMUL) /* We need a large stack because system libraries are bloated */ - #define CONFIG_PROC_DEFSTACKSIZE 65536 + #define CONFIG_KERN_MINSTACKSIZE 65536 #else /** * Default stack size for each thread, in bytes. @@ -174,7 +182,7 @@ INLINE void proc_permit(void) * required per process. Use irqmanager to minimize stack * usage. */ - #define CONFIG_PROC_DEFSTACKSIZE \ + #define CONFIG_KERN_MINSTACKSIZE \ (CPU_SAVED_REGS_CNT * 2 * sizeof(cpustack_t) \ + 32 * sizeof(int)) #endif