WINC Flash Interface.
Copyright (c) 2017-2019 Microchip Technology Inc. and its subsidiaries.
#include "driver/include/m2m_flash.h"
#include "spi_flash/include/spi_flash.h"
#include "spi_flash/include/spi_flash_map.h"
#include "driver/source/nmdrv.h"
Data Structures | |
struct | tstrFlashMapEntry |
Functions | |
static uint8 | crc7 (uint8 crc, const uint8 *buff, uint16 len) |
static bool | find_flash_section (tenuWincFlashRegion enuRegion, uint32 *pu32StartAddr, uint32 *pu32Size) |
sint8 | m2m_flash_erase_sector (tenuWincFlashRegion enuRegion, uint8 u8StartSector, uint8 u8NumSectors) |
Erase one or more sectors within a WINC flash region. More... | |
sint8 | m2m_flash_read (tenuWincFlashRegion enuRegion, void *pvBuffer, uint32 u32Offset, uint32 u32Size) |
Read the number of bytes specified from a WINC flash location. More... | |
sint8 | m2m_flash_switch_firmware (void) |
Switch the active and inactive firmware images. More... | |
sint8 | m2m_flash_write (tenuWincFlashRegion enuRegion, void *pvBuffer, uint32 u32Offset, uint32 u32Size) |
Write the number of bytes specified to a WINC flash location. More... | |
static sint8 | read_control_structure (tstrOtaControlSec *pstrControlSec) |
static sint8 | update_control_structure (tstrOtaControlSec *pstrControlSec) |
static sint8 | verify_control_structure (tstrOtaControlSec *pstrControlSec) |
static sint8 | winc_flash_compare (uint8 *pu8Buf, uint32 u32Offset, uint32 u32Size) |
static sint8 | winc_flash_write_verify (uint8 *pu8Buf, uint32 u32Offset, uint32 u32Size) |
Variables | |
static const tstrFlashMapEntry | flashMap [] |
Referenced by update_control_structure(), and verify_control_structure().
|
static |
References tstrFlashMapEntry::address, M2M_HTTP_MEM_FLASH_OFFSET, M2M_INFO, M2M_OTA_IMAGE1_OFFSET, M2M_SUCCESS, nm_get_state(), NM_STATE_INIT, NULL, read_control_structure(), tstrFlashMapEntry::size, spi_flash_get_size(), tstrOtaControlSec::u32OtaCurrentWorkingImagOffset, tstrOtaControlSec::u32OtaRollbackImageOffset, WINC_FLASH_NUM_REGIONS, WINC_FLASH_REGION_FIRMWARE_ACTIVE, WINC_FLASH_REGION_FIRMWARE_INACTIVE, WINC_FLASH_REGION_HTTP_FILES, and WINC_FLASH_REGION_RAW.
Referenced by m2m_flash_erase_sector(), m2m_flash_read(), and m2m_flash_write().
|
static |
References M2M_BACKUP_FLASH_OFFSET, M2M_CONTROL_FLASH_OFFSET, M2M_SUCCESS, spi_flash_read(), and verify_control_structure().
Referenced by find_flash_section(), and m2m_flash_switch_firmware().
|
static |
References crc7(), M2M_BACKUP_FLASH_OFFSET, M2M_BACKUP_FLASH_SZ, M2M_CONTROL_FLASH_OFFSET, M2M_CONTROL_FLASH_SZ, M2M_ERR_FAIL, M2M_SUCCESS, ret, spi_flash_erase(), tstrOtaControlSec::u32OtaControlSecCrc, tstrOtaControlSec::u32OtaSequenceNumber, and winc_flash_write_verify().
Referenced by m2m_flash_switch_firmware().
|
static |
References crc7(), M2M_ERR_FAIL, M2M_SUCCESS, OTA_MAGIC_VALUE, tstrOtaControlSec::u32OtaControlSecCrc, and tstrOtaControlSec::u32OtaMagicValue.
Referenced by read_control_structure().
References buf, m2m_memcmp(), M2M_SUCCESS, ret, and spi_flash_read().
Referenced by winc_flash_write_verify().
References count, M2M_ERR_FAIL, M2M_SUCCESS, ret, spi_flash_write(), and winc_flash_compare().
Referenced by update_control_structure().
|
static |