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