From: Erik M. <er...@us...> - 2001-10-02 21:54:51
|
Update of /cvsroot/blob/blob/src In directory usw-pr-cvs1:/tmp/cvs-serv6717/src Modified Files: command.c led.c linux.c main.c serial.c time.c Log Message: And this is how the init/exit lists are used. init_subsystems() is called in main(), exit_subsystems() just before the kernel boots. This should clean up things nicely. Index: command.c =================================================================== RCS file: /cvsroot/blob/blob/src/command.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- command.c 2001/10/02 20:50:24 1.7 +++ command.c 2001/10/02 21:54:48 1.8 @@ -36,6 +36,7 @@ #endif #include "command.h" +#include "init.h" #include "serial.h" #include "time.h" #include "types.h" @@ -51,7 +52,7 @@ commandlist_t *commands; -void init_commands(void) +static void init_commands(void) { commandlist_t *lastcommand; commandlist_t *cmd, *next_cmd; @@ -71,7 +72,7 @@ } } - +__initlist(init_commands, INIT_LEVEL_OTHER_STUFF); #define STATE_WHITESPACE (0) Index: led.c =================================================================== RCS file: /cvsroot/blob/blob/src/led.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- led.c 2001/08/06 22:44:52 1.2 +++ led.c 2001/10/02 21:54:48 1.3 @@ -42,10 +42,10 @@ #include "led.h" #include "sa1100.h" +#include "init.h" - static int led_state; @@ -76,3 +76,8 @@ else led_on(); } + + +/* init and exit calls */ +__initlist(led_on, INIT_LEVEL_INITIAL_HARDWARE); +__exitlist(led_off, INIT_LEVEL_INITIAL_HARDWARE); Index: linux.c =================================================================== RCS file: /cvsroot/blob/blob/src/linux.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- linux.c 2001/09/23 14:59:01 1.6 +++ linux.c 2001/10/02 21:54:48 1.7 @@ -29,6 +29,7 @@ #include "command.h" #include "main.h" #include "flash.h" +#include "init.h" #include "memory.h" #include "serial.h" #include "util.h" @@ -61,6 +62,9 @@ /* we assume that the kernel is in place */ SerialOutputString("\nStarting kernel ...\n\n"); + + /* disable subsystems that want to be disabled before kernel boot */ + exit_subsystems(); /* turn off I-cache */ asm ("mrc p15, 0, %0, c1, c0, 0": "=r" (i)); Index: main.c =================================================================== RCS file: /cvsroot/blob/blob/src/main.c,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- main.c 2001/09/24 17:50:41 1.14 +++ main.c 2001/10/02 21:54:48 1.15 @@ -40,6 +40,7 @@ #include "command.h" #include "flash.h" +#include "init.h" #include "led.h" #include "linux.h" #include "main.h" @@ -74,11 +75,9 @@ int retval = 0; u32 conf; - /* Turn the LED on again, so we can see that we safely made it - * into C code. - */ - led_on(); - + /* call subsystems */ + init_subsystems(); + /* initialise status */ blob_status.paramSize = 0; blob_status.paramType = fromFlash; @@ -93,6 +92,8 @@ blob_status.cmdline[0] = '\0'; blob_status.boot_delay = 10; + /* call SerialInit() because the default 9k6 speed might not + be what the user requested */ SerialInit(blob_status.terminalSpeed); /* parse the core tag, for critical things like terminal speed */ @@ -100,8 +101,6 @@ parse_ptag((void *) PARAM_START, &conf); #endif - TimerInit(); - /* Print the required GPL string */ SerialOutputString("\nConsider yourself LARTed!\n\n"); SerialOutputString(PACKAGE " version " VERSION "\n" @@ -116,9 +115,6 @@ /* get the amount of memory */ get_memory_map(); - - /* initialise command line parser */ - init_commands(); /* Parse all the tags in the paramater block */ #ifdef PARAM_START Index: serial.c =================================================================== RCS file: /cvsroot/blob/blob/src/serial.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- serial.c 2001/09/26 13:43:46 1.4 +++ serial.c 2001/10/02 21:54:48 1.5 @@ -35,6 +35,7 @@ # include "config.h" #endif +#include "init.h" #include "led.h" #include "sa1100.h" #include "serial.h" @@ -330,3 +331,13 @@ return(numRead); } + + +/* default initialisation */ +static void serial_default_init(void) +{ + SerialInit(baud9k6); +} + + +__initlist(serial_default_init, INIT_LEVEL_INITIAL_HARDWARE); Index: time.c =================================================================== RCS file: /cvsroot/blob/blob/src/time.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- time.c 2001/08/06 22:44:52 1.2 +++ time.c 2001/10/02 21:54:48 1.3 @@ -35,6 +35,7 @@ # include "config.h" #endif +#include "init.h" #include "led.h" #include "sa1100.h" #include "time.h" @@ -47,7 +48,7 @@ -void TimerInit(void) +static void TimerInit(void) { /* clear counter */ OSCR = 0; @@ -67,6 +68,8 @@ numOverflows = 0; } + +__initlist(TimerInit, INIT_LEVEL_OTHER_HARDWARE); |