home *** CD-ROM | disk | FTP | other *** search
/ ftp.wwiv.com / ftp.wwiv.com.zip / ftp.wwiv.com / pub / MISC / LSW270SR.ZIP / h / Apm.h < prev    next >
C/C++ Source or Header  |  1998-05-05  |  50KB  |  1,119 lines

  1. /***********************************************************************\
  2.  *                                APM/2                                *
  3.  *  Copyright (C) by Stangl Roman (rstangl@vnet.ibm.com), 1997, 1998   *
  4.  * This Code may be freely distributed, provided the Copyright isn't   *
  5.  * removed, under the conditions indicated in the documentation.       *
  6.  *                                                                     *
  7. \***********************************************************************/
  8.  
  9. #ifndef __APM_H__
  10. #define __APM_H__
  11.  
  12.                                         /* APM IOCTL */
  13. #ifndef IOCTL_POWER
  14. #define IOCTL_POWER                         0x000C
  15. #endif  /* IOCTL_POWER */
  16.  
  17. #pragma pack(1)
  18. /*---------------------------------------------------------------------*\
  19.  * IOCTL_POWER: Data packet                                            *
  20. \*---------------------------------------------------------------------*/
  21.                                         /* Data packet for all APM device I/Os */
  22. struct  POWERRETURNCODE
  23. {
  24. USHORT  usReturnCode;
  25. };
  26.  
  27.                                         /* Return codes */
  28. #define POWER_NOERROR                       0x0000
  29. #define POWER_BADSUBID                      0x0001
  30. #define POWER_BADRESERVED                   0x0002
  31. #define POWER_BADDEVID                      0x0003
  32. #define POWER_BADPWRSTATE                   0x0004
  33. #define POWER_SELALREADYSETUP               0x0005
  34. #define POWER_BADFLAGS                      0x0006
  35. #define POWER_BADSEMHANDLE                  0x0007
  36. #define POWER_BADLENGTH                     0x0008
  37. #define POWER_DISABLED                      0x0009
  38. #define POWER_NOEVENTQUEUE                  0x000A
  39. #define POWER_TOOMANYQUEUES                 0x000B
  40. #define POWER_BIOSERROR                     0x000C
  41. #define POWER_BADSEMAPHORE                  0x000D
  42. #define POWER_QUEUEOVERFLOW                 0x000E
  43. #define POWER_STATECHANGEREJECT             0x000F
  44. #define POWER_NOTSUPPORTED                  0x0010
  45. #define POWER_DISENGAGED                    0x0011
  46.  
  47.                                         /* Some APM data structures not defined in Warp Toolkit yet.
  48.                                            For more information please look into the Physical
  49.                                            Device Driver Reference available from the DDK (device
  50.                                            driver kit) homepage for free! */
  51.  
  52. /*---------------------------------------------------------------------*\
  53.  * IOCTL_POWER: SENDPOWEREVENT parameter packet                        *
  54. \*---------------------------------------------------------------------*/
  55. #ifndef POWER_SENDPOWEREVENT
  56. #define POWER_SENDPOWEREVENT                0x0040
  57. #endif  /* POWER_SENDPOWEREVENT */
  58.  
  59. #ifndef SENDPOWEREVENT
  60.                                         /* Parameter packet for POWER_SENDPOWEREVENT */
  61. struct  SENDPOWEREVENT
  62. {
  63.     USHORT  usSubID;
  64.     USHORT  usReserved;                 /* Always 0 */
  65.     USHORT  usData1;
  66.     USHORT  usData2;
  67. };
  68.  
  69.                                         /* 0:0 (usData1:usData2) */
  70. #define SUBID_ENABLE_POWER_MANAGEMENT       0x0003
  71. #define SUBID_DISABLE_POWER_MANAGEMENT      0x0004
  72. #define SUBID_RESTORE_BIOS_DEFAULTS         0x0005
  73.                                         /* DevId:PwrState (usData1:usData2) */
  74. #define SUBID_SET_POWER_STATE               0x0006
  75.                                         /* 0:0 (usData1:usData2) */
  76. #define SUBID_BATTERY_LOW_EVENT             0x0007
  77. #define SUBID_NORMAL_RESUME_EVENT           0x0008
  78. #define SUBID_CRITICAL_RESUME_EVENT         0x0009
  79. #define SUBID_STANDBY_RESUME_EVENT          0x000A
  80.                                         /* DevId (usData1) */
  81. #define SUBID_ENGAGE_POWER_MANAGEMENT       0x000B
  82. #define SUBID_DISENGAGE_POWER_MANAGEMENT    0x000C
  83.                                         /* 0:0 (usData1:usData2) */
  84. #define SUBID_POWER_STATUS_CHANGE_EVENT     0x000D
  85. #define SUBID_UPDATE_TIME_EVENT             0x000E
  86.                                         /* EvtCode (usData1) */
  87. #define SUBID_OEM_DEFINED_APM_EVENT         0x000F
  88.                                         /* DevId:PwrStata (usData1:usData2) */
  89. #define SUBID_QUERY_POWER_STATE             0x0010
  90.  
  91.                                         /* DevID, for 0xabb bb is the unit, and
  92.                                            0xFF is all units */
  93. #define DEVID_APMBIOS                       0x0000
  94. #define DEVID_ALL_DEVICES                   0x0001
  95. #define DEVID_DISPLAY                       0x0100
  96. #define DEVID_SECONDARY_STORAGE             0x0200
  97. #define DEVID_PARALLEL_PORTS                0x0300
  98. #define DEVID_SERIAL_PORTS                  0x0400
  99. #define DEVID_NETWORK_ADAPTERS              0x0500
  100. #define DEVID_PCMCIA_SOCKETS                0x0600
  101. #define DEVID_BATTERIES                     0x8000
  102.  
  103.                                         /* PwrState */
  104. #define POWERSTATE_READY                    0x0000
  105. #define POWERSTATE_STANDBY                  0x0001
  106. #define POWERSTATE_SUSPEND                  0x0002
  107. #define POWERSTATE_OFF                      0x0003
  108.                                         /* OEM defined 0x0020 - 0x007F) */
  109. #define POWERSTATE_OEMDEFINED               0x0020
  110. #endif  /* SENDPOWEREVENT */
  111.  
  112. /*---------------------------------------------------------------------*\
  113.  * IOCTL_POWER: SETPOWEREVENTRES parameter packet                      *
  114. \*---------------------------------------------------------------------*/
  115. #ifndef POWER_SETPOWEREVENTRES
  116. #define POWER_SETPOWEREVENTRES              0x0041
  117. #endif  /* POWER_SETPOWEREVENTRES */
  118.  
  119.  
  120. #ifndef SETPOWEREVENTRES
  121.                                         /* Parameter packet for POWER_SETPOWEREVENTRES */
  122. struct  SETPOWEREVENTRES
  123. {
  124.     USHORT  usRequestFlags;
  125.     ULONG   ulSemaphoreHandle;          /* !6-bit system semaphore or 32-bit shared event semaphore */
  126.     ULONG   ulEventMask;
  127. };
  128.  
  129. #define REQUESTFLAG_SEMAPHORE_SETUP         0x0001
  130. #define REQUESTFLAG_SEMAPHORE_REMOVAL       0x0002
  131. #define REQUESTFLAG_16BIT_SEMAPHORE         0x0004
  132. #define REQUESTFLAG_32BIT_SEMAPHORE         0x0008
  133. #define REQUESTFLAG_NO_SEMAPHORE            0x0010
  134.                                         /* All other bits must be 0 */
  135. #define REQUESTFLAG_RESERVED_BITS           0xFFE0
  136.  
  137. #define EVENTMASK_ENABLE_POWER_MANAGEMENT   0x0008
  138. #define EVENTMASK_DISABLE_POWER_MANAGEMENT  0x0010
  139. #define EVENTMASK_RESTORE_BIOS_DEFAULTS     0x0020
  140. #define EVENTMASK_SET_POWER_STATE           0x0040
  141. #define EVENTMASK_BATTERY_LOW_EVENT         0x0080
  142. #define EVENTMASK_NORMAL_RESUME_EVENT       0x0100
  143. #define EVENTMASK_CRITICAL_RESUME_EVENT     0x0200
  144.                                         /* All other bits must be 0 */
  145. #define EVENTMASK_RESERVED_BITS             0xFD00
  146. #endif  /* POWEREVENTRES */
  147.  
  148. /*---------------------------------------------------------------------*\
  149.  * IOCTL_POWER: POWEROEMFUNCTION parameter packet                      *
  150. \*---------------------------------------------------------------------*/
  151. #ifndef POWER_OEMFUNCTION
  152. #define POWER_OEMFUNCTION                   0x0045
  153. #endif  /* POWER_OEMFUNCTION */
  154.  
  155. #ifndef POWEROEMFUNCTION
  156.                                         /* Parameter packet for POWER_OEMFUNCTION. The Physical Device
  157.                                            Driver Reference states "The low order word of EAX is set to the
  158.                                            value 5380H, regardless of the parameter field value." However
  159.                                            with the APM 1.2 driver released on the device driver online
  160.                                            site this is simply not true, one can move e.g. 5307H into EAX
  161.                                            to power off by APM and it will work! I'm not sure if the
  162.                                            documentation if incorrect or a bug in APM.SYS, as this DevIOCtl
  163.                                            interface is based on the Ring-0 IDC interface where no limitation
  164.                                            is documented in the Input/Output Device Driver Reference I think
  165.                                            the documentation is incorrect. */
  166. struct  POWEROEMFUNCTION
  167. {
  168.     USHORT  usParmLength;
  169.     USHORT  usFlags;                    /* Contains CPU flags upon APM BIOS return (using LAHF
  170.                                            instruction):
  171.                                            Bit 7 ... Sign flag
  172.                                            Bit 6 ... Zero flag
  173.                                            Bit 5
  174.                                            Bit 4 ... Auxiliary Carry flag
  175.                                            Bit 3
  176.                                            Bit 2 ... Parity flag
  177.                                            Bit 1
  178.                                            Bit 0 ... Carry flag */
  179.     ULONG   ulEAX;                      /* AX is set to 0x5380 before calling APM BIOS, but
  180.                                            for some unknown reasons we! must set 0x5380 also */
  181.     ULONG   ulEBX;
  182.     ULONG   ulECX;
  183.     ULONG   ulEDX;
  184.     ULONG   ulESI;
  185.     ULONG   ulEDI;
  186.     USHORT  usDS;
  187.     USHORT  usES;
  188.     USHORT  usFS;
  189.     USHORT  usGS;
  190. };
  191.  
  192.                                         /* Access APM BIOS OEM functions */
  193. #define POWEROEMFUNCTION_EAX_OEMFUNCTION    0x5380
  194.  
  195.                                         /* The selector registers (DS, ..., GS) may or may not be
  196.                                            included in that call */
  197. #define POWEROEMFUNCTION_PARMLENTH_NOSELREG 0x001C
  198. #define POWEROEMFUNCTION_PARMLENTH_SELREG   0x0024
  199. #endif  /* POWEROEMFUNCTION */
  200.  
  201. /*---------------------------------------------------------------------*\
  202.  * IOCTL_POWER: GETPOWERSTATUS parameter packet                        *
  203. \*---------------------------------------------------------------------*/
  204. #ifndef POWER_GETPOWERSTATUS
  205. #define POWER_GETPOWERSTATUS                0x0060
  206. #endif  /* POWER_GETPOWERSTATUS */
  207.  
  208. #ifndef GETPOWERSTATUS
  209.                                         /* Parameter packet for POWER_GETPOWERSTATUS */
  210. struct  GETPOWERSTATUS
  211. {
  212.     USHORT  usParmLength;               /* Depends on APM 1.0 or 1.1+ */
  213.     USHORT  usPowerFlags;
  214.     UCHAR   ucACStatus;
  215.     UCHAR   ucBatteryStatus;
  216.     UCHAR   ucBatteryLife;              /* 0...100 or unknown */
  217.     UCHAR   ucBatteryTimeForm;
  218.     USHORT  usBatteryTime;
  219.     UCHAR   ucBatteryFlags;
  220. };
  221.  
  222. #define GETPOWERSTATUS_PARMLENGTH_APM10     0x0007
  223. #define GETPOWERSTATUS_PARMLENGTH_APM11     0x000B
  224.  
  225. #define FLAGS_POWER_MANAGEMENT_ENABLED      0x0001
  226. #define FLAGS_POWER_MANAGEMENT_ENGAGED      0x0002
  227. #define FLAGS_POWER_MANAGEMENT_CONNECTED    0x0004
  228.                                         /* All other bits must be 0 */
  229. #define FLAGS_RESERVED_BITS                 0xFFF8
  230.  
  231. #define ACSTATUS_ACOFFLINE                  0x0000
  232. #define ACSTATUS_ACONLINE                   0x0001
  233. #define ACSTATUS_ON_BACKUP_POWER            0x0002
  234. #define ACSTATUS_UNKNOWN                    0x00FF
  235.  
  236. #define DCSTATUS_HIGH                       0x0000
  237. #define DCSTATUS_LOW                        0x0001
  238. #define DCSTATUS_CRITICAL                   0x0002
  239. #define DCSTATUS_CHARGING                   0x0003
  240. #define DCSTATUS_UNKNOWN                    0x00FF
  241.  
  242. #define LIFE_UNKNOWN                        0x00FF
  243.  
  244. #define TIMEFORM_SECONDS                    0x0000
  245. #define TIMEFORM_MINUTES                    0x0001
  246. #define TIMEFORM_UNKNOWN                    0x00FF
  247.  
  248. #define BATTERYFLAGS_HIGH                   0x0001
  249. #define BATTERYFLAGS_LOW                    0x0002
  250. #define BATTERYFLAGS_CRITICAL               0x0004
  251. #define BATTERYFLAGS_CHARGING               0x0008
  252. #define BATTERYFLAGS_NO_SYSTEM_BATTERY      0x0080
  253. #define BATTERYFLAGS_UNKNOWN                0x00FF
  254. #endif  /* GETPOWERSTATUS */
  255.  
  256. /*---------------------------------------------------------------------*\
  257.  * IOCTL_POWER: GETPOWEREVENT parameter packet                         *
  258. \*---------------------------------------------------------------------*/
  259. #ifndef POWER_GETPOWEREVENT
  260. #define POWER_GETPOWEREVENT                 0x0061
  261. #endif  /* POWER_GETPOWEREVENT */
  262.  
  263. #ifndef GETPOWEREVENT
  264.                                         /* Parameter packet for POWER_GETPOWEREVENT */
  265. struct  GETPOWEREVENT
  266. {
  267.     USHORT  usParmLength;
  268.     USHORT  usMessageCount;             /* Number of remaining queue elements */
  269.     ULONG   ulParm1;                    /* Defined by Power Management event message */
  270.     ULONG   ulParm2;                    /* Defined by Power Management event message */
  271. };
  272. #endif  /* GETPOWEREVENT */
  273.  
  274. /*---------------------------------------------------------------------*\
  275.  * IOCTL_POWER: GETPOWERINFO parameter packet                          *
  276. \*---------------------------------------------------------------------*/
  277. #ifndef POWER_GETPOWERINFO
  278. #define POWER_GETPOWERINFO                  0x0062
  279. #endif  /* POWER_GETPOWERINFO */
  280.  
  281. #ifndef GETPOWERINFO
  282.                                         /* Parameter packet for POWER_GETPOWERINFO */
  283. struct  GETPOWERINFO
  284. {
  285.     USHORT  usParmLength;               /* Depends on compatible or new calling convention */
  286.     USHORT  usBIOSFlags;                /* Defined in APM BIOS technical reference */
  287.     USHORT  usBIOSVersion;              /* MSB:LSB (major:minor APM BIOS revision) */
  288.     USHORT  usSubsysVersion;            /* MSB:LSB (major:minor OS/2 APM subsystem revision) */
  289.     USHORT  usAPMVersion;               /* MSB:LSB (major:minor current APM support level)
  290.                                            This value is the lowest value of either the
  291.                                            APM BIOS revision, OS/2 APM subsystem revision and
  292.                                            version set to APM.SYS by /V commandline parameter */
  293. };
  294.  
  295.                                         /* For use with APM.SYS version 1.0, 1.1, 1.2 */
  296. #define GETPOWERINFO_PARMLENGTH_COMPATIBLE 0x0008
  297.                                         /* For use with APM.SYS version 1.2 */
  298. #define GETPOWERINFO_PARMLENGTH_NEW        0x000A
  299. #endif  /* GETPOWERINFO */
  300.  
  301. /*---------------------------------------------------------------------*\
  302.  * IOCTL_POWER: GETPOWERSTATE parameter packet                         *
  303. \*---------------------------------------------------------------------*/
  304. #ifndef POWER_GETPOWERSTATE
  305. #define POWER_GETPOWERSTATE                 0x0063
  306. #endif  /* POWER_GETPOWERSTATE */
  307.  
  308. #ifndef GETPOWERSTATE
  309.                                         /* Parameter packet for POWER_GETPOWERSTATE */
  310. struct  GETPOWERSTATE
  311. {
  312.     USHORT  usParmLength;
  313.     USHORT  usDeviceID;
  314.     USHORT  usPowerState;
  315. };
  316. #endif  /* GETPOWERSTATE */
  317.  
  318. /*---------------------------------------------------------------------*\
  319.  * IOCTL_POWER: Input/Output Device Driver Reference excerpt           *
  320. \*---------------------------------------------------------------------*/
  321. /***********************************************************************\
  322.  Some information from the Input/Output Device Driver Reference about event messages.
  323.  Event SubIds 000Ah through 0010h are only available on systems running APM version
  324.  1.1 or higher. They are not available under APM version 1.0.  An attempt to send an
  325.  event which is not supported under the current APM version will return a
  326.  PowerNotSupported error.
  327.  
  328.  ┌───────────────────────────┬─────────────────┬─────────────────┐
  329.  │OS/2 Power Management      │                 │                 │
  330.  │Event Messages             │     ulParm1     │    ulParm2      │
  331.  │                           │ SubId  │Reserved│ (msg-specific)  │
  332.  ├───────────────────────────┼────────┼────────┼────────┬────────┤
  333.  │Enable Pwr Mgt Functions   │ 0003h  │ 0000h  │ DevId  │ - - -  │
  334.  ├───────────────────────────┼────────┼────────┼────────┼────────┤
  335.  │Disable Pwr Mgt Functions  │ 0004h  │ 0000h  │ DevId  │ - - -  │
  336.  ├───────────────────────────┼────────┼────────┼────────┼────────┤
  337.  │Restore BIOS Defaults      │ 0005h  │ 0000h  │  - - - │ - - -  │
  338.  ├───────────────────────────┼────────┼────────┼────────┼────────┤
  339.  │Set Power State            │ 0006h  │ 0000h  │ DevId  │PwrState│
  340.  ├───────────────────────────┼────────┼────────┼────────┼────────┤
  341.  │Battery Low Event          │ 0007h  │ 0000h  │ - - -  │ - - -  │
  342.  ├───────────────────────────┼────────┼────────┼────────┼────────┤
  343.  │Normal Resume Event        │ 0008h  │ 0000h  │ - - -  │ - - -  │
  344.  ├───────────────────────────┼────────┼────────┼────────┼────────┤
  345.  │Critical Resume Event      │ 0009h  │ 0000h  │ - - -  │ - - -  │
  346.  ├───────────────────────────┼────────┼────────┼────────┼────────┤
  347.  │Standby Resume Event       │ 000Ah  │ 0000h  │ - - -  │ - - -  │
  348.  ├───────────────────────────┼────────┼────────┼────────┼────────┤
  349.  │Engage Pwr Mgt Functions   │ 000Bh  │ 0000h  │ DevId  │ - - -  │
  350.  ├───────────────────────────┼────────┼────────┼────────┼────────┤
  351.  │Disengage Pwr Mgt Functions│ 000Ch  │ 0000h  │ DevId  │ - - -  │
  352.  ├───────────────────────────┼────────┼────────┼────────┼────────┤
  353.  │Power Status Change Event  │ 000Dh  │ 0000h  │ - - -  │ - - -  │
  354.  ├───────────────────────────┼────────┼────────┼────────┼────────┤
  355.  │Update Time Event          │ 000Eh  │ 0000h  │ - - -  │ - - -  │
  356.  ├───────────────────────────┼────────┼────────┼────────┼────────┤
  357.  │OEM Defined APM Event      │ 000Fh  │ 0000h  │ EvtCode│ - - -  │
  358.  ├───────────────────────────┼────────┼────────┼────────┼────────┤
  359.  │Query Power State          │ 0010h  │ 0000h  │ DevId  │PwrState│ (Ring-0 only)
  360.  ├───────────────────────────┴────────┴────────┴────────┴────────┤
  361.  │ Note:  All other values are reserved.                         │
  362.  └───────────────────────────────────────────────────────────────┘
  363.  
  364.  The device types (DevId) supported by the Advanced Power Management Specification are:
  365.  
  366.       System BIOS (0000h)
  367.        Device ID for Advanced Power Management BIOS
  368.  
  369.       System BIOS-managed devices (0001h)
  370.        Generic device ID for all devices managed by Advanced Power Management BIOS.
  371.  
  372.       Display devices (01xxh)
  373.        Generic device ID for display devices
  374.  
  375.       Secondary storage devices (02xxh)
  376.        Generic device ID for secondary storage devices
  377.  
  378.       Parallel ports (03xxh)
  379.        Generic device ID for parallel ports
  380.  
  381.       Serial ports (04xxh)
  382.        Generic device ID for serial ports
  383.  
  384.       Network adapters (05xxh)
  385.        Generic device ID for network adapters
  386.  
  387.       PCMCIA sockets (06xxh)
  388.        Generic device ID for PCMCIA sockets
  389.  
  390.       Reserved (0700h - 7FFF)
  391.  
  392.       Batteries (80xx)
  393.  
  394.       Reserved (8100h - DFFF)
  395.  
  396.       OEM defined power device IDs (E000h - EFFFh)
  397.        Range of IDs to be used by OEM devices
  398.  
  399.       Reserved (F000 - FFFF)
  400.  
  401.   Note:
  402.  
  403.     1. XX indicates the physical device number (0-based)
  404.  
  405.     2. FF indicates all devices in that class
  406.  
  407.     3. All other device-type values are reserved
  408.  
  409.     4. Devices powered with external system unit power supplies are not supported
  410.  
  411.     5. Device IDs 05xxh and higher are only supported by version 1.1 or higher of APM
  412. \***********************************************************************/
  413.  
  414. /*---------------------------------------------------------------------*\
  415.  * IOCTL_POWER: Ralf Brown's Interrupt List excerpt                    *
  416. \*---------------------------------------------------------------------*/
  417. /***********************************************************************\
  418.  The following is an excerpt from Ralf Brown's Interrupt List, included
  419.  to allow calling the POWER_OEMFUNCTION DevIOCtl
  420.  
  421.  Copyright (c) 1989,1990,1991,1992,1993,1994,1995,1996,1997 Ralf Brown
  422.  
  423.  
  424.  --------p-155300-----------------------------
  425.  INT 15 - Advanced Power Management v1.0+ - INSTALLATION CHECK
  426.         AX = 5300h
  427.         BX = device ID of system BIOS (0000h)
  428.  Return: CF clear if successful
  429.             AH = major version (BCD)
  430.             AL = minor version (BCD)
  431.             BX = 504Dh ("PM")
  432.             CX = flags (see #0398)
  433.         CF set on error
  434.             AH = error code (06h,09h,86h) (see #0399)
  435.  BUG:   early versions of the Award Modular BIOS with built-in APM support
  436.           reportedly do not set BX on return
  437.  
  438.  Bitfields for APM flags:
  439.  Bit(s) Description     (Table 0398)
  440.   0     16-bit protected mode interface supported
  441.   1     32-bit protected mode interface supported
  442.   2     CPU idle call reduces processor speed
  443.   3     BIOS power management disabled
  444.   4     BIOS power management disengaged (APM v1.1)
  445.   5-7   reserved
  446.  
  447.  (Table 0399)
  448.  Values for APM error code:
  449.   01h   power management functionality disabled
  450.   02h   interface connection already in effect
  451.   03h   interface not connected
  452.   04h   real-mode interface not connected
  453.   05h   16-bit protected-mode interface already connected
  454.   06h   16-bit protected-mode interface not supported
  455.   07h   32-bit protected-mode interface already connected
  456.   08h   32-bit protected-mode interface not supported
  457.   09h   unrecognized device ID
  458.   0Ah   invalid parameter value in CX
  459.   0Bh   (APM v1.1) interface not engaged
  460.   0Ch   (APM v1.2) function not supported
  461.   0Dh   (APM v1.2) Resume Timer disabled
  462.   0Eh-1Fh reserved for other interface and general errors
  463.   20h-3Fh reserved for CPU errors
  464.   40h-5Fh reserved for device errors
  465.   60h   can't enter requested state
  466.   61h-7Fh reserved for other system errors
  467.   80h   no power management events pending
  468.   81h-85h reserved for other power management event errors
  469.   86h   APM not present
  470.   87h-9Fh reserved for other power management event errors
  471.   A0h-FEh reserved
  472.   FFh   undefined
  473.  --------p-155301-----------------------------
  474.  INT 15 - Advanced Power Management v1.0+ - CONNECT REAL-MODE INTERFACE
  475.         AX = 5301h
  476.         BX = device ID of system BIOS (0000h)
  477.  Return: CF clear if successful
  478.         CF set on error
  479.             AH = error code (02h,05h,07h,09h) (see #0399)
  480.  Note:  on connection, an APM v1.1 or v1.2 BIOS switches to APM v1.0
  481.           compatibility mode until it is informed that the user supports a
  482.           newer version of APM (see AX=530Eh)
  483.  SeeAlso: AX=5302h,AX=5303h,AX=5304h
  484.  --------p-155302-----------------------------
  485.  INT 15 R - Advanced Power Management v1.0+ - CONNECT 16-BIT PROTMODE INTERFACE
  486.         AX = 5302h
  487.         BX = device ID of system BIOS (0000h)
  488.  Return: CF clear if successful
  489.             AX = real-mode segment base address of protected-mode 16-bit code
  490.                 segment
  491.             BX = offset of entry point
  492.             CX = real-mode segment base address of protected-mode 16-bit data
  493.                 segment
  494.             ---APM v1.1---
  495.             SI = APM BIOS code segment length
  496.             DI = APM BIOS data segment length
  497.         CF set on error
  498.             AH = error code (02h,05h,06h,07h,09h) (see #0399)
  499.  Notes: the caller must initialize two consecutive descriptors with the
  500.           returned segment base addresses; these descriptors must be valid
  501.           whenever the protected-mode interface is called, and will have
  502.           their limits arbitrarily set to 64K.
  503.         the protected mode interface is invoked by making a far call with the
  504.           same register values as for INT 15; it must be invoked while CPL=0,
  505.           the code segment descriptor must have a DPL of 0, the stack must be
  506.           in a 16-bit segment and have enough room for BIOS use and possible
  507.           interrupts, and the current I/O permission bit map must allow access
  508.           to the I/O ports used for power management.
  509.         functions 00h-03h are not available from protected mode
  510.         on connection, an APM v1.1 or v1.2 BIOS switches to APM v1.0
  511.           compatibility mode until it is informed that the user supports a
  512.           newer version of APM (see AX=530Eh)
  513.  SeeAlso: AX=5301h,AX=5303h,AX=5304h
  514.  --------p-155303-----------------------------
  515.  INT 15 - Advanced Power Management v1.0+ - CONNECT 32-BIT PROTMODE INTERFACE
  516.         AX = 5303h
  517.         BX = device ID of system BIOS (0000h)
  518.  Return: CF clear if successful
  519.             AX = real-mode segment base address of protected-mode 32-bit code
  520.                 segment
  521.             EBX = offset of entry point
  522.             CX = real-mode segment base address of protected-mode 16-bit code
  523.                 segment
  524.             DX = real-mode segment base address of protected-mode 16-bit data
  525.                 segment
  526.             ---APM v1.1---
  527.             SI = APM BIOS code segment length
  528.             DI = APM BIOS data segment length
  529.         CF set on error
  530.             AH = error code (02h,05h,07h,08h,09h) (see #0399)
  531.  Notes: the caller must initialize three consecutive descriptors with the
  532.           returned segment base addresses for 32-bit code, 16-bit code, and
  533.           16-bit data, respectively; these descriptors must be valid whenever
  534.           the protected-mode interface is called, and will have their limits
  535.           arbitrarily set to 64K.
  536.         the protected mode interface is invoked by making a far call to the
  537.           32-bit code segment with the same register values as for INT 15; it
  538.           must be invoked while CPL=0, the code segment descriptor must have a
  539.           DPL of 0, the stack must be in a 32-bit segment and have enough room
  540.           for BIOS use and possible interrupts, and the current I/O permission
  541.           bit map must allow access to the I/O ports used for power management.
  542.         functions 00h-03h are not available from protected mode
  543.         on connection, an APM v1.1 or v1.2 BIOS switches to APM v1.0
  544.           compatibility mode until it is informed that the user supports a
  545.           newer version of APM (see AX=530Eh)
  546.  SeeAlso: AX=5301h,AX=5302h,AX=5304h
  547.  --------p-155304-----------------------------
  548.  INT 15 - Advanced Power Management v1.0+ - DISCONNECT INTERFACE
  549.         AX = 5304h
  550.         BX = device ID of system BIOS (0000h)
  551.  Return: CF clear if successful
  552.         CF set on error
  553.             AH = error code (03h,09h) (see #0399)
  554.  SeeAlso: AX=5301h,AX=5302h,AX=5303h
  555.  --------p-155305-----------------------------
  556.  INT 15 - Advanced Power Management v1.0+ - CPU IDLE
  557.         AX = 5305h
  558.  Return: CF clear if successful (after system leaves idle state)
  559.         CF set on error
  560.             AH = error code (03h,0Bh) (see #0399)
  561.  Notes: call when the system is idle and should be suspended until the next
  562.           system event or interrupt
  563.         should not be called from within a hardware interrupt handler to avoid
  564.           reentrance problems
  565.         if an interrupt causes the system to resume normal processing, the
  566.           interrupt may or may not have been handled when the BIOS returns
  567.           from this call; thus, the caller should allow interrupts on return
  568.         interrupt handlers may not retain control if the BIOS allows
  569.           interrupts while in idle mode even if they are able to determine
  570.           that they were called from idle mode
  571.         the caller should issue this call continuously in a loop until it needs
  572.           to perform some processing of its own
  573.  SeeAlso: AX=1000h,AX=5306h,INT 2F/AX=1680h
  574.  --------p-155306-----------------------------
  575.  INT 15 - Advanced Power Management v1.0+ - CPU BUSY
  576.         AX = 5306h
  577.  Return: CF clear if successful
  578.         CF set on error
  579.             AH = error code (03h,0Bh) (see #0399)
  580.  Notes: called to ensure that the system runs at full speed even on systems
  581.           where the BIOS is unable to recognize increased activity (especially
  582.           if interrupts are hooked by other programs and not chained to the
  583.           BIOS)
  584.         this call may be made even when the system is already running at full
  585.           speed, but it will create unnecessary overhead
  586.         should not be called from within a hardware interrupt handler to avoid
  587.           reentrance problems
  588.  SeeAlso: AX=5305h
  589.  --------p-155307-----------------------------
  590.  INT 15 - Advanced Power Management v1.0+ - SET POWER STATE
  591.         AX = 5307h
  592.         BX = device ID (see #0400)
  593.         CX = system state ID (see #0401)
  594.  Return: CF clear if successful
  595.         CF set on error
  596.             AH = error code (01h,03h,09h,0Ah,0Bh,60h) (see #0399)
  597.  Note:  should not be called from within a hardware interrupt handler to avoid
  598.           reentrance problems
  599.  SeeAlso: AX=530Ch
  600.  
  601.  (Table 0400)
  602.  Values for APM device IDs:
  603.   0000h system BIOS
  604.   0001h all devices for which the system BIOS manages power
  605.   01xxh display (01FFh for all attached display devices)
  606.   02xxh secondary storage (02FFh for all attached secondary storage devices)
  607.   03xxh parallel ports (03FFh for all attached parallel ports)
  608.   04xxh serial ports (04FFh for all attached serial ports)
  609.  ---APM v1.1+ ---
  610.   05xxh network adapters (05FFh for all attached network adapters)
  611.   06xxh PCMCIA sockets (06FFh for all)
  612.   0700h-7FFFh reserved
  613.   80xxh system battery devices (APM v1.2)
  614.   8100h-DFFFh reserved
  615.   Exxxh OEM-defined power device IDs
  616.   F000h-FFFFh reserved
  617.  
  618.  (Table 0401)
  619.  Values for system state ID:
  620.   0000h ready (not supported for device ID 0001h)
  621.   0001h stand-by
  622.   0002h suspend
  623.   0003h off (not supported for device ID 0001h)
  624.  ---APM v1.1---
  625.   0004h last request processing notification (only for device ID 0001h)
  626.   0005h last request rejected (only for device ID 0001h)
  627.   0006h-001Fh reserved system states
  628.   0020h-003Fh OEM-defined system states
  629.   0040h-007Fh OEM-defined device states
  630.   0080h-FFFFh reserved device states
  631.  --------p-155307CX0001-----------------------
  632.  INT 15 - Advanced Power Management v1.0+ - SYSTEM STAND-BY
  633.         AX = 5307h
  634.         CX = 0001h
  635.         BX = 0001h (device ID for all power-managed devices)
  636.  Return: CF clear
  637.  Notes: puts the entire system into stand-by mode; normally called in response
  638.           to a System Stand-by Request notification after any necessary
  639.           processing, but may also be invoked at the caller's discretion
  640.         should not be called from within a hardware interrupt handler to avoid
  641.           reentrance problems
  642.         the stand-by state is typically exited on an interrupt
  643.  SeeAlso: AX=4280h,AX=5307h/CX=0002h"SUSPEND",AX=530Bh
  644.  --------p-155307CX0002-----------------------
  645.  INT 15 - Advanced Power Management v1.0+ - SUSPEND SYSTEM
  646.         AX = 5307h
  647.         CX = 0002h
  648.         BX = 0001h (device ID for all power-managed devices)
  649.  Return: after system is resumed
  650.         CF clear
  651.  Notes: puts the entire system into a low-power suspended state; normally
  652.           called in response to a Suspend System Request notification after
  653.           any necessary processing, but may also be invoked at the caller's
  654.           discretion
  655.         should not be called from within a hardware interrupt handler to avoid
  656.           reentrance problems
  657.         the caller may need to update its date and time values because the
  658.           system could have been suspended for a long period of time
  659.  SeeAlso: AX=5307h/CX=0001h"STAND-BY",AX=530Bh
  660.  --------p-155308-----------------------------
  661.  INT 15 - Advanced Power Management v1.0+ - ENABLE/DISABLE POWER MANAGEMENT
  662.         AX = 5308h
  663.         BX = device ID for all devices power-managed by APM
  664.             0001h (APM v1.1+)
  665.             FFFFh (APM v1.0)
  666.         CX = new state
  667.             0000h disabled
  668.             0001h enabled
  669.  Return: CF clear if successful
  670.         CF set on error
  671.             AH = error code (01h,03h,09h,0Ah,0Bh) (see #0399)
  672.  Notes: when power management is disabled, the system BIOS will not
  673.           automatically power down devices, enter stand-by or suspended mode,
  674.           or perform any power-saving actions in response to AX=5305h calls
  675.         should not be called from within a hardware interrupt handler to avoid
  676.           reentrance problems
  677.         the APM BIOS should never be both disabled and disengaged at the same
  678.           time
  679.  SeeAlso: AX=5309h,AX=530Dh,AX=530Fh
  680.  --------p-155309-----------------------------
  681.  INT 15 - Advanced Power Management v1.0+ - RESTORE POWER-ON DEFAULTS
  682.         AX = 5309h
  683.         BX = device ID for all devices power-managed by APM
  684.             0001h (APM v1.1)
  685.             FFFFh (APM v1.0)
  686.  Return: CF clear if successful
  687.         CF set on error
  688.             AH = error code (03h,09h,0Bh) (see #0399)
  689.  Note:  should not be called from within a hardware interrupt handler to avoid
  690.           reentrance problems
  691.  SeeAlso: AX=5308h
  692.  --------p-15530A-----------------------------
  693.  INT 15 - Advanced Power Management v1.0+ - GET POWER STATUS
  694.         AX = 530Ah
  695.         BX = device ID
  696.             0001h all devices power-managed by APM
  697.             80xxh specific battery unit number XXh (01h-FFh) (APM v1.2)
  698.  Return: CF clear if successful
  699.             BH = AC line status
  700.                 00h off-line
  701.                 01h on-line
  702.                 02h on backup power (APM v1.1)
  703.                 FFh unknown
  704.                 other reserved
  705.             BL = battery status (see #0402)
  706.             CH = battery flag (APM v1.1+) (see #0403)
  707.             CL = remaining battery life, percentage
  708.                 00h-64h (0-100) percentage of full charge
  709.                 FFh unknown
  710.             DX = remaining battery life, time (APM v1.1) (see #0404)
  711.             ---if specific battery unit specified---
  712.             SI = number of battery units currently installed
  713.         CF set on error
  714.             AH = error code (09h,0Ah) (see #0399)
  715.  Notes: should not be called from within a hardware interrupt handler to avoid
  716.           reentrance problems
  717.         supported in real mode (INT 15) and both 16-bit and 32-bit protected
  718.           mode
  719.  
  720.  (Table 0402)
  721.  Values for APM v1.0+ battery status:
  722.   00h   high
  723.   01h   low
  724.   02h   critical
  725.   03h   charging
  726.   FFh   unknown
  727.   other reserved
  728.  SeeAlso: #0403,#0404
  729.  
  730.  Bitfields for APM v1.1+ battery flag:
  731.  Bit(s) Description     (Table 0403)
  732.   0     high
  733.   1     low
  734.   2     critical
  735.   3     charging
  736.   4     selected battery not present (APM v1.2)
  737.   5-6   reserved (0)
  738.   7     no system battery
  739.  Note:  all bits set (FFh) if unknown
  740.  SeeAlso: #0402,#0404
  741.  
  742.  Bitfields for APM v1.1+ remaining battery life:
  743.  Bit(s) Description     (Table 0404)
  744.   15    time units: 0=seconds, 1=minutes
  745.   14-0  battery life in minutes or seconds
  746.  Note:  all bits set (FFFFh) if unknown
  747.  SeeAlso: #0402,#0403
  748.  --------p-15530B-----------------------------
  749.  INT 15 - Advanced Power Management v1.0+ - GET POWER MANAGEMENT EVENT
  750.         AX = 530Bh
  751.  Return: CF clear if successful
  752.             BX = event code (see #0405)
  753.             CX = event information (APM v1.2) if BX=0003h or BX=0004h
  754.                 bit 0: PCMCIA socket was powered down in suspend state
  755.         CF set on error
  756.             AH = error code (03h,0Bh,80h) (see #0399)
  757.  Notes: although power management events are often asynchronous, notification
  758.           will not be made until polled via this call to permit software to
  759.           only receive event notification when it is prepared to process
  760.           power management events; since these events are not very time-
  761.           critical, it should be sufficient to poll once or twice per second
  762.         the critical resume notification is made after the system resumes
  763.           from an emergency suspension; normally, the system BIOS only notifies
  764.           its partner that it wishes to suspend and relies on the partner to
  765.           actually request the suspension, but no notification is made on an
  766.           emergency suspension
  767.         should not be called from within a hardware interrupt handler to avoid
  768.           reentrance problems
  769.  SeeAlso: AX=5307h,AX=5307h/CX=0001h"STAND-BY",AX=5307h/CX=0002h"SUSPEND"
  770.  
  771.  (Table 0405)
  772.  Values for APM event code:
  773.   0001h system stand-by request
  774.   0002h system suspend request
  775.   0003h normal resume system notification
  776.   0004h critical resume system notification
  777.   0005h battery low notification
  778.  ---APM v1.1---
  779.   0006h power status change notification
  780.   0007h update time notification
  781.   0008h critical system suspend notification
  782.   0009h user system standby request notification
  783.   000Ah user system suspend request notification
  784.   000Bh system standby resume notification
  785.  ---APM v1.2---
  786.   000Ch capabilities change notification (see AX=5310h)
  787.  ------
  788.   000Dh-00FFh reserved system events
  789.   01xxh reserved device events
  790.   02xxh OEM-defined APM events
  791.   0300h-FFFFh reserved
  792.  --------p-15530C-----------------------------
  793.  INT 15 - Advanced Power Management v1.1+ - GET POWER STATE
  794.         AX = 530Ch
  795.         BX = device ID (see #0400)
  796.  Return: CF clear if successful
  797.             CX = system state ID (see #0401)
  798.         CF set on error
  799.             AH = error code (01h,09h) (see #0399)
  800.  SeeAlso: AX=5307h
  801.  --------p-15530D-----------------------------
  802.  INT 15 - Advanced Power Management v1.1+ - EN/DISABLE DEVICE POWER MANAGEMENT
  803.         AX = 530Dh
  804.         BX = device ID (see #0400)
  805.         CX = function
  806.             0000h disable power management
  807.             0001h enable power management
  808.  Return: CF clear if successful
  809.         CF set on error
  810.             AH = error code (01h,03h,09h,0Ah,0Bh) (see #0399)
  811.  Desc:  specify whether automatic power management should be active for a
  812.           given device
  813.  SeeAlso: AX=5308h,AX=530Fh
  814.  --------p-15530E-----------------------------
  815.  INT 15 - Advanced Power Management v1.1+ - DRIVER VERSION
  816.         AX = 530Eh
  817.         BX = device ID of system BIOS (0000h)
  818.         CH = APM driver major version (BCD)
  819.         CL = APM driver minor version (BCD) (02h for APM v1.2)
  820.  Return: CF clear if successful
  821.             AH = APM connection major version (BCD)
  822.             AL = APM connection minor version (BCD)
  823.         CF set on error
  824.             AH = error code (03h,09h,0Bh) (see #0399)
  825.  SeeAlso: AX=5300h,AX=5303h
  826.  --------p-15530F-----------------------------
  827.  INT 15 - Advanced Power Management v1.1+ - ENGAGE/DISENGAGE POWER MANAGEMENT
  828.         AX = 530Fh
  829.         BX = device ID (see #0400)
  830.         CX = function
  831.             0000h disengage power management
  832.             0001h engage power management
  833.  Return: CF clear if successful
  834.         CF set on error
  835.             AH = error code (01h,09h) (see #0399)
  836.  Notes: unlike AX=5308h, this call does not affect the functioning of the APM
  837.           BIOS
  838.         when cooperative power management is disengaged, the APM BIOS performs
  839.           automatic power management of the system or device
  840.  SeeAlso: AX=5308h,AX=530Dh
  841.  --------p-155310-----------------------------
  842.  INT 15 - Advanced Power Management v1.2 - GET CAPABILITIES
  843.         AX = 5310h
  844.         BX = device ID (see #0400)
  845.             0000h (APM BIOS)
  846.             other reserved
  847.  Return: CF clear if successful
  848.             BL = number of battery units supported (00h if no system batteries)
  849.             CX = capabilities flags (see #0406)
  850.         CF set on error
  851.             AH = error code (01h,09h,86h) (see #0399)
  852.  Notes: this function is supported via the INT 15, 16-bit protected mode, and
  853.           32-bit protected mode interfaces; it does not require that a
  854.           connection be established prior to use
  855.         this function will return the capabilities currently in effect, not
  856.           any new settings which have been made but do not take effect until
  857.           a system restart
  858.  SeeAlso: AX=5300h,AX=530Fh,AX=5311h,AX=5312h,AX=5313h
  859.  
  860.  Bitfields for APM v1.2 capabilities flags:
  861.  Bit(s) Description     (Table 0406)
  862.   0     can enter global standby state
  863.   1     can enter global suspend state
  864.   2     resume timer will wake up system from standby mode
  865.   3     resume timer will wake up system from suspend mode
  866.   4     Resume on Ring Indicator will wake up system from standby mode
  867.   5     Resume on Ring Indicator will wake up system from suspend mode
  868.   6     PCMCIA Ring Indicator will wake up system from standby mode
  869.   7     PCMCIA Ring Indicator will wake up system from suspend mode
  870.  --------p-155311-----------------------------
  871.  INT 15 - Advanced Power Management v1.2 - GET/SET/DISABLE RESUME TIMER
  872.         AX = 5311h
  873.         BX = device ID (see #0400)
  874.             0000h (APM BIOS)
  875.             other reserved
  876.         CL = function
  877.             00h disable Resume Timer
  878.             01h get Resume Timer
  879.             02h set Resume Timer
  880.                 CH = resume time, seconds (BCD)
  881.                 DL = resume time, minutes (BCD)
  882.                 DH = resume time, hours (BCD)
  883.                 SI = resume date (BCD), high byte = month, low byte = day
  884.                 DI = resume date, year (BCD)
  885.  Return: CF clear if successful
  886.             ---if getting timer---
  887.             CH = resume time, seconds (BCD)
  888.             DL = resume time, minutes (BCD)
  889.             DH = resume time, hours (BCD)
  890.             SI = resume date (BCD), high byte = month, low byte = day
  891.             DI = resume date, year (BCD)
  892.         CF set on error
  893.             AH = error code (03h,09h,0Ah,0Bh,0Ch,0Dh,86h) (see #0399)
  894.  Notes: this function is supported via the INT 15, 16-bit protected mode, and
  895.           32-bit protected mode interfaces
  896.  SeeAlso: AX=5300h,AX=5310h,AX=5312h,AX=5313h
  897.  --------p-155312-----------------------------
  898.  INT 15 - Advanced Power Management v1.2 - ENABLE/DISABLE RESUME ON RING
  899.         AX = 5312h
  900.         BX = device ID (see #0400)
  901.             0000h (APM BIOS)
  902.             other reserved
  903.         CL = function
  904.             00h disable Resume on Ring Indicator
  905.             01h enable Resume on Ring Indicator
  906.             02h get Resume on Ring Indicator status
  907.  Return: CF clear if successful
  908.             CX = resume status (0000h disabled, 0001h enabled)
  909.         CF set on error
  910.             AH = error code (03h,09h,0Ah,0Bh,0Ch,86h) (see #0399)
  911.  Notes: this function is supported via the INT 15, 16-bit protected mode, and
  912.           32-bit protected mode interfaces
  913.  SeeAlso: AX=5300h,AX=5310h,AX=5311h,AX=5313h
  914.  --------p-155313-----------------------------
  915.  INT 15 - Advanced Power Management v1.2 - ENABLE/DISABLE TIMER-BASED REQUESTS
  916.         AX = 5313h
  917.         BX = device ID (see #0400)
  918.             0000h (APM BIOS)
  919.             other reserved
  920.         CL = function
  921.             00h disable timer-based requests
  922.             01h enable timer-based requests
  923.             02h get timer-based requests status
  924.  Return: CF clear if successful
  925.             CX = timer-based requests status (0000h disabled, 0001h enabled)
  926.         CF set on error
  927.             AH = error code (03h,09h,0Ah,0Bh,86h) (see #0399)
  928.  Notes: this function is supported via the INT 15, 16-bit protected mode, and
  929.           32-bit protected mode interfaces
  930.  SeeAlso: AX=5300h,AX=5310h,AX=5311h,AX=5312h
  931.  --------p-155380BH00-------------------------
  932.  INT 15 - APM SL Enhanced v1.0 - GET SUSPEND/GLOBAL STANDBY MODE
  933.         AX = 5380h
  934.         BH = 00h
  935.  Return: CF clear if successful
  936.             AL = 82360SL Auto Power Off Timer High Count (APWR_TMRH)
  937.             BL = sustdbymode (see #0407)
  938.  SeeAlso: AX=5380h/BH=01h,AX=5380h/BH=02h,AX=5380h/BH=7Fh
  939.  
  940.  Bitfields for APM SL sustdbymode:
  941.  Bit(s) Description     (Table 0407)
  942.   2     ???
  943.   1     Auto Power Off Timer Enable (APWR_TMR_EN)
  944.   0     ???
  945.  --------p-155380BH01-------------------------
  946.  INT 15 - APM SL Enhanced v1.0 - SET SUSPEND/GLOBAL STANDBY MODE
  947.         AX = 5380h
  948.         BH = 01h
  949.         BL = sustdbymode (see #0407)
  950.  Return: CF clear if successful
  951.  SeeAlso: AX=5380h/BH=00h,AX=5380h/BH=7Fh
  952.  --------p-155380BH02-------------------------
  953.  INT 15 - APM SL Enhanced v1.0 - GET GLOBAL STANDBY TIMER
  954.         AX = 5380h
  955.         BH = 02h
  956.  Return: CF clear if successful
  957.         SI:DI = timer count in seconds (actually 1.024 seconds)
  958.  Desc:  reads the value of 82360SL GSTDBY_TMRH & GSTDBY_TMRL registers
  959.  SeeAlso: AX=5380h/BH=00h,AX=5380h/BH=03h,AX=5380h/BH=04h,AX=5380h/BH=7Fh
  960.  --------p-155380BH03-------------------------
  961.  INT 15 - APM SL Enhanced v1.0 - SET GLOBAL STANDBY TIMER
  962.         AX = 5380h
  963.         BH = 03h
  964.         SI:DI = timer count in seconds (actually 1.024 seconds)
  965.  Return: CF clear if successful
  966.  Desc:  sets the value of 82360SL GSTDBY_TMRH & GSTDBY_TMRL registers
  967.  Note:  the maximum timer count is 268431 seconds
  968.  SeeAlso: AX=5380h/BH=02h,AX=5380h/BH=7Fh
  969.  --------p-155380BH04-------------------------
  970.  INT 15 - APM SL Enhanced v1.0 - GET AUTO POWER OFF TIMER
  971.         AX = 5380h
  972.         BH = 04h
  973.  Return: CF clear if successful
  974.         SI:DI = timer count in seconds (actually 1.024 seconds)
  975.  Desc:  reads the value of 82360SL APWR_TMRH & APWR_TMRL registers
  976.  SeeAlso: AX=5380h/BH=02h,AX=5380h/BH=05h,AX=5380h/BH=06h,AX=5380h/BH=7Fh
  977.  --------p-155380BH05-------------------------
  978.  INT 15 - APM SL Enhanced v1.0 - SET AUTO POWER OFF TIMER
  979.         AX = 5380h
  980.         BH = 05h
  981.         SI:DI = timer count in seconds (actually 1.024 seconds)
  982.  Return: CF clear if successful
  983.  Desc:  sets the value of 82360SL APWR_TMRH & APWR_TMRL registers
  984.  Note:  the maximum timer count is 134213 seconds
  985.  SeeAlso: AX=5380h/BH=04h,AX=5380h/BH=7Fh
  986.  --------p-155380BH06-------------------------
  987.  INT 15 - APM SL Enhanced v1.0 - GET RESUME CONDITION
  988.         AX = 5380h
  989.         BH = 06h
  990.  Return: CF clear if successful
  991.             BL = resume condition (see #0408)
  992.  Desc:  reads the value of 82360SL RESUME_MASK register
  993.  SeeAlso: AX=5380h/BH=04h,AX=5380h/BH=07h,AX=5380h/BH=08h,AX=5380h/BH=7Fh
  994.  
  995.  Bitfields for APM SL resume condition:
  996.  Bit(s) Description     (Table 0408)
  997.   7-2   reserved (0)
  998.   1     alarm enabled (resume on CMOS alarm)
  999.   0     ring enabled
  1000.  --------p-155380BH07-------------------------
  1001.  INT 15 - APM SL Enhanced v1.0 - SET RESUME CONDITION
  1002.         AX = 5380h
  1003.         BH = 07h
  1004.         BL = resume condition (see #0408)
  1005.  Return: CF clear if successful
  1006.  Desc:  sets the value of 82360SL RESUME_MASK register
  1007.  SeeAlso: AX=5380h/BH=06h,AX=5380h/BH=7Fh
  1008.  --------p-155380BH08-------------------------
  1009.  INT 15 - APM SL Enhanced v1.0 - GET CALENDAR EVENT TIME
  1010.         AX = 5380h
  1011.         BH = 08h
  1012.  Return: CF clear if successful
  1013.             CH = hours
  1014.             CL = minutes
  1015.             SI = seconds
  1016.         CF set on error
  1017.             AH = error code (see #0409)
  1018.  Desc:  gets calendar event time from CMOS ram
  1019.  SeeAlso: AX=5380h/BH=06h,AX=5380h/BH=09h,AX=5380h/BH=0Ah,AX=5380h/BH=7Fh
  1020.  
  1021.  (Table 0409)
  1022.  Values for APM SL error code:
  1023.   02h   no alarm set
  1024.   03h   no battery
  1025.  --------p-155380BH09-------------------------
  1026.  INT 15 - APM SL Enhanced v1.0 - SET CALENDAR EVENT TIME
  1027.         AX = 5380h
  1028.         BH = 09h
  1029.         CH = hours
  1030.         CL = minutes
  1031.         SI = seconds
  1032.  Return: CF clear if successful
  1033.         CF set on error
  1034.             AH = error code (see #0409)
  1035.  Desc:  sets calendar event time in CMOS ram, enables Alarm resume
  1036.  SeeAlso: AX=5380h/BH=08h,AX=5380h/BH=7Fh
  1037.  --------p-155380BH0A-------------------------
  1038.  INT 15 - APM SL Enhanced v1.0 - GET CALENDAR EVENT DATE
  1039.         AX = 5380h
  1040.         BH = 0Ah
  1041.  Return: CF clear if successful
  1042.             SI = century
  1043.             DI = year
  1044.             CH = month
  1045.             CL = day
  1046.         CF set on error
  1047.             AH = error code (see #0409)
  1048.  Desc:  reads calendar event date from Extended CMOS ram
  1049.  SeeAlso: AX=5380h/BH=08h,AX=5380h/BH=0Bh,AX=5380h/BH=0Ch,AX=5380h/BH=7Fh
  1050.  --------p-155380BH0B-------------------------
  1051.  INT 15 - APM SL Enhanced v1.0 - SET CALENDAR EVENT DATE
  1052.         AX = 5380h
  1053.         BH = 0Bh
  1054.         SI = century
  1055.         DI = year
  1056.         CH = month
  1057.         CL = day
  1058.  Return: CF clear if successful
  1059.         CF set on error
  1060.             AH = error code (see #0409)
  1061.  Desc:  sets calendar event date in Extended CMOS ram
  1062.  SeeAlso: AX=5380h/BH=0Ah,AX=5380h/BH=7Fh
  1063.  --------p-155380BH0C-------------------------
  1064.  INT 15 - APM SL Enhanced v1.0 - GET CPU SPEED MODE
  1065.         AX = 5380h
  1066.         BH = 0Ch
  1067.  Return: CF clear if successful
  1068.         CL = CPU clock divider (1,2,4 or 8)
  1069.         BL = autocpumode ???
  1070.  Desc:  reads bits 4-5 of CPUPWRMODE register
  1071.  SeeAlso: AX=5380h/BH=0Ah,AX=5380h/BH=0Dh,AX=5380h/BH=7Fh
  1072.  --------p-155380BH0D-------------------------
  1073.  INT 15 - APM SL Enhanced v1.0 - SET CPU SPEED MODE
  1074.         AX = 5380h
  1075.         BH = 0Dh
  1076.         CL = CPU clock divider (1,2,4 or 8)
  1077.         BL = autocpumode ???
  1078.  Return: CF clear if successful
  1079.  Desc:  writes bits 4-5 of CPUPWRMODE register
  1080.  SeeAlso: AX=5380h/BH=0Ch,AX=5380h/BH=7Eh,AX=5380h/BH=7Fh
  1081.  --------p-155380BH7E-------------------------
  1082.  INT 15 - APM SL Enhanced v1.0 - SL HW PARAMETER
  1083.         AX = 5380h
  1084.         BH = 7Eh
  1085.  Return: AL = ???
  1086.             03h on A-Step 386SL BIOSes
  1087.             12h on later steps
  1088.         BX = Control port (00B0h)
  1089.  SeeAlso: AX=5380h/BH=00h,AX=5380h/BH=7Fh
  1090.  --------p-155380BH7F-------------------------
  1091.  INT 15 - Advanced Power Management v1.1 - OEM APM INSTALLATION CHECK
  1092.         AX = 5380h
  1093.         BH = 7Fh
  1094.  Return: CF clear if successful
  1095.             BX = OEM identifier
  1096.             all other registers OEM-defined
  1097.             ---Intel SL Enhanced Option BIOS---
  1098.             BX = 534Ch ('SL')
  1099.             CL = 4Fh ('O')
  1100.             AL = version (10h = 1.0)
  1101.             ---HP APM BIOS---
  1102.             BX = 4850h ('HP')
  1103.             CX = version (0001h)
  1104.         CF set on error
  1105.             AH = error code (03h) (see #0399)
  1106.  SeeAlso: AX=5380h/BH=00h
  1107.  --------p-155380-----------------------------
  1108.  INT 15 - Advanced Power Management v1.1 - OEM APM FUNCTIONS
  1109.         AX = 5380h
  1110.         BH <> 7Fh
  1111.         all other registers OEM-defined
  1112.  Return: OEM-defined
  1113.  SeeAlso: AX=5380h/BH=7Fh
  1114. \***********************************************************************/
  1115.  
  1116. #pragma pack()
  1117.  
  1118. #endif  /* __APM_H__ */
  1119.