Mbed OS Reference
Loading...
Searching...
No Matches

Serial Flash Discoverable Parameters. More...

Data Structures

struct  sfdp_bptbl_info
 JEDEC Basic Flash Parameter Table info. More...
 
struct  sfdp_smptbl_info
 JEDEC Sector Map Table info. More...
 
struct  sfdp_fbatbl_info
 JEDEC 4-byte Address Instruction Parameter Table info. More...
 
struct  sfdp_hdr_info
 SFDP JEDEC Parameter Table info. More...
 

Functions

int sfdp_parse_headers (Callback< int(bd_addr_t, sfdp_cmd_addr_size_t, uint8_t, uint8_t, void *, bd_size_t)> sfdp_reader, sfdp_hdr_info &sfdp_info)
 Parse SFDP Database Retrieves all headers from within a memory device and parses the information contained by the headers. More...
 
int sfdp_parse_sector_map_table (Callback< int(bd_addr_t, sfdp_cmd_addr_size_t, uint8_t, uint8_t, void *, bd_size_t)> sfdp_reader, sfdp_hdr_info &sfdp_info)
 Parse Sector Map Parameter Table Retrieves the table from a device and parses the information contained by the table. More...
 
size_t sfdp_detect_page_size (uint8_t *bptbl_ptr, size_t bptbl_size)
 Detect page size used for writing on flash. More...
 
int sfdp_detect_erase_types_inst_and_size (uint8_t *bptbl_ptr, sfdp_hdr_info &sfdp_info)
 Detect all supported erase types. More...
 
int sfdp_find_addr_region (bd_addr_t offset, const sfdp_hdr_info &sfdp_info)
 Find the region to which the given offset belongs to. More...
 
int sfdp_iterate_next_largest_erase_type (uint8_t bitfield, bd_size_t size, bd_addr_t offset, int region, const sfdp_smptbl_info &smptbl)
 Finds the largest Erase Type of the Region to which the offset belongs to. More...
 
int sfdp_detect_device_density (uint8_t *bptbl_ptr, sfdp_bptbl_info &bptbl_info)
 Detect device density. More...
 
int sfdp_detect_addressability (uint8_t *bptbl_ptr, sfdp_bptbl_info &bptbl_info)
 Detect is it possible to access the whole memory region. More...
 

Variables

constexpr int SFDP_HEADER_SIZE = 8
 Size of an SFDP header in bytes, 2 DWORDS. More...
 
constexpr int SFDP_BASIC_PARAMS_TBL_SIZE = 80
 Basic Parameter Table size in bytes, 20 DWORDS. More...
 
constexpr int SFDP_SECTOR_MAP_MAX_REGIONS = 10
 Maximum number of regions with different erase granularity. More...
 
constexpr int SFDP_ERASE_BITMASK_TYPE4 = 0x08
 Erase type 4 (erase granularity) identifier. More...
 
constexpr int SFDP_ERASE_BITMASK_TYPE3 = 0x04
 Erase type 3 (erase granularity) identifier. More...
 
constexpr int SFDP_ERASE_BITMASK_TYPE2 = 0x02
 Erase type 2 (erase granularity) identifier. More...
 
constexpr int SFDP_ERASE_BITMASK_TYPE1 = 0x01
 Erase type 1 (erase granularity) identifier. More...
 
constexpr int SFDP_ERASE_BITMASK_NONE = 0x00
 Erase type None. More...
 
constexpr int SFDP_ERASE_BITMASK_ALL = 0x0F
 Erase type All. More...
 
constexpr int SFDP_MAX_NUM_OF_ERASE_TYPES = 4
 Maximum number of different erase types (erase granularity) More...
 

Detailed Description

Serial Flash Discoverable Parameters.

Based on JESD216D.01 Standard.

Function Documentation

◆ sfdp_parse_headers()

int sfdp_parse_headers ( Callback< int(bd_addr_t, sfdp_cmd_addr_size_t, uint8_t, uint8_t, void *, bd_size_t)>  sfdp_reader,
sfdp_hdr_info sfdp_info 
)

Parse SFDP Database Retrieves all headers from within a memory device and parses the information contained by the headers.

Only JEDEC headers are parsed, not vendor specific ones.

Parameters
sfdp_readerCallback function used to read headers from within a device
[out]sfdp_infoContains the results of parsing the SFDP Database JEDEC headers
Returns
MBED_SUCCESS on success, negative error code on failure

◆ sfdp_parse_sector_map_table()

int sfdp_parse_sector_map_table ( Callback< int(bd_addr_t, sfdp_cmd_addr_size_t, uint8_t, uint8_t, void *, bd_size_t)>  sfdp_reader,
sfdp_hdr_info sfdp_info 
)

Parse Sector Map Parameter Table Retrieves the table from a device and parses the information contained by the table.

Parameters
sfdp_readerCallback function used to read headers from within a device
[out]sfdp_infoContains the results of parsing the JEDEC Sector Map Table
Returns
MBED_SUCCESS on success, negative error code on failure

◆ sfdp_detect_page_size()

size_t sfdp_detect_page_size ( uint8_t *  bptbl_ptr,
size_t  bptbl_size 
)

Detect page size used for writing on flash.

Parameters
bptbl_ptrPointer to memory holding a Basic Parameter Table structure
bptbl_sizeSize of memory holding the Basic Parameter Table
Returns
Page size

◆ sfdp_detect_erase_types_inst_and_size()

int sfdp_detect_erase_types_inst_and_size ( uint8_t *  bptbl_ptr,
sfdp_hdr_info sfdp_info 
)

Detect all supported erase types.

Parameters
bptbl_ptrPointer to memory holding a JEDEC Basic Flash Parameter Table
[in,out]sfdp_infoContains the results of parsing erase type instructions and sizes
Returns
MBED_SUCCESS on success, negative error code on failure

◆ sfdp_find_addr_region()

int sfdp_find_addr_region ( bd_addr_t  offset,
const sfdp_hdr_info sfdp_info 
)

Find the region to which the given offset belongs to.

Parameters
offsetOffset value
sfdp_infoRegion information
Returns
Region number

◆ sfdp_iterate_next_largest_erase_type()

int sfdp_iterate_next_largest_erase_type ( uint8_t  bitfield,
bd_size_t  size,
bd_addr_t  offset,
int  region,
const sfdp_smptbl_info smptbl 
)

Finds the largest Erase Type of the Region to which the offset belongs to.

Iterates from highest type to lowest.

Parameters
bitfieldErase types bit field
sizeUpper limit for region size
offsetOffset value
regionRegion number
smptblInformation about different erase types
Returns
Largest erase type, or -1 if none matches the given address and size

◆ sfdp_detect_device_density()

int sfdp_detect_device_density ( uint8_t *  bptbl_ptr,
sfdp_bptbl_info bptbl_info 
)

Detect device density.

Parameters
bptbl_ptrPointer to memory holding a Basic Parameter Table structure
bptbl_infoBasic Parameter Table information structure
Returns
0 on success, negative error code on failure

◆ sfdp_detect_addressability()

int sfdp_detect_addressability ( uint8_t *  bptbl_ptr,
sfdp_bptbl_info bptbl_info 
)

Detect is it possible to access the whole memory region.

Parameters
bptbl_ptrPointer to memory holding a Basic Parameter Table structure
bptbl_infoBasic Parameter Table information structure
Returns
0 on success, negative error code on failure

Variable Documentation

◆ SFDP_HEADER_SIZE

constexpr int SFDP_HEADER_SIZE = 8
constexpr

Size of an SFDP header in bytes, 2 DWORDS.

Definition at line 36 of file SFDP.h.

◆ SFDP_BASIC_PARAMS_TBL_SIZE

constexpr int SFDP_BASIC_PARAMS_TBL_SIZE = 80
constexpr

Basic Parameter Table size in bytes, 20 DWORDS.

Definition at line 37 of file SFDP.h.

◆ SFDP_SECTOR_MAP_MAX_REGIONS

constexpr int SFDP_SECTOR_MAP_MAX_REGIONS = 10
constexpr

Maximum number of regions with different erase granularity.

Definition at line 38 of file SFDP.h.

◆ SFDP_ERASE_BITMASK_TYPE4

constexpr int SFDP_ERASE_BITMASK_TYPE4 = 0x08
constexpr

Erase type 4 (erase granularity) identifier.

Definition at line 41 of file SFDP.h.

◆ SFDP_ERASE_BITMASK_TYPE3

constexpr int SFDP_ERASE_BITMASK_TYPE3 = 0x04
constexpr

Erase type 3 (erase granularity) identifier.

Definition at line 42 of file SFDP.h.

◆ SFDP_ERASE_BITMASK_TYPE2

constexpr int SFDP_ERASE_BITMASK_TYPE2 = 0x02
constexpr

Erase type 2 (erase granularity) identifier.

Definition at line 43 of file SFDP.h.

◆ SFDP_ERASE_BITMASK_TYPE1

constexpr int SFDP_ERASE_BITMASK_TYPE1 = 0x01
constexpr

Erase type 1 (erase granularity) identifier.

Definition at line 44 of file SFDP.h.

◆ SFDP_ERASE_BITMASK_NONE

constexpr int SFDP_ERASE_BITMASK_NONE = 0x00
constexpr

Erase type None.

Definition at line 45 of file SFDP.h.

◆ SFDP_ERASE_BITMASK_ALL

constexpr int SFDP_ERASE_BITMASK_ALL = 0x0F
constexpr

Erase type All.

Definition at line 46 of file SFDP.h.

◆ SFDP_MAX_NUM_OF_ERASE_TYPES

constexpr int SFDP_MAX_NUM_OF_ERASE_TYPES = 4
constexpr

Maximum number of different erase types (erase granularity)

Definition at line 48 of file SFDP.h.