Client Upgrade implementation.
Client Upgrade Interface.
Copyright (c) 2018 - 2019 Microchip Technology Inc. and its subsidiaries.
Copyright (c) 2018 Microchip Technology Inc. and its subsidiaries.
#include "compiler.h"
#include "string.h"
#include "client_upgrade.h"
#include "otau_upgrade.h"
#include "common_nvm.h"
#include "delay.h"
Functions | |
static uint8_t | calcCrc (uint8_t *pcBlock, uint8_t length) |
void | otauUpgradeInit (void) |
void | otauUpgradeRcvdFrame (addr_mode_t addr_mode, uint8_t *src_addr, uint16_t length, uint8_t *payload) |
void | otauUpgradeSentFrame (uint8_t messageId, addr_mode_t addr_mode, uint8_t *addr, uint8_t status) |
void | otauUpgradeTimerHandler (SYS_Timer_t *timer) |
static void | send_image_req (uint32_t index) |
static void | send_switch_req (void) |
Variables | |
uint16_t | block [PHY_MAX_PAYLOAD_SIZE/2] |
uint16_t | block_size |
uint8_t | curr_upgrade_mode = 0 |
otauUpgradeState_t | currOtauUpgradeState = UPGRADE_OTAU_IDLE |
upgradeState_t | currUpgradeState = STATE_IDLE |
uint8_t | image_crc |
uint32_t | image_end |
uint32_t | image_index = 0 |
uint32_t | image_size |
uint8_t | imageReqRetry = 0 |
uint8_t | otauUpgradeConfirmWait = 0 |
uint16_t | upgradeImageReqInterval |
uint32_t | upgradeImageStart |
|
static |
References i.
Referenced by otauUpgradeTimerHandler().
void otauUpgradeInit | ( | void | ) |
References curr_upgrade_mode, currOtauUpgradeState, currUpgradeState, imageReqRetry, MIN_IMAGE_REQ_INTERVAL_MILLI_SEC, otauUpgradeConfirmWait, STATE_IDLE, UPGRADE_OTAU_IDLE, and upgradeImageReqInterval.
Referenced by otauInit(), and send_image_req().
void otauUpgradeRcvdFrame | ( | addr_mode_t | addr_mode, |
uint8_t * | src_addr, | ||
uint16_t | length, | ||
uint8_t * | payload | ||
) |
References APP_MAX_PAYLOAD_SIZE, at25dfx_chip_read_buffer(), at25dfx_chip_write_buffer(), block, otauImageResponse_t::block, block_size, otauImageResponse_t::blockAddr, otauImageResponse_t::blockSize, curr_upgrade_mode, currUpgradeState, DOMAIN_OTAU_UPGRADE, EXTENDED_ADDR_MODE, image_crc, image_end, image_index, image_size, otauImageNotifyRequest_t::imageCrc, imageReqRetry, otauImageNotifyRequest_t::imageSize, otauImageNotifyRequest_t::imageStart, MIN_IMAGE_REQ_INTERVAL_MILLI_SEC, NATIVE_ADDR_MODE, OTA_IMAGE_NOTIFY, OTA_IMAGE_RESPONSE, OTA_SWITCH_RESPONSE, otauSetServerDetails(), otauTimerStart(), otauTimerStop(), PHY_MAX_PAYLOAD_SIZE, otauImageNotifyRequest_t::reqInterval, send_switch_req(), STATE_IDLE, STATE_IMAGE_REQUESTED, STATE_START_DOWNLOAD, STATE_SWITCH_SUCCESS, STATE_WAITING_FOR_SWITCH, SWITCH_INTERVAL_MILLI_SEC, otauSwitchImageResponse_t::switchTime, TIMER_MODE_SINGLE, UPGRADE_OFFSET_ADDRESS, upgradeImageReqInterval, and upgradeImageStart.
Referenced by otauRcvdFrame().
void otauUpgradeSentFrame | ( | uint8_t | messageId, |
addr_mode_t | addr_mode, | ||
uint8_t * | addr, | ||
uint8_t | status | ||
) |
void otauUpgradeTimerHandler | ( | SYS_Timer_t * | timer | ) |
References ExistingImageInfo_t::active, app_info_t::app_cnt, APP_INFO_START_ADDRESS, app_table_tag::app_name, app_table_tag::app_start_addr, APP_START_ADDRESS, app_info_t::appTable, app_table_tag::bootInfo, calcCrc(), app_info_t::crc, currUpgradeState, app_info_t::default_app, delay_ms, app_table_tag::dest_addr, BootInfo_t::dest_memtype, DOMAIN_OTAU_UPGRADE, app_table_tag::existingImageInfo, image_index, image_size, app_table_tag::img_size, BootInfo_t::img_type, featureMask_t::mask, ExistingImageInfo_t::memtype, otauResetDevice(), otauTimerStart(), otauTimerStop(), otauUpgradeConfirmWait, app_info_t::required_features, send_image_req(), send_switch_req(), app_table_tag::skip_pds_end, app_table_tag::skip_pds_start, app_table_tag::src_addr, BootInfo_t::src_memtype, STATE_IMAGE_REQUESTED, STATE_IMAGE_RESPONDED, STATE_START_DOWNLOAD, STATE_SWITCH_SUCCESS, STATE_WAITING_FOR_SWITCH, TIMER_MODE_SINGLE, TYPE_EXTERNAL, TYPE_INTERNAL, BootInfo_t::update_action, UPGRADE_OFFSET_ADDRESS, and upgradeImageReqInterval.
Referenced by otauTimerStart().
|
static |
References APP_MAX_PAYLOAD_SIZE, block_size, otauImageRequest_t::blockAddr, otauImageRequest_t::blockSize, curr_upgrade_mode, currOtauUpgradeState, currUpgradeState, DOMAIN_OTAU_UPGRADE, otauImageRequest_t::domainId, EXTENDED_ADDR_MODE, image_end, IMAGE_REQ_RETRY_COUNT, IMAGE_REQUEST_SENT, IMAGE_RESP_WAIT_INTERVAL_MILLI_SEC, imageReqRetry, otauImageRequest_t::msgId, NATIVE_ADDR_MODE, NULL, OTA_IMAGE_REQUEST, otauDataSend(), otauGetServerDetails(), otauTimerStart(), otauTimerStop(), otauUpgradeConfirmWait, otauUpgradeInit(), PHY_MAX_PAYLOAD_SIZE, otauImageRequest_t::reqType, STATE_IMAGE_REQUESTED, and TIMER_MODE_SINGLE.
Referenced by otauUpgradeTimerHandler().
|
static |
References curr_upgrade_mode, currOtauUpgradeState, currUpgradeState, DOMAIN_OTAU_UPGRADE, otauSwitchImageRequest_t::domainId, EXTENDED_ADDR_MODE, otauSwitchImageRequest_t::msgId, NATIVE_ADDR_MODE, NULL, OTA_SWITCH_REQUEST, otauDataSend(), otauGetServerDetails(), otauUpgradeConfirmWait, STATE_WAITING_FOR_SWITCH, and SWITCH_REQUEST_SENT.
Referenced by otauUpgradeRcvdFrame(), and otauUpgradeTimerHandler().
uint16_t block[PHY_MAX_PAYLOAD_SIZE/2] |
Referenced by otauUpgradeRcvdFrame().
uint16_t block_size |
Referenced by otauUpgradeRcvdFrame(), send_image_req(), and udi_msc_trans_block().
uint8_t curr_upgrade_mode = 0 |
Referenced by otauUpgradeInit(), otauUpgradeRcvdFrame(), send_image_req(), and send_switch_req().
otauUpgradeState_t currOtauUpgradeState = UPGRADE_OTAU_IDLE |
Referenced by otauUpgradeInit(), otauUpgradeSentFrame(), send_image_req(), and send_switch_req().
upgradeState_t currUpgradeState = STATE_IDLE |
Referenced by otauUpgradeInit(), otauUpgradeRcvdFrame(), otauUpgradeTimerHandler(), send_image_req(), and send_switch_req().
uint8_t image_crc |
Referenced by otauUpgradeRcvdFrame().
uint32_t image_end |
Referenced by otauUpgradeRcvdFrame(), and send_image_req().
uint32_t image_index = 0 |
Referenced by otauUpgradeRcvdFrame(), and otauUpgradeTimerHandler().
uint32_t image_size |
Referenced by otauUpgradeRcvdFrame(), and otauUpgradeTimerHandler().
uint8_t imageReqRetry = 0 |
Referenced by otauUpgradeInit(), otauUpgradeRcvdFrame(), and send_image_req().
uint8_t otauUpgradeConfirmWait = 0 |
Referenced by otauUpgradeInit(), otauUpgradeSentFrame(), otauUpgradeTimerHandler(), send_image_req(), and send_switch_req().
uint16_t upgradeImageReqInterval |
Referenced by otauUpgradeInit(), otauUpgradeRcvdFrame(), otauUpgradeSentFrame(), and otauUpgradeTimerHandler().
uint32_t upgradeImageStart |
Referenced by otauUpgradeRcvdFrame().