Autodoc formatting fixed.
[AROS.git] / arch / ppc-chrp / exec / shutdowna.c
blob1a0fb1c0febf6eaa9ca265c229978ddf177831c1
1 /*
2 Copyright � 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: ShutdownA() - Shut down the operating system.
6 Lang: english
7 */
9 #include <aros/debug.h>
10 #include <proto/exec.h>
11 #include <proto/rtas.h>
13 static int rtas_call(struct ExecBase *SysBase, const char *method, int nargs, int nret, void *output, ...)
15 va_list args;
16 void *RTASBase = OpenResource("rtas.resource");
17 int retval;
19 va_start(args, output);
20 retval = RTASCall(method, nargs, nret, output, args);
21 va_end(args);
23 return retval;
26 /*****************************************************************************
28 NAME */
30 AROS_LH1(ULONG, ShutdownA,
32 /* SYNOPSIS */
33 AROS_LHA(ULONG, action, D0),
35 /* LOCATION */
36 struct ExecBase *, SysBase, 173, Exec)
38 /* FUNCTION
39 This function will shut down the operating system.
41 INPUTS
42 action - what to do:
43 * SD_ACTION_POWEROFF - power off the machine.
44 * SD_ACTION_COLDREBOOT - cold reboot the machine (not only AROS).
46 RESULT
47 This function does not return in case of success. Otherwise is returns
48 zero.
50 NOTES
51 It can be quite harmful to call this function. It may be possible that
52 you will lose data from other tasks not having saved, or disk buffers
53 not being flushed. Plus you could annoy the (other) users.
55 EXAMPLE
57 BUGS
59 SEE ALSO
60 ColdReboot()
62 ******************************************************************************/
64 AROS_LIBFUNC_INIT
66 void *RTASBase = OpenResource("rtas.resource");
68 if (RTASBase)
70 if (action == SD_ACTION_COLDREBOOT)
71 rtas_call(SysBase, "system-reboot", 0, 1, NULL);
72 else if (action ==SD_ACTION_POWEROFF)
73 rtas_call(SysBase, "power-off", 2, 1, NULL, -1, -1);
76 return 0;
78 AROS_LIBFUNC_EXIT