diff --git a/Hardware/ATI/ADL.cs b/Hardware/ATI/ADL.cs index 8c36839..1da3f73 100644 --- a/Hardware/ATI/ADL.cs +++ b/Hardware/ATI/ADL.cs @@ -90,6 +90,47 @@ namespace OpenHardwareMonitor.Hardware.ATI { public ADLSingleSensorData[] Sensors; } + [StructLayout(LayoutKind.Sequential)] + internal struct ADLODParameterRange { + public int Min; + public int Max; + public int Step; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct ADLODParameters { + public int Size; + public int NumberOfPerformanceLevels; + public int ActivityReportingSupported; + public int DiscretePerformanceLevels; + public int Reserved; + public ADLODParameterRange EngineClock; + public ADLODParameterRange MemoryClock; + public ADLODParameterRange Vddc; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct ADLODNPerformanceStatus { + public int CoreClock; + public int MemoryClock; + public int DCEFClock; + public int GFXClock; + public int UVDClock; + public int VCEClock; + public int GPUActivityPercent; + public int CurrentCorePerformanceLevel; + public int CurrentMemoryPerformanceLevel; + public int CurrentDCEFPerformanceLevel; + public int CurrentGFXPerformanceLevel; + public int UVDPerformanceLevel; + public int VCEPerformanceLevel; + public int CurrentBusSpeed; + public int CurrentBusLanes; + public int MaximumBusLanes; + public int VDDC; + public int VDDCI; + } + internal enum ADLODNCurrentPowerType { TOTAL_POWER = 0, PPT_POWER, @@ -149,13 +190,110 @@ namespace OpenHardwareMonitor.Hardware.ATI { SMART_POWERSHIFT_DGPU = 39 } + internal enum ADLStatus : int { + /// + /// All OK, but need to wait. + /// + OK_WAIT = 4, + + /// + /// All OK, but need restart. + /// + OK_RESTART = 3, + + /// + /// All OK but need mode change. + /// + OK_MODE_CHANGE = 2, + + /// + /// All OK, but with warning. + /// + OK_WARNING = 1, + + /// + /// ADL function completed successfully. + /// + OK = 0, + + /// + /// Generic Error. Most likely one or more of the Escape calls to the driver + /// failed! + /// + ERR = -1, + + /// + /// ADL not initialized. + /// + ERR_NOT_INIT = -2, + + /// + /// One of the parameter passed is invalid. + /// + ERR_INVALID_PARAM = -3, + + /// + /// One of the parameter size is invalid. + /// + ERR_INVALID_PARAM_SIZE = -4, + + /// + /// Invalid ADL index passed. + /// + ERR_INVALID_ADL_IDX = -5, + + /// + /// Invalid controller index passed. + /// + ERR_INVALID_CONTROLLER_IDX = -6, + + /// + /// Invalid display index passed. + /// + ERR_INVALID_DIPLAY_IDX = -7, + + /// + /// Function not supported by the driver. + /// + ERR_NOT_SUPPORTED = -8, + + /// + /// Null Pointer error. + /// + ERR_NULL_POINTER = -9, + + /// + /// Call can't be made due to disabled adapter. + /// + ERR_DISABLED_ADAPTER = -10, + + /// + /// Invalid Callback. + /// + ERR_INVALID_CALLBACK = -11, + + /// + /// Display Resource conflict. + /// + ERR_RESOURCE_CONFLICT = -12, + + /// + /// Failed to update some of the values. Can be returned by set request that + /// include multiple values if not all values were successfully committed. + /// + ERR_SET_INCOMPLETE = -20, + + /// + /// There's no Linux XDisplay in Linux Console environment. + /// + ERR_NO_XDISPLAY = -21 + } + internal class ADL { public const int ADL_MAX_PATH = 256; public const int ADL_MAX_ADAPTERS = 40; public const int ADL_MAX_DISPLAYS = 40; public const int ADL_MAX_DEVICENAME = 32; - public const int ADL_OK = 0; - public const int ADL_ERR = -1; public const int ADL_DRIVER_OK = 0; public const int ADL_MAX_GLSYNC_PORTS = 8; public const int ADL_MAX_GLSYNC_PORT_LEDS = 8; @@ -173,47 +311,52 @@ namespace OpenHardwareMonitor.Hardware.ATI { public const int ATI_VENDOR_ID = 0x1002; - private delegate int ADL_Main_Control_CreateDelegate( + private delegate ADLStatus ADL_Main_Control_CreateDelegate( ADL_Main_Memory_AllocDelegate callback, int enumConnectedAdapters); - private delegate int ADL_Adapter_AdapterInfo_GetDelegate(IntPtr info, + private delegate ADLStatus ADL_Adapter_AdapterInfo_GetDelegate(IntPtr info, int size); - public delegate int ADL_Main_Control_DestroyDelegate(); - public delegate int ADL_Adapter_NumberOfAdapters_GetDelegate( + public delegate ADLStatus ADL_Main_Control_DestroyDelegate(); + public delegate ADLStatus ADL_Adapter_NumberOfAdapters_GetDelegate( ref int numAdapters); - public delegate int ADL_Adapter_ID_GetDelegate(int adapterIndex, + public delegate ADLStatus ADL_Adapter_ID_GetDelegate(int adapterIndex, out int adapterID); - public delegate int ADL_Display_AdapterID_GetDelegate(int adapterIndex, + public delegate ADLStatus ADL_Display_AdapterID_GetDelegate(int adapterIndex, out int adapterID); public delegate int ADL_Adapter_Active_GetDelegate(int adapterIndex, out int status); - public delegate int ADL_Overdrive5_CurrentActivity_GetDelegate( + public delegate ADLStatus ADL_Overdrive5_CurrentActivity_GetDelegate( int iAdapterIndex, ref ADLPMActivity activity); - public delegate int ADL_Overdrive5_Temperature_GetDelegate(int adapterIndex, + public delegate ADLStatus ADL_Overdrive5_Temperature_GetDelegate(int adapterIndex, int thermalControllerIndex, ref ADLTemperature temperature); - public delegate int ADL_Overdrive5_FanSpeed_GetDelegate(int adapterIndex, + public delegate ADLStatus ADL_Overdrive5_FanSpeed_GetDelegate(int adapterIndex, int thermalControllerIndex, ref ADLFanSpeedValue fanSpeedValue); - public delegate int ADL_Overdrive5_FanSpeedInfo_GetDelegate( + public delegate ADLStatus ADL_Overdrive5_FanSpeedInfo_GetDelegate( int adapterIndex, int thermalControllerIndex, ref ADLFanSpeedInfo fanSpeedInfo); - public delegate int ADL_Overdrive5_FanSpeedToDefault_SetDelegate( + public delegate ADLStatus ADL_Overdrive5_FanSpeedToDefault_SetDelegate( int adapterIndex, int thermalControllerIndex); - public delegate int ADL_Overdrive5_FanSpeed_SetDelegate(int adapterIndex, + public delegate ADLStatus ADL_Overdrive5_FanSpeed_SetDelegate(int adapterIndex, int thermalControllerIndex, ref ADLFanSpeedValue fanSpeedValue); - public delegate int ADL_Overdrive_CapsDelegate(int adapterIndex, + public delegate ADLStatus ADL_Overdrive_CapsDelegate(int adapterIndex, out int supported, out int enabled, out int version); - private delegate int ADL2_Main_Control_CreateDelegate( + private delegate ADLStatus ADL2_Main_Control_CreateDelegate( ADL_Main_Memory_AllocDelegate callback, int enumConnectedAdapters, out IntPtr context); - public delegate int ADL2_Main_Control_DestroyDelegate(IntPtr context); - public delegate int ADL2_OverdriveN_Temperature_GetDelegate(IntPtr context, + public delegate ADLStatus ADL2_Main_Control_DestroyDelegate(IntPtr context); + public delegate ADLStatus ADL2_OverdriveN_Temperature_GetDelegate(IntPtr context, int adapterIndex, ADLODNTemperatureType temperatureType, out int temperature); - public delegate int ADL2_Overdrive6_CurrentPower_GetDelegate(IntPtr context, + public delegate ADLStatus ADL2_Overdrive6_CurrentPower_GetDelegate(IntPtr context, int adapterIndex, ADLODNCurrentPowerType powerType, out int currentValue); - public delegate int ADL2_New_QueryPMLogData_GetDelegate(IntPtr context, + public delegate ADLStatus ADL2_New_QueryPMLogData_GetDelegate(IntPtr context, int adapterIndex, out ADLPMLogDataOutput dataOutput); + public delegate ADLStatus ADL_Overdrive5_ODParameters_GetDelegate( + int adapterIndex, out ADLODParameters parameters); + public delegate ADLStatus ADL2_OverdriveN_PerformanceStatus_GetDelegate( + IntPtr context, int adapterIndex, + out ADLODNPerformanceStatus performanceStatus); private static ADL_Main_Control_CreateDelegate _ADL_Main_Control_Create; @@ -254,6 +397,10 @@ namespace OpenHardwareMonitor.Hardware.ATI { ADL2_Overdrive6_CurrentPower_Get; public static ADL2_New_QueryPMLogData_GetDelegate ADL2_New_QueryPMLogData_Get; + public static ADL_Overdrive5_ODParameters_GetDelegate + ADL_Overdrive5_ODParameters_Get; + public static ADL2_OverdriveN_PerformanceStatus_GetDelegate + ADL2_OverdriveN_PerformanceStatus_Get; private static string dllName; @@ -312,6 +459,10 @@ namespace OpenHardwareMonitor.Hardware.ATI { out ADL2_Overdrive6_CurrentPower_Get); GetDelegate("ADL2_New_QueryPMLogData_Get", out ADL2_New_QueryPMLogData_Get); + GetDelegate("ADL_Overdrive5_ODParameters_Get", + out ADL_Overdrive5_ODParameters_Get); + GetDelegate("ADL2_OverdriveN_PerformanceStatus_Get", + out ADL2_OverdriveN_PerformanceStatus_Get); } static ADL() { @@ -320,7 +471,7 @@ namespace OpenHardwareMonitor.Hardware.ATI { private ADL() { } - public static int ADL_Main_Control_Create(int enumConnectedAdapters) { + public static ADLStatus ADL_Main_Control_Create(int enumConnectedAdapters) { try { try { return _ADL_Main_Control_Create(Main_Memory_Alloc, @@ -331,30 +482,30 @@ namespace OpenHardwareMonitor.Hardware.ATI { enumConnectedAdapters); } } catch { - return ADL_ERR; + return ADLStatus.ERR; } } - public static int ADL2_Main_Control_Create(int enumConnectedAdapters, + public static ADLStatus ADL2_Main_Control_Create(int enumConnectedAdapters, out IntPtr context) { try { var result = _ADL2_Main_Control_Create(Main_Memory_Alloc, enumConnectedAdapters, out context); - if (result != ADL.ADL_OK) + if (result != ADLStatus.OK) context = IntPtr.Zero; return result; } catch { context = IntPtr.Zero; - return ADL_ERR; + return ADLStatus.ERR; } } - public static int ADL_Adapter_AdapterInfo_Get(ADLAdapterInfo[] info) { + public static ADLStatus ADL_Adapter_AdapterInfo_Get(ADLAdapterInfo[] info) { int elementSize = Marshal.SizeOf(typeof(ADLAdapterInfo)); int size = info.Length * elementSize; IntPtr ptr = Marshal.AllocHGlobal(size); - int result = _ADL_Adapter_AdapterInfo_Get(ptr, size); + var status = _ADL_Adapter_AdapterInfo_Get(ptr, size); for (int i = 0; i < info.Length; i++) info[i] = (ADLAdapterInfo) Marshal.PtrToStructure((IntPtr)((long)ptr + i * elementSize), @@ -377,10 +528,10 @@ namespace OpenHardwareMonitor.Hardware.ATI { } } - return result; + return status; } - public static int ADL_Adapter_ID_Get(int adapterIndex, + public static ADLStatus ADL_Adapter_ID_Get(int adapterIndex, out int adapterID) { try { return _ADL_Adapter_ID_Get(adapterIndex, out adapterID); @@ -389,7 +540,7 @@ namespace OpenHardwareMonitor.Hardware.ATI { return _ADL_Display_AdapterID_Get(adapterIndex, out adapterID); } catch (EntryPointNotFoundException) { adapterID = 1; - return ADL_OK; + return ADLStatus.OK; } } } diff --git a/Hardware/ATI/ATIGPU.cs b/Hardware/ATI/ATIGPU.cs index 40b2e80..83ca2c9 100644 --- a/Hardware/ATI/ATIGPU.cs +++ b/Hardware/ATI/ATIGPU.cs @@ -60,7 +60,7 @@ namespace OpenHardwareMonitor.Hardware.ATI { this.context = context; if (ADL.ADL_Overdrive_Caps(adapterIndex, out _, out _, - out overdriveVersion) != ADL.ADL_OK) + out overdriveVersion) != ADLStatus.OK) { overdriveVersion = -1; } @@ -109,7 +109,7 @@ namespace OpenHardwareMonitor.Hardware.ATI { ADLFanSpeedInfo afsi = new ADLFanSpeedInfo(); if (ADL.ADL_Overdrive5_FanSpeedInfo_Get(adapterIndex, 0, ref afsi) - != ADL.ADL_OK) + != ADLStatus.OK) { afsi.MaxPercent = 100; afsi.MinPercent = 0; @@ -167,7 +167,7 @@ namespace OpenHardwareMonitor.Hardware.ATI { Sensor sensor) { if (ADL.ADL2_OverdriveN_Temperature_Get(context, adapterIndex, - type, out int temperature) == ADL.ADL_OK) + type, out int temperature) == ADLStatus.OK) { sensor.Value = 0.001f * temperature; ActivateSensor(sensor); @@ -179,7 +179,7 @@ namespace OpenHardwareMonitor.Hardware.ATI { private void GetOD6Power(ADLODNCurrentPowerType type, Sensor sensor) { if (ADL.ADL2_Overdrive6_CurrentPower_Get(context, adapterIndex, type, - out int power) == ADL.ADL_OK) + out int power) == ADLStatus.OK) { sensor.Value = power * (1.0f / 0xFF); ActivateSensor(sensor); @@ -202,11 +202,10 @@ namespace OpenHardwareMonitor.Hardware.ATI { r.AppendLine("Overdrive Caps"); r.AppendLine(); try { - int status = ADL.ADL_Overdrive_Caps(adapterIndex, + var status = ADL.ADL_Overdrive_Caps(adapterIndex, out int supported, out int enabled, out int version); r.Append(" Status: "); - r.AppendLine(status == ADL.ADL_OK ? "OK" : - status.ToString(CultureInfo.InvariantCulture)); + r.AppendLine(status.ToString()); r.Append(" Supported: "); r.AppendLine(supported.ToString(CultureInfo.InvariantCulture)); r.Append(" Enabled: "); @@ -218,6 +217,42 @@ namespace OpenHardwareMonitor.Hardware.ATI { } r.AppendLine(); + r.AppendLine("Overdrive5 Parameters"); + r.AppendLine(); + try { + var status = ADL.ADL_Overdrive5_ODParameters_Get( + adapterIndex, out var p); + r.Append(" Status: "); + r.AppendLine(status.ToString()); + r.AppendFormat(" NumberOfPerformanceLevels: {0}{1}", + p.NumberOfPerformanceLevels, Environment.NewLine); + r.AppendFormat(" ActivityReportingSupported: {0}{1}", + p.ActivityReportingSupported, Environment.NewLine); + r.AppendFormat(" DiscretePerformanceLevels: {0}{1}", + p.DiscretePerformanceLevels, Environment.NewLine); + r.AppendFormat(" EngineClock.Min: {0}{1}", + p.EngineClock.Min, Environment.NewLine); + r.AppendFormat(" EngineClock.Max: {0}{1}", + p.EngineClock.Max, Environment.NewLine); + r.AppendFormat(" EngineClock.Step: {0}{1}", + p.EngineClock.Step, Environment.NewLine); + r.AppendFormat(" MemoryClock.Min: {0}{1}", + p.MemoryClock.Min, Environment.NewLine); + r.AppendFormat(" MemoryClock.Max: {0}{1}", + p.MemoryClock.Max, Environment.NewLine); + r.AppendFormat(" MemoryClock.Step: {0}{1}", + p.MemoryClock.Step, Environment.NewLine); + r.AppendFormat(" Vddc.Min: {0}{1}", + p.Vddc.Min, Environment.NewLine); + r.AppendFormat(" Vddc.Max: {0}{1}", + p.Vddc.Max, Environment.NewLine); + r.AppendFormat(" Vddc.Step: {0}{1}", + p.Vddc.Step, Environment.NewLine); + } catch (Exception e) { + r.AppendLine(" Status: " + e.Message); + } + r.AppendLine(); + r.AppendLine("Overdrive5 Temperature"); r.AppendLine(); try { @@ -225,8 +260,7 @@ namespace OpenHardwareMonitor.Hardware.ATI { var status = ADL.ADL_Overdrive5_Temperature_Get(adapterIndex, 0, ref adlt); r.Append(" Status: "); - r.AppendLine(status == ADL.ADL_OK ? "OK" : - status.ToString(CultureInfo.InvariantCulture)); + r.AppendLine(status.ToString()); r.AppendFormat(" Value: {0}{1}", 0.001f * adlt.Temperature, Environment.NewLine); } catch (Exception e) { @@ -241,15 +275,13 @@ namespace OpenHardwareMonitor.Hardware.ATI { adlf.SpeedType = ADL.ADL_DL_FANCTRL_SPEED_TYPE_RPM; var status = ADL.ADL_Overdrive5_FanSpeed_Get(adapterIndex, 0, ref adlf); r.Append(" Status RPM: "); - r.AppendLine(status == ADL.ADL_OK ? "OK" : - status.ToString(CultureInfo.InvariantCulture)); + r.AppendLine(status.ToString()); r.AppendFormat(" Value RPM: {0}{1}", adlf.FanSpeed, Environment.NewLine); adlf.SpeedType = ADL.ADL_DL_FANCTRL_SPEED_TYPE_PERCENT; status = ADL.ADL_Overdrive5_FanSpeed_Get(adapterIndex, 0, ref adlf); r.Append(" Status Percent: "); - r.AppendLine(status == ADL.ADL_OK ? "OK" : - status.ToString(CultureInfo.InvariantCulture)); + r.AppendLine(status.ToString()); r.AppendFormat(" Value Percent: {0}{1}", adlf.FanSpeed, Environment.NewLine); } catch (Exception e) { @@ -264,8 +296,7 @@ namespace OpenHardwareMonitor.Hardware.ATI { var status = ADL.ADL_Overdrive5_CurrentActivity_Get(adapterIndex, ref adlp); r.Append(" Status: "); - r.AppendLine(status == ADL.ADL_OK ? "OK" : - status.ToString(CultureInfo.InvariantCulture)); + r.AppendLine(status.ToString()); r.AppendFormat(" EngineClock: {0}{1}", 0.01f * adlp.EngineClock, Environment.NewLine); r.AppendFormat(" MemoryClock: {0}{1}", @@ -296,12 +327,12 @@ namespace OpenHardwareMonitor.Hardware.ATI { var status = ADL.ADL2_Overdrive6_CurrentPower_Get( context, adapterIndex, (ADLODNCurrentPowerType)i, out int power); - if (status == ADL.ADL_OK) { + if (status == ADLStatus.OK) { r.AppendFormat(" Power[{0}].Value: {1}{2}", pt, power * (1.0f / 0xFF), Environment.NewLine); } else { r.AppendFormat(" Power[{0}].Status: {1}{2}", pt, - status, Environment.NewLine); + status.ToString(), Environment.NewLine); } } } catch (EntryPointNotFoundException) { @@ -321,12 +352,12 @@ namespace OpenHardwareMonitor.Hardware.ATI { var status = ADL.ADL2_OverdriveN_Temperature_Get( context, adapterIndex, (ADLODNTemperatureType)i, out int temperature); - if (status == ADL.ADL_OK) { + if (status == ADLStatus.OK) { r.AppendFormat(" Temperature[{0}].Value: {1}{2}", tt, 0.001f * temperature, Environment.NewLine); } else { r.AppendFormat(" Temperature[{0}].Status: {1}{2}", tt, - status, Environment.NewLine); + status.ToString(), Environment.NewLine); } } } catch (EntryPointNotFoundException) { @@ -337,13 +368,65 @@ namespace OpenHardwareMonitor.Hardware.ATI { r.AppendLine(); } + if (context != IntPtr.Zero) { + r.AppendLine("OverdriveN Performance Status"); + r.AppendLine(); + try { + var status = ADL.ADL2_OverdriveN_PerformanceStatus_Get(context, + adapterIndex, out var ps); + r.Append(" Status: "); + r.AppendLine(status.ToString()); + r.AppendFormat(" CoreClock: {0}{1}", + ps.CoreClock, Environment.NewLine); + r.AppendFormat(" MemoryClock: {0}{1}", + ps.MemoryClock, Environment.NewLine); + r.AppendFormat(" DCEFClock: {0}{1}", + ps.DCEFClock, Environment.NewLine); + r.AppendFormat(" GFXClock: {0}{1}", + ps.GFXClock, Environment.NewLine); + r.AppendFormat(" UVDClock: {0}{1}", + ps.UVDClock, Environment.NewLine); + r.AppendFormat(" VCEClock: {0}{1}", + ps.VCEClock, Environment.NewLine); + r.AppendFormat(" GPUActivityPercent: {0}{1}", + ps.GPUActivityPercent, Environment.NewLine); + r.AppendFormat(" CurrentCorePerformanceLevel: {0}{1}", + ps.CurrentCorePerformanceLevel, Environment.NewLine); + r.AppendFormat(" CurrentMemoryPerformanceLevel: {0}{1}", + ps.CurrentMemoryPerformanceLevel, Environment.NewLine); + r.AppendFormat(" CurrentDCEFPerformanceLevel: {0}{1}", + ps.CurrentDCEFPerformanceLevel, Environment.NewLine); + r.AppendFormat(" CurrentGFXPerformanceLevel: {0}{1}", + ps.CurrentGFXPerformanceLevel, Environment.NewLine); + r.AppendFormat(" UVDPerformanceLevel: {0}{1}", + ps.UVDPerformanceLevel, Environment.NewLine); + r.AppendFormat(" VCEPerformanceLevel: {0}{1}", + ps.VCEPerformanceLevel, Environment.NewLine); + r.AppendFormat(" CurrentBusSpeed: {0}{1}", + ps.CurrentBusSpeed, Environment.NewLine); + r.AppendFormat(" CurrentBusLanes: {0}{1}", + ps.CurrentBusLanes, Environment.NewLine); + r.AppendFormat(" MaximumBusLanes: {0}{1}", + ps.MaximumBusLanes, Environment.NewLine); + r.AppendFormat(" VDDC: {0}{1}", + ps.VDDC, Environment.NewLine); + r.AppendFormat(" VDDCI: {0}{1}", + ps.VDDCI, Environment.NewLine); + } catch (EntryPointNotFoundException) { + r.AppendLine(" Status: Entry point not found"); + } catch (Exception e) { + r.AppendLine(" Status: " + e.Message); + } + r.AppendLine(); + } + if (context != IntPtr.Zero) { r.AppendLine("Performance Metrics"); r.AppendLine(); try { var status = ADL.ADL2_New_QueryPMLogData_Get(context, adapterIndex, out var data); - if (status == ADL.ADL_OK) { + if (status == ADLStatus.OK) { for (int i = 0; i < data.Sensors.Length; i++) { if (data.Sensors[i].Supported) { var st = ((ADLSensorType)i).ToString(); @@ -353,7 +436,7 @@ namespace OpenHardwareMonitor.Hardware.ATI { } } else { r.Append(" Status: "); - r.AppendLine(status.ToString(CultureInfo.InvariantCulture)); + r.AppendLine(status.ToString()); } } catch (EntryPointNotFoundException) { r.AppendLine(" Status: Entry point not found"); @@ -380,7 +463,7 @@ namespace OpenHardwareMonitor.Hardware.ATI { public override void Update() { if (context != IntPtr.Zero && overdriveVersion >= 8 && ADL.ADL2_New_QueryPMLogData_Get(context, adapterIndex, - out var data) == ADL.ADL_OK) + out var data) == ADLStatus.OK) { GetPMLog(data, ADLSensorType.TEMPERATURE_EDGE, temperatureCore); GetPMLog(data, ADLSensorType.TEMPERATURE_MEM, temperatureMemory); @@ -417,7 +500,7 @@ namespace OpenHardwareMonitor.Hardware.ATI { } else { ADLTemperature adlt = new ADLTemperature(); if (ADL.ADL_Overdrive5_Temperature_Get(adapterIndex, 0, ref adlt) - == ADL.ADL_OK) + == ADLStatus.OK) { temperatureCore.Value = 0.001f * adlt.Temperature; ActivateSensor(temperatureCore); @@ -436,7 +519,7 @@ namespace OpenHardwareMonitor.Hardware.ATI { ADLFanSpeedValue adlf = new ADLFanSpeedValue(); adlf.SpeedType = ADL.ADL_DL_FANCTRL_SPEED_TYPE_RPM; if (ADL.ADL_Overdrive5_FanSpeed_Get(adapterIndex, 0, ref adlf) - == ADL.ADL_OK) + == ADLStatus.OK) { fan.Value = adlf.FanSpeed; ActivateSensor(fan); @@ -447,7 +530,7 @@ namespace OpenHardwareMonitor.Hardware.ATI { adlf = new ADLFanSpeedValue(); adlf.SpeedType = ADL.ADL_DL_FANCTRL_SPEED_TYPE_PERCENT; if (ADL.ADL_Overdrive5_FanSpeed_Get(adapterIndex, 0, ref adlf) - == ADL.ADL_OK) + == ADLStatus.OK) { controlSensor.Value = adlf.FanSpeed; ActivateSensor(controlSensor); @@ -457,7 +540,7 @@ namespace OpenHardwareMonitor.Hardware.ATI { ADLPMActivity adlp = new ADLPMActivity(); if (ADL.ADL_Overdrive5_CurrentActivity_Get(adapterIndex, ref adlp) - == ADL.ADL_OK) + == ADLStatus.OK) { if (adlp.EngineClock > 0) { coreClock.Value = 0.01f * adlp.EngineClock; diff --git a/Hardware/ATI/ATIGroup.cs b/Hardware/ATI/ATIGroup.cs index 146698e..f2a5a79 100644 --- a/Hardware/ATI/ATIGroup.cs +++ b/Hardware/ATI/ATIGroup.cs @@ -23,20 +23,18 @@ namespace OpenHardwareMonitor.Hardware.ATI { public ATIGroup(ISettings settings) { try { - int adlStatus = ADL.ADL_Main_Control_Create(1); - int adl2Status = ADL.ADL2_Main_Control_Create(1, out context); + var adlStatus = ADL.ADL_Main_Control_Create(1); + var adl2Status = ADL.ADL2_Main_Control_Create(1, out context); report.AppendLine("AMD Display Library"); report.AppendLine(); report.Append("ADL Status: "); - report.AppendLine(adlStatus == ADL.ADL_OK ? "OK" : - adlStatus.ToString(CultureInfo.InvariantCulture)); + report.AppendLine(adlStatus.ToString()); report.Append("ADL2 Status: "); - report.AppendLine(adl2Status == ADL.ADL_OK ? "OK" : - adl2Status.ToString(CultureInfo.InvariantCulture)); + report.AppendLine(adl2Status.ToString()); report.AppendLine(); - if (adlStatus == ADL.ADL_OK) { + if (adlStatus == ADLStatus.OK) { int numberOfAdapters = 0; ADL.ADL_Adapter_NumberOfAdapters_Get(ref numberOfAdapters); @@ -46,7 +44,7 @@ namespace OpenHardwareMonitor.Hardware.ATI { if (numberOfAdapters > 0) { ADLAdapterInfo[] adapterInfo = new ADLAdapterInfo[numberOfAdapters]; - if (ADL.ADL_Adapter_AdapterInfo_Get(adapterInfo) == ADL.ADL_OK) + if (ADL.ADL_Adapter_AdapterInfo_Get(adapterInfo) == ADLStatus.OK) for (int i = 0; i < numberOfAdapters; i++) { int isActive; ADL.ADL_Adapter_Active_Get(adapterInfo[i].AdapterIndex, diff --git a/Properties/AssemblyVersion.cs b/Properties/AssemblyVersion.cs index 3a05ec5..2c7fdba 100644 --- a/Properties/AssemblyVersion.cs +++ b/Properties/AssemblyVersion.cs @@ -10,5 +10,5 @@ using System.Reflection; -[assembly: AssemblyVersion("0.9.2.1")] -[assembly: AssemblyInformationalVersion("0.9.2.1 Alpha")] \ No newline at end of file +[assembly: AssemblyVersion("0.9.2.2")] +[assembly: AssemblyInformationalVersion("0.9.2.2 Alpha")] \ No newline at end of file