Hardware/ATI/ATIGPU.cs
changeset 1 361e324a0ed4
child 3 1a0928afac6b
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/Hardware/ATI/ATIGPU.cs	Tue Jan 26 22:37:48 2010 +0000
     1.3 @@ -0,0 +1,117 @@
     1.4 +/*
     1.5 +  
     1.6 +  Version: MPL 1.1/GPL 2.0/LGPL 2.1
     1.7 +
     1.8 +  The contents of this file are subject to the Mozilla Public License Version
     1.9 +  1.1 (the "License"); you may not use this file except in compliance with
    1.10 +  the License. You may obtain a copy of the License at
    1.11 + 
    1.12 +  http://www.mozilla.org/MPL/
    1.13 +
    1.14 +  Software distributed under the License is distributed on an "AS IS" basis,
    1.15 +  WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
    1.16 +  for the specific language governing rights and limitations under the License.
    1.17 +
    1.18 +  The Original Code is the Open Hardware Monitor code.
    1.19 +
    1.20 +  The Initial Developer of the Original Code is 
    1.21 +  Michael Möller <m.moeller@gmx.ch>.
    1.22 +  Portions created by the Initial Developer are Copyright (C) 2009-2010
    1.23 +  the Initial Developer. All Rights Reserved.
    1.24 +
    1.25 +  Contributor(s):
    1.26 +
    1.27 +  Alternatively, the contents of this file may be used under the terms of
    1.28 +  either the GNU General Public License Version 2 or later (the "GPL"), or
    1.29 +  the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
    1.30 +  in which case the provisions of the GPL or the LGPL are applicable instead
    1.31 +  of those above. If you wish to allow use of your version of this file only
    1.32 +  under the terms of either the GPL or the LGPL, and not to allow others to
    1.33 +  use your version of this file under the terms of the MPL, indicate your
    1.34 +  decision by deleting the provisions above and replace them with the notice
    1.35 +  and other provisions required by the GPL or the LGPL. If you do not delete
    1.36 +  the provisions above, a recipient may use your version of this file under
    1.37 +  the terms of any one of the MPL, the GPL or the LGPL.
    1.38 + 
    1.39 +*/
    1.40 +
    1.41 +using System;
    1.42 +using System.Collections.Generic;
    1.43 +using System.Drawing;
    1.44 +using System.Reflection;
    1.45 +
    1.46 +namespace OpenHardwareMonitor.Hardware.ATI {
    1.47 +  public class ATIGPU : IHardware {
    1.48 +
    1.49 +    private string name;
    1.50 +    private Image icon;
    1.51 +    private int adapterIndex;
    1.52 +    private Sensor temperature;
    1.53 +    private Sensor fan;
    1.54 +    private Sensor coreClock;
    1.55 +    private Sensor memoryClock;
    1.56 +    private Sensor coreVoltage;
    1.57 +
    1.58 +    public ATIGPU(string name, int adapterIndex) {
    1.59 +      this.name = name;
    1.60 +      this.icon = Utilities.EmbeddedResources.GetImage("ati.png");
    1.61 +      this.adapterIndex = adapterIndex;
    1.62 +
    1.63 +      ADLFanSpeedInfo speedInfo = new ADLFanSpeedInfo();
    1.64 +      ADL.ADL_Overdrive5_FanSpeedInfo_Get(adapterIndex, 0, ref speedInfo);
    1.65 +
    1.66 +      this.temperature = 
    1.67 +        new Sensor("GPU Core", 0, SensorType.Temperature, this);
    1.68 +      this.fan = new Sensor("GPU", 0, speedInfo.MaxRPM, SensorType.Fan, this);
    1.69 +      this.coreClock = new Sensor("GPU Core", 0, SensorType.Clock, this);
    1.70 +      this.memoryClock = new Sensor("GPU Memory", 1, SensorType.Clock, this);
    1.71 +      this.coreVoltage = new Sensor("GPU Core", 0, SensorType.Voltage, this);
    1.72 +      Update();                   
    1.73 +    }
    1.74 +
    1.75 +    public string Name {
    1.76 +      get { return name; }
    1.77 +    }
    1.78 +
    1.79 +    public string Identifier {
    1.80 +      get { return "/atigpu/" + adapterIndex; }
    1.81 +    }
    1.82 +
    1.83 +    public Image Icon {
    1.84 +      get { return icon; }
    1.85 +    }
    1.86 +
    1.87 +    public ISensor[] Sensors {
    1.88 +      get {
    1.89 +        return new ISensor[] { coreVoltage, coreClock, memoryClock, temperature, 
    1.90 +          fan };
    1.91 +      }
    1.92 +    }
    1.93 +
    1.94 +    public string GetReport() {
    1.95 +      return null;
    1.96 +    }
    1.97 +
    1.98 +    public void Update() {
    1.99 +      ADLTemperature adlt = new ADLTemperature();
   1.100 +      ADL.ADL_Overdrive5_Temperature_Get(adapterIndex, 0, ref adlt);
   1.101 +      temperature.Value = 0.001f * adlt.Temperature;
   1.102 +
   1.103 +      ADLFanSpeedValue adlf = new ADLFanSpeedValue();
   1.104 +      adlf.SpeedType = ADL.ADL_DL_FANCTRL_SPEED_TYPE_RPM;
   1.105 +      ADL.ADL_Overdrive5_FanSpeed_Get(adapterIndex, 0, ref adlf);
   1.106 +      fan.Value = adlf.FanSpeed;
   1.107 +
   1.108 +      ADLPMActivity adlp = new ADLPMActivity();
   1.109 +      ADL.ADL_Overdrive5_CurrentActivity_Get(adapterIndex, ref adlp);
   1.110 +      coreClock.Value = 0.01f * adlp.EngineClock;
   1.111 +      memoryClock.Value = 0.01f * adlp.MemoryClock;
   1.112 +      coreVoltage.Value = 0.001f * adlp.Vddc;
   1.113 +    }
   1.114 +
   1.115 +    #pragma warning disable 67
   1.116 +    public event SensorEventHandler SensorAdded;
   1.117 +    public event SensorEventHandler SensorRemoved;
   1.118 +    #pragma warning restore 67
   1.119 +  }
   1.120 +}