preempt: add module initialization safety checks
authorbernie <bernie@38d2e660-2303-0410-9eaa-f027e97ec537>
Mon, 25 Aug 2008 11:29:28 +0000 (11:29 +0000)
committerbernie <bernie@38d2e660-2303-0410-9eaa-f027e97ec537>
Mon, 25 Aug 2008 11:29:28 +0000 (11:29 +0000)
git-svn-id: https://src.develer.com/svnoss/bertos/trunk@1684 38d2e660-2303-0410-9eaa-f027e97ec537

bertos/kern/preempt.c

index f285d43f5a53c3e3932f3d1d5edca9be072a26d2..825505019aebeae98ed03f7efe77bc383ecd385a 100644 (file)
  * \author Bernie Innocenti <bernie@codewiz.org>
  */
 
+#include <cfg/cfg_kern.h>
+
+#if CONFIG_KERN_PREEMPT
+
 #include "proc_p.h"
 #include "proc.h"
 
 #include <cpu/irq.h>   // IRQ_DISABLE()...
 #include <drv/timer.h>
 #include <cfg/module.h>
+#include <cfg/depend.h>    // 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