41//#define BOOTROM_ERROR_NO_DATA (-3) // E.g. read from an empty buffer/FIFO
42#define BOOTROM_ERROR_NOT_PERMITTED (-4) // Permission violation e.g. write to read-only flash partition
43#define BOOTROM_ERROR_INVALID_ARG (-5) // Argument is outside of range of supported values`
44//#define BOOTROM_ERROR_IO (-6)
45//#define BOOTROM_ERROR_BADAUTH (-7)
46//#define BOOTROM_ERROR_CONNECT_FAILED (-8)
47//#define BOOTROM_ERROR_INSUFFICIENT_RESOURCES (-9) // Dynamic allocation of resources failed
48#define BOOTROM_ERROR_INVALID_ADDRESS (-10) // Address argument was out-of-bounds or was determined to be an address that the caller may not access
49#define BOOTROM_ERROR_BAD_ALIGNMENT (-11) // Address modulo transfer chunk size was nonzero (e.g. word-aligned transfer with address % 4 != 0)
50#define BOOTROM_ERROR_INVALID_STATE (-12) // Something happened or failed to happen in the past, and consequently we (currently) can't service the request
51#define BOOTROM_ERROR_BUFFER_TOO_SMALL (-13) // A user-allocated buffer was too small to hold the result or working state of this function
52#define BOOTROM_ERROR_PRECONDITION_NOT_MET (-14) // This call failed because another ROM function must be called first
53#define BOOTROM_ERROR_MODIFIED_DATA (-15) // Cached data was determined to be inconsistent with the full version of the data it was calculated from
54#define BOOTROM_ERROR_INVALID_DATA (-16) // A data structure failed to validate
55#define BOOTROM_ERROR_NOT_FOUND (-17) // Attempted to access something that does not exist; or, a search failed
56#define BOOTROM_ERROR_UNSUPPORTED_MODIFICATION (-18) // Write is impossible based on previous writes; e.g. attempted to clear an OTP bit
57#define BOOTROM_ERROR_LOCK_REQUIRED (-19) // A required lock is not owned
58#define BOOTROM_ERROR_LAST (-19)
59
60#define RT_FLAG_FUNC_RISCV 0x0001
61#define RT_FLAG_FUNC_RISCV_FAR 0x0003
62#define RT_FLAG_FUNC_ARM_SEC 0x0004
63// reserved for 32-bit pointer: 0x0008
64#define RT_FLAG_FUNC_ARM_NONSEC 0x0010
65// reserved for 32-bit pointer: 0x0020
66#define RT_FLAG_DATA 0x0040
67// reserved for 32-bit pointer: 0x0080
68
69#define PARTITION_TABLE_MAX_PARTITIONS 16
70// note this is deliberately > MAX_PARTITIONs is likely to be, and also -1 as a signed byte
71#define PARTITION_TABLE_NO_PARTITION_INDEX 0xff
72
73// values returned from \ref rom_get_last_boot_type()
74// --- note these match the REBOOT2_FLAG_REBOOT_TYPE_ constants in pico/picoboot_constants.h
75// values 0-7 are secure/non-secure
76#define BOOT_TYPE_NORMAL 0
77#define BOOT_TYPE_BOOTSEL 2
78#define BOOT_TYPE_RAM_IMAGE 3
79#define BOOT_TYPE_FLASH_UPDATE 4
80// values 8-15 are secure only
81#define BOOT_TYPE_PC_SP 0xd
82
83// ORed in if a bootloader chained into the image
84#define BOOT_TYPE_CHAINED_FLAG 0x80
85// ---
86
87// call from NS to S
88#ifndef __riscv
89#define BOOTROM_API_CALLBACK_secure_call 0
90#endif
91#define BOOTROM_API_CALLBACK_COUNT 1
92
93#define BOOTROM_LOCK_SHA_256 0
94#define BOOTROM_LOCK_FLASH_OP 1
95#define BOOTROM_LOCK_OTP 2
96#define BOOTROM_LOCK_MAX 2
97
98#define BOOTROM_LOCK_ENABLE 7
99
100#define BOOT_PARTITION_NONE (-1)
101#define BOOT_PARTITION_SLOT0 (-2)
102#define BOOT_PARTITION_SLOT1 (-3)
103#define BOOT_PARTITION_WINDOW (-4)
104
105#define BOOT_DIAGNOSTIC_WINDOW_SEARCHED 0x01
106// note if both BOOT_DIAGNOSTIC_INVALID_BLOCK_LOOP and BOOT_DIAGNOSTIC_VALID_BLOCK_LOOP then the block loop was valid
107// but it has a PARTITION_TABLE which while it passed the initial verification (and hash/sig) had invalid contents
136// PICO_CONFIG: BLOCK_DEVICE_DEFAULT_PARTITION_ID, default ID of block device partition which must match the ID used in the partition table JSON, type=int, default=0x626C6F636B646576, group=pico_bootrom
137#ifndef BLOCK_DEVICE_DEFAULT_PARTITION_ID
138// The default 0x626C6F636B646576 value is the ASCII encoding of "blockdev"