SFDP: doxygen improvements

pull/12318/head
Veijo Pesonen 2020-01-29 13:14:22 +02:00
parent ba71b09902
commit e784c15c9e
1 changed files with 43 additions and 36 deletions

View File

@ -25,39 +25,45 @@
namespace mbed {
static const int SFDP_HEADER_SIZE = 8; ///< Size of an SFDP header */
static const int SFDP_BASIC_PARAMS_TBL_SIZE = 80; ///< Basic Parameter Table size in Bytes, 20 DWORDS */
static const int SFDP_SECTOR_MAP_MAX_REGIONS = 10;
/** \defgroup drivers-internal-api-sfdp SFDP
* \ingroup drivers-internal-api
* Serial Flash Discoverable Parameters.
*
* Based on <a href="https://www.jedec.org/standards-documents/docs/jesd216b">JESD216D.01 Standard</a>.
* @{
*/
static const int SFDP_HEADER_SIZE = 8; ///< Size of an SFDP header in bytes, 2 DWORDS
static const int SFDP_BASIC_PARAMS_TBL_SIZE = 80; ///< Basic Parameter Table size in bytes, 20 DWORDS
static const int SFDP_SECTOR_MAP_MAX_REGIONS = 10; ///< Maximum number of regions with different erase granularity
// Erase Types Per Region BitMask
static const int SFDP_ERASE_BITMASK_TYPE4 = 0x08;
static const int SFDP_ERASE_BITMASK_TYPE3 = 0x04;
static const int SFDP_ERASE_BITMASK_TYPE2 = 0x02;
static const int SFDP_ERASE_BITMASK_TYPE1 = 0x01;
static const int SFDP_ERASE_BITMASK_NONE = 0x00;
static const int SFDP_ERASE_BITMASK_ALL = 0x0F;
static const int SFDP_ERASE_BITMASK_TYPE4 = 0x08; ///< Erase type 4 (erase granularity) identifier
static const int SFDP_ERASE_BITMASK_TYPE3 = 0x04; ///< Erase type 3 (erase granularity) identifier
static const int SFDP_ERASE_BITMASK_TYPE2 = 0x02; ///< Erase type 2 (erase granularity) identifier
static const int SFDP_ERASE_BITMASK_TYPE1 = 0x01; ///< Erase type 1 (erase granularity) identifier
static const int SFDP_ERASE_BITMASK_NONE = 0x00; ///< Erase type None
static const int SFDP_ERASE_BITMASK_ALL = 0x0F; ///< Erase type All
static const int SFDP_MAX_NUM_OF_ERASE_TYPES = 4;
static const int SFDP_MAX_NUM_OF_ERASE_TYPES = 4; ///< Maximum number of different erase types (erase granularity)
/** SFDP Basic Parameter Table info */
struct sfdp_bptbl_info {
uint32_t addr;
size_t size;
uint32_t addr; ///< Address
size_t size; ///< Size
};
/** SFDP Sector Map Table info */
struct sfdp_smptbl_info {
uint32_t addr;
size_t size;
int region_cnt;
int region_size[SFDP_SECTOR_MAP_MAX_REGIONS]; // [Bytes]
//Each Region can support a bit combination of any of the 4 Erase Types
uint8_t region_erase_types_bitfld[SFDP_SECTOR_MAP_MAX_REGIONS];
unsigned int regions_min_common_erase_size; // minimal common erase size for all regions (0 if none exists)
bd_size_t region_high_boundary[SFDP_SECTOR_MAP_MAX_REGIONS]; //region high address offset boundary
// Up To 4 Erase Types are supported by SFDP (each with its own command Instruction and Size)
int erase_type_inst_arr[SFDP_MAX_NUM_OF_ERASE_TYPES];
unsigned int erase_type_size_arr[SFDP_MAX_NUM_OF_ERASE_TYPES];
uint32_t addr; ///< Address
size_t size; ///< Size
int region_cnt; ///< Number of erase regions
int region_size[SFDP_SECTOR_MAP_MAX_REGIONS]; ///< Erase region size in bytes
uint8_t region_erase_types_bitfld[SFDP_SECTOR_MAP_MAX_REGIONS]; ///< Each Region can support a bit combination of any of the 4 Erase Types
unsigned int regions_min_common_erase_size; ///< Minimal common erase size for all regions (0 if none exists)
bd_size_t region_high_boundary[SFDP_SECTOR_MAP_MAX_REGIONS]; ///< Region high address offset boundary
int erase_type_inst_arr[SFDP_MAX_NUM_OF_ERASE_TYPES]; ///< // Up To 4 Erase Types are supported by SFDP (each with its own command Instruction and Size)
unsigned int erase_type_size_arr[SFDP_MAX_NUM_OF_ERASE_TYPES]; ///< Erase sizes for all different erase types
};
/** SFDP Parameter Table addresses and sizes */
@ -68,23 +74,23 @@ struct sfdp_hdr_info {
/** SFDP Header */
struct sfdp_hdr {
uint8_t SIG_B0; // SFDP Signature, Byte 0
uint8_t SIG_B1; // SFDP Signature, Byte 1
uint8_t SIG_B2; // SFDP Signature, Byte 2
uint8_t SIG_B3; // SFDP Signature, Byte 3
uint8_t R_MINOR; // SFDP Minor Revision
uint8_t R_MAJOR; // SFDP Major Revision
uint8_t NPH; // Number of parameter headers (0-based, 0 indicates 1 parameter header)
uint8_t ACP; // SFDP Access Protocol
uint8_t SIG_B0; ///< SFDP Signature, Byte 0
uint8_t SIG_B1; ///< SFDP Signature, Byte 1
uint8_t SIG_B2; ///< SFDP Signature, Byte 2
uint8_t SIG_B3; ///< SFDP Signature, Byte 3
uint8_t R_MINOR; ///< SFDP Minor Revision
uint8_t R_MAJOR; ///< SFDP Major Revision
uint8_t NPH; ///< Number of parameter headers (0-based, 0 indicates 1 parameter header)
uint8_t ACP; ///< SFDP Access Protocol
};
/** SFDP Parameter header */
struct sfdp_prm_hdr {
uint8_t PID_LSB; // Parameter ID LSB
uint8_t P_MINOR; // Parameter Minor Revision
uint8_t P_MAJOR; // Parameter Major Revision
uint8_t P_LEN; // Parameter length in DWORDS
uint32_t DWORD2; // Parameter ID MSB + Parameter Table Pointer
uint8_t PID_LSB; ///< Parameter ID LSB
uint8_t P_MINOR; ///< Parameter Minor Revision
uint8_t P_MAJOR; ///< Parameter Major Revision
uint8_t P_LEN; ///< Parameter length in DWORDS
uint32_t DWORD2; ///< Parameter ID MSB + Parameter Table Pointer
};
/** Parse SFDP Header
@ -120,5 +126,6 @@ int sfdp_parse_headers(Callback<int(bd_addr_t, void *, bd_size_t)> sfdp_reader,
*/
int sfdp_parse_sector_map_table(Callback<int(bd_addr_t, void *, bd_size_t)> sfdp_reader, sfdp_smptbl_info &smtbl);
/** @}*/
} /* namespace mbed */
#endif