nRF Connect SDK API 0.1.0
Loading...
Searching...
No Matches
dfu_target.h File Reference
#include <zephyr/types.h>
#include <stdbool.h>

Go to the source code of this file.

Data Structures

struct  dfu_target
 Functions which needs to be supported by all DFU targets. More...
 

Typedefs

typedef void(* dfu_target_callback_t) (enum dfu_target_evt_id evt_id)
 

Enumerations

enum  dfu_target_image_type {
  DFU_TARGET_IMAGE_TYPE_NONE = 0 , DFU_TARGET_IMAGE_TYPE_MCUBOOT = 1 , DFU_TARGET_IMAGE_TYPE_MODEM_DELTA = 2 , DFU_TARGET_IMAGE_TYPE_FULL_MODEM = 4 ,
  DFU_TARGET_IMAGE_TYPE_SMP = 8 , DFU_TARGET_IMAGE_TYPE_SUIT = 16 , DFU_TARGET_IMAGE_TYPE_ANY_APPLICATION = DFU_TARGET_IMAGE_TYPE_MCUBOOT , DFU_TARGET_IMAGE_TYPE_ANY_MODEM ,
  DFU_TARGET_IMAGE_TYPE_ANY
}
 DFU image type. More...
 
enum  dfu_target_evt_id { DFU_TARGET_EVT_ERASE_PENDING , DFU_TARGET_EVT_TIMEOUT , DFU_TARGET_EVT_ERASE_DONE }
 

Functions

enum dfu_target_image_type dfu_target_img_type (const void *const buf, size_t len)
 Find the image type for the buffer of bytes received. Used to determine what DFU target to initialize.
 
enum dfu_target_image_type dfu_target_smp_img_type_check (const void *const buf, size_t len)
 Find the image type for the buffer of bytes received. Used to validate type for DFU SMP target to initialize.
 
int dfu_target_init (int img_type, int img_num, size_t file_size, dfu_target_callback_t cb)
 Initialize the resources needed for the specific image type DFU target.
 
int dfu_target_offset_get (size_t *offset)
 Get offset of the firmware upgrade.
 
int dfu_target_write (const void *const buf, size_t len)
 Write the given buffer to the initialized DFU target.
 
int dfu_target_done (bool successful)
 Release the resources that were needed for the current DFU target.
 
int dfu_target_reset (void)
 Release the resources that were needed for the current DFU target if any and resets the current DFU target.
 
int dfu_target_schedule_update (int img_num)
 Schedule update of one or more images.