From: bernie Date: Mon, 25 Aug 2008 11:29:28 +0000 (+0000) Subject: preempt: add module initialization safety checks X-Git-Tag: 2.0.0~250 X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;h=6db1e5bb5ee9abb34b1f0b0c40cb82c6143b7bae;p=bertos.git preempt: add module initialization safety checks git-svn-id: https://src.develer.com/svnoss/bertos/trunk@1684 38d2e660-2303-0410-9eaa-f027e97ec537 --- diff --git a/bertos/kern/preempt.c b/bertos/kern/preempt.c index f285d43f..82550501 100644 --- a/bertos/kern/preempt.c +++ b/bertos/kern/preempt.c @@ -35,6 +35,10 @@ * \author Bernie Innocenti */ +#include + +#if CONFIG_KERN_PREEMPT + #include "proc_p.h" #include "proc.h" @@ -44,7 +48,13 @@ #include // IRQ_DISABLE()... #include #include +#include // CONFIG_DEPEND() + +// Check config dependencies +CONFIG_DEPEND(CONFIG_KERN_PREEMPT, CONFIG_KERN_SCHED && CONFIG_TIMER_EVENTS && CONFIG_KERN_IRQ); +CONFIG_DEPEND(CONFIG_KERN_PRI, CONFIG_KERN_PREEMPT); +MOD_DEFINE(preempt) int preempt_forbid_cnt; @@ -140,4 +150,8 @@ void preempt_init(void) timer_add(&preempt_timer); idle_init(); + + MOD_INIT(preempt); } + +#endif // CONFIG_KERN_PREEMPT