Zephyr Project API 4.0.99
A Scalable Open Source RTOS
|
MCUmgr img_mgmt API. More...
Data Structures | |
struct | img_mgmt_upload_req |
Represents an individual upload request. More... | |
struct | img_mgmt_state |
Global state for upload in progress. More... | |
struct | img_mgmt_upload_action |
Describes what to do during processing of an upload request. More... | |
Macros | |
#define | IMG_MGMT_DATA_SHA_LEN 32 /* SHA256 */ |
#define | IMG_MGMT_STATE_F_PENDING 0x01 |
Image state flags. | |
#define | IMG_MGMT_STATE_F_CONFIRMED 0x02 |
#define | IMG_MGMT_STATE_F_ACTIVE 0x04 |
#define | IMG_MGMT_STATE_F_PERMANENT 0x08 |
#define | IMG_MGMT_VER_MAX_STR_LEN (sizeof("255.255.65535.4294967295")) |
#define | IMG_MGMT_SWAP_TYPE_NONE 0 |
Swap Types for image management state machine. | |
#define | IMG_MGMT_SWAP_TYPE_TEST 1 |
#define | IMG_MGMT_SWAP_TYPE_PERM 2 |
#define | IMG_MGMT_SWAP_TYPE_REVERT 3 |
#define | IMG_MGMT_SWAP_TYPE_UNKNOWN 255 |
#define | IMG_MGMT_ID_STATE 0 |
Command IDs for image management group. | |
#define | IMG_MGMT_ID_UPLOAD 1 |
#define | IMG_MGMT_ID_FILE 2 |
#define | IMG_MGMT_ID_CORELIST 3 |
#define | IMG_MGMT_ID_CORELOAD 4 |
#define | IMG_MGMT_ID_ERASE 5 |
#define | IMG_MGMT_ID_SLOT_INFO 6 |
#define | IMG_MGMT_UPLOAD_ACTION_SET_RC_RSN(action, rsn) |
#define | IMG_MGMT_UPLOAD_ACTION_RC_RSN(action) NULL |
Functions | |
int | img_mgmt_read_info (int image_slot, struct image_version *ver, uint8_t *hash, uint32_t *flags) |
int | img_mgmt_my_version (struct image_version *ver) |
Get the image version of the currently running application. | |
int | img_mgmt_ver_str (const struct image_version *ver, char *dst) |
Format version string from struct image_version. | |
int | img_mgmt_active_slot (int image) |
Get active, running application slot number for an image. | |
int | img_mgmt_active_image (void) |
Get active image number. | |
int | img_mgmt_slot_in_use (int slot) |
Check if the image slot is in use. | |
int | img_mgmt_state_any_pending (void) |
Check if any slot is in MCUboot pending state. | |
uint8_t | img_mgmt_state_flags (int query_slot) |
Returns state flags set to slot. | |
int | img_mgmt_state_set_pending (int slot, int permanent) |
Sets the pending flag for the specified image slot. | |
int | img_mgmt_state_confirm (void) |
Confirms the current image state. | |
int | img_mgmt_vercmp (const struct image_version *a, const struct image_version *b) |
Compares two image version numbers in a semver-compatible way. | |
Variables | |
int | boot_current_slot |
struct img_mgmt_state | g_img_mgmt_state |
MCUmgr img_mgmt API.
#define IMG_MGMT_DATA_SHA_LEN 32 /* SHA256 */ |
#define IMG_MGMT_ID_CORELIST 3 |
#define IMG_MGMT_ID_CORELOAD 4 |
#define IMG_MGMT_ID_ERASE 5 |
#define IMG_MGMT_ID_FILE 2 |
#define IMG_MGMT_ID_SLOT_INFO 6 |
#define IMG_MGMT_ID_STATE 0 |
#include <include/zephyr/mgmt/mcumgr/grp/img_mgmt/img_mgmt.h>
Command IDs for image management group.
#define IMG_MGMT_ID_UPLOAD 1 |
#define IMG_MGMT_STATE_F_ACTIVE 0x04 |
#define IMG_MGMT_STATE_F_CONFIRMED 0x02 |
#define IMG_MGMT_STATE_F_PENDING 0x01 |
#include <include/zephyr/mgmt/mcumgr/grp/img_mgmt/img_mgmt.h>
Image state flags.
#define IMG_MGMT_STATE_F_PERMANENT 0x08 |
#define IMG_MGMT_SWAP_TYPE_NONE 0 |
#include <include/zephyr/mgmt/mcumgr/grp/img_mgmt/img_mgmt.h>
Swap Types for image management state machine.
#define IMG_MGMT_SWAP_TYPE_PERM 2 |
#define IMG_MGMT_SWAP_TYPE_REVERT 3 |
#define IMG_MGMT_SWAP_TYPE_TEST 1 |
#define IMG_MGMT_SWAP_TYPE_UNKNOWN 255 |
#define IMG_MGMT_UPLOAD_ACTION_RC_RSN | ( | action | ) | NULL |
#define IMG_MGMT_UPLOAD_ACTION_SET_RC_RSN | ( | action, | |
rsn | |||
) |
#define IMG_MGMT_VER_MAX_STR_LEN (sizeof("255.255.65535.4294967295")) |
enum img_mgmt_err_code_t |
#include <include/zephyr/mgmt/mcumgr/grp/img_mgmt/img_mgmt.h>
Command result codes for image management group.
enum img_mgmt_id_upload_t |
#include <include/zephyr/mgmt/mcumgr/grp/img_mgmt/img_mgmt.h>
IMG_MGMT_ID_UPLOAD statuses.
Enumerator | |
---|---|
IMG_MGMT_ID_UPLOAD_STATUS_START | |
IMG_MGMT_ID_UPLOAD_STATUS_ONGOING | |
IMG_MGMT_ID_UPLOAD_STATUS_COMPLETE |
int img_mgmt_active_image | ( | void | ) |
#include <include/zephyr/mgmt/mcumgr/grp/img_mgmt/img_mgmt.h>
Get active image number.
Gets 0 based number for running application.
int img_mgmt_active_slot | ( | int | image | ) |
#include <include/zephyr/mgmt/mcumgr/grp/img_mgmt/img_mgmt.h>
Get active, running application slot number for an image.
image | image number to get active slot for. |
int img_mgmt_my_version | ( | struct image_version * | ver | ) |
#include <include/zephyr/mgmt/mcumgr/grp/img_mgmt/img_mgmt.h>
Get the image version of the currently running application.
ver | output buffer for an image version information object. |
int img_mgmt_slot_in_use | ( | int | slot | ) |
#include <include/zephyr/mgmt/mcumgr/grp/img_mgmt/img_mgmt.h>
Check if the image slot is in use.
The check is based on MCUboot flags, not image contents. This means that slot with image in it, but no bootable flags set, is considered empty. Active slot is always in use.
slot | slot number |
int img_mgmt_state_any_pending | ( | void | ) |
#include <include/zephyr/mgmt/mcumgr/grp/img_mgmt/img_mgmt.h>
Check if any slot is in MCUboot pending state.
Function returns 1 if slot 0 or slot 1 is in MCUboot pending state, which means that it has been either marked for test or confirmed.
int img_mgmt_state_confirm | ( | void | ) |
#include <include/zephyr/mgmt/mcumgr/grp/img_mgmt/img_mgmt.h>
Confirms the current image state.
Prevents a fallback from occurring on the next reboot if the active image is currently being tested.
uint8_t img_mgmt_state_flags | ( | int | query_slot | ) |
#include <include/zephyr/mgmt/mcumgr/grp/img_mgmt/img_mgmt.h>
Returns state flags set to slot.
Flags are translated from MCUboot image state flags. Returned value is zero if no flags are set or a combination of: IMG_MGMT_STATE_F_PENDING IMG_MGMT_STATE_F_CONFIRMED IMG_MGMT_STATE_F_ACTIVE IMG_MGMT_STATE_F_PERMANENT
query_slot | slot number |
int img_mgmt_state_set_pending | ( | int | slot, |
int | permanent | ||
) |
#include <include/zephyr/mgmt/mcumgr/grp/img_mgmt/img_mgmt.h>
Sets the pending flag for the specified image slot.
Sets specified image slot to be used as active slot during next boot, either for test or permanently. Non-permanent image will be reverted unless image confirms itself during next boot.
slot | slot number |
permanent | permanent or test only |
int img_mgmt_ver_str | ( | const struct image_version * | ver, |
char * | dst | ||
) |
#include <include/zephyr/mgmt/mcumgr/grp/img_mgmt/img_mgmt.h>
Format version string from struct image_version.
ver | pointer to image_version object |
dst | output buffer for image version string |
int img_mgmt_vercmp | ( | const struct image_version * | a, |
const struct image_version * | b | ||
) |
#include <include/zephyr/mgmt/mcumgr/grp/img_mgmt/img_mgmt.h>
Compares two image version numbers in a semver-compatible way.
a | The first version to compare |
b | The second version to compare |
|
extern |
|
extern |