From d6f66b0496d96877fbcaea3751d4865729ad2aaa Mon Sep 17 00:00:00 2001 From: batt Date: Fri, 28 May 2010 16:20:16 +0000 Subject: [PATCH] Explicit dependancy between CONFIG_KERN_PREEMPT and CONFIG_KERN. This will disable the kernel related macros whem kernel is not enabled. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@3880 38d2e660-2303-0410-9eaa-f027e97ec537 --- bertos/cfg/os.h | 2 +- bertos/cpu/cortex-m3/hw/init_cm3.c | 2 +- bertos/cpu/irq.h | 8 ++++---- bertos/drv/dc_motor.c | 2 +- bertos/kern/proc_p.h | 11 ++++++++--- 5 files changed, 15 insertions(+), 10 deletions(-) diff --git a/bertos/cfg/os.h b/bertos/cfg/os.h index 2089cc4f..2e393599 100644 --- a/bertos/cfg/os.h +++ b/bertos/cfg/os.h @@ -111,7 +111,7 @@ sigismember(&sigs__, SIGALRM) ? false : true; \ }) - #if CONFIG_KERN_PREEMPT + #if (CONFIG_KERN && CONFIG_KERN_PREEMPT) #define DECLARE_ISR_CONTEXT_SWITCH(vect) \ void vect(UNUSED_ARG(int, arg)); \ INLINE void __isr_##vect(void); \ diff --git a/bertos/cpu/cortex-m3/hw/init_cm3.c b/bertos/cpu/cortex-m3/hw/init_cm3.c index 079f08a3..8415cbfb 100644 --- a/bertos/cpu/cortex-m3/hw/init_cm3.c +++ b/bertos/cpu/cortex-m3/hw/init_cm3.c @@ -93,7 +93,7 @@ void __init2(void) /* Initialize IRQ vector table in RAM */ sysirq_init(); -#if CONFIG_KERN_PREEMPT +#if (CONFIG_KERN && CONFIG_KERN_PREEMPT) /* * Voluntary context switch handler. * diff --git a/bertos/cpu/irq.h b/bertos/cpu/irq.h index 6eac70fd..153f7861 100644 --- a/bertos/cpu/irq.h +++ b/bertos/cpu/irq.h @@ -148,7 +148,7 @@ } #define IRQ_RUNNING() irq_running() - #if CONFIG_KERN_PREEMPT + #if (CONFIG_KERN && CONFIG_KERN_PREEMPT) #define DECLARE_ISR_CONTEXT_SWITCH(func) \ void func(void); \ @@ -288,7 +288,7 @@ #define IRQ_ENABLED() ((CPU_READ_FLAGS() & 0xc0) != 0xc0) - #if CONFIG_KERN_PREEMPT + #if (CONFIG_KERN && CONFIG_KERN_PREEMPT) EXTERN_C void asm_irq_switch_context(void); /** @@ -482,7 +482,7 @@ ); \ (bool)(sreg & 0x80); \ }) - #if CONFIG_KERN_PREEMPT + #if (CONFIG_KERN && CONFIG_KERN_PREEMPT) #define DECLARE_ISR_CONTEXT_SWITCH(vect) \ INLINE void __isr_##vect(void); \ ISR(vect) \ @@ -556,7 +556,7 @@ #ifndef IRQ_PREEMPT_HANDLER - #if CONFIG_KERN_PREEMPT + #if (CONFIG_KERN && CONFIG_KERN_PREEMPT) /** * Handle preemptive context switch inside timer IRQ. */ diff --git a/bertos/drv/dc_motor.c b/bertos/drv/dc_motor.c index 13d8b769..75a05f34 100644 --- a/bertos/drv/dc_motor.c +++ b/bertos/drv/dc_motor.c @@ -82,7 +82,7 @@ #define DC_MOTOR_SET_STATUS_DIR(status, dir) \ (dir == POS_DIR ? DC_MOTOR_POS_DIR(status) : DC_MOTOR_NEG_DIR(status)) -#if CONFIG_KERN_PREEMPT +#if (CONFIG_KERN && CONFIG_KERN_PREEMPT) #if CONFIG_DC_MOTOR_USE_SEM #include diff --git a/bertos/kern/proc_p.h b/bertos/kern/proc_p.h index 64fabb12..5469dfcd 100644 --- a/bertos/kern/proc_p.h +++ b/bertos/kern/proc_p.h @@ -181,7 +181,12 @@ void proc_schedInit(void); void monitor_rename(Process *proc, const char *name); #endif /* CONFIG_KERN_MONITOR */ -#if CONFIG_KERN_PREEMPT +/* + * Quantum related macros are used in the + * timer module and must be empty when + * kernel is disabled. + */ +#if (CONFIG_KERN && CONFIG_KERN_PREEMPT) INLINE int preempt_quantum(void) { extern int _proc_quantum; @@ -200,7 +205,7 @@ INLINE void preempt_reset_quantum(void) extern int _proc_quantum; _proc_quantum = CONFIG_KERN_QUANTUM; } -#else /* !CONFIG_KERN_PREEMPT */ +#else /* !(CONFIG_KERN && CONFIG_KERN_PREEMPT) */ INLINE int preempt_quantum(void) { return 0; @@ -213,6 +218,6 @@ INLINE void proc_decQuantum(void) INLINE void preempt_reset_quantum(void) { } -#endif /* CONFIG_KERN_PREEMPT */ +#endif /* (CONFIG_KERN && CONFIG_KERN_PREEMPT) */ #endif /* KERN_PROC_P_H */ -- 2.25.1