mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
riotboot: Add function to retrieve the slot size
This commit is contained in:
parent
fc794d9a21
commit
a00314bfc4
@ -104,6 +104,27 @@ size_t riotboot_slot_offset(unsigned slot);
|
||||
*/
|
||||
void riotboot_slot_dump_addrs(void);
|
||||
|
||||
/**
|
||||
* @brief Get the size of a slot
|
||||
*
|
||||
* @param[in] slot slot nr to get the size from
|
||||
*
|
||||
* @returns The slot size in bytes
|
||||
*/
|
||||
static inline size_t riotboot_slot_size(unsigned slot)
|
||||
{
|
||||
switch(slot) {
|
||||
case 0:
|
||||
return SLOT0_LEN;
|
||||
#if NUM_SLOTS==2
|
||||
case 1:
|
||||
return SLOT1_LEN;
|
||||
#endif
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Number of configured firmware slots (incl. bootloader slot)
|
||||
*/
|
||||
|
@ -34,15 +34,10 @@ static inline size_t min(size_t a, size_t b)
|
||||
return a <= b ? a : b;
|
||||
}
|
||||
|
||||
size_t riotboot_flashwrite_slotsize(const riotboot_flashwrite_t *state)
|
||||
size_t riotboot_flashwrite_slotsize(
|
||||
const riotboot_flashwrite_t *state)
|
||||
{
|
||||
switch (state->target_slot) {
|
||||
case 0: return SLOT0_LEN;
|
||||
#if NUM_SLOTS==2
|
||||
case 1: return SLOT1_LEN;
|
||||
#endif
|
||||
default: return 0;
|
||||
}
|
||||
return riotboot_slot_size(state->target_slot);
|
||||
}
|
||||
|
||||
int riotboot_flashwrite_init_raw(riotboot_flashwrite_t *state, int target_slot,
|
||||
|
Loading…
Reference in New Issue
Block a user