apm-emulation.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /* -*- linux-c -*-
  2. *
  3. * (C) 2003 zecke@handhelds.org
  4. *
  5. * GPL version 2
  6. *
  7. * based on arch/arm/kernel/apm.c
  8. * factor out the information needed by architectures to provide
  9. * apm status
  10. */
  11. #ifndef __LINUX_APM_EMULATION_H
  12. #define __LINUX_APM_EMULATION_H
  13. #include <linux/apm_bios.h>
  14. /*
  15. * This structure gets filled in by the machine specific 'get_power_status'
  16. * implementation. Any fields which are not set default to a safe value.
  17. */
  18. struct apm_power_info {
  19. unsigned char ac_line_status;
  20. #define APM_AC_OFFLINE 0
  21. #define APM_AC_ONLINE 1
  22. #define APM_AC_BACKUP 2
  23. #define APM_AC_UNKNOWN 0xff
  24. unsigned char battery_status;
  25. #define APM_BATTERY_STATUS_HIGH 0
  26. #define APM_BATTERY_STATUS_LOW 1
  27. #define APM_BATTERY_STATUS_CRITICAL 2
  28. #define APM_BATTERY_STATUS_CHARGING 3
  29. #define APM_BATTERY_STATUS_NOT_PRESENT 4
  30. #define APM_BATTERY_STATUS_UNKNOWN 0xff
  31. unsigned char battery_flag;
  32. #define APM_BATTERY_FLAG_HIGH (1 << 0)
  33. #define APM_BATTERY_FLAG_LOW (1 << 1)
  34. #define APM_BATTERY_FLAG_CRITICAL (1 << 2)
  35. #define APM_BATTERY_FLAG_CHARGING (1 << 3)
  36. #define APM_BATTERY_FLAG_NOT_PRESENT (1 << 7)
  37. #define APM_BATTERY_FLAG_UNKNOWN 0xff
  38. int battery_life;
  39. int time;
  40. int units;
  41. #define APM_UNITS_MINS 0
  42. #define APM_UNITS_SECS 1
  43. #define APM_UNITS_UNKNOWN -1
  44. };
  45. /*
  46. * This allows machines to provide their own "apm get power status" function.
  47. */
  48. extern void (*apm_get_power_status)(struct apm_power_info *);
  49. /*
  50. * Queue an event (APM_SYS_SUSPEND or APM_CRITICAL_SUSPEND)
  51. */
  52. void apm_queue_event(apm_event_t event);
  53. #endif /* __LINUX_APM_EMULATION_H */