mgmt/MCUmgr/grp/img: Reduce logic in img_mgmt_active_slot
Make img_mgmt_active_slot independent from CONFIG_MCUMGR_GRP_IMG_UPDATABLE_IMAGE_NUMBER for MCUboot swap type algorithms. Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
This commit is contained in:
parent
5739f2c6da
commit
21c3263b95
1 changed files with 12 additions and 8 deletions
|
@ -141,16 +141,20 @@ static int img_mgmt_find_tlvs(int slot, size_t *start_off, size_t *end_off, uint
|
||||||
|
|
||||||
int img_mgmt_active_slot(int image)
|
int img_mgmt_active_slot(int image)
|
||||||
{
|
{
|
||||||
#if CONFIG_MCUMGR_GRP_IMG_UPDATABLE_IMAGE_NUMBER == 2
|
int slot = 0;
|
||||||
if (image == 1) {
|
|
||||||
return 2;
|
/* Multi image does not support DirectXIP currently */
|
||||||
|
#if CONFIG_MCUMGR_GRP_IMG_UPDATABLE_IMAGE_NUMBER > 1
|
||||||
|
slot = (image << 1);
|
||||||
|
#else
|
||||||
|
/* This covers single image, including DirectXiP */
|
||||||
|
if (FIXED_PARTITION_IS_RUNNING_APP_PARTITION(slot1_partition)) {
|
||||||
|
slot = 1;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
/* Image 0 */
|
LOG_DBG("(%d) => %d", image, slot);
|
||||||
if (FIXED_PARTITION_IS_RUNNING_APP_PARTITION(slot1_partition)) {
|
|
||||||
return 1;
|
return slot;
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int img_mgmt_active_image(void)
|
int img_mgmt_active_image(void)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue