1 /* $Id: pwroff.c,v 1.1 2004/12/03 20:10:43 gvg Exp $
3 * FILE : reactos/hal/x86/apm.c
4 * DESCRIPTION: Turn CPU off...
5 * PROJECT : ReactOS Operating System
6 * AUTHOR : D. Lindauer (July 11 1997)
7 * NOTE : This program is public domain
12 #define APM_FUNCTION_AVAILABLE 0x5300
13 #define APM_FUNCTION_CONNREAL 0x5301
14 #define APM_FUNCTION_POWEROFF 0x5307
15 #define APM_FUNCTION_ENABLECPU 0x530d
16 #define APM_FUNCTION_ENABLEAPM 0x530e
18 #define APM_DEVICE_BIOS 0
19 #define APM_DEVICE_ALL 1
21 #define APM_MODE_DISABLE 0
22 #define APM_MODE_ENABLE 1
28 nopm db
'No power management functionality',10,13,'$'
29 errmsg db
'Power management error',10,13,'$'
30 wrongver db
'Need APM version 1.1 or better',10,13,'$'
37 cmp ax
,101h
; See
if version
1.1 or greater
38 mov dx
,offset wrongver
42 mov ax
,5301h
; Do a real mode connection
43 mov bx
,0 ; device
= BIOS
47 cmp ah
,2 ; Pass
if already connected
48 mov dx
,offset errmsg
; else error
51 mov ax
,530eh
; Enable latest version of APM
52 mov bx
,0 ; device
= BIOS
53 mov cx
,[ver
] ; version
58 mov ax
,530dh
; Now engage
and enable CPU management
59 mov bx
,1 ; device
= all
66 mov bx
,1 ; device
= ALL
91 __asm__("int 21\n"); /* 0x15 */
94 #elif defined(_MSC_VER)
96 #error Unknown compiler for inline assembler
104 APM_FUNCTION_AVAILABLE
,
109 APM_FUNCTION_ENABLEAPM
,
113 APM_FUNCTION_POWEROFF
,