Zephyr API Documentation 4.0.0-rc3
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
img_mgmt.h File Reference
#include <inttypes.h>
#include <zephyr/mgmt/mcumgr/mgmt/mgmt.h>
#include <zephyr/mgmt/mcumgr/smp/smp.h>
#include <bootutil/image.h>
#include <zcbor_common.h>

Go to the source code of this file.

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)
 

Enumerations

enum  img_mgmt_err_code_t {
  IMG_MGMT_ERR_OK = 0 , IMG_MGMT_ERR_UNKNOWN , IMG_MGMT_ERR_FLASH_CONFIG_QUERY_FAIL , IMG_MGMT_ERR_NO_IMAGE ,
  IMG_MGMT_ERR_NO_TLVS , IMG_MGMT_ERR_INVALID_TLV , IMG_MGMT_ERR_TLV_MULTIPLE_HASHES_FOUND , IMG_MGMT_ERR_TLV_INVALID_SIZE ,
  IMG_MGMT_ERR_HASH_NOT_FOUND , IMG_MGMT_ERR_NO_FREE_SLOT , IMG_MGMT_ERR_FLASH_OPEN_FAILED , IMG_MGMT_ERR_FLASH_READ_FAILED ,
  IMG_MGMT_ERR_FLASH_WRITE_FAILED , IMG_MGMT_ERR_FLASH_ERASE_FAILED , IMG_MGMT_ERR_INVALID_SLOT , IMG_MGMT_ERR_NO_FREE_MEMORY ,
  IMG_MGMT_ERR_FLASH_CONTEXT_ALREADY_SET , IMG_MGMT_ERR_FLASH_CONTEXT_NOT_SET , IMG_MGMT_ERR_FLASH_AREA_DEVICE_NULL , IMG_MGMT_ERR_INVALID_PAGE_OFFSET ,
  IMG_MGMT_ERR_INVALID_OFFSET , IMG_MGMT_ERR_INVALID_LENGTH , IMG_MGMT_ERR_INVALID_IMAGE_HEADER , IMG_MGMT_ERR_INVALID_IMAGE_HEADER_MAGIC ,
  IMG_MGMT_ERR_INVALID_HASH , IMG_MGMT_ERR_INVALID_FLASH_ADDRESS , IMG_MGMT_ERR_VERSION_GET_FAILED , IMG_MGMT_ERR_CURRENT_VERSION_IS_NEWER ,
  IMG_MGMT_ERR_IMAGE_ALREADY_PENDING , IMG_MGMT_ERR_INVALID_IMAGE_VECTOR_TABLE , IMG_MGMT_ERR_INVALID_IMAGE_TOO_LARGE , IMG_MGMT_ERR_INVALID_IMAGE_DATA_OVERRUN ,
  IMG_MGMT_ERR_IMAGE_CONFIRMATION_DENIED , IMG_MGMT_ERR_IMAGE_SETTING_TEST_TO_ACTIVE_DENIED , IMG_MGMT_ERR_ACTIVE_SLOT_NOT_KNOWN
}
 Command result codes for image management group. More...
 
enum  img_mgmt_id_upload_t { IMG_MGMT_ID_UPLOAD_STATUS_START = 0 , IMG_MGMT_ID_UPLOAD_STATUS_ONGOING , IMG_MGMT_ID_UPLOAD_STATUS_COMPLETE }
 IMG_MGMT_ID_UPLOAD statuses. More...
 

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