dsmi_get_device_flash_info
Prototype
int dsmi_get_device_flash_info(int device_id, unsigned int flash_index, dm_flash_info_stru *pflash_info)
Description
Obtains the flash device information.
For the Ascend 310 AI Processor, this API supports mini modules (EP) and standard PCIe cards.
Parameters
Parameter |
Input/Output |
Description |
---|---|---|
device_id |
Input |
Device ID For the Ascend 310 AI Processor, the value range is 0–63. Obtain the actual device ID by calling dsmi_list_device. |
flash_index |
Input |
Flash index, fixed at 0 |
pflash_info |
Output |
Flash device information The information struct is as follows. typedef struct dm_flash_info_stru { unsigned long flash_id; /* combined device & manufacturer code */ unsigned short device_id; /* device id */ unsigned short vendor; /* the primary vendor id */ unsigned int state; /*flash health, 0x8 indicates normal, and 0x10 indicates abnormal.*/ unsigned long size; /* total size in bytes */ unsigned int sector_count; /* number of erase units */ unsigned short manufacturer_id; /* manufacturer id */ }DM_FLASH_INFO_STRU, dm_flash_info_stru; |
Returns
Type |
Description |
---|---|
int |
0 on success; else, failure |
Restrictions
None
Example
int i; int ret = 0; dm_flash_info_stru flash_info = {0}; unsigned int flash_count = 0; ret = dsmi_get_device_flash_count(0, &flash_count); ... for (i = 0; i < flash_count; i++){ ret = dsmi_get_device_flash_info(0, i, &flash_info); if(ret != 0) { //To-do: records logs. return ret; } ... } ...