1 /*
2  * Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #ifndef _BOOT_PICOBOOT_CONSTANTS_H
8 #define _BOOT_PICOBOOT_CONSTANTS_H
9 
10 #define REBOOT2_TYPE_MASK  0x0f
11 
12 // note these match REBOOT_TYPE in pico/bootrom_constants.h
13 // values 0-7 are secure/non-secure
14 #define REBOOT2_FLAG_REBOOT_TYPE_NORMAL       0x0 // param0 = diagnostic partition
15 #define REBOOT2_FLAG_REBOOT_TYPE_BOOTSEL      0x2 // param0 = gpio_pin_number, param1 = flags
16 #define REBOOT2_FLAG_REBOOT_TYPE_RAM_IMAGE    0x3 // param0 = image_region_base, param1 = image_region_size
17 #define REBOOT2_FLAG_REBOOT_TYPE_FLASH_UPDATE 0x4 // param0 = update_base
18 
19 // values 8-15 are secure only
20 #define REBOOT2_FLAG_REBOOT_TYPE_PC_SP        0xd
21 
22 #define REBOOT2_FLAG_REBOOT_TO_ARM            0x10
23 #define REBOOT2_FLAG_REBOOT_TO_RISCV          0x20
24 
25 #define REBOOT2_FLAG_NO_RETURN_ON_SUCCESS    0x100
26 
27 #define BOOTSEL_FLAG_DISABLE_MSD_INTERFACE      0x01
28 #define BOOTSEL_FLAG_DISABLE_PICOBOOT_INTERFACE 0x02
29 #define BOOTSEL_FLAG_GPIO_PIN_ACTIVE_LOW        0x10
30 #define BOOTSEL_FLAG_GPIO_PIN_SPECIFIED         0x20
31 
32 #define PICOBOOT_GET_INFO_SYS              1
33 #define PICOBOOT_GET_INFO_PARTTION_TABLE   2
34 #define PICOBOOT_GET_INFO_UF2_TARGET_PARTITION 3
35 #define PICOBOOT_GET_INFO_UF2_STATUS       4
36 
37 #define UF2_STATUS_IGNORED_FAMILY             0x01
38 #define UF2_STATUS_ABORT_EXCLUSIVELY_LOCKED   0x10
39 #define UF2_STATUS_ABORT_BAD_ADDRESS          0x20
40 #define UF2_STATUS_ABORT_WRITE_ERROR          0x40
41 #define UF2_STATUS_ABORT_REBOOT_FAILED        0x80
42 #endif
43