WS63 SDK 文档 7021f4f@fbb_ws63
ws63 和 ws63e 解决方案的 SDK 文档
载入中...
搜索中...
未找到
upg_patch.h 文件参考
#include <stdint.h>
#include <stdbool.h>
#include "errcode.h"
#include "upg_common_porting.h"
#include "upg.h"
#include "upg_definitions.h"
upg_patch.h 的引用(Include)关系图:
此图展示该文件直接或间接的被哪些文件引用了:

浏览源代码.

结构体

struct  patch_description
 

宏定义

#define DIFF_STATUS_FLASH_SIZE   0x800000
 
#define FLASH_PAGES   (DIFF_STATUS_FLASH_SIZE / UPG_FLASH_PAGE_SIZE)
 
#define NUM_BITS_PER_BYTE   8
 

类型定义

typedef struct patch_description patch
 
typedef void(* failfunc) (patch *desc)
 The function to be called when a deliberate failure is injected.
 
typedef errcode_t(* fetch_image_contents) (patch *desc, uint32_t size, int32_t location, uint8_t *dest)
 The function to be called to obtain firmware image contents.
 
typedef errcode_t(* prep_image_contents_for_write) (patch *desc, uint32_t image_page_no, uint8_t *page_contents)
 Update the image contents prior to writing to flash.
 
typedef errcode_t(* copy_recovered_buffer_to_flash_cache) (patch *desc, int32_t flash_page, uint8_t *recover_buffer)
 Creates a plaintext copy of the recovered 4K flash. It assumes metadata pages are populated with the information about updated pages during FOTA It assumes FOTA Section is populated with the right key areas.
 
typedef errcode_t(* plaintext_flash_cache_init) (patch *desc)
 Creates a plaintext version of the image flash in RAM It assumes metadata pages are populated with the information about updated pages during FOTA It assumes FOTA Section is populated with the right key areas.
 
typedef errcode_t(* encrypt_one_flash_page) (upg_key_area_data_t *aes_ctrl, uint8_t *src, uint8_t *dst, int32_t ptxt_len)
 

函数

errcode_t process_patch (patch *desc)
 Process the patch provided.
 
errcode_t fota_pkg_task_apply_code_diff (const upg_image_header_t *image)
 Apply a FOTA core task for an image.
 

宏定义说明

◆ DIFF_STATUS_FLASH_SIZE

#define DIFF_STATUS_FLASH_SIZE   0x800000

◆ FLASH_PAGES

#define FLASH_PAGES   (DIFF_STATUS_FLASH_SIZE / UPG_FLASH_PAGE_SIZE)

◆ NUM_BITS_PER_BYTE

#define NUM_BITS_PER_BYTE   8

类型定义说明

◆ copy_recovered_buffer_to_flash_cache

typedef errcode_t(* copy_recovered_buffer_to_flash_cache) (patch *desc, int32_t flash_page, uint8_t *recover_buffer)

Creates a plaintext copy of the recovered 4K flash. It assumes metadata pages are populated with the information about updated pages during FOTA It assumes FOTA Section is populated with the right key areas.

参数
descPatch description
flash_pageNumber of flash pages from base
recover_bufferBuffer to decrypt and copy
返回
ERRCODE_SUCC errcode_t or an error code.

◆ encrypt_one_flash_page

typedef errcode_t(* encrypt_one_flash_page) (upg_key_area_data_t *aes_ctrl, uint8_t *src, uint8_t *dst, int32_t ptxt_len)

Encrypt a UPG_FLASH_PAGE_SIZE RAM buffer and optionally specify a block of data at the start or at the end of the buffer that is to remain plaintext and not to be encrypted. It can encrypt in place if required where the the output encrypted buffer is set to the same as the plaintext source buffer.

参数
aes_ctrlaes control structure.
srcUPG_FLASH_PAGE_SIZE RAM buffer where the plaintext version of the page is located.
dstUPG_FLASH_PAGE_SIZE RAM buffer where the encrypted version of the page will be produced.
ptxt_lenNumber of bytes in the plaintext page (#src) that is to remain plaintext and not to be encrypted. Defined either from the start (>0) or from the end (<0) of the buffer #src. Its valid range of values is: -UPG_FLASH_PAGE_SIZE < ptxt_len < UPG_FLASH_PAGE_SIZE. If ptxt_len = 0 The whole page will be encrypted. If ptxt_len > 0 Everything except the first ptxt_len bytes will will be encrypted. If ptxt_len < 0 Everything except the last ptxt_len bytes will will be encrypted.
返回
ERRCODE_SUCC errcode_t or an error code.

◆ failfunc

typedef void(* failfunc) (patch *desc)

The function to be called when a deliberate failure is injected.

参数
descThe patch to be applied

◆ fetch_image_contents

typedef errcode_t(* fetch_image_contents) (patch *desc, uint32_t size, int32_t location, uint8_t *dest)

The function to be called to obtain firmware image contents.

参数
descThe patch description.
sizeThe size of the contents.
locationThe byte position within the image to get the contents from.
destThe buffer to put the contents into.

◆ patch

typedef struct patch_description patch

◆ plaintext_flash_cache_init

typedef errcode_t(* plaintext_flash_cache_init) (patch *desc)

Creates a plaintext version of the image flash in RAM It assumes metadata pages are populated with the information about updated pages during FOTA It assumes FOTA Section is populated with the right key areas.

参数
descPatch description
返回
ERRCODE_SUCC errcode_t or an error code

◆ prep_image_contents_for_write

typedef errcode_t(* prep_image_contents_for_write) (patch *desc, uint32_t image_page_no, uint8_t *page_contents)

Update the image contents prior to writing to flash.

参数
descThe patch description.
image_page_noThe page to be written.
page_contentsThe buffer containing the page contents that will be written.

函数说明

◆ fota_pkg_task_apply_code_diff()

errcode_t fota_pkg_task_apply_code_diff ( const upg_image_header_t image)

Apply a FOTA core task for an image.

参数
taskThe FOTA code task header in SCPU RAM.
返回
errcode_t ERRCODE_SUCC or an error code.

◆ process_patch()

errcode_t process_patch ( patch desc)

Process the patch provided.

参数
descThe patch description to apply.
返回
errcode_t ERRCODE_SUCC or an error code.