|
WS63 SDK 文档 7021f4f@fbb_ws63
ws63 和 ws63e 解决方案的 SDK 文档
|
#include <stdint.h>#include <stdbool.h>#include "errcode.h"#include "upg_common_porting.h"#include "upg.h"#include "upg_definitions.h"

结构体 | |
| 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. | |
| #define DIFF_STATUS_FLASH_SIZE 0x800000 |
| #define FLASH_PAGES (DIFF_STATUS_FLASH_SIZE / UPG_FLASH_PAGE_SIZE) |
| #define NUM_BITS_PER_BYTE 8 |
| 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.
| desc | Patch description |
| flash_page | Number of flash pages from base |
| recover_buffer | Buffer to decrypt and copy |
| 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_ctrl | aes control structure. |
| src | UPG_FLASH_PAGE_SIZE RAM buffer where the plaintext version of the page is located. |
| dst | UPG_FLASH_PAGE_SIZE RAM buffer where the encrypted version of the page will be produced. |
| ptxt_len | Number 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. |
| typedef void(* failfunc) (patch *desc) |
The function to be called when a deliberate failure is injected.
| desc | The patch to be applied |
| 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.
| desc | The patch description. |
| size | The size of the contents. |
| location | The byte position within the image to get the contents from. |
| dest | The buffer to put the contents into. |
| typedef struct patch_description patch |
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.
| desc | Patch description |
| 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.
| desc | The patch description. |
| image_page_no | The page to be written. |
| page_contents | The buffer containing the page contents that will be written. |
| errcode_t fota_pkg_task_apply_code_diff | ( | const upg_image_header_t * | image | ) |
Apply a FOTA core task for an image.
| task | The FOTA code task header in SCPU RAM. |