Simon Glass | 20bf89a | 2012-02-15 15:51:15 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2011-2012 The Chromium OS Authors. |
Wolfgang Denk | d79de1d | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 3 | * SPDX-License-Identifier: GPL-2.0+ |
Simon Glass | 20bf89a | 2012-02-15 15:51:15 -0800 | [diff] [blame] | 4 | */ |
| 5 | |
| 6 | #ifndef __SANDBOX_STATE_H |
| 7 | #define __SANDBOX_STATE_H |
| 8 | |
Simon Glass | 8a3e035 | 2012-02-15 15:51:16 -0800 | [diff] [blame] | 9 | #include <config.h> |
Simon Glass | f498e43 | 2013-11-10 10:27:02 -0700 | [diff] [blame^] | 10 | #include <stdbool.h> |
Simon Glass | 8a3e035 | 2012-02-15 15:51:16 -0800 | [diff] [blame] | 11 | |
Simon Glass | 20bf89a | 2012-02-15 15:51:15 -0800 | [diff] [blame] | 12 | /* How we exited U-Boot */ |
| 13 | enum exit_type_id { |
| 14 | STATE_EXIT_NORMAL, |
| 15 | STATE_EXIT_COLD_REBOOT, |
| 16 | STATE_EXIT_POWER_OFF, |
| 17 | }; |
| 18 | |
Mike Frysinger | 1d8e57c | 2013-12-03 16:43:26 -0700 | [diff] [blame] | 19 | struct sandbox_spi_info { |
| 20 | const char *spec; |
| 21 | const struct sandbox_spi_emu_ops *ops; |
| 22 | }; |
| 23 | |
Simon Glass | 20bf89a | 2012-02-15 15:51:15 -0800 | [diff] [blame] | 24 | /* The complete state of the test system */ |
| 25 | struct sandbox_state { |
| 26 | const char *cmd; /* Command to execute */ |
Simon Glass | f498e43 | 2013-11-10 10:27:02 -0700 | [diff] [blame^] | 27 | bool interactive; /* Enable cmdline after execute */ |
Simon Glass | 1539343 | 2013-04-20 08:42:41 +0000 | [diff] [blame] | 28 | const char *fdt_fname; /* Filename of FDT binary */ |
Simon Glass | 20bf89a | 2012-02-15 15:51:15 -0800 | [diff] [blame] | 29 | enum exit_type_id exit_type; /* How we exited U-Boot */ |
Simon Glass | 8a3e035 | 2012-02-15 15:51:16 -0800 | [diff] [blame] | 30 | const char *parse_err; /* Error to report from parsing */ |
| 31 | int argc; /* Program arguments */ |
| 32 | char **argv; |
Mike Frysinger | 1d8e57c | 2013-12-03 16:43:26 -0700 | [diff] [blame] | 33 | |
| 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 Glass | 20bf89a | 2012-02-15 15:51:15 -0800 | [diff] [blame] | 37 | }; |
| 38 | |
| 39 | /** |
| 40 | * Record the exit type to be reported by the test program. |
| 41 | * |
| 42 | * @param exit_type Exit type to record |
| 43 | */ |
| 44 | void 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 | */ |
| 51 | struct sandbox_state *state_get_current(void); |
| 52 | |
| 53 | /** |
| 54 | * Initialize the test system state |
| 55 | */ |
| 56 | int state_init(void); |
| 57 | |
| 58 | #endif |