power.h

Go to the documentation of this file.
00001 
00037 #ifndef CPU_POWER_H
00038 #define CPU_POWER_H
00039 
00040 #include "cfg/cfg_proc.h"
00041 #include "cfg/cfg_wdt.h"
00042 
00043 #if CONFIG_KERN
00044     #include <kern/proc.h>
00045 #endif
00046 
00047 #if CONFIG_WATCHDOG
00048     #include <drv/wdt.h>
00049 #endif
00050 
00067 INLINE void cpu_relax(void)
00068 {
00069 #if CONFIG_KERN
00070     proc_yield();
00071 #endif
00072 
00073 #if CONFIG_WATCHDOG
00074     wdt_reset();
00075 #endif
00076 }
00077 
00102 INLINE void cpu_pause(void)
00103 {
00104     //ASSERT_IRQ_DISABLED();
00105     //IRQ_ENABLE();
00106     cpu_relax();
00107     //IRQ_DISABLE();
00108 }
00109 
00113 #define CPU_PAUSE_ON(COND) ATOMIC(while (!(COND)) { cpu_pause(); })
00114 
00115 #endif /* CPU_POWER_H */