From d75c1fd76c0e8a0dc0b212b838ea6fae17cc14a1 Mon Sep 17 00:00:00 2001 From: Kaspar Schleiser Date: Wed, 13 Mar 2019 17:21:44 +0100 Subject: [PATCH] sys/riotboot: introduce riotboot_slot_other() --- sys/include/riotboot/slot.h | 7 +++++++ sys/riotboot/slot.c | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/sys/include/riotboot/slot.h b/sys/include/riotboot/slot.h index 24d65e32da..dbbb11f686 100644 --- a/sys/include/riotboot/slot.h +++ b/sys/include/riotboot/slot.h @@ -38,6 +38,13 @@ extern "C" { */ int riotboot_slot_current(void); +/** + * @brief Get currently not running image slot + * + * @returns nr of currently inactive slot + */ +int riotboot_slot_other(void); + /** * @brief Get jump-to address of image slot * diff --git a/sys/riotboot/slot.c b/sys/riotboot/slot.c index 4d38e6568d..b7c288d3f6 100644 --- a/sys/riotboot/slot.c +++ b/sys/riotboot/slot.c @@ -60,6 +60,11 @@ int riotboot_slot_current(void) return -1; } +int riotboot_slot_other(void) +{ + return riotboot_slot_current() ? 0 : 1; +} + void riotboot_slot_jump(unsigned slot) { _riotboot_slot_jump_to_image(riotboot_slot_get_hdr(slot));