state.c 647 B

1234567891011121314151617181920212223242526272829303132333435
  1. /*
  2. * Copyright (c) 2011-2012 The Chromium OS Authors.
  3. * SPDX-License-Identifier: GPL-2.0+
  4. */
  5. #include <common.h>
  6. #include <asm/state.h>
  7. /* Main state record for the sandbox */
  8. static struct sandbox_state main_state;
  9. static struct sandbox_state *state; /* Pointer to current state record */
  10. void state_record_exit(enum exit_type_id exit_type)
  11. {
  12. state->exit_type = exit_type;
  13. }
  14. struct sandbox_state *state_get_current(void)
  15. {
  16. assert(state);
  17. return state;
  18. }
  19. int state_init(void)
  20. {
  21. state = &main_state;
  22. /*
  23. * Example of how to use GPIOs:
  24. *
  25. * sandbox_gpio_set_direction(170, 0);
  26. * sandbox_gpio_set_value(170, 0);
  27. */
  28. return 0;
  29. }