]> git.sur5r.net Git - u-boot/blobdiff - arch/sandbox/include/asm/state.h
Rename reset to sysreset
[u-boot] / arch / sandbox / include / asm / state.h
index e8e4fea1b57de66865ac84e0f06011f77a93202f..149f28d8732f980a3676a3bcefa71511458d4c40 100644 (file)
@@ -7,39 +7,64 @@
 #define __SANDBOX_STATE_H
 
 #include <config.h>
+#include <sysreset.h>
 #include <stdbool.h>
 #include <linux/stringify.h>
 
-/* How we exited U-Boot */
-enum exit_type_id {
-       STATE_EXIT_NORMAL,
-       STATE_EXIT_COLD_REBOOT,
-       STATE_EXIT_POWER_OFF,
+/**
+ * Selects the behavior of the serial terminal.
+ *
+ * If Ctrl-C is processed by U-Boot, then the only way to quit sandbox is with
+ * the 'reset' command, or equivalent.
+ *
+ * If the terminal is cooked, then Ctrl-C will terminate U-Boot, and the
+ * command line will not be quite such a faithful emulation.
+ *
+ * Options are:
+ *
+ *     raw-with-sigs           - Raw, but allow signals (Ctrl-C will quit)
+ *     raw                     - Terminal is always raw
+ *     cooked                  - Terminal is always cooked
+ */
+enum state_terminal_raw {
+       STATE_TERM_RAW_WITH_SIGS,       /* Default */
+       STATE_TERM_RAW,
+       STATE_TERM_COOKED,
+
+       STATE_TERM_COUNT,
 };
 
 struct sandbox_spi_info {
        const char *spec;
-       const struct sandbox_spi_emu_ops *ops;
+       struct udevice *emul;
 };
 
 /* The complete state of the test system */
 struct sandbox_state {
        const char *cmd;                /* Command to execute */
        bool interactive;               /* Enable cmdline after execute */
+       bool run_distro_boot;           /* Automatically run distro bootcommands */
        const char *fdt_fname;          /* Filename of FDT binary */
-       enum exit_type_id exit_type;    /* How we exited U-Boot */
        const char *parse_err;          /* Error to report from parsing */
        int argc;                       /* Program arguments */
-       char **argv;
+       char **argv;                    /* Command line arguments */
+       const char *jumped_fname;       /* Jumped from previous U_Boot */
        uint8_t *ram_buf;               /* Emulated RAM buffer */
        unsigned int ram_size;          /* Size of RAM buffer */
        const char *ram_buf_fname;      /* Filename to use for RAM buffer */
+       bool ram_buf_rm;                /* Remove RAM buffer file after read */
        bool write_ram_buf;             /* Write RAM buffer on exit */
        const char *state_fname;        /* File containing sandbox state */
        void *state_fdt;                /* Holds saved state for sandbox */
        bool read_state;                /* Read sandbox state on startup */
        bool write_state;               /* Write sandbox state on exit */
        bool ignore_missing_state_on_read;      /* No error if state missing */
+       bool show_lcd;                  /* Show LCD on start-up */
+       enum sysreset_t last_sysreset;  /* Last system reset type */
+       bool sysreset_allowed[SYSRESET_COUNT];  /* Allowed system reset types */
+       enum state_terminal_raw term_raw;       /* Terminal raw/cooked */
+       bool skip_delays;               /* Ignore any time delays (for test) */
+       bool show_test_output;          /* Don't suppress stdout in tests */
 
        /* Pointer to information for each SPI bus/cs */
        struct sandbox_spi_info spi[CONFIG_SANDBOX_SPI_MAX_BUS]
@@ -111,13 +136,6 @@ struct sandbox_state_io {
                .compat = _compat, \
        }
 
-/**
- * Record the exit type to be reported by the test program.
- *
- * @param exit_type    Exit type to record
- */
-void state_record_exit(enum exit_type_id exit_type);
-
 /**
  * Gets a pointer to the current state.
  *
@@ -168,6 +186,24 @@ int sandbox_write_state(struct sandbox_state *state, const char *fname);
  */
 int state_setprop(int node, const char *prop_name, const void *data, int size);
 
+/**
+ * Control skipping of time delays
+ *
+ * Some tests have unnecessay time delays (e.g. USB). Allow these to be
+ * skipped to speed up testing
+ *
+ * @param skip_delays  true to skip delays from now on, false to honour delay
+ *                     requests
+ */
+void state_set_skip_delays(bool skip_delays);
+
+/**
+ * See if delays should be skipped
+ *
+ * @return true if delays should be skipped, false if they should be honoured
+ */
+bool state_get_skip_delays(void);
+
 /**
  * Initialize the test system state
  */