From: Erik M. <er...@us...> - 2001-10-02 21:39:58
|
Update of /cvsroot/blob/blob/include In directory usw-pr-cvs1:/tmp/cvs-serv3560/include Modified Files: init.h Makefile.am Log Message: The init and exit lists code. Index: init.h =================================================================== RCS file: /cvsroot/blob/blob/include/init.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- init.h 2001/10/02 21:31:17 1.1 +++ init.h 2001/10/02 21:39:54 1.2 @@ -0,0 +1,76 @@ +/* + * init.h: Support for init and exit lists + * + * Copyright (C) 2001 Erik Mouw (J.A...@it...) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#ident "$Id$" + +#ifndef BLOB_INIT_H +#define BLOB_INIT_H + +#include "types.h" + +#define INIT_MAGIC (0x496e6974) /* "Init" */ +#define EXIT_MAGIC (0x45786974) /* "Exit" */ + + +typedef void(*initfunc_t)(void); + + +typedef struct { + u32 magic; + initfunc_t callback; + int level; +} initlist_t; + + +#define __init __attribute__((unused, __section__(".initlist"))) + +#define __initlist(fn, lvl) \ +static initlist_t __init_##fn __init = { \ + magic: INIT_MAGIC, \ + callback: fn, \ + level: lvl } + + +#define __exit __attribute__((unused, __section__(".exitlist"))) + +#define __exitlist(fn, lvl) \ +static initlist_t __exit_##fn __exit = { \ + magic: EXIT_MAGIC, \ + callback: fn, \ + level: lvl } + + +/* minimum and maximum levels */ +#define INIT_LEVEL_MIN (0) +#define INIT_LEVEL_MAX (99) + +/* define some useful levels */ +#define INIT_LEVEL_INITIAL_HARDWARE (0) +#define INIT_LEVEL_PARAM_LIST (10) +#define INIT_LEVEL_OTHER_HARDWARE (20) +#define INIT_LEVEL_OTHER_STUFF (30) + + +void init_subsystems(void); +void exit_subsystems(void); + + +#endif Index: Makefile.am =================================================================== RCS file: /cvsroot/blob/blob/include/Makefile.am,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- Makefile.am 2001/09/18 19:55:29 1.4 +++ Makefile.am 2001/10/02 21:39:54 1.5 @@ -14,6 +14,7 @@ noinst_HEADERS = \ command.h \ flash.h \ + init.h \ led.h \ linux.h \ main.h \ |