16fb62078SSimon Glass /* 26fb62078SSimon Glass * Copyright (c) 2011-2012 The Chromium OS Authors. 36fb62078SSimon Glass * See file CREDITS for list of people who contributed to this 46fb62078SSimon Glass * project. 56fb62078SSimon Glass * 66fb62078SSimon Glass * This program is free software; you can redistribute it and/or 76fb62078SSimon Glass * modify it under the terms of the GNU General Public License as 86fb62078SSimon Glass * published by the Free Software Foundation; either version 2 of 96fb62078SSimon Glass * the License, or (at your option) any later version. 106fb62078SSimon Glass * 116fb62078SSimon Glass * This program is distributed in the hope that it will be useful, 126fb62078SSimon Glass * but WITHOUT ANY WARRANTY; without even the implied warranty of 136fb62078SSimon Glass * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 146fb62078SSimon Glass * GNU General Public License for more details. 156fb62078SSimon Glass * 166fb62078SSimon Glass * You should have received a copy of the GNU General Public License 176fb62078SSimon Glass * along with this program; if not, write to the Free Software 186fb62078SSimon Glass * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 196fb62078SSimon Glass * MA 02111-1307 USA 206fb62078SSimon Glass */ 216fb62078SSimon Glass 226fb62078SSimon Glass #ifndef __SANDBOX_STATE_H 236fb62078SSimon Glass #define __SANDBOX_STATE_H 246fb62078SSimon Glass 25*70db4212SSimon Glass #include <config.h> 26*70db4212SSimon Glass 276fb62078SSimon Glass /* How we exited U-Boot */ 286fb62078SSimon Glass enum exit_type_id { 296fb62078SSimon Glass STATE_EXIT_NORMAL, 306fb62078SSimon Glass STATE_EXIT_COLD_REBOOT, 316fb62078SSimon Glass STATE_EXIT_POWER_OFF, 326fb62078SSimon Glass }; 336fb62078SSimon Glass 346fb62078SSimon Glass /* The complete state of the test system */ 356fb62078SSimon Glass struct sandbox_state { 366fb62078SSimon Glass const char *cmd; /* Command to execute */ 376fb62078SSimon Glass enum exit_type_id exit_type; /* How we exited U-Boot */ 38*70db4212SSimon Glass const char *parse_err; /* Error to report from parsing */ 39*70db4212SSimon Glass int argc; /* Program arguments */ 40*70db4212SSimon Glass char **argv; 416fb62078SSimon Glass }; 426fb62078SSimon Glass 436fb62078SSimon Glass /** 446fb62078SSimon Glass * Record the exit type to be reported by the test program. 456fb62078SSimon Glass * 466fb62078SSimon Glass * @param exit_type Exit type to record 476fb62078SSimon Glass */ 486fb62078SSimon Glass void state_record_exit(enum exit_type_id exit_type); 496fb62078SSimon Glass 506fb62078SSimon Glass /** 516fb62078SSimon Glass * Gets a pointer to the current state. 526fb62078SSimon Glass * 536fb62078SSimon Glass * @return pointer to state 546fb62078SSimon Glass */ 556fb62078SSimon Glass struct sandbox_state *state_get_current(void); 566fb62078SSimon Glass 576fb62078SSimon Glass /** 586fb62078SSimon Glass * Initialize the test system state 596fb62078SSimon Glass */ 606fb62078SSimon Glass int state_init(void); 616fb62078SSimon Glass 626fb62078SSimon Glass #endif 63