X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=bertos%2Fcfg%2Fos.h;h=2089cc4fc1e977b69333b09ce7214a9d1339d12f;hb=32d1445272120a254d77ce8d1af1f527da7a2c17;hp=92f20d914d06a21bd6a831b6cd4c919d3d810aeb;hpb=e62ca0b357f09804d7d894949df44224c9d74bb7;p=bertos.git diff --git a/bertos/cfg/os.h b/bertos/cfg/os.h index 92f20d91..2089cc4f 100644 --- a/bertos/cfg/os.h +++ b/bertos/cfg/os.h @@ -39,6 +39,8 @@ #ifndef CFG_OS_H #define CFG_OS_H +#include "cfg/cfg_proc.h" + /* * OS autodetection (Some systems trigger multiple OS definitions) */ @@ -109,6 +111,40 @@ sigismember(&sigs__, SIGALRM) ? false : true; \ }) + #if 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 +163,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