NVIDIA DriveOS Linux SDK API Reference

7.2.5.0 Early Access Release

Detailed Description

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
 

Enumerations

enum  __mnand_device_type {
  MNAND_CATCH_ALL = 0,
  MNAND_HYNIX_F26 = 1,
  MNAND_HYNIX_F20 = 2,
  MNAND_HYNIX_F16 = 3,
  MNAND_MICRON = 4,
  MNAND_SAMSUNG50 = 5,
  MNAND_SAMSUNG51 = 6,
  MNAND_TOSHIBA = 7,
  MNAND_UFS_TOSHIBA = 8,
  MNAND_UFS_SAMSUNG = 9,
  MNAND_UFS_MICRON = 10
}
 mNAND device type enumeration More...
 
enum  __mnand_storage_type {
  MNAND_EMMC = 0,
  MNAND_UFS = 1,
  MNAND_UNKNOWN = 2
}
 mNAND storage type enumeration More...
 
enum  __mnand_eol_status {
  MNAND_EOL_OK = 0,
  MNAND_EOL_DETECTED = 1
}
 mNAND End-of-Life status enumeration More...
 
enum  __mnand_fw_comparison_result {
  MNAND_PASSED_FW_VERSION_SAME = 0,
  MNAND_PASSED_FW_VERSION_GREATER = 1,
  MNAND_PASSED_FW_VERSION_LESSER = 2
}
 mNAND firmware comparison result enumeration More...
 
enum  __mnand_ffu_status {
  MNAND_FFU_STATUS_SUCCESS = 0,
  MNAND_FFU_STATUS_INSTALL_FAILED = 1,
  MNAND_FFU_STATUS_ERROR_DOWNLOADING_FIRMWARE = 2,
  MNAND_FFU_STATUS_FW_CORRUPTION_ERROR = 3,
  MNAND_FFU_STATUS_FW_VERSION_MISMATCH = 4,
  MNAND_FFU_STATUS_INTERNAL_ERROR = 5,
  MNAND_FFU_STATUS_NO_INFORMATION = 6,
  MNAND_FFU_STATUS_GENERIC_ERROR = 7,
  MNAND_FFU_STATUS_RESERVED_ERROR = 8
}
 mNAND UFS Field Firmware Update (FFU) status enumeration More...
 
enum  __mnand_status {
  MNAND_OK = 0,
  MNAND_ENOMEM = 1,
  MNAND_EIO = 2,
  MNAND_EINVAL = 3,
  MNAND_EOPEN = 4,
  MNAND_UNSUPPORTED = 5,
  MNAND_UNKNOWN_ERR = 6,
  MNAND_BKOPS_EN_ERR = 7
}
 mNAND operation status codes More...
 

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

Macro Definition Documentation

◆ MAX_ERASE_CNT

#define MAX_ERASE_CNT   0xFFFF

Maximum erase count a block can have.

Definition at line 54 of file nvmnand.h.

◆ MAX_FW_STR_LEN

#define MAX_FW_STR_LEN   (32U)

Maximum length of the firmware string.

Definition at line 70 of file nvmnand.h.

◆ MAX_PRN_STR_LEN

#define MAX_PRN_STR_LEN   (64U)

Maximum length of the product name string.

Definition at line 72 of file nvmnand.h.

◆ MNAND_READ_CACHE_ENABLE

#define MNAND_READ_CACHE_ENABLE   (1 << 0)

Read/Write Cache enable bits used in cache handling API.

Definition at line 66 of file nvmnand.h.

◆ MNAND_WRITE_CACHE_ENABLE

#define MNAND_WRITE_CACHE_ENABLE   (1 << 1)

Definition at line 67 of file nvmnand.h.

◆ SECTOR_SZ

#define SECTOR_SZ   512

Sector size.

Definition at line 60 of file nvmnand.h.

Typedef Documentation

◆ mnand_ages_info

Summary of ages.

This structure holds statistical information about block ages in a region.

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

◆ mnand_chip

typedef struct __mnand_chip mnand_chip

Definition at line 902 of file nvmnand.h.

◆ mnand_cid_info

CID information - eMMC only.

Contains the Card Identification Data as specified in JDEC spec. 4.51, table 64

◆ mnand_config_desc_info

CONFIG DESC information - UFS Only.

Contains the Configuration Descriptor

◆ mnand_csd_info

CSD information - eMMC only.

Contains the Card Specific Data as specified in JDEC spec. 4.51, table 67

◆ mnand_device_desc_info

DEVICE DESC information - UFS Only.

Contains the Device Descriptor as specified in JESD220C spec. table 14.4

◆ MNAND_DEVICE_TYPE

mNAND device type enumeration

Enumerates the supported device types and manufacturers for both eMMC and UFS devices.

◆ MNAND_EOL_STATUS

mNAND End-of-Life status enumeration

Indicates whether the device has reached its end-of-life condition.

◆ mnand_ext_csd_info

EXT CSD information - eMMC only.

Contains the Extended Card Specific Data as specified in JDEC spec. 4.51, table 82

◆ MNAND_FFU_STATUS

mNAND UFS Field Firmware Update (FFU) status enumeration

Defines possible status codes returned during firmware update operations.

◆ MNAND_FW_COMPARE

mNAND firmware comparison result enumeration

Used to indicate the version comparison result between current firmware and a provided firmware version.

◆ mnand_geo_desc_info

GEOMETRY DESC information - UFS Only.

Contains the Geometry Descriptor as specified in JESD220C spec. table 14.13

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

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

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

◆ mnand_lu_info

Logical Unit information - UFS Only.

Contains information about a logical unit in UFS device

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

◆ mnand_refresh_element

Information on refresh element.

This union represents either the last refreshed block or refresh percentage depending on the context of usage.

◆ mnand_refresh_progress

Information on refresh progress.

This structure holds refresh progress information and how it's being represented.

◆ mnand_refresh_properties

Information on refresh properties.

This structure holds various refresh-related timing and calibration parameters.

◆ MNAND_STATUS

mNAND operation status codes

Defines the possible status codes returned by mNAND API functions.

◆ MNAND_STORAGE_TYPE

mNAND storage type enumeration

Defines the type of storage interface used by the device.

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

◆ mnand_summary_info

Aggregation of summaries.

Contains summary information for different regions (MLC/SLC) and the entire chip, along with bad block counts.

◆ mnand_ufs_combo_query_req

Definition at line 985 of file nvmnand.h.

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

◆ mnand_ufs_query_req

Definition at line 984 of file nvmnand.h.

◆ mnand_ufs_write_erase_amplification

Write/Erase amplification information.

Gives the erase/write amplification value for the device.

◆ mnand_unit_desc_info

UNIT DESC information - UFS Only.

Contains the Unit Descriptor as specified in JESD220C spec. table 14.14

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

Enumeration Type Documentation

◆ __mnand_device_type

mNAND device type enumeration

Enumerates the supported device types and manufacturers for both eMMC and UFS devices.

Enumerator
MNAND_CATCH_ALL 

Default catch-all type when no specific match is found.

MNAND_HYNIX_F26 

Hynix F26 device.

MNAND_HYNIX_F20 

Hynix F20 device.

MNAND_HYNIX_F16 

Hynix F16 device.

MNAND_MICRON 

Micron eMMC device.

MNAND_SAMSUNG50 

Samsung eMMC 5.0 device.

MNAND_SAMSUNG51 

Samsung eMMC 5.1 device.

MNAND_TOSHIBA 

Toshiba eMMC device.

MNAND_UFS_TOSHIBA 

Toshiba UFS device.

MNAND_UFS_SAMSUNG 

Samsung UFS device.

MNAND_UFS_MICRON 

Micron UFS device.

Definition at line 646 of file nvmnand.h.

◆ __mnand_eol_status

mNAND End-of-Life status enumeration

Indicates whether the device has reached its end-of-life condition.

Enumerator
MNAND_EOL_OK 

Device has not reached end-of-life.

MNAND_EOL_DETECTED 

Device has reached end-of-life condition.

Definition at line 690 of file nvmnand.h.

◆ __mnand_ffu_status

mNAND UFS Field Firmware Update (FFU) status enumeration

Defines possible status codes returned during firmware update operations.

Enumerator
MNAND_FFU_STATUS_SUCCESS 

Indicates FFU operation was successful.

MNAND_FFU_STATUS_INSTALL_FAILED 

Indicates installing the firmware failed.

MNAND_FFU_STATUS_ERROR_DOWNLOADING_FIRMWARE 

Indicates downloading the firmware onto the device failed.

MNAND_FFU_STATUS_FW_CORRUPTION_ERROR 

Indicates the firmware that was passed for the FFU operation was corrupted.

MNAND_FFU_STATUS_FW_VERSION_MISMATCH 

Indicates the frimware version does not match

MNAND_FFU_STATUS_INTERNAL_ERROR 

Indicates there was device internal error during FFU operation.

MNAND_FFU_STATUS_NO_INFORMATION 

Indicates there is no informatuon available about the FFU operation.

MNAND_FFU_STATUS_GENERIC_ERROR 

Indicates there was a generic error during the FFU process.

MNAND_FFU_STATUS_RESERVED_ERROR 

Indicates there was a reserved error during the FFU process.

Definition at line 717 of file nvmnand.h.

◆ __mnand_fw_comparison_result

mNAND firmware comparison result enumeration

Used to indicate the version comparison result between current firmware and a provided firmware version.

Enumerator
MNAND_PASSED_FW_VERSION_SAME 
MNAND_PASSED_FW_VERSION_GREATER 
MNAND_PASSED_FW_VERSION_LESSER 

Definition at line 703 of file nvmnand.h.

◆ __mnand_status

mNAND operation status codes

Defines the possible status codes returned by mNAND API functions.

Enumerator
MNAND_OK 

Operation completed successfully.

MNAND_ENOMEM 

Memory allocation failed.

MNAND_EIO 

Input/Output error occurred.

MNAND_EINVAL 

Invalid parameter or operation.

MNAND_EOPEN 

Failed to open device node.

MNAND_UNSUPPORTED 

Operation not supported by device.

MNAND_UNKNOWN_ERR 

Unknown error occurred.

MNAND_BKOPS_EN_ERR 

Background operations enable state not set to requested value.

Definition at line 743 of file nvmnand.h.

◆ __mnand_storage_type

mNAND storage type enumeration

Defines the type of storage interface used by the device.

Enumerator
MNAND_EMMC 

eMMC storage device

MNAND_UFS 

UFS storage device.

MNAND_UNKNOWN 

Unknown storage type - indicates error condition.

Definition at line 676 of file nvmnand.h.

Function Documentation

◆ mnand_bind()

MNAND_STATUS mnand_bind ( int  fd,
mnand_chip *  chip 
)

Binds the mNAND chip.

This function establishes mNAND health related content. It performs:

  • mNAND identification
  • Allocation and initialization of health related data structures

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

Parameters
[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:
  • fd
  • vendor_lib
  • vendor_lib_name
  • vendor_lib_handle
  • vendor_ops
Returns
  • MNAND_OK : Success
  • MNAND_EINVAL : Invalid input parameter
  • MNAND_UNSUPPORTED : Operation not supported
  • MNAND_EIO : I/O error
  • MNAND_ENOMEM : Memory allocation failed


Usage considerations

  • Allowed context for the API call
    • Interrupt handler: No
    • Signal handler: No
    • Thread-safe: Yes
    • Async/Sync: Sync
    • Re-entrant: No
  • API Group
    • Init: Yes
    • Runtime: No
    • De-Init: No

◆ mnand_check_eol_status()

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.

Parameters
[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
Returns
  • MNAND_OK : Success
  • MNAND_EINVAL : Invalid input parameter
  • MNAND_UNSUPPORTED : Operation not supported
  • MNAND_EIO : I/O error
Precondition
mnand_open() or mnand_bind() shall be success


Usage considerations

  • Allowed context for the API call
    • Interrupt handler: No
    • Signal handler: No
    • Thread-safe: Yes
    • Async/Sync: Sync
    • Re-entrant: No
  • API Group
    • Init: No
    • Runtime: Yes
    • De-Init: No

◆ mnand_close()

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.

Parameters
[in]chip- Handle to mNAND device structure
Returns
  • MNAND_OK : Success
  • MNAND_EINVAL : Invalid input parameter such as NULL chip handle
  • MNAND_EIO : Device I/O operation failed
Precondition
mnand_open() shall be success


Usage considerations

  • Allowed context for the API call
    • Interrupt handler: No
    • Signal handler: No
    • Thread-safe: Yes
    • Async/Sync: Sync
    • Re-entrant: No
  • API Group
    • Init: No
    • Runtime: No
    • De-Init: Yes

◆ mnand_compare_fw_version()

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.

Parameters
[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.
Returns
  • MNAND_OK : Success
  • MNAND_EINVAL : Invalid input parameter, such as NULL or invalid "handle", or invalid firmware file.
Precondition
mnand_is_ffu_ready() shall be success


Usage considerations

  • Allowed context for the API call
    • Interrupt handler: No
    • Signal handler: No
    • Thread-safe: Yes, with the condition:
      • This API is thread safe if there are different instances of "handle" When it is called from different threads.
    • Async/Sync: Sync
    • Re-entrant: No
  • API Group
    • Init: No
    • Runtime: Yes
    • De-Init: No

◆ mnand_enable_power_off_notification()

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.

Parameters
[in]chip- Handle to mNAND device structure
Returns
  • MNAND_OK: Operation successful
  • Other: Problem occurred during operation
Precondition


Usage considerations

  • Allowed context for the API call
    • Interrupt handler: No
    • Signal handler: No
    • Thread-safe: Yes
    • Re-entrant: No
  • API Group
    • Init: Yes
    • Runtime: No
    • De-Init: No

◆ mnand_extract_age_info()

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.

Parameters
[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)
Returns
  • MNAND_OK : Success
  • MNAND_EINVAL : Invalid input parameter
  • MNAND_UNSUPPORTED : Operation not supported
  • MNAND_EIO : I/O error
Precondition
mnand_open() or mnand_bind() shall be success


Usage considerations

  • Allowed context for the API call
    • Interrupt handler: No
    • Signal handler: No
    • Thread-safe: Yes
    • Async/Sync: Sync
    • Re-entrant: No
  • API Group
    • Init: No
    • Runtime: Yes
    • De-Init: No

◆ mnand_extract_life_time_info()

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.

Parameters
[in]chip- Handle to mNAND device structure
[out]life_time_info- Structure to store lifetime information
Returns
  • MNAND_OK : Success
  • MNAND_EINVAL : Invalid input parameter
  • MNAND_UNSUPPORTED : Operation not supported
  • MNAND_EIO : I/O error
Precondition
mnand_open() or mnand_bind() shall be success


Usage considerations

  • Allowed context for the API call
    • Interrupt handler: No
    • Signal handler: No
    • Thread-safe: Yes
    • Async/Sync: Sync
    • Re-entrant: No
  • API Group
    • Init: No
    • Runtime: Yes
    • De-Init: No

◆ mnand_ffu()

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.

  • PRN is the product id or product revision that uniquely identifies the product family. It can be obtained from the vendor data sheet and added in the place of <product id/revision>. The maximum size of this string is defined in MAX_PRN_STR_LEN.
  • FW version is the unique version number of each firmware the is released from the verdor. It should be obtained from the vendors when the new firmware image is received from them. This version string or number should then be converted to hex and added in the place of <hex version string>. The maximum size of this string is defined in MAX_FW_STR_LEN.

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"

  • FW image name : SAMSUNG_UFS_3_1_SELENA_V5 TLC_128GB_P53
  • PRN(PRODUCT IDENTIFICATION(16 bytes string) field of INQUIRY response) : KLUDG4UHYB-B0EP (PRODUCT IDENTIFICATION(16 bytes string) field of INQUIRY response)
  • FW version : 5100(decimal) / 13EC(hex) (PRODUCT REVISION LEVEL(4 bytes string stored as Hex) field of INQUIRY response)

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"

  • FW image name : SAMSUNG_eMMC_5_1_VINCENT_FETB_MLC_32GB_P63
  • PRN : BGUF4R (PRODUCT NAME(6 bytes string) field in the CID.)
  • FW version : 000000089(decimal)/000000059(hex) (FIRMWARE_VERSION(8 bytes string stored as Hex) field in the EXT CSD)

Below is the sequence that needs to be followed for performing FFU.

Parameters
[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.
Returns
  • MNAND_OK : Success
  • MNAND_EINVAL : Invalid input parameter, such as NULL or invalid "handle", or invalid firmware file or firmware version is lesser than the current firmware version of the device or the firmware size is invalid.
  • MNAND_UNSUPPORTED : FFU is not supported by device or the firmeare size is too high.
  • MNAND_EIO : Device I/O operation failed or reading from the passed firmware file failed.
  • MNAND_EOFLOW : Overflow error, while conversion of data from one essential type to another
Precondition
mnand_is_ffu_ready() shall be success


Usage considerations

  • Allowed context for the API call
    • Interrupt handler: No
    • Signal handler: No
    • Thread-safe: Yes, with the condition:
      • This API is thread safe if there are different instances of "handle" When it is called from different threads.
    • Async/Sync: Sync
    • Re-entrant: No
  • API Group
    • Init: No
    • Runtime: Yes
    • De-Init: No

◆ mnand_flush_cache()

MNAND_STATUS mnand_flush_cache ( mnand_chip *  chip)

Flush cache on mNAND.

This function flushes any cached data to the device.

Parameters
[in]chip- Handle to mNAND device structure
Returns
  • MNAND_OK : Success
  • MNAND_EINVAL : Invalid input parameter
  • MNAND_UNSUPPORTED : Operation not supported
  • MNAND_EIO : I/O error
Precondition
mnand_open() or mnand_bind() shall be success


Usage considerations

  • Allowed context for the API call
    • Interrupt handler: No
    • Signal handler: No
    • Thread-safe: Yes
    • Async/Sync: Sync
    • Re-entrant: No
  • API Group
    • Init: No
    • Runtime: Yes
    • De-Init: No

◆ mnand_get_bkops_en()

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.

Parameters
[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
Returns
  • MNAND_OK: Operation successful
  • Other: Problem occurred during operation
Precondition
  • chip must be a valid pointer
  • enabled must be a valid pointer
  • mnand_open() or mnand_bind() must have been called successfully


Usage considerations

  • Allowed context for the API call
    • Interrupt handler: No
    • Signal handler: No
    • Thread-safe: Yes
    • Re-entrant: No
  • API Group
    • Init: No
    • Runtime: Yes
    • De-Init: No

◆ mnand_get_bkops_status()

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.

Parameters
[in]chip- Handle to mNAND device structure
[out]stat- Pointer to store the BKOPS status
Returns
  • MNAND_OK: Operation successful
  • Other: Problem occurred during operation
Precondition
  • chip must be a valid pointer
  • stat must be a valid pointer
  • mnand_open() or mnand_bind() must have been called successfully


Usage considerations

  • Allowed context for the API call
    • Interrupt handler: No
    • Signal handler: No
    • Thread-safe: Yes
    • Re-entrant: No
  • API Group
    • Init: No
    • Runtime: Yes
    • De-Init: No

◆ mnand_get_cache_en()

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.

Parameters
[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
Returns
  • MNAND_OK : Success
  • MNAND_EINVAL : Invalid input parameter
  • MNAND_UNSUPPORTED : Operation not supported
  • MNAND_EIO : I/O error
Precondition
mnand_open() or mnand_bind() shall be success


Usage considerations

  • Allowed context for the API call
    • Interrupt handler: No
    • Signal handler: No
    • Thread-safe: Yes
    • Async/Sync: Sync
    • Re-entrant: No
  • API Group
    • Init: No
    • Runtime: Yes
    • De-Init: No

◆ mnand_get_current_lun()

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.

Parameters
[in]chip- Handle to mNAND device structure
[out]lun- Pointer to logical unit number to be updated
Returns
  • MNAND_OK : Success
  • MNAND_EINVAL : Invalid input parameter
  • MNAND_UNSUPPORTED : Operation not supported
  • MNAND_EIO : I/O error
Precondition
mnand_open() or mnand_bind() shall be success


Usage considerations

  • Allowed context for the API call
    • Interrupt handler: No
    • Signal handler: No
    • Thread-safe: Yes
    • Async/Sync: Sync
    • Re-entrant: No
  • API Group
    • Init: No
    • Runtime: Yes
    • De-Init: No

◆ mnand_get_ffu_status()

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.

Parameters
[in]chip- Handle to an mNAND eMMC device structure.
[out]ffu_status- Ths status of the FFU operation that was performed before.
Returns
  • MNAND_OK : Success
  • MNAND_EINVAL : Invalid input parameter, such as NULL or invalid "handle".
  • MNAND_EIO : Device I/O operation failed.
  • MNAND_EOFLOW : Overflow error, while conversion of data from one essential type to another
Precondition
mnand_ffu() shall be success


Usage considerations

  • Allowed context for the API call
    • Interrupt handler: No
    • Signal handler: No
    • Thread-safe: Yes, with the condition:
      • This API is thread safe if there are different instances of "handle" When it is called from different threads.
    • Async/Sync: Sync
    • Re-entrant: No
  • API Group
    • Init: No
    • Runtime: Yes
    • De-Init: No

◆ mnand_get_fw_version()

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.

Parameters
[in]chip- Handle to an mNAND eMMC device structure.
[out]fw_version- pointer to the string buffer to which the version should be copied.
Returns
  • MNAND_OK : Success
  • MNAND_EINVAL : Invalid input parameter, such as NULL or invalid "handle".
Precondition
mnand_is_ffu_ready() shall be success


Usage considerations

  • Allowed context for the API call
    • Interrupt handler: No
    • Signal handler: No
    • Thread-safe: Yes, with the condition:
      • This API is thread safe if there are different instances of "handle" When it is called from different threads.
    • Async/Sync: Sync
    • Re-entrant: No
  • API Group
    • Init: No
    • Runtime: Yes
    • De-Init: No

◆ mnand_get_geo_info()

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.

Parameters
[in]chip- Handle to mNAND device structure
[out]geo_info- Structure to store geometry information
Returns
  • MNAND_OK : Success
  • MNAND_EINVAL : Invalid input parameter
  • MNAND_UNSUPPORTED : Operation not supported
  • MNAND_EIO : I/O error
Precondition
mnand_open() or mnand_bind() shall be success


Usage considerations

  • Allowed context for the API call
    • Interrupt handler: No
    • Signal handler: No
    • Thread-safe: Yes
    • Async/Sync: Sync
    • Re-entrant: No
  • API Group
    • Init: No
    • Runtime: Yes
    • De-Init: No

◆ mnand_get_lu_info()

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.

Parameters
[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
Returns
  • MNAND_OK : Success
  • MNAND_EINVAL : Invalid input parameter
  • MNAND_UNSUPPORTED : Operation not supported
  • MNAND_EIO : I/O error
Precondition
mnand_open() or mnand_bind() shall be success


Usage considerations

  • Allowed context for the API call
    • Interrupt handler: No
    • Signal handler: No
    • Thread-safe: Yes
    • Async/Sync: Sync
    • Re-entrant: No
  • API Group
    • Init: No
    • Runtime: Yes
    • De-Init: No

◆ mnand_get_refresh_progress()

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.

Parameters
[in]chip- Handle to mNAND device structure
[out]rfsh_progress- Current refresh progress (in percentage)
Returns
  • MNAND_OK : Success
  • MNAND_EINVAL : Invalid input parameter
  • MNAND_UNSUPPORTED : Operation not supported
  • MNAND_EIO : I/O error
Precondition
mnand_open() or mnand_bind() shall be success


Usage considerations

  • Allowed context for the API call
    • Interrupt handler: No
    • Signal handler: No
    • Thread-safe: Yes
    • Async/Sync: Sync
    • Re-entrant: No
  • API Group
    • Init: No
    • Runtime: Yes
    • De-Init: No

◆ mnand_get_storage_type()

static MNAND_STORAGE_TYPE mnand_get_storage_type ( mnand_chip *  chip)
inlinestatic

Returns mnand storage type.

This function returns the storage type (eMMC/UFS) of the mNAND device.

Parameters
[in]chip- Handle to mNAND device structure
Returns
MNAND_STORAGE_TYPE
  • MNAND_EMMC: eMMC storage device
  • MNAND_UFS: UFS storage device
  • MNAND_UNKNOWN: Unknown storage type (error)
Precondition
chip pointer must not be NULL


Usage considerations

  • Allowed context for the API call
    • Interrupt handler: Yes
    • Signal handler: Yes
    • Thread-safe: Yes
    • Re-entrant: Yes

Definition at line 1275 of file nvmnand.h.

References __mnand_chip::storage_type.

◆ mnand_is_bad_block()

static int mnand_is_bad_block ( mnand_block_info *  blk)
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.

Parameters
[in]blk- Pointer to block information structure
Returns
  • Non-zero: Block is bad
  • 0: Block is good
Precondition
blk pointer must not be NULL


Usage considerations

  • Allowed context for the API call
    • Interrupt handler: Yes
    • Signal handler: Yes
    • Thread-safe: Yes
    • Re-entrant: Yes

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

◆ mnand_is_block_info_available()

static int mnand_is_block_info_available ( mnand_chip *  chip)
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.

Parameters
[in]chip- Handle to mNAND device structure
Returns
  • Non-zero: Block information is available
  • 0: Block information is not available
Precondition
chip pointer must not be NULL


Usage considerations

  • Allowed context for the API call
    • Interrupt handler: Yes
    • Signal handler: Yes
    • Thread-safe: Yes
    • Re-entrant: Yes

Definition at line 1249 of file nvmnand.h.

References __mnand_chip::num_blocks.

◆ mnand_is_ffu_ready()

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 .

Parameters
[in]chip- Handle to an mNAND eMMC/UFS device structure.
[out]res- whether the device is ready.
Returns
  • MNAND_OK : Success
  • MNAND_EINVAL : Invalid input parameter, such as NULL or invalid "handle".
Precondition
mnand_open() shall be success


Usage considerations

  • Allowed context for the API call
    • Interrupt handler: No
    • Signal handler: No
    • Thread-safe: Yes, with the condition:
      • This API is thread safe if there are different instances of "handle" When it is called from different threads.
    • Async/Sync: Sync
    • Re-entrant: No
  • API Group
    • Init: No
    • Runtime: Yes
    • De-Init: No

◆ mnand_is_mlc_block()

static int mnand_is_mlc_block ( mnand_block_info *  blk)
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.

Parameters
[in]blk- Pointer to block information structure
Returns
  • Non-zero: Block is in MLC region
  • 0: Block is not in MLC region
Precondition
blk pointer must not be NULL


Usage considerations

  • Allowed context for the API call
    • Interrupt handler: Yes
    • Signal handler: Yes
    • Thread-safe: Yes
    • Re-entrant: Yes

Definition at line 1147 of file nvmnand.h.

References __mnand_block_info::block_type, mnand_is_valid_block(), and MNAND_MLC_BLOCK.

◆ mnand_is_refresh_available()

static int mnand_is_refresh_available ( mnand_chip *  chip)
inlinestatic

Checks if force refresh is available.

This function checks if the device supports force refresh operations.

Parameters
[in]chip- Handle to mNAND device structure
Returns
  • Non-zero: Force refresh is available
  • 0: Force refresh is not available
Precondition
chip pointer must not be NULL


Usage considerations

  • Allowed context for the API call
    • Interrupt handler: Yes
    • Signal handler: Yes
    • Thread-safe: Yes
    • Re-entrant: Yes

Definition at line 1223 of file nvmnand.h.

References __mnand_chip::refresh_available.

◆ mnand_is_slc_block()

static int mnand_is_slc_block ( mnand_block_info *  blk)
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.

Parameters
[in]blk- Pointer to block information structure
Returns
  • Non-zero: Block is in SLC region
  • 0: Block is not in SLC region
Precondition
blk pointer must not be NULL


Usage considerations

  • Allowed context for the API call
    • Interrupt handler: Yes
    • Signal handler: Yes
    • Thread-safe: Yes
    • Re-entrant: Yes

Definition at line 1120 of file nvmnand.h.

References __mnand_block_info::block_type, mnand_is_valid_block(), and MNAND_SLC_BLOCK.

◆ mnand_is_smart_summary_available()

static int mnand_is_smart_summary_available ( mnand_chip *  chip)
inlinestatic

Checks if smart summary information is available.

This function checks if the device has smart summary information available.

Parameters
[in]chip- Handle to mNAND device structure
Returns
  • Non-zero: Smart summary information is available
  • 0: Smart summary information is not available
Precondition
chip pointer must not be NULL


Usage considerations

  • Allowed context for the API call
    • Interrupt handler: Yes
    • Signal handler: Yes
    • Thread-safe: Yes
    • Re-entrant: Yes

Definition at line 1198 of file nvmnand.h.

References __mnand_chip::smart_summary_available.

◆ mnand_is_summary_available()

static int mnand_is_summary_available ( mnand_chip *  chip)
inlinestatic

Checks if summary information is available.

This function checks if the device has summary information available.

Parameters
[in]chip- Handle to mNAND device structure
Returns
  • Non-zero: Summary information is available
  • 0: Summary information is not available
Precondition
chip pointer must not be NULL


Usage considerations

  • Allowed context for the API call
    • Interrupt handler: Yes
    • Signal handler: Yes
    • Thread-safe: Yes
    • Re-entrant: Yes

Definition at line 1173 of file nvmnand.h.

References __mnand_chip::summary_available.

◆ mnand_is_usable_block()

static int mnand_is_usable_block ( mnand_block_info *  blk)
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.

Parameters
[in]blk- Pointer to block information structure
Returns
  • Non-zero: Block is usable
  • 0: Block is not usable
Precondition
blk pointer must not be NULL


Usage considerations

  • Allowed context for the API call
    • Interrupt handler: Yes
    • Signal handler: Yes
    • Thread-safe: Yes
    • Re-entrant: Yes

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

◆ mnand_is_usable_block_with_type()

static int mnand_is_usable_block_with_type ( mnand_block_info *  blk,
uint16_t  blk_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.

Parameters
[in]blk- Pointer to block information structure
[in]blk_type- Block type mask to match against
Returns
  • Non-zero: Block is usable and matches type
  • 0: Block is not usable or doesn't match type
Precondition
  • blk pointer must not be NULL
  • blk_type must not be 0


Usage considerations

  • Allowed context for the API call
    • Interrupt handler: Yes
    • Signal handler: Yes
    • Thread-safe: Yes
    • Re-entrant: Yes

Definition at line 1093 of file nvmnand.h.

References __mnand_block_info::block_type, and mnand_is_usable_block().

◆ mnand_is_valid_block()

static int mnand_is_valid_block ( mnand_block_info *  blk)
inlinestatic

Checks if a block is valid.

This function checks the validity flag of a given block.

Parameters
[in]blk- Pointer to block information structure
Returns
  • Non-zero: Block is valid
  • 0: Block is invalid
Precondition
blk pointer must not be NULL


Usage considerations

  • Allowed context for the API call
    • Interrupt handler: Yes
    • Signal handler: Yes
    • Thread-safe: Yes
    • Re-entrant: Yes

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_open()

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.

Parameters
[in]devname- Device node name on which the nvmnand lib should operate
[in,out]chip- Handle to mNAND device structure
Returns
  • MNAND_OK : Success
  • MNAND_EINVAL : Invalid input parameter such as NULL chip handle
  • MNAND_UNSUPPORTED : Operation not supported by device
  • MNAND_EIO : Device I/O operation failed
  • MNAND_ENOMEM : Memory allocation failed


Usage considerations

  • Allowed context for the API call
    • Interrupt handler: No
    • Signal handler: No
    • Thread-safe: Yes
    • Async/Sync: Sync
    • Re-entrant: No
  • API Group
    • Init: Yes
    • Runtime: No
    • De-Init: No

◆ mnand_read_sectors_phys()

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.

Parameters
[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
Returns
Number of sectors read on success -1 on error
Precondition
mnand_open() or mnand_bind() shall be success


Usage considerations

  • Allowed context for the API call
    • Interrupt handler: No
    • Signal handler: No
    • Thread-safe: Yes
    • Async/Sync: Sync
    • Re-entrant: No
  • API Group
    • Init: No
    • Runtime: Yes
    • De-Init: No

◆ mnand_read_sectors_virt()

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.

Parameters
[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
Returns
Number of sectors read on success -1 on error
Precondition
mnand_open() or mnand_bind() shall be success


Usage considerations

  • Allowed context for the API call
    • Interrupt handler: No
    • Signal handler: No
    • Thread-safe: Yes
    • Async/Sync: Sync
    • Re-entrant: No
  • API Group
    • Init: No
    • Runtime: Yes
    • De-Init: No

◆ mnand_send_combo_query_req()

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.

Parameters
[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
Returns
  • MNAND_OK : Success
  • MNAND_EINVAL : Invalid input parameter
  • MNAND_UNSUPPORTED : Operation not supported
  • MNAND_EIO : I/O error
Precondition
mnand_open() or mnand_bind() shall be success


Usage considerations

  • Allowed context for the API call
    • Interrupt handler: No
    • Signal handler: No
    • Thread-safe: Yes
    • Async/Sync: Sync
    • Re-entrant: No
  • API Group
    • Init: No
    • Runtime: Yes
    • De-Init: No

◆ mnand_send_power_off_notification()

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.

Parameters
[in]chip- Handle to mNAND device structure
Returns
  • MNAND_OK: Operation successful
  • Other: Problem occurred during operation
Precondition


Usage considerations

  • Allowed context for the API call
    • Interrupt handler: No
    • Signal handler: No
    • Thread-safe: Yes
    • Re-entrant: No
  • API Group
    • Init: No
    • Runtime: No
    • De-Init: Yes

◆ mnand_send_refresh()

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.

Parameters
[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
Returns
  • MNAND_OK : Success
  • MNAND_EINVAL : Invalid input parameter
  • MNAND_UNSUPPORTED : Operation not supported
  • MNAND_EIO : I/O error
Precondition
mnand_open() or mnand_bind() shall be success


Usage considerations

  • Allowed context for the API call
    • Interrupt handler: No
    • Signal handler: No
    • Thread-safe: Yes
    • Async/Sync: Sync
    • Re-entrant: No
  • API Group
    • Init: No
    • Runtime: Yes
    • De-Init: No

◆ mnand_set_bkops_en()

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.

Parameters
[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
Returns
  • MNAND_OK: Operation successful
  • Other: Problem occurred during operation
Precondition


Usage considerations

  • Allowed context for the API call
    • Interrupt handler: No
    • Signal handler: No
    • Thread-safe: Yes
    • Re-entrant: No
  • API Group
    • Init: No
    • Runtime: Yes
    • De-Init: No

◆ mnand_set_bkops_start()

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.

Parameters
[in]chip- Handle to mNAND device structure
Returns
  • MNAND_OK: Operation successful
  • Other: Problem occurred during operation
Precondition


Usage considerations

  • Allowed context for the API call
    • Interrupt handler: No
    • Signal handler: No
    • Thread-safe: Yes
    • Re-entrant: No
  • API Group
    • Init: No
    • Runtime: Yes
    • De-Init: No

◆ mnand_set_cache_en()

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.

Parameters
[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
Returns
  • MNAND_OK : Success
  • MNAND_EINVAL : Invalid input parameter
  • MNAND_UNSUPPORTED : Operation not supported
  • MNAND_EIO : I/O error
Precondition
mnand_open() or mnand_bind() shall be success


Usage considerations

  • Allowed context for the API call
    • Interrupt handler: No
    • Signal handler: No
    • Thread-safe: Yes
    • Async/Sync: Sync
    • Re-entrant: No
  • API Group
    • Init: No
    • Runtime: Yes
    • De-Init: No

◆ mnand_switch_cmd()

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.

Parameters
[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
Returns
  • MNAND_OK : Success
  • MNAND_EINVAL : Invalid input parameter
  • MNAND_UNSUPPORTED : Operation not supported
  • MNAND_EIO : I/O error
Precondition
mnand_open() or mnand_bind() shall be success


Usage considerations

  • Allowed context for the API call
    • Interrupt handler: No
    • Signal handler: No
    • Thread-safe: Yes
    • Async/Sync: Sync
    • Re-entrant: No
  • API Group
    • Init: No
    • Runtime: Yes
    • De-Init: No

◆ mnand_test_multi_cmd()

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.

Parameters
[in]chip- Handle to mNAND device structure
Returns
  • MNAND_OK : Success
  • MNAND_EINVAL : Invalid input parameter
  • MNAND_UNSUPPORTED : Operation not supported
  • MNAND_EIO : I/O error
Precondition
mnand_open() or mnand_bind() shall be success


Usage considerations

  • Allowed context for the API call
    • Interrupt handler: No
    • Signal handler: No
    • Thread-safe: Yes
    • Async/Sync: Sync
    • Re-entrant: No
  • API Group
    • Init: No
    • Runtime: Yes
    • De-Init: No

◆ mnand_trim_all()

MNAND_STATUS mnand_trim_all ( mnand_chip *  chip)

Trimming the whole device.

This function trims the entire device, marking all blocks as unused.

Parameters
[in]chip- Handle to mNAND device structure
Returns
  • MNAND_OK : Success
  • MNAND_EINVAL : Invalid input parameter
  • MNAND_UNSUPPORTED : Operation not supported
  • MNAND_EIO : I/O error
Precondition
mnand_open() or mnand_bind() shall be success


Usage considerations

  • Allowed context for the API call
    • Interrupt handler: No
    • Signal handler: No
    • Thread-safe: Yes
    • Async/Sync: Sync
    • Re-entrant: No
  • API Group
    • Init: No
    • Runtime: Yes
    • De-Init: No

◆ mnand_unbind()

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.

Parameters
[in]chip- Handle to mNAND device structure Following members of the structure are used/modified:
  • vendor_lib_handle
  • vendor_ops
Returns
  • MNAND_OK : Success
  • MNAND_EINVAL : Invalid input parameter
  • MNAND_UNSUPPORTED : Operation not supported
  • MNAND_EIO : I/O error
Precondition
mnand_bind() shall be success


Usage considerations

  • Allowed context for the API call
    • Interrupt handler: No
    • Signal handler: No
    • Thread-safe: Yes
    • Async/Sync: Sync
    • Re-entrant: No
  • API Group
    • Init: No
    • Runtime: No
    • De-Init: Yes

◆ mnand_update_block_info()

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.

Parameters
[in,out]chip- Handle to mNAND device structure Following members of the structure are used/modified:
  • block_info
  • num_blocks
Returns
  • MNAND_OK : Success
  • MNAND_EINVAL : Invalid input parameter
  • MNAND_UNSUPPORTED : Operation not supported
  • MNAND_EIO : I/O error
Precondition
mnand_open() or mnand_bind() shall be success


Usage considerations

  • Allowed context for the API call
    • Interrupt handler: No
    • Signal handler: No
    • Thread-safe: Yes
    • Async/Sync: Sync
    • Re-entrant: No
  • API Group
    • Init: No
    • Runtime: Yes
    • De-Init: No

◆ mnand_update_card_status()

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.

Parameters
[in,out]chip- Handle to mNAND device structure Following members of the structure are used/modified:
  • card_status
Returns
  • MNAND_OK : Success
  • MNAND_EINVAL : Invalid input parameter
  • MNAND_UNSUPPORTED : Operation not supported
  • MNAND_EIO : I/O error
Precondition
mnand_open() or mnand_bind() shall be success


Usage considerations

  • Allowed context for the API call
    • Interrupt handler: No
    • Signal handler: No
    • Thread-safe: Yes
    • Async/Sync: Sync
    • Re-entrant: No
  • API Group
    • Init: No
    • Runtime: Yes
    • De-Init: No

◆ mnand_update_cid()

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.

Parameters
[in,out]chip- Handle to mNAND device structure Following members of the structure are used/modified:
  • cid
Returns
  • MNAND_OK : Success
  • MNAND_EINVAL : Invalid input parameter
  • MNAND_UNSUPPORTED : Operation not supported
  • MNAND_EIO : I/O error
Precondition
mnand_open() or mnand_bind() shall be success


Usage considerations

  • Allowed context for the API call
    • Interrupt handler: No
    • Signal handler: No
    • Thread-safe: Yes
    • Async/Sync: Sync
    • Re-entrant: No
  • API Group
    • Init: No
    • Runtime: Yes
    • De-Init: No

◆ mnand_update_csd()

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.

Parameters
[in,out]chip- Handle to mNAND device structure Following members of the structure are used/modified:
  • csd
Returns
  • MNAND_OK : Success
  • MNAND_EINVAL : Invalid input parameter
  • MNAND_UNSUPPORTED : Operation not supported
  • MNAND_EIO : I/O error
Precondition
mnand_open() or mnand_bind() shall be success


Usage considerations

  • Allowed context for the API call
    • Interrupt handler: No
    • Signal handler: No
    • Thread-safe: Yes
    • Async/Sync: Sync
    • Re-entrant: No
  • API Group
    • Init: No
    • Runtime: Yes
    • De-Init: No

◆ mnand_update_smart_summary_info()

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.

Parameters
[in,out]chip- Handle to mNAND device structure Following members of the structure are used/modified:
  • smart_summary_info
  • smart_summary_available
Returns
  • MNAND_OK : Success
  • MNAND_EINVAL : Invalid input parameter
  • MNAND_UNSUPPORTED : Operation not supported
  • MNAND_EIO : I/O error
Precondition
mnand_open() or mnand_bind() shall be success


Usage considerations

  • Allowed context for the API call
    • Interrupt handler: No
    • Signal handler: No
    • Thread-safe: Yes
    • Async/Sync: Sync
    • Re-entrant: No
  • API Group
    • Init: No
    • Runtime: Yes
    • De-Init: No

◆ mnand_update_summary_info()

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.

Parameters
[in,out]chip- Handle to mNAND device structure Following members of the structure are used/modified:
  • summary_info
Returns
  • MNAND_OK : Success
  • MNAND_EINVAL : Invalid input parameter
  • MNAND_UNSUPPORTED : Operation not supported
  • MNAND_EIO : I/O error
Precondition
mnand_open() or mnand_bind() shall be success


Usage considerations

  • Allowed context for the API call
    • Interrupt handler: No
    • Signal handler: No
    • Thread-safe: Yes
    • Async/Sync: Sync
    • Re-entrant: No
  • API Group
    • Init: No
    • Runtime: Yes
    • De-Init: No

◆ mnand_update_xcsd()

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.

Parameters
[in,out]chip- Handle to mNAND device structure Following members of the structure are used/modified:
  • ext_csd
Returns
  • MNAND_OK : Success
  • MNAND_EINVAL : Invalid input parameter
  • MNAND_UNSUPPORTED : Operation not supported
  • MNAND_EIO : I/O error
Precondition
mnand_open() or mnand_bind() shall be success


Usage considerations

  • Allowed context for the API call
    • Interrupt handler: No
    • Signal handler: No
    • Thread-safe: Yes
    • Async/Sync: Sync
    • Re-entrant: No
  • API Group
    • Init: No
    • Runtime: Yes
    • De-Init: No