Microchip® Advanced Software Framework

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Functions

Functions

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...
 

sint8 m2m_flash_erase_sector ( tenuWincFlashRegion  enuRegion,
uint8  u8StartSector,
uint8  u8NumSectors 
)

Erase one or more sectors within a WINC flash region.

Parameters
[in]enuRegionRegion of flash in which to erase.
[in]u8StartSectorSector offset (within region) of first sector to erase.
[in]u8NumSectorsNumber of sectors to erase.
Returns
M2M_SUCCESS - The erase completed successfully. M2M_ERR_INVALID_ARG - The parameters were invalid. M2M_ERR_FAIL - The request encountered an error.
Precondition
The WINC must have been initialised but must not be running. This can be done via m2m_wifi_init_hold, m2m_wifi_reinit_hold or m2m_wifi_download_mode.

References find_flash_section(), FLASH_SECTOR_SZ, M2M_ERR_FAIL, M2M_ERR_INVALID_ARG, M2M_SUCCESS, nm_get_state(), NM_STATE_INIT, spi_flash_erase(), and WINC_FLASH_NUM_REGIONS.

sint8 m2m_flash_read ( tenuWincFlashRegion  enuRegion,
void *  pvBuffer,
uint32  u32Offset,
uint32  u32Size 
)

Read the number of bytes specified from a WINC flash location.

Parameters
[in]enuRegionRegion of flash from which to read.
[out]pvBufferPointer to buffer to populate with the data being read.
[in]u32OffsetByte offset (within region) of read location.
[in]u32SizeNumber of bytes to read.
Returns
M2M_SUCCESS - The read completed successfully. M2M_ERR_INVALID_ARG - The parameters were invalid. M2M_ERR_FAIL - The request encountered an error.
Precondition
The WINC must have been initialised but must not be running. This can be done via m2m_wifi_init_hold, m2m_wifi_reinit_hold or m2m_wifi_download_mode.

References find_flash_section(), M2M_ERR_FAIL, M2M_ERR_INVALID_ARG, M2M_SUCCESS, nm_get_state(), NM_STATE_INIT, NULL, spi_flash_read(), and WINC_FLASH_NUM_REGIONS.

sint8 m2m_flash_switch_firmware ( void  )

Switch the active and inactive firmware images.

Returns
M2M_SUCCESS - The firmware switch completed successfully. M2M_ERR_FAIL - The request encountered an error.
Precondition
The WINC must have been initialised but must not be running. This can be done via m2m_wifi_init_hold, m2m_wifi_reinit_hold or m2m_wifi_download_mode.

References M2M_ERR_FAIL, M2M_SUCCESS, nm_get_state(), NM_STATE_INIT, OTA_STATUS_INVALID, read_control_structure(), tstrOtaControlSec::u32OtaCurrentWorkingImagOffset, tstrOtaControlSec::u32OtaRollbackImageOffset, tstrOtaControlSec::u32OtaRollbackImageValidStatus, and update_control_structure().

sint8 m2m_flash_write ( tenuWincFlashRegion  enuRegion,
void *  pvBuffer,
uint32  u32Offset,
uint32  u32Size 
)

Write the number of bytes specified to a WINC flash location.

Parameters
[in]enuRegionRegion of flash in which to write.
[in]pvBufferPointer to buffer containing the data to write.
[in]u32OffsetByte offset (within region) of write location.
[in]u32SizeNumber of bytes to write.
Returns
M2M_SUCCESS - The write completed successfully. M2M_ERR_INVALID_ARG - The parameters were invalid. M2M_ERR_FAIL - The request encountered an error.
Precondition
The WINC must have been initialised but must not be running. This can be done via m2m_wifi_init_hold, m2m_wifi_reinit_hold or m2m_wifi_download_mode.
Warning
The write operation does not erase the flash device first, therefore the user must ensure the flash region has been erased first.

References find_flash_section(), M2M_ERR_FAIL, M2M_ERR_INVALID_ARG, M2M_SUCCESS, nm_get_state(), NM_STATE_INIT, NULL, spi_flash_write(), and WINC_FLASH_NUM_REGIONS.