dfu: boot: Add implementation for multi-image swap type check

Adds multi-image implementations for checking swap type based on image
index.

Signed-off-by: Sigvart Hovland <sigvart.hovland@nordicsemi.no>
This commit is contained in:
Sigvart Hovland 2021-08-19 01:01:24 +02:00 committed by Anas Nashif
commit bcbc53015d
2 changed files with 16 additions and 0 deletions

View file

@ -204,6 +204,17 @@ int boot_write_img_confirmed_multi(int image_index);
*/ */
int mcuboot_swap_type(void); int mcuboot_swap_type(void);
/**
* @brief Determines the action, if any, that mcuboot will take on the next
* reboot.
*
* @param image_index Image pair index.
*
* @return a BOOT_SWAP_TYPE_[...] constant on success, negative errno code on
* fail.
*/
int mcuboot_swap_type_multi(int image_index);
/** Boot upgrade request modes */ /** Boot upgrade request modes */
#define BOOT_UPGRADE_TEST 0 #define BOOT_UPGRADE_TEST 0

View file

@ -144,6 +144,11 @@ int boot_read_bank_header(uint8_t area_id,
return 0; return 0;
} }
int mcuboot_swap_type_multi(int image_index)
{
return boot_swap_type_multi(image_index);
}
int mcuboot_swap_type(void) int mcuboot_swap_type(void)
{ {
#ifdef FLASH_AREA_IMAGE_SECONDARY #ifdef FLASH_AREA_IMAGE_SECONDARY