]> git.ipfire.org Git - people/ms/u-boot.git/blame - arch/sandbox/include/asm/state.h
sandbox: Allow reading/writing of RAM buffer
[people/ms/u-boot.git] / arch / sandbox / include / asm / state.h
CommitLineData
6fb62078
SG
1/*
2 * Copyright (c) 2011-2012 The Chromium OS Authors.
1a459660 3 * SPDX-License-Identifier: GPL-2.0+
6fb62078
SG
4 */
5
6#ifndef __SANDBOX_STATE_H
7#define __SANDBOX_STATE_H
8
70db4212 9#include <config.h>
c5a62d4a 10#include <stdbool.h>
70db4212 11
6fb62078
SG
12/* 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
6122813f
MF
19struct sandbox_spi_info {
20 const char *spec;
21 const struct sandbox_spi_emu_ops *ops;
22};
23
6fb62078
SG
24/* The complete state of the test system */
25struct sandbox_state {
26 const char *cmd; /* Command to execute */
c5a62d4a 27 bool interactive; /* Enable cmdline after execute */
f828bf25 28 const char *fdt_fname; /* Filename of FDT binary */
6fb62078 29 enum exit_type_id exit_type; /* How we exited U-Boot */
70db4212
SG
30 const char *parse_err; /* Error to report from parsing */
31 int argc; /* Program arguments */
32 char **argv;
5c2859cd
SG
33 uint8_t *ram_buf; /* Emulated RAM buffer */
34 unsigned int ram_size; /* Size of RAM buffer */
35 const char *ram_buf_fname; /* Filename to use for RAM buffer */
36 bool write_ram_buf; /* Write RAM buffer on exit */
6122813f
MF
37
38 /* Pointer to information for each SPI bus/cs */
39 struct sandbox_spi_info spi[CONFIG_SANDBOX_SPI_MAX_BUS]
40 [CONFIG_SANDBOX_SPI_MAX_CS];
6fb62078
SG
41};
42
43/**
44 * Record the exit type to be reported by the test program.
45 *
46 * @param exit_type Exit type to record
47 */
48void state_record_exit(enum exit_type_id exit_type);
49
50/**
51 * Gets a pointer to the current state.
52 *
53 * @return pointer to state
54 */
55struct sandbox_state *state_get_current(void);
56
57/**
58 * Initialize the test system state
59 */
60int state_init(void);
61
5c2859cd
SG
62/**
63 * Uninitialize the test system state, writing out state if configured to
64 * do so.
65 *
66 * @return 0 if OK, -ve on error
67 */
68int state_uninit(void);
69
6fb62078 70#endif