This interface can be used to communicate with mNAND via vendor specific commands, or more generic commands (JDEC spec. 4.51).
MNAND Core Library provides interfaces for performing device specific eMMC and UFS operations.
MNAND Core library implements only eMMC 5.1 and UFS 3.0/3.1 specification operations. For vendor specific commands it links with vendor specific library - libnvmnand_public.so.
Data Structures | |
| struct | __mnand_block_info |
| Information per block. More... | |
| union | __mnand_life_time_element |
| Information on life time element. More... | |
| struct | __mnand_life_time_info |
| Information on life time. More... | |
| union | __mnand_refresh_element |
| Information on refresh element. More... | |
| struct | __mnand_refresh_progress |
| Information on refresh progress. More... | |
| struct | __mnand_refresh_properties |
| Information on refresh properties. More... | |
| struct | __mnand_ages_element |
| Summary of ages. More... | |
| struct | __mnand_wr_info |
| Host cumulative written data information. More... | |
| struct | mnand_ufs_write_erase_amplification |
| Write/Erase amplification information. More... | |
| struct | __mnand_summary_element |
| Summary of given block type (or region) More... | |
| struct | __mnand_summary_info |
| Aggregation of summaries. More... | |
| struct | __mnand_cid_info |
| CID information - eMMC only. More... | |
| struct | __mnand_csd_info |
| CSD information - eMMC only. More... | |
| struct | __mnand_ext_csd_info |
| EXT CSD information - eMMC only. More... | |
| struct | __mnand_device_desc_info |
| DEVICE DESC information - UFS Only. More... | |
| struct | __mnand_config_desc_info |
| CONFIG DESC information - UFS Only. More... | |
| struct | __mnand_geo_desc_info |
| GEOMETRY DESC information - UFS Only. More... | |
| struct | __mnand_unit_desc_info |
| UNIT DESC information - UFS Only. More... | |
| struct | __mnand_mmc_geo_info |
| MMC Geometry Information. More... | |
| struct | __mnand_ufs_geo_info |
| UFS Geometry Information. More... | |
| union | __mnand_geo_info |
| Device Geometry Information. More... | |
| struct | __mnand_lu_info |
| Logical Unit information - UFS Only. More... | |
| struct | __mnand_chip |
| mNAND chip information More... | |
| struct | __mnand_ufs_query_req |
| UFS Query Request Information Structure. More... | |
| struct | __mnand_ufs_combo_query_req |
| UFS Combo Query Request Information Structure. More... | |
Macros | |
| #define | MAX_ERASE_CNT 0xFFFF |
| Maximum erase count a block can have. More... | |
| #define | SECTOR_SZ 512 |
| Sector size. More... | |
| #define | MNAND_READ_CACHE_ENABLE (1 << 0) |
| Read/Write Cache enable bits used in cache handling API. More... | |
| #define | MNAND_WRITE_CACHE_ENABLE (1 << 1) |
| #define | MAX_FW_STR_LEN (32U) |
| Maximum length of the firmware string. More... | |
| #define | MAX_PRN_STR_LEN (64U) |
| Maximum length of the product name string. More... | |
Typedefs | |
| typedef struct __mnand_block_info | mnand_block_info |
| Information per block. More... | |
| typedef union __mnand_life_time_element | mnand_life_time_element |
| Information on life time element. More... | |
| typedef struct __mnand_life_time_info | mnand_life_time_info |
| Information on life time. More... | |
| typedef union __mnand_refresh_element | mnand_refresh_element |
| Information on refresh element. More... | |
| typedef struct __mnand_refresh_progress | mnand_refresh_progress |
| Information on refresh progress. More... | |
| typedef struct __mnand_refresh_properties | mnand_refresh_properties |
| Information on refresh properties. More... | |
| typedef struct __mnand_ages_element | mnand_ages_info |
| Summary of ages. More... | |
| typedef struct __mnand_wr_info | mnand_wr_info |
| Host cumulative written data information. More... | |
| typedef struct mnand_ufs_write_erase_amplification | mnand_ufs_write_erase_amplification |
| Write/Erase amplification information. More... | |
| typedef struct __mnand_summary_element | mnand_summary_element |
| Summary of given block type (or region) More... | |
| typedef struct __mnand_summary_info | mnand_summary_info |
| Aggregation of summaries. More... | |
| typedef struct __mnand_cid_info | mnand_cid_info |
| CID information - eMMC only. More... | |
| typedef struct __mnand_csd_info | mnand_csd_info |
| CSD information - eMMC only. More... | |
| typedef struct __mnand_ext_csd_info | mnand_ext_csd_info |
| EXT CSD information - eMMC only. More... | |
| typedef struct __mnand_device_desc_info | mnand_device_desc_info |
| DEVICE DESC information - UFS Only. More... | |
| typedef struct __mnand_config_desc_info | mnand_config_desc_info |
| CONFIG DESC information - UFS Only. More... | |
| typedef struct __mnand_geo_desc_info | mnand_geo_desc_info |
| GEOMETRY DESC information - UFS Only. More... | |
| typedef struct __mnand_unit_desc_info | mnand_unit_desc_info |
| UNIT DESC information - UFS Only. More... | |
| typedef struct __mnand_mmc_geo_info | mnand_mmc_geo_info |
| MMC Geometry Information. More... | |
| typedef struct __mnand_ufs_geo_info | mnand_ufs_geo_info |
| UFS Geometry Information. More... | |
| typedef union __mnand_geo_info | mnand_geo_info |
| Device Geometry Information. More... | |
| typedef struct __mnand_lu_info | mnand_lu_info |
| Logical Unit information - UFS Only. More... | |
| typedef enum __mnand_device_type | MNAND_DEVICE_TYPE |
| mNAND device type enumeration More... | |
| typedef enum __mnand_storage_type | MNAND_STORAGE_TYPE |
| mNAND storage type enumeration More... | |
| typedef enum __mnand_eol_status | MNAND_EOL_STATUS |
| mNAND End-of-Life status enumeration More... | |
| typedef enum __mnand_fw_comparison_result | MNAND_FW_COMPARE |
| mNAND firmware comparison result enumeration More... | |
| typedef enum __mnand_ffu_status | MNAND_FFU_STATUS |
| mNAND UFS Field Firmware Update (FFU) status enumeration More... | |
| typedef enum __mnand_status | MNAND_STATUS |
| mNAND operation status codes More... | |
| typedef struct __mnand_chip | mnand_chip |
| typedef struct __mnand_ufs_query_req | mnand_ufs_query_req |
| typedef struct __mnand_ufs_combo_query_req | mnand_ufs_combo_query_req |
Functions | |
| static int | mnand_is_valid_block (mnand_block_info *blk) |
| Checks if a block is valid. More... | |
| static int | mnand_is_bad_block (mnand_block_info *blk) |
| Checks if a block is marked as bad. More... | |
| static int | mnand_is_usable_block (mnand_block_info *blk) |
| Checks if a block is usable. More... | |
| static int | mnand_is_usable_block_with_type (mnand_block_info *blk, uint16_t blk_type) |
| Checks if a block is usable and matches specified type. More... | |
| static int | mnand_is_slc_block (mnand_block_info *blk) |
| Checks if a block is in the SLC region. More... | |
| static int | mnand_is_mlc_block (mnand_block_info *blk) |
| Checks if a block is in the MLC region. More... | |
| static int | mnand_is_summary_available (mnand_chip *chip) |
| Checks if summary information is available. More... | |
| static int | mnand_is_smart_summary_available (mnand_chip *chip) |
| Checks if smart summary information is available. More... | |
| static int | mnand_is_refresh_available (mnand_chip *chip) |
| Checks if force refresh is available. More... | |
| static int | mnand_is_block_info_available (mnand_chip *chip) |
| Checks if block information is available. More... | |
| static MNAND_STORAGE_TYPE | mnand_get_storage_type (mnand_chip *chip) |
| Returns mnand storage type. More... | |
| MNAND_STATUS | mnand_get_bkops_en (mnand_chip *chip, uint8_t *enabled) |
| Gets the status of background operations enable bit. More... | |
| MNAND_STATUS | mnand_get_bkops_status (mnand_chip *chip, uint8_t *stat) |
| Gets the status of background operations. More... | |
| MNAND_STATUS | mnand_set_bkops_en (mnand_chip *chip, uint8_t enable) |
| Sets the background operations enable bit. More... | |
| MNAND_STATUS | mnand_set_bkops_start (mnand_chip *chip) |
| Mark the start of BKOPS. More... | |
| MNAND_STATUS | mnand_enable_power_off_notification (mnand_chip *chip) |
| Enable power-off notification. More... | |
| MNAND_STATUS | mnand_send_power_off_notification (mnand_chip *chip) |
| Send power-off notification. More... | |
| MNAND_STATUS | mnand_open (const char *devname, mnand_chip *chip) |
| Opens and initializes the mNAND device. More... | |
| MNAND_STATUS | mnand_close (mnand_chip *chip) |
| Closes the mNAND device. More... | |
| MNAND_STATUS | mnand_bind (int fd, mnand_chip *chip) |
| Binds the mNAND chip. More... | |
| MNAND_STATUS | mnand_unbind (mnand_chip *chip) |
| Unbinds (releases) the mNAND chip. More... | |
| MNAND_STATUS | mnand_update_cid (mnand_chip *chip) |
| Updates the CID field in mNAND chip handle. More... | |
| MNAND_STATUS | mnand_update_csd (mnand_chip *chip) |
| Updates the CSD field in mNAND chip handle. More... | |
| MNAND_STATUS | mnand_update_xcsd (mnand_chip *chip) |
| Updates the EXT CSD field in mNAND chip handle. More... | |
| MNAND_STATUS | mnand_update_card_status (mnand_chip *chip) |
| Updates the card status field in mNAND chip handle. More... | |
| MNAND_STATUS | mnand_update_block_info (mnand_chip *chip) |
| Updates the block info list in mNAND chip handle. More... | |
| MNAND_STATUS | mnand_update_summary_info (mnand_chip *chip) |
| Updates the summary info in mNAND chip handle. More... | |
| MNAND_STATUS | mnand_update_smart_summary_info (mnand_chip *chip) |
| Updates the smart summary info in mNAND chip handle. More... | |
| MNAND_STATUS | mnand_check_eol_status (mnand_chip *chip, MNAND_EOL_STATUS *eol_status) |
| Checks the EOL (End of Life) status. More... | |
| MNAND_STATUS | mnand_send_refresh (mnand_chip *chip, uint8_t block_type, int num_blocks, uint32_t rfsh_unit_time_us, mnand_refresh_progress *progress) |
| Sends "refresh" command to the mNAND chip. More... | |
| MNAND_STATUS | mnand_extract_age_info (mnand_chip *chip, int block_type, uint64_t *total_age, uint32_t *blk_count, double *avg_age) |
| Extracts age information from the mNAND chip. More... | |
| MNAND_STATUS | mnand_get_refresh_progress (mnand_chip *chip, double *rfsh_progress) |
| Extracts refresh progress from the mNAND chip. More... | |
| MNAND_STATUS | mnand_extract_life_time_info (mnand_chip *chip, mnand_life_time_info *life_time_info) |
| Extracts lifetime information from the mNAND chip. More... | |
| MNAND_STATUS | mnand_set_cache_en (mnand_chip *chip, uint8_t enable) |
| Enable/Disable cache on mNAND. More... | |
| MNAND_STATUS | mnand_flush_cache (mnand_chip *chip) |
| Flush cache on mNAND. More... | |
| int | mnand_read_sectors_virt (mnand_chip *chip, unsigned int start_sector, unsigned int sector_cnt, void *virtaddr) |
| Read data sectors into given buffer (virtual address). More... | |
| int | mnand_read_sectors_phys (mnand_chip *chip, unsigned int start_sector, unsigned int sector_cnt, off_t physaddr) |
| Read data sectors into given buffer (physical address). More... | |
| MNAND_STATUS | mnand_trim_all (mnand_chip *chip) |
| Trimming the whole device. More... | |
| MNAND_STATUS | mnand_get_cache_en (mnand_chip *chip, uint8_t *enabled) |
| Determine if eMMC cache is enabled. More... | |
| MNAND_STATUS | mnand_switch_cmd (mnand_chip *chip, uint8_t index, uint8_t value, char *errmsg_prepend) |
| Send mnand switch cmd to mmc to set EXT CSD register (eMMC only). More... | |
| MNAND_STATUS | mnand_get_geo_info (mnand_chip *chip, mnand_geo_info *geo_info) |
| Extract mnand geometry info. More... | |
| MNAND_STATUS | mnand_get_lu_info (mnand_chip *chip, uint32_t lun, mnand_lu_info *lu_info) |
| Get mnand lu info (UFS only). More... | |
| MNAND_STATUS | mnand_get_current_lun (mnand_chip *chip, uint32_t *lun) |
| Get mnand current lun (UFS only). More... | |
| MNAND_STATUS | mnand_send_combo_query_req (mnand_chip *chip, mnand_ufs_query_req *query_req, uint8_t num_cmds, uint8_t need_cq_empty, uint8_t ret_on_error) |
| Send mnand combo query request (UFS only). More... | |
| MNAND_STATUS | mnand_test_multi_cmd (mnand_chip *chip) |
| Test IOCTL MULTI CMD. More... | |
| MNAND_STATUS | mnand_ffu (mnand_chip *chip, char *fw_file) |
| Performs Field Firmware Update for UFS and eMMC device using the firmware image that is passed as argument. More... | |
| MNAND_STATUS | mnand_get_ffu_status (mnand_chip *chip, MNAND_FFU_STATUS *ffu_status) |
| Returns the status of the FFU operation that was done in the previous boot cycle. More... | |
| MNAND_STATUS | mnand_get_fw_version (mnand_chip *chip, char *fw_version) |
| Returns the current version(in hex string format) of the firmware that is running on the device. More... | |
| MNAND_STATUS | mnand_compare_fw_version (mnand_chip *chip, char *fw_file, MNAND_FW_COMPARE *res) |
| Compares the version of the passed firmware with the version of the frimware that is currently running on the device and returns if the passed firmware version is equal or lesser or greater. More... | |
| MNAND_STATUS | mnand_is_ffu_ready (mnand_chip *chip, bool *res) |
| Returns wheher the device is ready to read the current firmware verion that is on the device and to perform the FFU operation . More... | |
| #define MAX_ERASE_CNT 0xFFFF |
| #define MAX_FW_STR_LEN (32U) |
| #define MAX_PRN_STR_LEN (64U) |
| #define MNAND_READ_CACHE_ENABLE (1 << 0) |
| typedef struct __mnand_ages_element mnand_ages_info |
Summary of ages.
This structure holds statistical information about block ages in a region.
| typedef struct __mnand_block_info mnand_block_info |
Information per block.
This structure holds information about individual blocks in the NAND device. Used by block information retrieval and management functions.
| typedef struct __mnand_chip mnand_chip |
| typedef struct __mnand_cid_info mnand_cid_info |
CID information - eMMC only.
Contains the Card Identification Data as specified in JDEC spec. 4.51, table 64
| typedef struct __mnand_config_desc_info mnand_config_desc_info |
CONFIG DESC information - UFS Only.
Contains the Configuration Descriptor
| typedef struct __mnand_csd_info mnand_csd_info |
CSD information - eMMC only.
Contains the Card Specific Data as specified in JDEC spec. 4.51, table 67
| typedef struct __mnand_device_desc_info mnand_device_desc_info |
DEVICE DESC information - UFS Only.
Contains the Device Descriptor as specified in JESD220C spec. table 14.4
| typedef enum __mnand_device_type MNAND_DEVICE_TYPE |
mNAND device type enumeration
Enumerates the supported device types and manufacturers for both eMMC and UFS devices.
| typedef enum __mnand_eol_status MNAND_EOL_STATUS |
mNAND End-of-Life status enumeration
Indicates whether the device has reached its end-of-life condition.
| typedef struct __mnand_ext_csd_info mnand_ext_csd_info |
EXT CSD information - eMMC only.
Contains the Extended Card Specific Data as specified in JDEC spec. 4.51, table 82
| typedef enum __mnand_ffu_status MNAND_FFU_STATUS |
mNAND UFS Field Firmware Update (FFU) status enumeration
Defines possible status codes returned during firmware update operations.
| typedef enum __mnand_fw_comparison_result MNAND_FW_COMPARE |
mNAND firmware comparison result enumeration
Used to indicate the version comparison result between current firmware and a provided firmware version.
| typedef struct __mnand_geo_desc_info mnand_geo_desc_info |
GEOMETRY DESC information - UFS Only.
Contains the Geometry Descriptor as specified in JESD220C spec. table 14.13
| typedef union __mnand_geo_info mnand_geo_info |
Device Geometry Information.
This union contains geometry information for both eMMC and UFS devices. The appropriate member should be used based on the device type.
| typedef union __mnand_life_time_element mnand_life_time_element |
Information on life time element.
This union represents either spare block count or lifetime percentage depending on the context of usage.
| typedef struct __mnand_life_time_info mnand_life_time_info |
Information on life time.
This structure holds lifetime information for a region or the entire device, including how the lifetime is being represented.
| typedef struct __mnand_lu_info mnand_lu_info |
Logical Unit information - UFS Only.
Contains information about a logical unit in UFS device
| typedef struct __mnand_mmc_geo_info mnand_mmc_geo_info |
MMC Geometry Information.
This structure contains detailed geometry information specific to eMMC devices. It includes sector counts, partition sizes, and various alignment requirements.
| typedef union __mnand_refresh_element mnand_refresh_element |
Information on refresh element.
This union represents either the last refreshed block or refresh percentage depending on the context of usage.
| typedef struct __mnand_refresh_progress mnand_refresh_progress |
Information on refresh progress.
This structure holds refresh progress information and how it's being represented.
| typedef struct __mnand_refresh_properties mnand_refresh_properties |
Information on refresh properties.
This structure holds various refresh-related timing and calibration parameters.
| typedef enum __mnand_status MNAND_STATUS |
mNAND operation status codes
Defines the possible status codes returned by mNAND API functions.
| typedef enum __mnand_storage_type MNAND_STORAGE_TYPE |
mNAND storage type enumeration
Defines the type of storage interface used by the device.
| typedef struct __mnand_summary_element mnand_summary_element |
Summary of given block type (or region)
Contains lifetime, age, write count, and erase amplification information for a specific region or block type.
| typedef struct __mnand_summary_info mnand_summary_info |
Aggregation of summaries.
Contains summary information for different regions (MLC/SLC) and the entire chip, along with bad block counts.
| typedef struct __mnand_ufs_combo_query_req mnand_ufs_combo_query_req |
| typedef struct __mnand_ufs_geo_info mnand_ufs_geo_info |
UFS Geometry Information.
This structure contains detailed geometry information specific to UFS devices. It includes capacity information, logical unit details, and memory type capabilities.
| typedef struct __mnand_ufs_query_req mnand_ufs_query_req |
Write/Erase amplification information.
Gives the erase/write amplification value for the device.
| typedef struct __mnand_unit_desc_info mnand_unit_desc_info |
UNIT DESC information - UFS Only.
Contains the Unit Descriptor as specified in JESD220C spec. table 14.14
| typedef struct __mnand_wr_info mnand_wr_info |
Host cumulative written data information.
Holds the information that indicates the host cumulative written data (units of 100MB). Written data is calculated as host cumulative written data * 100MB.
| enum __mnand_device_type |
mNAND device type enumeration
Enumerates the supported device types and manufacturers for both eMMC and UFS devices.
| enum __mnand_eol_status |
| enum __mnand_ffu_status |
mNAND UFS Field Firmware Update (FFU) status enumeration
Defines possible status codes returned during firmware update operations.
| enum __mnand_status |
mNAND operation status codes
Defines the possible status codes returned by mNAND API functions.
| enum __mnand_storage_type |
| MNAND_STATUS mnand_bind | ( | int | fd, |
| mnand_chip * | chip | ||
| ) |
Binds the mNAND chip.
This function establishes mNAND health related content. It performs:
Note: mnand_bind and mnand_unbind must be used in pairs. Note: This function uses an existing file descriptor (unlike mnand_open, which takes a pathname for device node).
| [in] | fd | - File descriptor to mNAND device |
| [in,out] | chip | - Handle to mNAND device structure to be initialized Following members of the structure are used/modified:
|
Usage considerations
| MNAND_STATUS mnand_check_eol_status | ( | mnand_chip * | chip, |
| MNAND_EOL_STATUS * | eol_status | ||
| ) |
Checks the EOL (End of Life) status.
This function checks and returns the current EOL status of the device.
| [in] | chip | - Handle to mNAND device structure |
| [out] | eol_status | - Pointer to store EOL status MNAND_EOL_DETECTED: EOL condition detected MNAND_EOL_NOT_DETECTED: EOL condition not detected |
Usage considerations
| MNAND_STATUS mnand_close | ( | mnand_chip * | chip | ) |
Closes the mNAND device.
This function closes the mNAND device and frees allocated resources. No other mNAND functions should be called after this.
| [in] | chip | - Handle to mNAND device structure |
Usage considerations
| MNAND_STATUS mnand_compare_fw_version | ( | mnand_chip * | chip, |
| char * | fw_file, | ||
| MNAND_FW_COMPARE * | res | ||
| ) |
Compares the version of the passed firmware with the version of the frimware that is currently running on the device and returns if the passed firmware version is equal or lesser or greater.
| [in] | chip | - Handle to an mNAND eMMC device structure. |
| [in] | fw_file | - Pointer to the path/name of the firmware file with the firmware filename adhering to the filename naming convention given in the API description of mnand_ffu(). |
| [out] | res | - result of the version comparison. |
Usage considerations
| MNAND_STATUS mnand_enable_power_off_notification | ( | mnand_chip * | chip | ) |
Enable power-off notification.
This function enables the power-off notification feature on the device. When enabled, the device expects to receive a notification before power-off to complete any pending operations safely.
| [in] | chip | - Handle to mNAND device structure |
Usage considerations
| MNAND_STATUS mnand_extract_age_info | ( | mnand_chip * | chip, |
| int | block_type, | ||
| uint64_t * | total_age, | ||
| uint32_t * | blk_count, | ||
| double * | avg_age | ||
| ) |
Extracts age information from the mNAND chip.
This function retrieves age-related information for blocks in the specified region.
| [in] | chip | - Handle to mNAND device structure |
| [in] | block_type | - Region type (SLC/MLC) to query |
| [out] | total_age | - Sum of ages from all blocks |
| [out] | blk_count | - Number of blocks in specified region |
| [out] | avg_age | - Average age of blocks (used when total_age/blk_count not available) |
Usage considerations
| MNAND_STATUS mnand_extract_life_time_info | ( | mnand_chip * | chip, |
| mnand_life_time_info * | life_time_info | ||
| ) |
Extracts lifetime information from the mNAND chip.
This function retrieves device lifetime information.
| [in] | chip | - Handle to mNAND device structure |
| [out] | life_time_info | - Structure to store lifetime information |
Usage considerations
| MNAND_STATUS mnand_ffu | ( | mnand_chip * | chip, |
| char * | fw_file | ||
| ) |
Performs Field Firmware Update for UFS and eMMC device using the firmware image that is passed as argument.
This API expects the firmware image name to be defined in below format. <firmware image>_PRN_<product id/revision>_FWVER_<hex version string>.bin
For generating the firmware image name in the above format, the details can be obtained from below sources.
Ex: If below are the UFS firmare image details received from the vendor, then the firmware image name should be "SAMSUNG_UFS_3_1_SELENA_V5_TLC_128GB_P53_PRN_KLUDG4UHYB-B0EP_FWVER_13EC.bin"
Similarly if below are the eMMC firmware details received from the vendor, then the firmware image name should be "SAMSUNG_eMMC_5_1_VINCENT_FETB_MLC_32GB_P63_PRN_BGUF4R_FWVER_000000059.bin"
Below is the sequence that needs to be followed for performing FFU.
| [in] | chip | - Handle to an mNAND UFS device structure. |
| [in] | fw_file | - Pointer to the path of the firmware file with the firmware filename adhering to the filename naming convention given in the API description. |
Usage considerations
| MNAND_STATUS mnand_flush_cache | ( | mnand_chip * | chip | ) |
Flush cache on mNAND.
This function flushes any cached data to the device.
| [in] | chip | - Handle to mNAND device structure |
Usage considerations
| MNAND_STATUS mnand_get_bkops_en | ( | mnand_chip * | chip, |
| uint8_t * | enabled | ||
| ) |
Gets the status of background operations enable bit.
This function retrieves the current status of the BKOPS_EN bit from the device.
| [in] | chip | - Handle to mNAND device structure |
| [out] | enabled | - Pointer to store the BKOPS_EN bit status 1: Background operations are enabled 0: Background operations are disabled |
Usage considerations
| MNAND_STATUS mnand_get_bkops_status | ( | mnand_chip * | chip, |
| uint8_t * | stat | ||
| ) |
Gets the status of background operations.
This function retrieves the current status of background operations.
| [in] | chip | - Handle to mNAND device structure |
| [out] | stat | - Pointer to store the BKOPS status |
Usage considerations
| MNAND_STATUS mnand_get_cache_en | ( | mnand_chip * | chip, |
| uint8_t * | enabled | ||
| ) |
Determine if eMMC cache is enabled.
This function checks if eMMC cache is enabled and returns the current cache state.
| [in] | chip | - Handle to mNAND device structure |
| [out] | enabled | - Store the Read and Write cache enabled status Bit 0 - Read Cache, Bit 1 - Write Cache Bit value 1 - Cache enabled, Bit value 0 - Cache Disabled |
Usage considerations
| MNAND_STATUS mnand_get_current_lun | ( | mnand_chip * | chip, |
| uint32_t * | lun | ||
| ) |
Get mnand current lun (UFS only).
This function retrieves the current logical unit number (LUN) for UFS devices.
| [in] | chip | - Handle to mNAND device structure |
| [out] | lun | - Pointer to logical unit number to be updated |
Usage considerations
| MNAND_STATUS mnand_get_ffu_status | ( | mnand_chip * | chip, |
| MNAND_FFU_STATUS * | ffu_status | ||
| ) |
Returns the status of the FFU operation that was done in the previous boot cycle.
| [in] | chip | - Handle to an mNAND eMMC device structure. |
| [out] | ffu_status | - Ths status of the FFU operation that was performed before. |
Usage considerations
| MNAND_STATUS mnand_get_fw_version | ( | mnand_chip * | chip, |
| char * | fw_version | ||
| ) |
Returns the current version(in hex string format) of the firmware that is running on the device.
This function returns the current version(in hex string format) of the firmware that is running on the device.
| [in] | chip | - Handle to an mNAND eMMC device structure. |
| [out] | fw_version | - pointer to the string buffer to which the version should be copied. |
Usage considerations
| MNAND_STATUS mnand_get_geo_info | ( | mnand_chip * | chip, |
| mnand_geo_info * | geo_info | ||
| ) |
Extract mnand geometry info.
This function retrieves device geometry information including block and page sizes.
| [in] | chip | - Handle to mNAND device structure |
| [out] | geo_info | - Structure to store geometry information |
Usage considerations
| MNAND_STATUS mnand_get_lu_info | ( | mnand_chip * | chip, |
| uint32_t | lun, | ||
| mnand_lu_info * | lu_info | ||
| ) |
Get mnand lu info (UFS only).
This function retrieves logical unit (LU) information for UFS devices.
| [in] | chip | - Handle to mNAND device structure |
| [in] | lun | - Logical unit number for which lu info is needed |
| [out] | lu_info | - Pointer for the lu_info data to be updated |
Usage considerations
| MNAND_STATUS mnand_get_refresh_progress | ( | mnand_chip * | chip, |
| double * | rfsh_progress | ||
| ) |
Extracts refresh progress from the mNAND chip.
This function retrieves the current progress of refresh operation.
| [in] | chip | - Handle to mNAND device structure |
| [out] | rfsh_progress | - Current refresh progress (in percentage) |
Usage considerations
|
inlinestatic |
Returns mnand storage type.
This function returns the storage type (eMMC/UFS) of the mNAND device.
| [in] | chip | - Handle to mNAND device structure |
Usage considerations
Definition at line 1275 of file nvmnand.h.
References __mnand_chip::storage_type.
|
inlinestatic |
Checks if a block is marked as bad.
This function determines if a block is marked as bad by checking various bad block indicators and block age.
| [in] | blk | - Pointer to block information structure |
Usage considerations
Definition at line 1035 of file nvmnand.h.
References __mnand_block_info::block_age, __mnand_block_info::block_type, MAX_ERASE_CNT, mnand_is_valid_block(), MNAND_MANF_BAD_BLOCK, MNAND_RUNTIME_BAD_BLOCK, and MNAND_UNKNOWN_BAD_BLOCK.
Referenced by mnand_is_usable_block().
|
inlinestatic |
Checks if block information is available.
This function checks if the device has block information available by verifying the number of blocks is greater than zero.
| [in] | chip | - Handle to mNAND device structure |
Usage considerations
Definition at line 1249 of file nvmnand.h.
References __mnand_chip::num_blocks.
| MNAND_STATUS mnand_is_ffu_ready | ( | mnand_chip * | chip, |
| bool * | res | ||
| ) |
Returns wheher the device is ready to read the current firmware verion that is on the device and to perform the FFU operation .
| [in] | chip | - Handle to an mNAND eMMC/UFS device structure. |
| [out] | res | - whether the device is ready. |
Usage considerations
|
inlinestatic |
Checks if a block is in the MLC region.
This function determines if a block is located in the Multi-Level Cell (MLC) region of the device.
| [in] | blk | - Pointer to block information structure |
Usage considerations
Definition at line 1147 of file nvmnand.h.
References __mnand_block_info::block_type, mnand_is_valid_block(), and MNAND_MLC_BLOCK.
|
inlinestatic |
Checks if force refresh is available.
This function checks if the device supports force refresh operations.
| [in] | chip | - Handle to mNAND device structure |
Usage considerations
Definition at line 1223 of file nvmnand.h.
References __mnand_chip::refresh_available.
|
inlinestatic |
Checks if a block is in the SLC region.
This function determines if a block is located in the Single-Level Cell (SLC) region of the device.
| [in] | blk | - Pointer to block information structure |
Usage considerations
Definition at line 1120 of file nvmnand.h.
References __mnand_block_info::block_type, mnand_is_valid_block(), and MNAND_SLC_BLOCK.
|
inlinestatic |
Checks if smart summary information is available.
This function checks if the device has smart summary information available.
| [in] | chip | - Handle to mNAND device structure |
Usage considerations
Definition at line 1198 of file nvmnand.h.
References __mnand_chip::smart_summary_available.
|
inlinestatic |
Checks if summary information is available.
This function checks if the device has summary information available.
| [in] | chip | - Handle to mNAND device structure |
Usage considerations
Definition at line 1173 of file nvmnand.h.
References __mnand_chip::summary_available.
|
inlinestatic |
Checks if a block is usable.
This function determines if a block is usable by checking its validity, bad block status, and system block status.
| [in] | blk | - Pointer to block information structure |
Usage considerations
Definition at line 1063 of file nvmnand.h.
References __mnand_block_info::block_type, mnand_is_bad_block(), mnand_is_valid_block(), and MNAND_SYSTEM_BLOCK.
Referenced by mnand_is_usable_block_with_type().
|
inlinestatic |
Checks if a block is usable and matches specified type.
This function checks if a block is both usable and matches the specified block type mask.
| [in] | blk | - Pointer to block information structure |
| [in] | blk_type | - Block type mask to match against |
Usage considerations
Definition at line 1093 of file nvmnand.h.
References __mnand_block_info::block_type, and mnand_is_usable_block().
|
inlinestatic |
Checks if a block is valid.
This function checks the validity flag of a given block.
| [in] | blk | - Pointer to block information structure |
Usage considerations
Definition at line 1009 of file nvmnand.h.
References __mnand_block_info::valid.
Referenced by mnand_is_bad_block(), mnand_is_mlc_block(), mnand_is_slc_block(), and mnand_is_usable_block().
| MNAND_STATUS mnand_open | ( | const char * | devname, |
| mnand_chip * | chip | ||
| ) |
Opens and initializes the mNAND device.
This function opens the mNAND device and initializes internal data structures. It must be called before using any other mNAND functions.
| [in] | devname | - Device node name on which the nvmnand lib should operate |
| [in,out] | chip | - Handle to mNAND device structure |
Usage considerations
| int mnand_read_sectors_phys | ( | mnand_chip * | chip, |
| unsigned int | start_sector, | ||
| unsigned int | sector_cnt, | ||
| off_t | physaddr | ||
| ) |
Read data sectors into given buffer (physical address).
This function reads the specified number of sectors into a buffer addressed by physical address.
| [in] | chip | - Handle to mNAND device structure |
| [in] | start_sector | - Starting sector number to read |
| [in] | sector_cnt | - Number of sectors to read |
| [out] | physaddr | - Buffer address (physical address) to store read data |
Usage considerations
| int mnand_read_sectors_virt | ( | mnand_chip * | chip, |
| unsigned int | start_sector, | ||
| unsigned int | sector_cnt, | ||
| void * | virtaddr | ||
| ) |
Read data sectors into given buffer (virtual address).
This function reads the specified number of sectors into a buffer addressed by virtual address.
| [in] | chip | - Handle to mNAND device structure |
| [in] | start_sector | - Starting sector number to read |
| [in] | sector_cnt | - Number of sectors to read |
| [out] | virtaddr | - Buffer address (virtual address) to store read data |
Usage considerations
| MNAND_STATUS mnand_send_combo_query_req | ( | mnand_chip * | chip, |
| mnand_ufs_query_req * | query_req, | ||
| uint8_t | num_cmds, | ||
| uint8_t | need_cq_empty, | ||
| uint8_t | ret_on_error | ||
| ) |
Send mnand combo query request (UFS only).
This function sends a combo query request to UFS device. A combo query request allows multiple query requests to be sent in a single command.
| [in] | chip | - Handle to mNAND device structure |
| [in] | query_req | - Pointer to array of UFS query request info structures |
| [in] | num_cmds | - Number of query requests in this combo request |
| [in] | need_cq_empty | - Flag to specify if command queue should be empty before sending request 1: Wait for command queue to be empty 0: Send request without waiting |
| [in] | ret_on_error | - Flag to specify behavior on error 1: Return immediately on error 0: Continue processing remaining requests |
Usage considerations
| MNAND_STATUS mnand_send_power_off_notification | ( | mnand_chip * | chip | ) |
Send power-off notification.
This function notifies the device of an impending power-off, allowing it to complete any pending operations and prepare for shutdown. Should be called before powering off the device if power-off notification is enabled.
| [in] | chip | - Handle to mNAND device structure |
Usage considerations
| MNAND_STATUS mnand_send_refresh | ( | mnand_chip * | chip, |
| uint8_t | block_type, | ||
| int | num_blocks, | ||
| uint32_t | rfsh_unit_time_us, | ||
| mnand_refresh_progress * | progress | ||
| ) |
Sends "refresh" command to the mNAND chip.
This function forces data rotation to improve data retention.
| [in] | chip | - Handle to mNAND device structure |
| [in] | block_type | - Region type (SLC/MLC) to be used |
| [in] | num_blocks | - Number of blocks to be refreshed |
| [in] | rfsh_unit_time_us | - Refresh unit time in microseconds |
| [out] | progress | - Pointer to store refresh progress information |
Usage considerations
| MNAND_STATUS mnand_set_bkops_en | ( | mnand_chip * | chip, |
| uint8_t | enable | ||
| ) |
Sets the background operations enable bit.
This function sets the BKOPS_EN bit in the extended CSD register. Note that this is a one-time programmable (OTP) bit and cannot be changed once programmed.
| [in] | chip | - Handle to mNAND device structure |
| [in] | enable | - Value to set in BKOPS_EN bit 1: Host driver will issue background operations requests 0: Host driver will not issue background operations requests |
Usage considerations
| MNAND_STATUS mnand_set_bkops_start | ( | mnand_chip * | chip | ) |
Mark the start of BKOPS.
This function signals the device to start background operations (BKOPS). Background operations help maintain device health and performance.
| [in] | chip | - Handle to mNAND device structure |
Usage considerations
| MNAND_STATUS mnand_set_cache_en | ( | mnand_chip * | chip, |
| uint8_t | enable | ||
| ) |
Enable/Disable cache on mNAND.
This function controls the read and write cache functionality.
| [in] | chip | - Handle to mNAND device structure |
| [in] | enable | - Enables/Disable state for Read and Write cache Bit 0 - Read Cache, Bit 1 - Write Cache Bit value 1 - Cache enabled, Bit value 0 - Cache Disabled |
Usage considerations
| MNAND_STATUS mnand_switch_cmd | ( | mnand_chip * | chip, |
| uint8_t | index, | ||
| uint8_t | value, | ||
| char * | errmsg_prepend | ||
| ) |
Send mnand switch cmd to mmc to set EXT CSD register (eMMC only).
This function sends a command to the mmc to set EXT CSD register.
| [in] | chip | - Handle to mNAND device structure |
| [in] | index | - Which EXT CSD register to be set |
| [in] | value | - The value of EXT CSD register to be set |
| [in] | errmsg_prepend | - Error msg to be displayed on failure |
Usage considerations
| MNAND_STATUS mnand_test_multi_cmd | ( | mnand_chip * | chip | ) |
Test IOCTL MULTI CMD.
This function tests the multi-command IOCTL functionality. It is primarily used for testing and validation purposes.
| [in] | chip | - Handle to mNAND device structure |
Usage considerations
| MNAND_STATUS mnand_trim_all | ( | mnand_chip * | chip | ) |
Trimming the whole device.
This function trims the entire device, marking all blocks as unused.
| [in] | chip | - Handle to mNAND device structure |
Usage considerations
| MNAND_STATUS mnand_unbind | ( | mnand_chip * | chip | ) |
Unbinds (releases) the mNAND chip.
This function frees up health related resources and data structures. Must be called as the last operation to release resources.
Note: mnand_bind and mnand_unbind must be used in pairs. Note: The file descriptor used in bind will NOT be closed.
| [in] | chip | - Handle to mNAND device structure Following members of the structure are used/modified:
|
Usage considerations
| MNAND_STATUS mnand_update_block_info | ( | mnand_chip * | chip | ) |
Updates the block info list in mNAND chip handle.
This function retrieves and updates the list of block information in the chip handle.
| [in,out] | chip | - Handle to mNAND device structure Following members of the structure are used/modified:
|
Usage considerations
| MNAND_STATUS mnand_update_card_status | ( | mnand_chip * | chip | ) |
Updates the card status field in mNAND chip handle.
This function retrieves and updates the current card status information in the chip handle.
| [in,out] | chip | - Handle to mNAND device structure Following members of the structure are used/modified:
|
Usage considerations
| MNAND_STATUS mnand_update_cid | ( | mnand_chip * | chip | ) |
Updates the CID field in mNAND chip handle.
This function retrieves and updates the Card Identification (CID) register information in the chip handle.
| [in,out] | chip | - Handle to mNAND device structure Following members of the structure are used/modified:
|
Usage considerations
| MNAND_STATUS mnand_update_csd | ( | mnand_chip * | chip | ) |
Updates the CSD field in mNAND chip handle.
This function retrieves and updates the Card Specific Data (CSD) register information in the chip handle.
| [in,out] | chip | - Handle to mNAND device structure Following members of the structure are used/modified:
|
Usage considerations
| MNAND_STATUS mnand_update_smart_summary_info | ( | mnand_chip * | chip | ) |
Updates the smart summary info in mNAND chip handle.
This function retrieves and updates smart health summary information in the chip handle.
| [in,out] | chip | - Handle to mNAND device structure Following members of the structure are used/modified:
|
Usage considerations
| MNAND_STATUS mnand_update_summary_info | ( | mnand_chip * | chip | ) |
Updates the summary info in mNAND chip handle.
This function retrieves and updates device health summary information in the chip handle.
| [in,out] | chip | - Handle to mNAND device structure Following members of the structure are used/modified:
|
Usage considerations
| MNAND_STATUS mnand_update_xcsd | ( | mnand_chip * | chip | ) |
Updates the EXT CSD field in mNAND chip handle.
This function retrieves and updates the Extended Card Specific Data (EXT CSD) register information in the chip handle.
| [in,out] | chip | - Handle to mNAND device structure Following members of the structure are used/modified:
|
Usage considerations