#pragma once
#define MTML_DEVICE_PCI_SBDF_BUFFER_SIZE 32
#define MTML_DEVICE_NAME_BUFFER_SIZE 32
typedef enum
{
MTML_SUCCESS = 0,
} MtmlReturn;
typedef enum
{
MTML_BRAND_MTT = 0, } MtmlBrandType;
typedef struct MtmlLibrary MtmlLibrary;
typedef struct MtmlSystem MtmlSystem;
typedef struct MtmlDevice MtmlDevice;
typedef struct MtmlGpu MtmlGpu;
typedef struct MtmlMemory MtmlMemory;
typedef struct
{
char sbdf[MTML_DEVICE_PCI_SBDF_BUFFER_SIZE]; unsigned int segment; unsigned int bus; unsigned int device; unsigned int pciDeviceId; unsigned int pciSubsystemId; unsigned int busWidth; float pciMaxSpeed; float pciCurSpeed; unsigned int pciMaxWidth; unsigned int pciCurWidth; unsigned int pciMaxGen; unsigned int pciCurGen; int rsvd[6]; } MtmlPciInfo;
MtmlReturn mtmlDeviceCountGpuCores(const MtmlDevice* device, unsigned int* numCores);
MtmlReturn mtmlDeviceGetBrand(const MtmlDevice *dev, MtmlBrandType *type);
MtmlReturn mtmlDeviceGetIndex(const MtmlDevice *dev, unsigned int *index);
MtmlReturn mtmlDeviceGetName(const MtmlDevice *dev, char *name, unsigned int length);
MtmlReturn mtmlDeviceGetPciInfo(const MtmlDevice *dev, MtmlPciInfo *pci);
MtmlReturn mtmlDeviceGetUUID(const MtmlDevice *dev, char *uuid, unsigned int length);
MtmlReturn mtmlDeviceInitGpu(const MtmlDevice *dev, MtmlGpu **gpu);
MtmlReturn mtmlDeviceInitMemory(const MtmlDevice *dev, MtmlMemory **mem);
MtmlReturn mtmlGpuGetMaxClock(const MtmlGpu *gpu, unsigned int *clockMhz);
MtmlReturn mtmlGpuGetTemperature(const MtmlGpu *gpu, unsigned int *temp);
MtmlReturn mtmlGpuGetUtilization(const MtmlGpu *gpu, unsigned int *utilization);
MtmlReturn mtmlLibraryCountDevice(const MtmlLibrary *lib, unsigned int *count);
MtmlReturn mtmlLibraryInit(MtmlLibrary **lib);
MtmlReturn mtmlLibraryInitDeviceByIndex(const MtmlLibrary *lib, unsigned int index, MtmlDevice **dev);
MtmlReturn mtmlLibraryInitDeviceByPciSbdf(const MtmlLibrary *lib, const char *pciSbdf, MtmlDevice **dev);
MtmlReturn mtmlLibraryInitSystem(const MtmlLibrary *lib, MtmlSystem **sys);
MtmlReturn mtmlLibraryShutDown(MtmlLibrary *lib);
MtmlReturn mtmlMemoryGetTotal(const MtmlMemory *mem, unsigned long long *total);
MtmlReturn mtmlMemoryGetUsed(const MtmlMemory *mem, unsigned long long *used);
MtmlReturn mtmlMemoryGetUtilization(const MtmlMemory *mem, unsigned int *utilization);