![]() |
![]() |
TI-OpenThread
1.08.06.06
|
#include <string.h>
#include <ti/sysbios/knl/Task.h>
#include <ti/devices/DeviceFamily.h>
#include <DeviceFamily_constructPath(driverlib/flash.h)>
#include "crc32.h"
#include "ext_flash_layout.h"
#include "flash_interface.h"
#include "oad_image_header.h"
#include "oad_storage.h"
Macros | |
#define | HAL_FLASH_WORD_SIZE 4 |
#define | OAD_IMG_PG_INVALID 0xFF |
#define | OAD_PROFILE_VERSION 0x01 |
#define | OADStorage_BUILD_UINT32(Byte0, Byte1, Byte2, Byte3) ((uint32_t) (((Byte0) & 0xFF) + (((Byte1) & 0xFF) << 8) + (((Byte2) & 0xFF) << 16) + (((Byte3) & 0xFF) << 24) )) |
Variables | |
static imgHdr_t | candidateImageHeader |
static uint32_t | candidateImageLength = 0xFFFFFFFF |
static uint32_t | candidateImageType = 0xFFFFFFFF |
static uint32_t | flashNumPages |
static uint32_t | flashPageSize |
static uint32_t | imageAddress = 0 |
static uint16_t | imagePage = 0 |
uint16_t | metaPage = 0 |
uint8_t | numBlksInImgHdr = 0 |
static uint32_t | oadBlkTot = 0xFFFFFFFF |
static uint16_t | oadImgBytesPerBlock = OADStorage_BLOCK_SIZE - OADStorage_BLK_NUM_HDR_SZ |
static bool | useExternalFlash = false |
#define HAL_FLASH_WORD_SIZE 4 |
#define OAD_PROFILE_VERSION 0x01 |
#define OAD_IMG_PG_INVALID 0xFF |
Referenced by oadCheckImageID(), oadFindCurrentImageHdr(), and oadValidateCandidateHdr().
#define OADStorage_BUILD_UINT32 | ( | Byte0, | |
Byte1, | |||
Byte2, | |||
Byte3 | |||
) | ((uint32_t) (((Byte0) & 0xFF) + (((Byte1) & 0xFF) << 8) + (((Byte2) & 0xFF) << 16) + (((Byte3) & 0xFF) << 24) )) |
|
static |
References flashNumPages, IMG_TYPE_OFFSET, OAD_EXTFL_ID_VAL, OAD_IMG_ID_LEN, OAD_IMG_ID_VAL, OAD_IMG_PG_INVALID, and OAD_IMG_TYPE_APPSTACKLIB.
Referenced by oadCheckImageID(), and oadValidateCandidateHdr().
|
static |
References EFL_APP_IMG_SZ, EFL_IMG_SPACE_START, and OAD_IMG_TYPE_APP.
Referenced by OADStorage_imgIdentifyWrite(), and OADStorage_init().
|
static |
References ExtImageInfo_t::counter, EFL_MAX_META, EFL_NUM_FACT_IMAGES, eraseFlashPg(), FLASH_FAILURE, FLASH_SUCCESS, metaPage, OAD_EFL_MAGIC, OAD_IMG_ID_LEN, and readFlashPg().
Referenced by OADStorage_imgIdentifyWrite().
|
static |
References _imgHdr, imgHdr::fixedHdr, flashPageSize, imgHdr::imgPayload, img_common_header::imgType, OAD_IMG_PG_INVALID, OAD_IMG_TYPE_APP, OAD_IMG_TYPE_APP_STACK, oadFindCurrentImageHdr(), OADStorage_Rejected, OADStorage_Status_Success, img_seg_payload::startAddr, img_common_header::techType, and useExternalFlash.
Referenced by OADStorage_imgBlockWrite().
|
static |
References candidateImageLength, CRC32_calc(), CRC_INVALID, CRC_OFFSET, CRC_STAT_OFFSET, CRC_VALID, EFL_PAGE_SIZE, FLASH_FAILURE, FLASH_SUCCESS, flashPageSize, imagePage, OADStorage_CrcError, OADStorage_FlashError, OADStorage_Status_Success, readFlashPg(), useExternalFlash, and writeFlashPg().
Referenced by OADStorage_imgFinalise().
|
static |
References _imgHdr, OADStorage_imgIdentifyPld_t::bimVer, img_common_header::bimVer, candidateImageLength, candidateImageType, imgHdr::fixedHdr, OADStorage_imgIdentifyPld_t::imgID, OADStorage_imgIdentifyPld_t::imgType, OADStorage_imgIdentifyPld_t::len, OADStorage_imgIdentifyPld_t::metaVer, img_common_header::metaVer, OAD_EXTFL_ID_VAL, OAD_IMG_ID_LEN, OAD_IMG_ID_VAL, OAD_IMG_PG_INVALID, OAD_IMG_TYPE_APP, OAD_IMG_TYPE_APP_STACK, OAD_IMG_TYPE_BIM, OAD_IMG_TYPE_FACTORY, OAD_IMG_TYPE_PERSISTENT_APP, OAD_IMG_TYPE_RSVD_BEGIN, oadFindCurrentImageHdr(), OADStorage_Rejected, OADStorage_Status_Success, and useExternalFlash.
Referenced by OADStorage_imgIdentifyWrite().
void OADStorage_init | ( | void | ) |
References OADStorage_imgIdentifyPld_t::bimVer, img_common_header::bimVer, OADStorage_imgIdentifyPld_t::crcStat, img_common_header::crcStat, EXT_FLASH_PAGE, imgHdr::fixedHdr, FLASH_FAILURE, flash_open(), FLASH_SUCCESS, flashNumPages, flashPageSize, hasExternalFlash(), imageAddress, imagePage, OADStorage_imgIdentifyPld_t::imgCpStat, img_common_header::imgCpStat, OADStorage_imgIdentifyPld_t::imgID, img_common_header::imgID, OADStorage_imgIdentifyPld_t::imgNo, img_common_header::imgNo, OADStorage_imgIdentifyPld_t::imgType, img_common_header::imgType, OADStorage_imgIdentifyPld_t::len, img_common_header::len, OADStorage_imgIdentifyPld_t::metaVer, img_common_header::metaVer, OAD_EXTFL_ID_VAL, OAD_IMG_ID_LEN, OAD_IMG_ID_VAL, oadBlkTot, oadFindExtFlImgAddr(), OADStorage_BLK_NUM_HDR_SZ, OADStorage_BLOCK_SIZE, OADStorage_imgIdentifyRead(), readFlashPg(), OADStorage_imgIdentifyPld_t::softVer, img_common_header::softVer, and useExternalFlash.
uint16_t OADStorage_imgIdentifyWrite | ( | uint8_t * | pBlockData | ) |
References candidateImageLength, EXT_FLASH_PAGE, FLASH_FAILURE, imageAddress, imagePage, OADStorage_imgIdentifyPld_t::imgType, metaPage, numBlksInImgHdr, oadBlkTot, oadCheckImageID(), oadFindExtFlImgAddr(), oadFindExtFlMetaPage(), oadImgBytesPerBlock, OADStorage_Status_Success, and useExternalFlash.
OADStorage_Status_t OADStorage_imgBlockWrite | ( | uint32_t | blkNum, |
uint8_t * | pBlockData, | ||
uint8_t | len | ||
) |
References EFL_PAGE_SIZE, eraseFlashPg(), imgHdr::fixedHdr, FLASH_FAILURE, FLASH_SUCCESS, imageAddress, imagePage, img_common_header::len, numBlksInImgHdr, oadImgBytesPerBlock, OADStorage_BLK_NUM_HDR_SZ, OADStorage_FlashError, OADStorage_Status_Success, oadValidateCandidateHdr(), and writeFlashPg().
OADStorage_Status_t OADStorage_eraseImgPage | ( | uint32_t | page | ) |
References eraseFlashPg(), FLASH_SUCCESS, imagePage, OADStorage_FlashError, and OADStorage_Status_Success.
OADStorage_Status_t OADStorage_imgFinalise | ( | void | ) |
References candidateImageType, ExtImageInfo_t::counter, CRC_VALID, img_common_header::crcStat, EFL_META_COPY_SZ, eraseFlashPg(), ExtImageInfo_t::extFlAddr, ExtImageInfo_t::fixedHdr, FLASH_FAILURE, FLASH_SUCCESS, imageAddress, imagePage, img_common_header::imgCpStat, metaPage, NEED_COPY, OAD_EXTFL_ID_VAL, OAD_IMG_HDR_LEN, OAD_IMG_ID_LEN, OAD_IMG_TYPE_APPSTACKLIB, OAD_IMG_TYPE_PERSISTENT_APP, oadCheckDL(), OADStorage_Failed, OADStorage_FlashError, OADStorage_Status_Success, readFlashPg(), useExternalFlash, and writeFlashPg().
|
static |
References _imgHdr, EFL_FLASH_SIZE, EXT_FLASH_ADDRESS, EXT_FLASH_PAGE, and EXTFLASH_PAGE_MASK.
Referenced by OADStorage_createFactoryImageBackup().
|
static |
References eraseFlashPg(), FLASH_FAILURE, OADStorage_FlashError, and OADStorage_Status_Success.
Referenced by OADStorage_createFactoryImageBackup().
bool OADStorage_checkFactoryImage | ( | void | ) |
uint16_t OADStorage_getFactoryImage | ( | void | ) |
uint8_t OADStorage_createFactoryImageBackup | ( | void | ) |
References _imgHdr, img_common_header::crc32, CRC32_calc(), CRC_OFFSET, CRC_VALID, img_common_header::crcStat, DEFAULT_STATE, EFL_ADDR_META, EFL_PAGE_SIZE, eraseFlashPg(), EXT_FLASH_PAGE, imgHdr::fixedHdr, flash_close(), flash_open(), FLASH_SUCCESS, img_common_header::imgCpStat, img_common_header::imgID, imgHdr::imgPayload, img_common_header::imgType, img_common_header::len, OAD_EXTFL_ID_VAL, OAD_IMG_HDR_LEN, OAD_IMG_TYPE_FACTORY, oadEraseExtFlashPages(), oadFindFactImgAddr(), OADStorage_FlashError, OADStorage_Status_Success, img_seg_payload::startAddr, and writeFlash().
OADStorage_Status_t OADStorage_imgBlockRead | ( | uint16_t | blockNum, |
uint8_t * | pBlockData | ||
) |
void OADStorage_close | ( | void | ) |
References flash_close().
uint16_t metaPage = 0 |
Referenced by oadFindExtFlMetaPage(), OADStorage_imgFinalise(), and OADStorage_imgIdentifyWrite().
|
static |
|
static |
Referenced by OADStorage_imgIdentifyWrite(), and OADStorage_init().
|
static |
Referenced by OADStorage_imgBlockRead(), OADStorage_imgBlockWrite(), and OADStorage_imgIdentifyWrite().
uint8_t numBlksInImgHdr = 0 |
Referenced by OADStorage_imgBlockWrite(), and OADStorage_imgIdentifyWrite().
|
static |
|
static |
|
static |
Referenced by oadCheckDL(), oadCheckImageID(), and OADStorage_imgIdentifyWrite().
|
static |
Referenced by oadCheckImageID(), and OADStorage_imgFinalise().
|
static |
|
static |
Referenced by oadCheckDL(), OADStorage_init(), and oadValidateCandidateHdr().
|
static |
Referenced by oadFindCurrentImageHdr(), and OADStorage_init().