X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=bertos%2Fcfg%2Fos.h;h=36e11eb5e9d4d85bbb5998955bf021f74d7ad6c6;hb=39e200e1f43474a96888f97e2271728c9605ccbe;hp=7fe971294d17c3c4e35f830b1a7d668448ba9f3e;hpb=36743f1df2a4fa3839d6af0204330915af563e6b;p=bertos.git diff --git a/bertos/cfg/os.h b/bertos/cfg/os.h index 7fe97129..36e11eb5 100644 --- a/bertos/cfg/os.h +++ b/bertos/cfg/os.h @@ -32,13 +32,14 @@ * * \brief OS-specific definitions * - * \version $Id$ * \author Bernie Innocenti */ #ifndef CFG_OS_H #define CFG_OS_H +#include "cfg/cfg_proc.h" + /* * OS autodetection (Some systems trigger multiple OS definitions) */ @@ -47,7 +48,7 @@ #define OS_ID win32 // FIXME: Maybe disable Win32 exceptions? - typedef int cpuflags_t; + typedef int cpu_flags_t; #define IRQ_DISABLE FIXME #define IRQ_ENABLE FIXME #define IRQ_SAVE_DISABLE(old_sigs) FIXME @@ -66,7 +67,7 @@ * The POSIX moral equivalent of disabling IRQs is disabling signals. */ #include - typedef sigset_t cpuflags_t; + typedef sigset_t cpu_flags_t; #define SET_ALL_SIGNALS(sigs) \ do { \ @@ -109,6 +110,40 @@ sigismember(&sigs__, SIGALRM) ? false : true; \ }) + #if (CONFIG_KERN && CONFIG_KERN_PREEMPT) + #define DECLARE_ISR_CONTEXT_SWITCH(vect) \ + void vect(UNUSED_ARG(int, arg)); \ + INLINE void __isr_##vect(void); \ + void vect(UNUSED_ARG(int, arg)) \ + { \ + __isr_##vect(); \ + IRQ_PREEMPT_HANDLER(); \ + } \ + INLINE void __isr_##vect(void) + /** + * With task priorities enabled each ISR is used a point to + * check if we need to perform a context switch. + * + * Instead, without priorities a context switch can occur only + * when the running task expires its time quantum. In this last + * case, the context switch can only occur in the timer ISR, + * that must be always declared with the + * DECLARE_ISR_CONTEXT_SWITCH() macro. + */ + #if CONFIG_KERN_PRI + #define DECLARE_ISR(vect) \ + DECLARE_ISR_CONTEXT_SWITCH(vect) + #endif /* CONFIG_KERN_PRI */ + #endif + #ifndef DECLARE_ISR + #define DECLARE_ISR(vect) \ + void vect(UNUSED_ARG(int, arg)) + #endif + #ifndef DECLARE_ISR_CONTEXT_SWITCH + #define DECLARE_ISR_CONTEXT_SWITCH(vect) \ + void vect(UNUSED_ARG(int, arg)) + #endif + #else #define OS_UNIX 0 #define OS_POSIX 0 @@ -127,7 +162,7 @@ #endif -#include /* For ARCH_QT */ +#include "cfg/cfg_arch.h" /* For ARCH_QT */ /* * We want Qt and other frameworks to look like OSes because you would