xref: /rk3399_rockchip-uboot/arch/sandbox/cpu/state.c (revision 6fb62078210b78ff5cc87829a62166feebb8e9dc)
1*6fb62078SSimon Glass /*
2*6fb62078SSimon Glass  * Copyright (c) 2011-2012 The Chromium OS Authors.
3*6fb62078SSimon Glass  * See file CREDITS for list of people who contributed to this
4*6fb62078SSimon Glass  * project.
5*6fb62078SSimon Glass  *
6*6fb62078SSimon Glass  * This program is free software; you can redistribute it and/or
7*6fb62078SSimon Glass  * modify it under the terms of the GNU General Public License as
8*6fb62078SSimon Glass  * published by the Free Software Foundation; either version 2 of
9*6fb62078SSimon Glass  * the License, or (at your option) any later version.
10*6fb62078SSimon Glass  *
11*6fb62078SSimon Glass  * This program is distributed in the hope that it will be useful,
12*6fb62078SSimon Glass  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13*6fb62078SSimon Glass  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14*6fb62078SSimon Glass  * GNU General Public License for more details.
15*6fb62078SSimon Glass  *
16*6fb62078SSimon Glass  * You should have received a copy of the GNU General Public License
17*6fb62078SSimon Glass  * along with this program; if not, write to the Free Software
18*6fb62078SSimon Glass  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
19*6fb62078SSimon Glass  * MA 02111-1307 USA
20*6fb62078SSimon Glass  */
21*6fb62078SSimon Glass 
22*6fb62078SSimon Glass #include <common.h>
23*6fb62078SSimon Glass #include <asm/state.h>
24*6fb62078SSimon Glass 
25*6fb62078SSimon Glass /* Main state record for the sandbox */
26*6fb62078SSimon Glass static struct sandbox_state main_state;
27*6fb62078SSimon Glass static struct sandbox_state *state;	/* Pointer to current state record */
28*6fb62078SSimon Glass 
29*6fb62078SSimon Glass void state_record_exit(enum exit_type_id exit_type)
30*6fb62078SSimon Glass {
31*6fb62078SSimon Glass 	state->exit_type = exit_type;
32*6fb62078SSimon Glass }
33*6fb62078SSimon Glass 
34*6fb62078SSimon Glass struct sandbox_state *state_get_current(void)
35*6fb62078SSimon Glass {
36*6fb62078SSimon Glass 	assert(state);
37*6fb62078SSimon Glass 	return state;
38*6fb62078SSimon Glass }
39*6fb62078SSimon Glass 
40*6fb62078SSimon Glass int state_init(void)
41*6fb62078SSimon Glass {
42*6fb62078SSimon Glass 	state = &main_state;
43*6fb62078SSimon Glass 
44*6fb62078SSimon Glass 	/*
45*6fb62078SSimon Glass 	 * Example of how to use GPIOs:
46*6fb62078SSimon Glass 	 *
47*6fb62078SSimon Glass 	 * sandbox_gpio_set_direction(170, 0);
48*6fb62078SSimon Glass 	 * sandbox_gpio_set_value(170, 0);
49*6fb62078SSimon Glass 	 */
50*6fb62078SSimon Glass 	return 0;
51*6fb62078SSimon Glass }
52