Software APIs
bootstrap.h
1 // Copyright lowRISC contributors (OpenTitan project).
2 // Licensed under the Apache License, Version 2.0, see LICENSE for details.
3 // SPDX-License-Identifier: Apache-2.0
4 #ifndef OPENTITAN_SW_DEVICE_SILICON_CREATOR_ROM_BOOTSTRAP_H_
5 #define OPENTITAN_SW_DEVICE_SILICON_CREATOR_ROM_BOOTSTRAP_H_
6 
8 #include "sw/device/silicon_creator/lib/error.h"
9 
10 #ifdef __cplusplus
11 extern "C" {
12 #endif
13 
14 /**
15  * Checks whether bootstrap is requested.
16  *
17  * The return value of this function also depends on the `ROM_BOOTSTRAP_DIS` OTP
18  * item.
19  *
20  * @return Whether bootstrap is requested.
21  */
23 hardened_bool_t bootstrap_requested(void);
24 
25 /**
26  * Bootstraps the data partition of the embedded flash with data received by the
27  * spi_device.
28  *
29  * OpenTitan bootstrap uses the typical SPI flash EEPROM commands. A typical
30  * bootstrap session involves:
31  * - Erasing the chip (WREN, CHIP_ERASE, busy loop ...),
32  * - Programming the chip (WREN, PAGE_PROGRAM, busy loop ...), and
33  * - Resetting the chip (RESET).
34  *
35  * This function only returns on error since a successful bootstrap ends with a
36  * chip reset.
37  *
38  * @return Result of the operation.
39  */
41 rom_error_t bootstrap(void);
42 
43 #ifdef __cplusplus
44 }
45 #endif
46 
47 #endif // OPENTITAN_SW_DEVICE_SILICON_CREATOR_ROM_BOOTSTRAP_H_