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 if (proc_preemptAllowed())
00071 proc_yield();
00072 #endif
00073
00074 #if CONFIG_WATCHDOG
00075 wdt_reset();
00076 #endif
00077 }
00078
00103 INLINE void cpu_pause(void)
00104 {
00105
00106
00107 cpu_relax();
00108
00109 }
00110
00114 #define CPU_PAUSE_ON(COND) ATOMIC(while (!(COND)) { cpu_pause(); })
00115
00116 #endif