state.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. * Copyright (c) 2011-2012 The Chromium OS Authors.
  3. * SPDX-License-Identifier: GPL-2.0+
  4. */
  5. #ifndef __SANDBOX_STATE_H
  6. #define __SANDBOX_STATE_H
  7. #include <config.h>
  8. #include <stdbool.h>
  9. /* How we exited U-Boot */
  10. enum exit_type_id {
  11. STATE_EXIT_NORMAL,
  12. STATE_EXIT_COLD_REBOOT,
  13. STATE_EXIT_POWER_OFF,
  14. };
  15. struct sandbox_spi_info {
  16. const char *spec;
  17. const struct sandbox_spi_emu_ops *ops;
  18. };
  19. /* The complete state of the test system */
  20. struct sandbox_state {
  21. const char *cmd; /* Command to execute */
  22. bool interactive; /* Enable cmdline after execute */
  23. const char *fdt_fname; /* Filename of FDT binary */
  24. enum exit_type_id exit_type; /* How we exited U-Boot */
  25. const char *parse_err; /* Error to report from parsing */
  26. int argc; /* Program arguments */
  27. char **argv;
  28. /* Pointer to information for each SPI bus/cs */
  29. struct sandbox_spi_info spi[CONFIG_SANDBOX_SPI_MAX_BUS]
  30. [CONFIG_SANDBOX_SPI_MAX_CS];
  31. };
  32. /**
  33. * Record the exit type to be reported by the test program.
  34. *
  35. * @param exit_type Exit type to record
  36. */
  37. void state_record_exit(enum exit_type_id exit_type);
  38. /**
  39. * Gets a pointer to the current state.
  40. *
  41. * @return pointer to state
  42. */
  43. struct sandbox_state *state_get_current(void);
  44. /**
  45. * Initialize the test system state
  46. */
  47. int state_init(void);
  48. #endif