capi.h Source File

capi.h Source File#

mbltml: capi.h Source File
mbltml Test Preview
mbltml — EN
capi.h
Go to the documentation of this file.
1// Copyright ⓒ 2019- Mobilint Inc. All rights reserved.
5
6#ifndef MOBILINT_MBLTML_CAPI_H_
7#define MOBILINT_MBLTML_CAPI_H_
8
9#include "mbltml/export.h"
10#include "mbltml/type.h"
11
16
18#define MBLTML_DRIVER_VERSION_BUFFER_SIZE 80
20#define MBLTML_FIRMWARE_VERSION_BUFFER_SIZE 80
22#define MBLTML_NODE_NAME_BUFFER_SIZE 80
23
24#ifdef __cplusplus
25extern "C" {
26#endif
27
28/* ------------------------------------------------------------------------- */
29/* Initialization / CleanUp APIs */
30/* ------------------------------------------------------------------------- */
31
43
53MBLTML_EXPORT mbltmlStatusCode_t mbltmlInitDevices(unsigned int device_types);
54
65
66/* ------------------------------------------------------------------------- */
67/* System-Wide Monitor APIs */
68/* ------------------------------------------------------------------------- */
69
81MBLTML_EXPORT mbltmlStatusCode_t mbltmlGetDeviceCount(unsigned int* counts);
82
101 char* version,
102 unsigned int length);
103
117 uint32_t* revision);
118
119/* ------------------------------------------------------------------------- */
120/* Device-Wise Monitor APIs */
121/* ------------------------------------------------------------------------- */
122
141MBLTML_EXPORT mbltmlStatusCode_t mbltmlGetNodeName(int dev_no, char* name,
142 unsigned int length);
143
158 mbltmlDeviceType_t* device_type);
159
173MBLTML_EXPORT mbltmlStatusCode_t
175
194MBLTML_EXPORT mbltmlStatusCode_t mbltmlGetFirmwareVersion(int dev_no, char* version,
195 unsigned int length);
196
211 uint32_t* revision);
212
226MBLTML_EXPORT mbltmlStatusCode_t mbltmlGetFirmwareCRC(int dev_no, uint32_t* crc);
227
241MBLTML_EXPORT mbltmlStatusCode_t mbltmlGetTemperature(int dev_no, int* temperature);
242
256MBLTML_EXPORT mbltmlStatusCode_t mbltmlGetSignalType(int dev_no, uint32_t* signal_type);
257
271MBLTML_EXPORT mbltmlStatusCode_t mbltmlGetNPUClock(int dev_no, uint32_t* clock);
272
286MBLTML_EXPORT mbltmlStatusCode_t mbltmlGetBusClock(int dev_no, uint32_t* clock);
287
301MBLTML_EXPORT mbltmlStatusCode_t mbltmlGetFanDuty(int dev_no, int* fan_duty);
302
316MBLTML_EXPORT mbltmlStatusCode_t mbltmlGetVendorId(int dev_no, uint32_t* vendor_id);
317
331MBLTML_EXPORT mbltmlStatusCode_t mbltmlGetDeviceId(int dev_no, uint32_t* device_id);
332
347 uint32_t* sub_vendor_id);
348
363 uint32_t* sub_device_id);
364
378MBLTML_EXPORT mbltmlStatusCode_t mbltmlGetPcieGen(int dev_no, uint32_t* pcie_gen);
379
393MBLTML_EXPORT mbltmlStatusCode_t mbltmlGetPcieLanes(int dev_no, uint32_t* pcie_lanes);
394
408MBLTML_EXPORT mbltmlStatusCode_t mbltmlGetPcieRev(int dev_no, uint32_t* pcie_rev);
409
424 uint32_t* pcie_class_code);
425
439MBLTML_EXPORT mbltmlStatusCode_t mbltmlGetTotalPower(int dev_no, double* power);
440
454MBLTML_EXPORT mbltmlStatusCode_t mbltmlGetTotalCurrent(int dev_no, double* current);
455
469MBLTML_EXPORT mbltmlStatusCode_t mbltmlGetTotalVoltage(int dev_no, double* voltage);
470
492MBLTML_EXPORT mbltmlStatusCode_t mbltmlGetExtraPmicPower(int dev_no, double* power);
493
512MBLTML_EXPORT mbltmlStatusCode_t mbltmlGetExtraPmicCurrent(int dev_no, double* current);
513
532MBLTML_EXPORT mbltmlStatusCode_t mbltmlGetExtraPmicVoltage(int dev_no, double* voltage);
533
549 mbltmlExtraPmicId_t* pmic_id);
550
566 double* utilization);
567
581MBLTML_EXPORT mbltmlStatusCode_t mbltmlGetMemoryUsage(int dev_no, int64_t* memory_usage);
582
596MBLTML_EXPORT mbltmlStatusCode_t mbltmlGetMemoryTotal(int dev_no, int64_t* memory_total);
597
626 mbltmlProcessInfo_t* infos,
627 unsigned int* info_count);
628
652 unsigned int* info_count);
653
654/* ------------------------------------------------------------------------- */
655/* Device-Wise Control APIs */
656/* ------------------------------------------------------------------------- */
657
677 mbltmlExtraPmicId_t pmic_id);
678
679#ifdef __cplusplus
680}
681#endif
682
684
685#endif // MOBILINT_MBLTML_CAPI_H_
MBLTML_EXPORT mbltmlStatusCode_t mbltmlGetTotalPower(int dev_no, double *power)
Get the total instantaneous power consumption of a device.
MBLTML_EXPORT mbltmlStatusCode_t mbltmlGetExtraPmicPower(int dev_no, double *power)
Get the power consumption of the extra PMIC rail currently selected for the device (W).
MBLTML_EXPORT mbltmlStatusCode_t mbltmlGetDeviceId(int dev_no, uint32_t *device_id)
Get the PCIe device ID of a device.
MBLTML_EXPORT mbltmlStatusCode_t mbltmlGetSignalType(int dev_no, uint32_t *signal_type)
Get the current signal-type indicator reported by the device.
MBLTML_EXPORT mbltmlStatusCode_t mbltmlGetProcessInfos(int dev_no, mbltmlProcessInfo_t *infos, unsigned int *info_count)
Get per-process usage information for a device.
MBLTML_EXPORT mbltmlStatusCode_t mbltmlShutdown()
Release all resources held by the mbltml library.
MBLTML_EXPORT mbltmlStatusCode_t mbltmlInit()
Initialize the mbltml library for all supported device types.
MBLTML_EXPORT mbltmlStatusCode_t mbltmlGetNodeName(int dev_no, char *name, unsigned int length)
Get the node name of a device.
MBLTML_EXPORT mbltmlStatusCode_t mbltmlGetMemoryUsage(int dev_no, int64_t *memory_usage)
Get the amount of device memory currently in use.
MBLTML_EXPORT mbltmlStatusCode_t mbltmlGetFirmwareRevision(int dev_no, uint32_t *revision)
Get the firmware revision number of a device.
MBLTML_EXPORT mbltmlStatusCode_t mbltmlGetSubDeviceId(int dev_no, uint32_t *sub_device_id)
Get the PCIe subsystem device ID of a device.
MBLTML_EXPORT mbltmlStatusCode_t mbltmlGetDeviceCount(unsigned int *counts)
Get the total number of devices detected by the library.
MBLTML_EXPORT mbltmlStatusCode_t mbltmlGetDeviceType(int dev_no, mbltmlDeviceType_t *device_type)
Get the device family type of a device.
MBLTML_EXPORT mbltmlStatusCode_t mbltmlGetMemoryTotal(int dev_no, int64_t *memory_total)
Get the total amount of device memory available.
MBLTML_EXPORT mbltmlStatusCode_t mbltmlGetFirmwareCRC(int dev_no, uint32_t *crc)
Get the CRC of the currently-loaded firmware image.
MBLTML_EXPORT mbltmlStatusCode_t mbltmlGetCoreInfos(int dev_no, mbltmlCoreInfo_t *infos, unsigned int *info_count)
Get per-core usage information for a device.
MBLTML_EXPORT mbltmlStatusCode_t mbltmlGetVendorId(int dev_no, uint32_t *vendor_id)
Get the PCIe vendor ID of a device.
mbltmlDeviceType_t
Identifier of a Mobilint NPU device family.
Definition type.h:25
MBLTML_EXPORT mbltmlStatusCode_t mbltmlGetTotalCurrent(int dev_no, double *current)
Get the total instantaneous current draw of a device.
MBLTML_EXPORT mbltmlStatusCode_t mbltmlGetPcieRev(int dev_no, uint32_t *pcie_rev)
Get the PCIe configuration-space revision ID of a device.
MBLTML_EXPORT mbltmlStatusCode_t mbltmlInitDevices(unsigned int device_types)
Initialize the mbltml library for a selected set of device types.
MBLTML_EXPORT mbltmlStatusCode_t mbltmlGetPcieGen(int dev_no, uint32_t *pcie_gen)
Get the negotiated PCIe link generation of a device.
MBLTML_EXPORT mbltmlStatusCode_t mbltmlGetFanDuty(int dev_no, int *fan_duty)
Get the current cooling-fan duty cycle of a device.
mbltmlStatusCode_t
Status code returned by mbltml APIs.
Definition type.h:46
MBLTML_EXPORT mbltmlStatusCode_t mbltmlGetTemperature(int dev_no, int *temperature)
Get the current die temperature of a device.
MBLTML_EXPORT mbltmlStatusCode_t mbltmlSetExtraPmicID(int dev_no, mbltmlExtraPmicId_t pmic_id)
Select which extra PMIC rail subsequent mbltmlGetExtraPmic*() queries refer to.
MBLTML_EXPORT mbltmlStatusCode_t mbltmlGetNPUClock(int dev_no, uint32_t *clock)
Get the current NPU clock frequency of a device.
MBLTML_EXPORT mbltmlStatusCode_t mbltmlGetPcieClassCode(int dev_no, uint32_t *pcie_class_code)
Get the PCIe configuration-space class code of a device.
mbltmlHardwareVersion_t
Specific hardware revision of a Mobilint NPU.
Definition type.h:35
MBLTML_EXPORT mbltmlStatusCode_t mbltmlGetBusClock(int dev_no, uint32_t *clock)
Get the current bus clock frequency of a device.
MBLTML_EXPORT mbltmlStatusCode_t mbltmlGetExtraPmicCurrent(int dev_no, double *current)
Get the current of the extra PMIC rail currently selected for the device (A).
MBLTML_EXPORT mbltmlStatusCode_t mbltmlGetSubVendorId(int dev_no, uint32_t *sub_vendor_id)
Get the PCIe subsystem vendor ID of a device.
MBLTML_EXPORT mbltmlStatusCode_t mbltmlGetTotalUtilization(int dev_no, double *utilization)
Get the overall NPU utilization of a device.
mbltmlExtraPmicId_t
Identifier of an extra PMIC rail.
Definition type.h:62
MBLTML_EXPORT mbltmlStatusCode_t mbltmlGetDriverVersion(mbltmlDeviceType_t dt, char *version, unsigned int length)
Get the driver version string for a specific device family.
MBLTML_EXPORT mbltmlStatusCode_t mbltmlGetTotalVoltage(int dev_no, double *voltage)
Get the total instantaneous supply voltage of a device.
MBLTML_EXPORT mbltmlStatusCode_t mbltmlGetPcieLanes(int dev_no, uint32_t *pcie_lanes)
Get the negotiated PCIe link width (in lanes) of a device.
MBLTML_EXPORT mbltmlStatusCode_t mbltmlGetExtraPmicVoltage(int dev_no, double *voltage)
Get the voltage of the extra PMIC rail currently selected for the device (V).
MBLTML_EXPORT mbltmlStatusCode_t mbltmlGetFirmwareVersion(int dev_no, char *version, unsigned int length)
Get the firmware version string of a device.
MBLTML_EXPORT mbltmlStatusCode_t mbltmlGetExtraPmicId(int dev_no, mbltmlExtraPmicId_t *pmic_id)
Get the extra PMIC rail currently selected for the device.
MBLTML_EXPORT mbltmlStatusCode_t mbltmlGetHardwareVersion(int dev_no, mbltmlHardwareVersion_t *version)
Get the hardware version of a device.
MBLTML_EXPORT mbltmlStatusCode_t mbltmlGetDriverRevision(mbltmlDeviceType_t dt, uint32_t *revision)
Get the driver revision number for a specific device family.
Per-core usage record returned by mbltmlGetCoreInfos().
Definition type.h:104
Per-process usage record returned by mbltmlGetProcessInfos().
Definition type.h:117