Hardware/Nvidia/NVAPI.cs
author moel.mich
Mon, 02 Jul 2012 21:14:40 +0000
changeset 357 fb8dc26f65a4
parent 334 013e148e8f12
permissions -rw-r--r--
Added mainboard specific configurations for the following Gigabyte mainboards: EX58-UD3R, G41M-Combo, G41MT-S2, G41MT-S2P, GA-MA770T-UD3P, GA-MA785GM-US2H, GA-MA78LM-S2H, GA-MA790X-UD3P, H55-USB3, H55N-USB3, H61M-DS2 REV 1.2, H61M-USB3-B3 REV 2.0, H67A-USB3-B3, P55A-UD3, P67A-UD3-B3, P67A-UD3R-B3, Z68A-D3H-B3, Z68AP-D3, Z68X-UD3H-B3.
moel@1
     1
/*
moel@1
     2
 
moel@344
     3
  This Source Code Form is subject to the terms of the Mozilla Public
moel@344
     4
  License, v. 2.0. If a copy of the MPL was not distributed with this
moel@344
     5
  file, You can obtain one at http://mozilla.org/MPL/2.0/.
moel@344
     6
 
moel@344
     7
  Copyright (C) 2009-2012 Michael Möller <mmoeller@openhardwaremonitor.org>
moel@344
     8
	Copyright (C) 2011 Christian Vallières
moel@1
     9
 
moel@1
    10
*/
moel@1
    11
moel@1
    12
using System;
moel@1
    13
using System.Runtime.InteropServices;
moel@1
    14
using System.Text;
moel@1
    15
moel@1
    16
namespace OpenHardwareMonitor.Hardware.Nvidia {
moel@1
    17
moel@165
    18
  internal enum NvStatus {
moel@1
    19
    OK = 0,
moel@1
    20
    ERROR = -1,
moel@1
    21
    LIBRARY_NOT_FOUND = -2,
moel@1
    22
    NO_IMPLEMENTATION = -3,
moel@1
    23
    API_NOT_INTIALIZED = -4,
moel@1
    24
    INVALID_ARGUMENT = -5,
moel@1
    25
    NVIDIA_DEVICE_NOT_FOUND = -6,
moel@1
    26
    END_ENUMERATION = -7,
moel@1
    27
    INVALID_HANDLE = -8,
moel@1
    28
    INCOMPATIBLE_STRUCT_VERSION = -9,
moel@1
    29
    HANDLE_INVALIDATED = -10,
moel@1
    30
    OPENGL_CONTEXT_NOT_CURRENT = -11,
moel@1
    31
    NO_GL_EXPERT = -12,
moel@1
    32
    INSTRUMENTATION_DISABLED = -13,
moel@1
    33
    EXPECTED_LOGICAL_GPU_HANDLE = -100,
moel@1
    34
    EXPECTED_PHYSICAL_GPU_HANDLE = -101,
moel@1
    35
    EXPECTED_DISPLAY_HANDLE = -102,
moel@1
    36
    INVALID_COMBINATION = -103,
moel@1
    37
    NOT_SUPPORTED = -104,
moel@1
    38
    PORTID_NOT_FOUND = -105,
moel@1
    39
    EXPECTED_UNATTACHED_DISPLAY_HANDLE = -106,
moel@1
    40
    INVALID_PERF_LEVEL = -107,
moel@1
    41
    DEVICE_BUSY = -108,
moel@1
    42
    NV_PERSIST_FILE_NOT_FOUND = -109,
moel@1
    43
    PERSIST_DATA_NOT_FOUND = -110,
moel@1
    44
    EXPECTED_TV_DISPLAY = -111,
moel@1
    45
    EXPECTED_TV_DISPLAY_ON_DCONNECTOR = -112,
moel@1
    46
    NO_ACTIVE_SLI_TOPOLOGY = -113,
moel@1
    47
    SLI_RENDERING_MODE_NOTALLOWED = -114,
moel@1
    48
    EXPECTED_DIGITAL_FLAT_PANEL = -115,
moel@1
    49
    ARGUMENT_EXCEED_MAX_SIZE = -116,
moel@1
    50
    DEVICE_SWITCHING_NOT_ALLOWED = -117,
moel@1
    51
    TESTING_CLOCKS_NOT_SUPPORTED = -118,
moel@1
    52
    UNKNOWN_UNDERSCAN_CONFIG = -119,
moel@1
    53
    TIMEOUT_RECONFIGURING_GPU_TOPO = -120,
moel@1
    54
    DATA_NOT_FOUND = -121,
moel@1
    55
    EXPECTED_ANALOG_DISPLAY = -122,
moel@1
    56
    NO_VIDLINK = -123,
moel@1
    57
    REQUIRES_REBOOT = -124,
moel@1
    58
    INVALID_HYBRID_MODE = -125,
moel@1
    59
    MIXED_TARGET_TYPES = -126,
moel@1
    60
    SYSWOW64_NOT_SUPPORTED = -127,
moel@1
    61
    IMPLICIT_SET_GPU_TOPOLOGY_CHANGE_NOT_ALLOWED = -128,
moel@1
    62
    REQUEST_USER_TO_CLOSE_NON_MIGRATABLE_APPS = -129,
moel@1
    63
    OUT_OF_MEMORY = -130,
moel@1
    64
    WAS_STILL_DRAWING = -131,
moel@1
    65
    FILE_NOT_FOUND = -132,
moel@1
    66
    TOO_MANY_UNIQUE_STATE_OBJECTS = -133,
moel@1
    67
    INVALID_CALL = -134,
moel@1
    68
    D3D10_1_LIBRARY_NOT_FOUND = -135,
moel@1
    69
    FUNCTION_NOT_FOUND = -136
moel@165
    70
  }
moel@1
    71
moel@165
    72
  internal enum NvThermalController {
moel@1
    73
    NONE = 0,
moel@309
    74
    GPU_INTERNAL,
moel@1
    75
    ADM1032,
moel@309
    76
    MAX6649,
moel@309
    77
    MAX1617,
moel@309
    78
    LM99,
moel@309
    79
    LM89,
moel@309
    80
    LM64,
moel@1
    81
    ADT7473,
moel@1
    82
    SBMAX6649,
moel@309
    83
    VBIOSEVT,
moel@309
    84
    OS,
moel@1
    85
    UNKNOWN = -1,
moel@165
    86
  }
moel@1
    87
moel@165
    88
  internal enum NvThermalTarget {
moel@1
    89
    NONE = 0,
moel@1
    90
    GPU = 1,
moel@1
    91
    MEMORY = 2,
moel@1
    92
    POWER_SUPPLY = 4,
moel@1
    93
    BOARD = 8,
moel@1
    94
    ALL = 15,
moel@1
    95
    UNKNOWN = -1
moel@1
    96
  };
moel@1
    97
moel@61
    98
  [StructLayout(LayoutKind.Sequential, Pack = 8)]
moel@165
    99
  internal struct NvSensor {
moel@1
   100
    public NvThermalController Controller;
moel@140
   101
    public uint DefaultMinTemp;
moel@140
   102
    public uint DefaultMaxTemp;
moel@140
   103
    public uint CurrentTemp;
moel@309
   104
    public NvThermalTarget Target;
moel@1
   105
  }
moel@1
   106
moel@61
   107
  [StructLayout(LayoutKind.Sequential, Pack = 8)]
moel@165
   108
  internal struct NvGPUThermalSettings {
moel@140
   109
    public uint Version;
moel@140
   110
    public uint Count;
moel@309
   111
    [MarshalAs(UnmanagedType.ByValArray,
moel@1
   112
      SizeConst = NVAPI.MAX_THERMAL_SENSORS_PER_GPU)]
moel@1
   113
    public NvSensor[] Sensor;
moel@1
   114
  }
moel@1
   115
moel@61
   116
  [StructLayout(LayoutKind.Sequential)]
moel@165
   117
  internal struct NvDisplayHandle {
moel@195
   118
    private readonly IntPtr ptr;
moel@1
   119
  }
moel@1
   120
moel@61
   121
  [StructLayout(LayoutKind.Sequential)]
moel@165
   122
  internal struct NvPhysicalGpuHandle {
moel@195
   123
    private readonly IntPtr ptr;
moel@1
   124
  }
moel@1
   125
moel@140
   126
  [StructLayout(LayoutKind.Sequential, Pack = 8)]
moel@165
   127
  internal struct NvClocks {
moel@140
   128
    public uint Version;
moel@140
   129
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = NVAPI.MAX_CLOCKS_PER_GPU)]
moel@140
   130
    public uint[] Clock;
moel@140
   131
  }
moel@140
   132
moel@140
   133
  [StructLayout(LayoutKind.Sequential, Pack = 8)]
moel@165
   134
  internal struct NvPState {
moel@140
   135
    public bool Present;
moel@140
   136
    public int Percentage;
moel@140
   137
  }
moel@140
   138
moel@140
   139
  [StructLayout(LayoutKind.Sequential, Pack = 8)]
moel@165
   140
  internal struct NvPStates {
moel@140
   141
    public uint Version;
moel@140
   142
    public uint Flags;
moel@140
   143
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = NVAPI.MAX_PSTATES_PER_GPU)]
moel@140
   144
    public NvPState[] PStates;
moel@140
   145
  }
moel@140
   146
moel@140
   147
  [StructLayout(LayoutKind.Sequential, Pack = 8)]
moel@165
   148
  internal struct NvUsages {
moel@140
   149
    public uint Version;
moel@140
   150
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = NVAPI.MAX_USAGES_PER_GPU)]
moel@140
   151
    public uint[] Usage;
moel@140
   152
  }
moel@140
   153
moel@140
   154
  [StructLayout(LayoutKind.Sequential, Pack = 8)]
moel@165
   155
  internal struct NvCooler {
moel@140
   156
    public int Type;
moel@140
   157
    public int Controller;
moel@140
   158
    public int DefaultMin;
moel@140
   159
    public int DefaultMax;
moel@140
   160
    public int CurrentMin;
moel@140
   161
    public int CurrentMax;
moel@140
   162
    public int CurrentLevel;
moel@140
   163
    public int DefaultPolicy;
moel@140
   164
    public int CurrentPolicy;
moel@140
   165
    public int Target;
moel@140
   166
    public int ControlType;
moel@140
   167
    public int Active;
moel@140
   168
  }
moel@140
   169
moel@140
   170
  [StructLayout(LayoutKind.Sequential, Pack = 8)]
moel@165
   171
  internal struct NvGPUCoolerSettings {
moel@140
   172
    public uint Version;
moel@140
   173
    public uint Count;
moel@140
   174
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = NVAPI.MAX_COOLER_PER_GPU)]
moel@140
   175
    public NvCooler[] Cooler;
moel@140
   176
  }
moel@140
   177
moel@140
   178
  [StructLayout(LayoutKind.Sequential, Pack = 8)]
moel@309
   179
  internal struct NvLevel {
moel@309
   180
    public int Level;
moel@309
   181
    public int Policy;
moel@309
   182
  }
moel@309
   183
moel@309
   184
  [StructLayout(LayoutKind.Sequential, Pack = 8)]
moel@309
   185
  internal struct NvGPUCoolerLevels {
moel@309
   186
    public uint Version;
moel@309
   187
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = NVAPI.MAX_COOLER_PER_GPU)]
moel@309
   188
    public NvLevel[] Levels;
moel@309
   189
  }
moel@309
   190
moel@309
   191
  [StructLayout(LayoutKind.Sequential, Pack = 8)]
moel@165
   192
  internal struct NvMemoryInfo {
moel@140
   193
    public uint Version;
moel@309
   194
    [MarshalAs(UnmanagedType.ByValArray, SizeConst =
moel@140
   195
      NVAPI.MAX_MEMORY_VALUES_PER_GPU)]
moel@140
   196
    public uint[] Values;
moel@140
   197
  }
moel@140
   198
moel@140
   199
  [StructLayout(LayoutKind.Sequential, Pack = 8)]
moel@165
   200
  internal struct NvDisplayDriverVersion {
moel@140
   201
    public uint Version;
moel@140
   202
    public uint DriverVersion;
moel@140
   203
    public uint BldChangeListNum;
moel@140
   204
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = NVAPI.SHORT_STRING_MAX)]
moel@140
   205
    public string BuildBranch;
moel@140
   206
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = NVAPI.SHORT_STRING_MAX)]
moel@140
   207
    public string Adapter;
moel@165
   208
  }
moel@140
   209
moel@165
   210
  internal class NVAPI {
moel@1
   211
moel@1
   212
    public const int MAX_PHYSICAL_GPUS = 64;
moel@140
   213
    public const int SHORT_STRING_MAX = 64;
moel@140
   214
moel@309
   215
    public const int MAX_THERMAL_SENSORS_PER_GPU = 3;
moel@140
   216
    public const int MAX_CLOCKS_PER_GPU = 0x120;
moel@140
   217
    public const int MAX_PSTATES_PER_GPU = 8;
moel@140
   218
    public const int MAX_USAGES_PER_GPU = 33;
moel@140
   219
    public const int MAX_COOLER_PER_GPU = 20;
moel@140
   220
    public const int MAX_MEMORY_VALUES_PER_GPU = 5;
moel@140
   221
moel@140
   222
    public static readonly uint GPU_THERMAL_SETTINGS_VER = (uint)
moel@1
   223
      Marshal.SizeOf(typeof(NvGPUThermalSettings)) | 0x10000;
moel@140
   224
    public static readonly uint GPU_CLOCKS_VER = (uint)
moel@140
   225
      Marshal.SizeOf(typeof(NvClocks)) | 0x20000;
moel@140
   226
    public static readonly uint GPU_PSTATES_VER = (uint)
moel@140
   227
      Marshal.SizeOf(typeof(NvPStates)) | 0x10000;
moel@140
   228
    public static readonly uint GPU_USAGES_VER = (uint)
moel@140
   229
      Marshal.SizeOf(typeof(NvUsages)) | 0x10000;
moel@140
   230
    public static readonly uint GPU_COOLER_SETTINGS_VER = (uint)
moel@140
   231
      Marshal.SizeOf(typeof(NvGPUCoolerSettings)) | 0x20000;
moel@309
   232
    public static readonly uint GPU_MEMORY_INFO_VER = (uint)
moel@140
   233
      Marshal.SizeOf(typeof(NvMemoryInfo)) | 0x20000;
moel@140
   234
    public static readonly uint DISPLAY_DRIVER_VERSION_VER = (uint)
moel@140
   235
      Marshal.SizeOf(typeof(NvDisplayDriverVersion)) | 0x10000;
moel@309
   236
    public static readonly uint GPU_COOLER_LEVELS_VER = (uint)
moel@309
   237
      Marshal.SizeOf(typeof(NvGPUCoolerLevels)) | 0x10000;
moel@309
   238
moel@1
   239
    private delegate IntPtr nvapi_QueryInterfaceDelegate(uint id);
moel@1
   240
    private delegate NvStatus NvAPI_InitializeDelegate();
moel@1
   241
    private delegate NvStatus NvAPI_GPU_GetFullNameDelegate(
moel@1
   242
      NvPhysicalGpuHandle gpuHandle, StringBuilder name);
moel@1
   243
moel@1
   244
    public delegate NvStatus NvAPI_GPU_GetThermalSettingsDelegate(
moel@309
   245
      NvPhysicalGpuHandle gpuHandle, int sensorIndex,
moel@1
   246
      ref NvGPUThermalSettings nvGPUThermalSettings);
moel@1
   247
    public delegate NvStatus NvAPI_EnumNvidiaDisplayHandleDelegate(int thisEnum,
moel@1
   248
      ref NvDisplayHandle displayHandle);
moel@1
   249
    public delegate NvStatus NvAPI_GetPhysicalGPUsFromDisplayDelegate(
moel@309
   250
      NvDisplayHandle displayHandle, [Out] NvPhysicalGpuHandle[] gpuHandles,
moel@140
   251
      out uint gpuCount);
moel@1
   252
    public delegate NvStatus NvAPI_EnumPhysicalGPUsDelegate(
moel@1
   253
      [Out] NvPhysicalGpuHandle[] gpuHandles, out int gpuCount);
moel@38
   254
    public delegate NvStatus NvAPI_GPU_GetTachReadingDelegate(
moel@38
   255
      NvPhysicalGpuHandle gpuHandle, out int value);
moel@140
   256
    public delegate NvStatus NvAPI_GPU_GetAllClocksDelegate(
moel@140
   257
      NvPhysicalGpuHandle gpuHandle, ref NvClocks nvClocks);
moel@140
   258
    public delegate NvStatus NvAPI_GPU_GetPStatesDelegate(
moel@140
   259
      NvPhysicalGpuHandle gpuHandle, ref NvPStates nvPStates);
moel@140
   260
    public delegate NvStatus NvAPI_GPU_GetUsagesDelegate(
moel@140
   261
      NvPhysicalGpuHandle gpuHandle, ref NvUsages nvUsages);
moel@140
   262
    public delegate NvStatus NvAPI_GPU_GetCoolerSettingsDelegate(
moel@140
   263
      NvPhysicalGpuHandle gpuHandle, int coolerIndex,
moel@140
   264
      ref NvGPUCoolerSettings nvGPUCoolerSettings);
moel@309
   265
    public delegate NvStatus NvAPI_GPU_SetCoolerLevelsDelegate(
moel@309
   266
      NvPhysicalGpuHandle gpuHandle, int coolerIndex,
moel@309
   267
      ref NvGPUCoolerLevels NvGPUCoolerLevels);
moel@140
   268
    public delegate NvStatus NvAPI_GPU_GetMemoryInfoDelegate(
moel@140
   269
      NvDisplayHandle displayHandle, ref NvMemoryInfo nvMemoryInfo);
moel@140
   270
    public delegate NvStatus NvAPI_GetDisplayDriverVersionDelegate(
moel@140
   271
      NvDisplayHandle displayHandle, [In, Out] ref NvDisplayDriverVersion
moel@140
   272
      nvDisplayDriverVersion);
moel@140
   273
    public delegate NvStatus NvAPI_GetInterfaceVersionStringDelegate(
moel@140
   274
      StringBuilder version);
moel@334
   275
    public delegate NvStatus NvAPI_GPU_GetPCIIdentifiersDelegate(
moel@334
   276
      NvPhysicalGpuHandle gpuHandle, out uint deviceId, out uint subSystemId, 
moel@334
   277
      out uint revisionId, out uint extDeviceId);
moel@1
   278
moel@195
   279
    private static readonly bool available;
moel@195
   280
    private static readonly nvapi_QueryInterfaceDelegate nvapi_QueryInterface;
moel@195
   281
    private static readonly NvAPI_InitializeDelegate NvAPI_Initialize;
moel@309
   282
    private static readonly NvAPI_GPU_GetFullNameDelegate
moel@195
   283
      _NvAPI_GPU_GetFullName;
moel@195
   284
    private static readonly NvAPI_GetInterfaceVersionStringDelegate
moel@140
   285
      _NvAPI_GetInterfaceVersionString;
moel@1
   286
moel@309
   287
    public static readonly NvAPI_GPU_GetThermalSettingsDelegate
moel@1
   288
      NvAPI_GPU_GetThermalSettings;
moel@140
   289
    public static readonly NvAPI_EnumNvidiaDisplayHandleDelegate
moel@1
   290
      NvAPI_EnumNvidiaDisplayHandle;
moel@140
   291
    public static readonly NvAPI_GetPhysicalGPUsFromDisplayDelegate
moel@1
   292
      NvAPI_GetPhysicalGPUsFromDisplay;
moel@140
   293
    public static readonly NvAPI_EnumPhysicalGPUsDelegate
moel@1
   294
      NvAPI_EnumPhysicalGPUs;
moel@140
   295
    public static readonly NvAPI_GPU_GetTachReadingDelegate
moel@38
   296
      NvAPI_GPU_GetTachReading;
moel@140
   297
    public static readonly NvAPI_GPU_GetAllClocksDelegate
moel@140
   298
      NvAPI_GPU_GetAllClocks;
moel@140
   299
    public static readonly NvAPI_GPU_GetPStatesDelegate
moel@140
   300
      NvAPI_GPU_GetPStates;
moel@140
   301
    public static readonly NvAPI_GPU_GetUsagesDelegate
moel@140
   302
      NvAPI_GPU_GetUsages;
moel@140
   303
    public static readonly NvAPI_GPU_GetCoolerSettingsDelegate
moel@140
   304
      NvAPI_GPU_GetCoolerSettings;
moel@309
   305
    public static readonly NvAPI_GPU_SetCoolerLevelsDelegate
moel@309
   306
      NvAPI_GPU_SetCoolerLevels;
moel@140
   307
    public static readonly NvAPI_GPU_GetMemoryInfoDelegate
moel@140
   308
      NvAPI_GPU_GetMemoryInfo;
moel@140
   309
    public static readonly NvAPI_GetDisplayDriverVersionDelegate
moel@167
   310
      NvAPI_GetDisplayDriverVersion;
moel@334
   311
    public static readonly NvAPI_GPU_GetPCIIdentifiersDelegate
moel@334
   312
      NvAPI_GPU_GetPCIIdentifiers;
moel@167
   313
moel@167
   314
    private NVAPI() { }
moel@1
   315
moel@1
   316
    public static NvStatus NvAPI_GPU_GetFullName(NvPhysicalGpuHandle gpuHandle,
moel@1
   317
      out string name) {
moel@1
   318
      StringBuilder builder = new StringBuilder(SHORT_STRING_MAX);
moel@101
   319
      NvStatus status;
moel@101
   320
      if (_NvAPI_GPU_GetFullName != null)
moel@101
   321
        status = _NvAPI_GPU_GetFullName(gpuHandle, builder);
moel@101
   322
      else
moel@101
   323
        status = NvStatus.FUNCTION_NOT_FOUND;
moel@1
   324
      name = builder.ToString();
moel@1
   325
      return status;
moel@1
   326
    }
moel@1
   327
moel@140
   328
    public static NvStatus NvAPI_GetInterfaceVersionString(out string version) {
moel@140
   329
      StringBuilder builder = new StringBuilder(SHORT_STRING_MAX);
moel@140
   330
      NvStatus status;
moel@140
   331
      if (_NvAPI_GetInterfaceVersionString != null)
moel@140
   332
        status = _NvAPI_GetInterfaceVersionString(builder);
moel@140
   333
      else
moel@140
   334
        status = NvStatus.FUNCTION_NOT_FOUND;
moel@140
   335
      version = builder.ToString();
moel@140
   336
      return status;
moel@140
   337
    }
moel@140
   338
moel@1
   339
    private static string GetDllName() {
moel@1
   340
      if (IntPtr.Size == 4) {
moel@1
   341
        return "nvapi.dll";
moel@1
   342
      } else {
moel@1
   343
        return "nvapi64.dll";
moel@1
   344
      }
moel@1
   345
    }
moel@1
   346
moel@309
   347
    private static void GetDelegate<T>(uint id, out T newDelegate)
moel@309
   348
      where T : class {
moel@1
   349
      IntPtr ptr = nvapi_QueryInterface(id);
moel@38
   350
      if (ptr != IntPtr.Zero) {
moel@38
   351
        newDelegate =
moel@38
   352
          Marshal.GetDelegateForFunctionPointer(ptr, typeof(T)) as T;
moel@38
   353
      } else {
moel@38
   354
        newDelegate = null;
moel@38
   355
      }
moel@1
   356
    }
moel@1
   357
moel@309
   358
    static NVAPI() {
moel@1
   359
      DllImportAttribute attribute = new DllImportAttribute(GetDllName());
moel@1
   360
      attribute.CallingConvention = CallingConvention.Cdecl;
moel@1
   361
      attribute.PreserveSig = true;
moel@1
   362
      attribute.EntryPoint = "nvapi_QueryInterface";
moel@1
   363
      PInvokeDelegateFactory.CreateDelegate(attribute,
moel@1
   364
        out nvapi_QueryInterface);
moel@1
   365
moel@1
   366
      try {
moel@1
   367
        GetDelegate(0x0150E828, out NvAPI_Initialize);
moel@1
   368
      } catch (DllNotFoundException) { return; } 
moel@121
   369
        catch (EntryPointNotFoundException) { return; } 
moel@1
   370
        catch (ArgumentNullException) { return; }
moel@1
   371
moel@1
   372
      if (NvAPI_Initialize() == NvStatus.OK) {
moel@1
   373
        GetDelegate(0xE3640A56, out NvAPI_GPU_GetThermalSettings);
moel@1
   374
        GetDelegate(0xCEEE8E9F, out _NvAPI_GPU_GetFullName);
moel@1
   375
        GetDelegate(0x9ABDD40D, out NvAPI_EnumNvidiaDisplayHandle);
moel@1
   376
        GetDelegate(0x34EF9506, out NvAPI_GetPhysicalGPUsFromDisplay);
moel@1
   377
        GetDelegate(0xE5AC921F, out NvAPI_EnumPhysicalGPUs);
moel@140
   378
        GetDelegate(0x5F608315, out NvAPI_GPU_GetTachReading);
moel@140
   379
        GetDelegate(0x1BD69F49, out NvAPI_GPU_GetAllClocks);
moel@140
   380
        GetDelegate(0x60DED2ED, out NvAPI_GPU_GetPStates);
moel@140
   381
        GetDelegate(0x189A1FDF, out NvAPI_GPU_GetUsages);
moel@140
   382
        GetDelegate(0xDA141340, out NvAPI_GPU_GetCoolerSettings);
moel@309
   383
        GetDelegate(0x891FA0AE, out NvAPI_GPU_SetCoolerLevels);
moel@140
   384
        GetDelegate(0x774AA982, out NvAPI_GPU_GetMemoryInfo);
moel@140
   385
        GetDelegate(0xF951A4D1, out NvAPI_GetDisplayDriverVersion);
moel@140
   386
        GetDelegate(0x01053FA5, out _NvAPI_GetInterfaceVersionString);
moel@334
   387
        GetDelegate(0x2DDFB66E, out NvAPI_GPU_GetPCIIdentifiers);
moel@140
   388
moel@1
   389
        available = true;
moel@1
   390
      }
moel@1
   391
    }
moel@1
   392
moel@1
   393
    public static bool IsAvailable {
moel@1
   394
      get { return available; }
moel@1
   395
    }
moel@1
   396
moel@1
   397
  }
moel@1
   398
}