blob: df196b79f6dfd8a3a2796c1e3aba994c90e8d299 [file] [log] [blame]
Simon Glass20bf89a2012-02-15 15:51:15 -08001/*
2 * Copyright (c) 2011-2012 The Chromium OS Authors.
Wolfgang Denkd79de1d2013-07-08 09:37:19 +02003 * SPDX-License-Identifier: GPL-2.0+
Simon Glass20bf89a2012-02-15 15:51:15 -08004 */
5
6#ifndef __SANDBOX_STATE_H
7#define __SANDBOX_STATE_H
8
Simon Glass8a3e0352012-02-15 15:51:16 -08009#include <config.h>
Simon Glassf498e432013-11-10 10:27:02 -070010#include <stdbool.h>
Simon Glass8a3e0352012-02-15 15:51:16 -080011
Simon Glass20bf89a2012-02-15 15:51:15 -080012/* How we exited U-Boot */
13enum exit_type_id {
14 STATE_EXIT_NORMAL,
15 STATE_EXIT_COLD_REBOOT,
16 STATE_EXIT_POWER_OFF,
17};
18
Mike Frysinger1d8e57c2013-12-03 16:43:26 -070019struct sandbox_spi_info {
20 const char *spec;
21 const struct sandbox_spi_emu_ops *ops;
22};
23
Simon Glass20bf89a2012-02-15 15:51:15 -080024/* The complete state of the test system */
25struct sandbox_state {
26 const char *cmd; /* Command to execute */
Simon Glassf498e432013-11-10 10:27:02 -070027 bool interactive; /* Enable cmdline after execute */
Simon Glass15393432013-04-20 08:42:41 +000028 const char *fdt_fname; /* Filename of FDT binary */
Simon Glass20bf89a2012-02-15 15:51:15 -080029 enum exit_type_id exit_type; /* How we exited U-Boot */
Simon Glass8a3e0352012-02-15 15:51:16 -080030 const char *parse_err; /* Error to report from parsing */
31 int argc; /* Program arguments */
32 char **argv;
Mike Frysinger1d8e57c2013-12-03 16:43:26 -070033
34 /* Pointer to information for each SPI bus/cs */
35 struct sandbox_spi_info spi[CONFIG_SANDBOX_SPI_MAX_BUS]
36 [CONFIG_SANDBOX_SPI_MAX_CS];
Simon Glass20bf89a2012-02-15 15:51:15 -080037};
38
39/**
40 * Record the exit type to be reported by the test program.
41 *
42 * @param exit_type Exit type to record
43 */
44void state_record_exit(enum exit_type_id exit_type);
45
46/**
47 * Gets a pointer to the current state.
48 *
49 * @return pointer to state
50 */
51struct sandbox_state *state_get_current(void);
52
53/**
54 * Initialize the test system state
55 */
56int state_init(void);
57
58#endif