Simon Glass | 6fb6207 | 2012-02-15 15:51:15 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2011-2012 The Chromium OS Authors. |
Wolfgang Denk | 1a45966 | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 3 | * SPDX-License-Identifier: GPL-2.0+ |
Simon Glass | 6fb6207 | 2012-02-15 15:51:15 -0800 | [diff] [blame] | 4 | */ |
| 5 | |
| 6 | #ifndef __SANDBOX_STATE_H |
| 7 | #define __SANDBOX_STATE_H |
| 8 | |
Simon Glass | 70db421 | 2012-02-15 15:51:16 -0800 | [diff] [blame] | 9 | #include <config.h> |
| 10 | |
Simon Glass | 6fb6207 | 2012-02-15 15:51:15 -0800 | [diff] [blame] | 11 | /* How we exited U-Boot */ |
| 12 | enum exit_type_id { |
| 13 | STATE_EXIT_NORMAL, |
| 14 | STATE_EXIT_COLD_REBOOT, |
| 15 | STATE_EXIT_POWER_OFF, |
| 16 | }; |
| 17 | |
Mike Frysinger | 6122813 | 2013-12-03 16:43:26 -0700 | [diff] [blame] | 18 | struct sandbox_spi_info { |
| 19 | const char *spec; |
| 20 | const struct sandbox_spi_emu_ops *ops; |
| 21 | }; |
| 22 | |
Simon Glass | 6fb6207 | 2012-02-15 15:51:15 -0800 | [diff] [blame] | 23 | /* The complete state of the test system */ |
| 24 | struct sandbox_state { |
| 25 | const char *cmd; /* Command to execute */ |
Simon Glass | f828bf2 | 2013-04-20 08:42:41 +0000 | [diff] [blame] | 26 | const char *fdt_fname; /* Filename of FDT binary */ |
Simon Glass | 6fb6207 | 2012-02-15 15:51:15 -0800 | [diff] [blame] | 27 | enum exit_type_id exit_type; /* How we exited U-Boot */ |
Simon Glass | 70db421 | 2012-02-15 15:51:16 -0800 | [diff] [blame] | 28 | const char *parse_err; /* Error to report from parsing */ |
| 29 | int argc; /* Program arguments */ |
| 30 | char **argv; |
Mike Frysinger | 6122813 | 2013-12-03 16:43:26 -0700 | [diff] [blame] | 31 | |
| 32 | /* Pointer to information for each SPI bus/cs */ |
| 33 | struct sandbox_spi_info spi[CONFIG_SANDBOX_SPI_MAX_BUS] |
| 34 | [CONFIG_SANDBOX_SPI_MAX_CS]; |
Simon Glass | 6fb6207 | 2012-02-15 15:51:15 -0800 | [diff] [blame] | 35 | }; |
| 36 | |
| 37 | /** |
| 38 | * Record the exit type to be reported by the test program. |
| 39 | * |
| 40 | * @param exit_type Exit type to record |
| 41 | */ |
| 42 | void state_record_exit(enum exit_type_id exit_type); |
| 43 | |
| 44 | /** |
| 45 | * Gets a pointer to the current state. |
| 46 | * |
| 47 | * @return pointer to state |
| 48 | */ |
| 49 | struct sandbox_state *state_get_current(void); |
| 50 | |
| 51 | /** |
| 52 | * Initialize the test system state |
| 53 | */ |
| 54 | int state_init(void); |
| 55 | |
| 56 | #endif |