pm.h 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. * AVR32 AP Power Management.
  3. *
  4. * Copyright (C) 2008 Atmel Corporation
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License version 2 as
  8. * published by the Free Software Foundation.
  9. */
  10. #ifndef __ASM_AVR32_ARCH_PM_H
  11. #define __ASM_AVR32_ARCH_PM_H
  12. /* Possible arguments to the "sleep" instruction */
  13. #define CPU_SLEEP_IDLE 0
  14. #define CPU_SLEEP_FROZEN 1
  15. #define CPU_SLEEP_STANDBY 2
  16. #define CPU_SLEEP_STOP 3
  17. #define CPU_SLEEP_STATIC 5
  18. #ifndef __ASSEMBLY__
  19. extern void cpu_enter_idle(void);
  20. extern bool disable_idle_sleep;
  21. static inline void cpu_disable_idle_sleep(void)
  22. {
  23. disable_idle_sleep = true;
  24. }
  25. static inline void cpu_enable_idle_sleep(void)
  26. {
  27. disable_idle_sleep = false;
  28. }
  29. static inline void cpu_idle_sleep(void)
  30. {
  31. /*
  32. * If we're using the COUNT and COMPARE registers for
  33. * timekeeping, we can't use the IDLE state.
  34. */
  35. if (disable_idle_sleep)
  36. cpu_relax();
  37. else
  38. cpu_enter_idle();
  39. }
  40. #endif
  41. #endif /* __ASM_AVR32_ARCH_PM_H */