From: Russ D. <ru...@us...> - 2001-09-02 03:08:23
|
Update of /cvsroot/blob/blob/src In directory usw-pr-cvs1:/tmp/cvs-serv7168/src Modified Files: main.c param_block.c Log Message: add configuration logic to blob tags Index: main.c =================================================================== RCS file: /cvsroot/blob/blob/src/main.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- main.c 2001/09/02 02:29:54 1.5 +++ main.c 2001/09/02 03:08:20 1.6 @@ -81,6 +81,7 @@ char commandline[128]; int i; int retval = 0; + u32 conf; /* Turn the LED on again, so we can see that we safely made it * into C code. @@ -109,7 +110,7 @@ /* Parse the paramater block */ #ifdef PARAM_START - parse_ptags((void *) PARAM_START); + parse_ptags((void *) PARAM_START, &conf); #endif /* Print the required GPL string */ Index: param_block.c =================================================================== RCS file: /cvsroot/blob/blob/src/param_block.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- param_block.c 2001/09/02 02:29:54 1.2 +++ param_block.c 2001/09/02 03:08:20 1.3 @@ -41,6 +41,8 @@ #include "flash.h" #include <asm/setup.h> +#define __ASM_ARCH_HARDWARE_H +#include <asm/arch-sa1100/SA-1100.h> /* @@ -92,19 +94,33 @@ __ptagtable(PTAG_BAUD, parse_ptag_baud); +static int parse_ptag_gpio(const struct ptag *ptag) +{ + GPDR &= ~ptag->u.gpio.mask; + if ((GPSR & ptag->u.gpio.mask) == ptag->u.gpio.level) + return -1; + else return 0; +} + +__ptagtable(PTAG_GPIO, parse_ptag_gpio); + /* * Scan the tag table for this tag, and call its parse function. * The tag table is built by the linker from all the __ptagtable * declarations. */ -static int parse_ptag(const struct ptag *ptag) +static int parse_ptag(const struct ptag *ptag, u32 *conf) { extern struct ptagtable __ptagtable_begin, __ptagtable_end; struct ptagtable *t; for (t = &__ptagtable_begin; t < &__ptagtable_end; t++) - if (ptag->hdr.ptag == t->ptag) { - t->parse(ptag); + if (ptag->hdr.ptag == t->ptag && + ((*conf & ptag->hdr.conf_mask) == ptag->hdr.conf)) { + if (t->parse(ptag) == -1) { + *conf |= ptag->hdr.fail_set_mask; + *conf &= ~ptag->hdr.fail_clear_mask; + } break; } @@ -114,7 +130,7 @@ /* * Parse all tags in the list */ -void parse_ptags(void *arg) +void parse_ptags(void *arg, u32 *conf) { #ifdef PARAM_START struct ptag *t = (struct ptag *) arg; @@ -125,7 +141,7 @@ t->hdr.size > 0x7FFFFFFF) { return; /* corrupt tags */ } - if (!parse_ptag(t)) { /* Ignoring unrecognised tag */ } + if (!parse_ptag(t, conf)) { /* Ignoring unrecognised tag */ } } } #endif |