Prototype
int dsmi_get_soc_sensor_info (int device_id, int sensor_id,TAG_SENSOR_INFO *tsensor_info)
Description
Obtains SoC sensor 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.
|
sensor_id
|
Input
|
Sensor ID. The supported values are as follows:
- 0: CLUSTER_TEMP_ID, indicating the cluster temperature. The return is of type uchar.
- 1: PERI_TEMP_ID, indicating the peripheral temperature. The return is of type uchar.
- 2: AICORE0_TEMP_ID, indicating the AI Core 0 temperature. The return is of type uchar.
- 3: AICORE1_TEMP_ID, indicating the AI Core 1 temperature. The return is of type uchar.
- 4: AICORE_LIMIT_ID. The return is of type uchar. 0 indicates limited, and 1 indicates unlimited.
- 5: AICORE_TOTAL_PER_ID, indicating the total pulse period of AI Cores. The return is of type uchar.
- 6: AICORE_ELIM_PER_ID, indicating the eliminable period of AI Cores. The return is of type uchar.
- 7: AICORE_BASE_FREQ_ID, indicating the AI Core base frequency (MHz). The return is of type ushort.
- 8: NPU_DDR_FREQ_ID, indicating the DDR frequency (MHz). The return is of type ushort.
- 9: THERMAL_THRESHOLD_ID. The return is of type temp[2]. temp[0] is the temperature threshold for limiting the frequency. temp[1] is the temperature for resetting the system.
- 10: NTC_TEMP_ID. The return is of type ntc_tmp[4]. ntc_tmp[0], ntc_tmp[1], ntc_tmp[2], and ntc_tmp[3] correspond to the temperature of four thermistors, respectively. For Ascend 310 AI Processors (mini module), board_id can be set to 000, 1000, 2000, 004, 1004, or 2004. If the value is beyond the valid range, an error is reported when the thermistor temperature is queried. You can call dsmi_get_board_info to obtain the board_id first.
- 11: SOC_TEMP_ID, indicating the maximum temperature of the SoC. The return is of type uchar.
- INVALID_TSENSOR_ID
|
tsensor_info
|
Output
|
The output union is defined as follows.
#define DSMI_TAG_SENSOR_TEMP_LEN 2
#define DSMI_TAG_SENSOR_NTC_TEMP_LEN 4
typedef union tag_sensor_info {
unsigned char uchar;
unsigned short ushort;
unsigned int uint;
signed int iint;
signed char temp[DSMI_TAG_SENSOR_TEMP_LEN]; /**< 2 temp size */
signed int ntc_tmp[DSMI_TAG_SENSOR_NTC_TEMP_LEN]; /**< 4 ntc_tmp size */
unsigned int data[SENSOR_DATA_MAX_LEN];
} TAG_SENSOR_INFO;
|
Returns
Type
|
Description
|
int
|
0 on success; else, failure
|
Example
int ret = 0;
TAG_SENSOR_INFO sensor_info = {0};
ret = dsmi_get_soc_sensor_info(0, CLUSTER_TEMP_ID, &sensor_info);
if(ret != 0) {
//To-do: records logs.
return ret;
}
...