123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128 |
- #ifndef HAL_OTA_H
- #define HAL_OTA_H
- #include "hal_board_cfg.h"
- #include "hal_types.h"
- #if !defined HAL_OTA_BOOT_CODE
- #define HAL_OTA_BOOT_CODE FALSE
- #endif
- #define PACK_1
- #define HAL_OTA_RC_START 0x0800
- #define HAL_OTA_CRC_ADDR 0x0888
- #define HAL_OTA_CRC_OSET (HAL_OTA_CRC_ADDR - HAL_OTA_RC_START)
- #define HAL_OTA_XNV_IS_INT FALSE
- #define HAL_OTA_XNV_IS_SPI !HAL_OTA_XNV_IS_INT
- #define HAL_OTA_BOOT_PG_CNT 2
- #if HAL_OTA_XNV_IS_SPI && !defined HAL_BOARD_CC2530EB_REV13
- #define HAL_OTA_DL_MAX 0x40000
- #define HAL_OTA_DL_SIZE (0x40000 - ((HAL_NV_PAGE_CNT+HAL_OTA_BOOT_PG_CNT)*HAL_FLASH_PAGE_SIZE))
- #define HAL_OTA_DL_OSET 0x0
- #else
- #define HAL_OTA_DL_MAX (0x40000 - ((HAL_NV_PAGE_CNT+HAL_OTA_BOOT_PG_CNT)*HAL_FLASH_PAGE_SIZE))
- #define HAL_OTA_DL_SIZE (HAL_OTA_DL_MAX / 2)
- #define HAL_OTA_DL_OSET (HAL_OTA_DL_MAX / 2)
- #endif
- #define PREAMBLE_OFFSET 0x8C
- typedef enum {
- HAL_OTA_RC,
- HAL_OTA_DL
- } image_t;
- typedef struct {
- uint16 crc;
- uint16 crc_shadow;
- } otaCrc_t;
- typedef struct {
- uint32 programLength;
- uint16 manufacturerId;
- uint16 imageType;
- uint32 imageVersion;
- } preamble_t;
- uint8 HalOTAChkDL(uint8 dlImagePreambleOffset);
- void HalOTAInvRC(void);
- uint32 HalOTAAvail(void);
- void HalOTARead(uint32 oset, uint8 *pBuf, uint16 len, image_t type);
- void HalOTAWrite(uint32 oset, uint8 *pBuf, uint16 len, image_t type);
- #endif
|