WE310F5  39.00.000
M2MB FLASH

This section describes the M2MB API for the flash module. More...

#define M2MB_FLASH_PARTITION_ALL   0x7FFF
 
typedef struct M2MB_FLASH_INFO M2MB_FLASH_INFO_T
 
INT32 m2mb_flash_open (UINT32 partition_id, HANDLE *handle)
 m2mb_flash_open opens handle to a flash partition. More...
 
INT32 m2mb_flash_close (HANDLE handle)
 m2mb_flash_close Closes handle to a flash partition. More...
 
INT32 m2mb_flash_get_info (HANDLE handle, M2MB_FLASH_INFO_T *flash_info)
 m2mb_flash_get_info Gets flash device information. More...
 
INT32 m2mb_flash_erase (HANDLE handle, UINT32 start_block, UINT32 block_count)
 m2mb_flash_erase erases given flash blocks. More...
 
INT32 m2mb_flash_write (HANDLE handle, UINT32 byte_offset, UINT32 byte_count, void *buffer)
 m2mb_flash_write writes to the flash. More...
 
INT32 m2mb_flash_read (HANDLE handle, UINT32 byte_offset, UINT32 byte_count, void *buffer)
 m2mb_flash_read to read the flash. More...
 
INT32 m2mb_flash_erase_bulk (HANDLE handle, UINT32 start_block, UINT32 block_count)
 m2mb_flash_erase_bulk Erases given flash blocks of specified block size. More...
 

Detailed Description

This section describes the M2MB API for the flash module.

Flash access module provides APIs to open the flash module and read/ write raw data to it. Since flash stores the code and file system, so be careful while writing to the flash. Ensure that flash write does not happen on these areas. The only recovery way is to re-flash the board with the new image using the boot loader.

Macro Definition Documentation

◆ M2MB_FLASH_PARTITION_ALL

#define M2MB_FLASH_PARTITION_ALL   0x7FFF

Definition at line 50 of file m2mb_flash.h.

Typedef Documentation

◆ M2MB_FLASH_INFO_T

Function Documentation

◆ m2mb_flash_close()

INT32 m2mb_flash_close ( HANDLE  handle)

m2mb_flash_close Closes handle to a flash partition.

Clients should close the flash partition when accesses to the partition is no longer needed.

Parameters
[in]handlePointer to FLASH interface handle to store
Returns
Returns 0 on success, or -ve value code on error
Note
<Notes> Example

◆ m2mb_flash_erase()

INT32 m2mb_flash_erase ( HANDLE  handle,
UINT32  start_block,
UINT32  block_count 
)

m2mb_flash_erase erases given flash blocks.

Erases given flash blocks.

Parameters
[in]handlePointer to FLASH interface handle to store.
[in]start_blockStarting block from where the erase has to happen.
[in]block_countNumber of block to erase.
Returns
Returns 0 on success, or -ve value code on error
Note
<Notes> Example

◆ m2mb_flash_erase_bulk()

INT32 m2mb_flash_erase_bulk ( HANDLE  handle,
UINT32  start_block,
UINT32  block_count 
)

m2mb_flash_erase_bulk Erases given flash blocks of specified block size.

Erases given flash blocks.

Parameters
[in]handlePointer to FLASH interface handle to store.
[in]start_blockStarting block from where the erase has to happen.
[in]block_countNumber of blocks to erase.
Returns
Returns 0 on success, or -ve value code on error
Note
<Notes> Example

◆ m2mb_flash_get_info()

INT32 m2mb_flash_get_info ( HANDLE  handle,
M2MB_FLASH_INFO_T flash_info 
)

m2mb_flash_get_info Gets flash device information.

Gets flash device information with the data related to manufacturer ID, flash size, sector size and number of sector.

Parameters
[in]handlePointer to FLASH interface handle to store.
[in]flash_infoPointer to the client's flash device info data.
Returns
Returns 0 on success, or -ve value code on error
Note
<Notes> Example
HANDLE handle;
M2MB_FLASH_INFO_T flash_info;
m2mb_flash_get_info( handle, &flash_info );
m2mb_dbg_consol_print( "\r\nS2W BIN TYPE=DEFAULT\r\nS2W RELEASE TYPE=BETA\r\nBUILD TIME=%s\r\nBUILD DATE=%s\
\r\nWLAN EXT VERSION=%s\r\nS2W APP EXT VERSION=%s\r\nWLAN FEAT BMAP=0000000000000237\r\nGEPS EXT VERSION=1\r\nFLASH ID=%08x:MICRONIX-4MB",
info.build_time, info.build_date, info.tp_sw_version,
info.core_minor_version, flash_info.device_id );

◆ m2mb_flash_open()

INT32 m2mb_flash_open ( UINT32  partition_id,
HANDLE handle 
)

m2mb_flash_open opens handle to a flash partition.

m2mb_flash_open opens the given partition.

Parameters
[out]partition_idPartition ID.
[out]handlePointer to FLASH interface handle to store
Returns
Returns 0 on success, or -ve value code on error
Note
<Notes> Example

◆ m2mb_flash_read()

INT32 m2mb_flash_read ( HANDLE  handle,
UINT32  byte_offset,
UINT32  byte_count,
void *  buffer 
)

m2mb_flash_read to read the flash.

Reads from flash.

Parameters
[in]handlePointer to FLASH interface handle to store.
[in]byte_offsetByte offset from the start of the partition/image to read from.
[in]byte_countNumber of bytes to read data.
[out]bufferData buffer to store the data read from flash.
Returns
Returns 0 on success, or -ve value code on error
Note
<Notes> Example
HANDLE fh;
UINT8 buf[5];
m2mb_flash_read( fh, 0xAABBCCDD, 5, buf );

◆ m2mb_flash_write()

INT32 m2mb_flash_write ( HANDLE  handle,
UINT32  byte_offset,
UINT32  byte_count,
void *  buffer 
)

m2mb_flash_write writes to the flash.

Writes to the flash.

Parameters
[in]handlePointer to FLASH interface handle to store.
[in]byte_offsetByte offset from the start of the partition/image to write to.
[in]byte_countNumber of bytes to write data.
[in]bufferData buffer for flash write operation.
Returns
Returns 0 on success, or -ve value code on error
Note
<Notes> Example
HANDLE fh;
m2mb_flash_write( fh, 0xAABBCCDD, 5, "Telit" );