[U-Boot] [PATCH v3 5/8] sandbox: Add concept of sandbox state

Mike Frysinger vapier at gentoo.org
Wed Jan 25 00:05:48 CET 2012


On Monday 23 January 2012 01:48:50 Simon Glass wrote:
> --- a/arch/sandbox/cpu/start.c
> +++ b/arch/sandbox/cpu/start.c
> 
>  int main(int argc, char *argv[])
>  {
> +	struct sandbox_state *state = NULL;
> +	int err;
> +
> +	err = state_init();
> +	if (!err) {
> +		state = state_get_current();
> +		assert(state);
> +	}

i guess a lot of this checking/plumbing only makes sense in the context of 
future work where the state represents a lot more stuff

> --- /dev/null
> +++ b/arch/sandbox/cpu/state.c
>
> +struct sandbox_state main_state;
> +struct sandbox_state *state;	/* Pointer to current state record */

static

> +int state_is_processor_reset(void)
> +{
> +	return 1;
> +}

if the cpu is in reset, then u-boot is dead ...

> +struct sandbox_state *state_get_current(void)
> +{
> +	assert(state);
> +	return state;
> +}

you assert() here and in main() ... i think we can get rid of the one in the 
main() func

> --- /dev/null
> +++ b/arch/sandbox/include/asm/arch-sandbox/state.h

needs ifdef protection against multiple inclusion

> +/* The complete state of the test system */
> +struct sandbox_state {
> +	const char *cmd;		/* Command to execute */
> +	enum exit_type_id exit_type;	/* How we exited U-Boot */
> +};

the argc/argv given to main() should be in here
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120124/5a846502/attachment.pgp>


More information about the U-Boot mailing list