init.h

Go to the documentation of this file.
00001 #ifndef _GPXE_INIT_H
00002 #define _GPXE_INIT_H
00003 
00004 FILE_LICENCE ( GPL2_OR_LATER );
00005 
00006 #include <gpxe/tables.h>
00007 
00008 /**
00009  * An initialisation function
00010  *
00011  * Initialisation functions are called exactly once, as part of the
00012  * call to initialise().
00013  */
00014 struct init_fn {
00015         void ( * initialise ) ( void );
00016 };
00017 
00018 /** Initialisation function table */
00019 #define INIT_FNS __table ( struct init_fn, "init_fns" )
00020 
00021 /** Declare an initialisation functon */
00022 #define __init_fn( init_order ) __table_entry ( INIT_FNS, init_order )
00023 
00024 /** @defgroup initfn_order Initialisation function ordering
00025  * @{
00026  */
00027 
00028 #define INIT_EARLY      01      /**< Early initialisation */
00029 #define INIT_SERIAL     02      /**< Serial driver initialisation */
00030 #define INIT_CONSOLE    03      /**< Console initialisation */
00031 #define INIT_NORMAL     04      /**< Normal initialisation */
00032 
00033 /** @} */
00034 
00035 /** Shutdown flags */
00036 enum shutdown_flags {
00037         /** Shutdown is in order to exit (return to gPXE's caller) */
00038         SHUTDOWN_EXIT = 0x0001,
00039         /** Shutdown is in order to boot an OS */
00040         SHUTDOWN_BOOT = 0x0002,
00041         /** Do not remove devices */
00042         SHUTDOWN_KEEP_DEVICES = 0x0004,
00043 };
00044 
00045 /**
00046  * A startup/shutdown function
00047  *
00048  * Startup and shutdown functions may be called multiple times, as
00049  * part of the calls to startup() and shutdown().
00050  */
00051 struct startup_fn {
00052         void ( * startup ) ( void );
00053         void ( * shutdown ) ( int flags );
00054 };
00055 
00056 /** Startup/shutdown function table */
00057 #define STARTUP_FNS __table ( struct startup_fn, "startup_fns" )
00058 
00059 /** Declare a startup/shutdown function */
00060 #define __startup_fn( startup_order ) \
00061         __table_entry ( STARTUP_FNS, startup_order )
00062 
00063 /** @defgroup startfn_order Startup/shutdown function ordering
00064  *
00065  * Shutdown functions are called in the reverse order to startup
00066  * functions.
00067  *
00068  * @{
00069  */
00070 
00071 #define STARTUP_EARLY   01      /**< Early startup */
00072 #define STARTUP_NORMAL  02      /**< Normal startup */
00073 #define STARTUP_LATE    03      /**< Late startup */
00074 
00075 /** @} */
00076 
00077 extern void initialise ( void );
00078 extern void startup ( void );
00079 extern void shutdown ( int flags );
00080 
00081 #endif /* _GPXE_INIT_H */

Generated on Tue Apr 6 20:01:08 2010 for gPXE by  doxygen 1.5.7.1