# HG changeset patch # User moel.mich # Date 1275604818 0 # Node ID 80065ab20b844e60a619a28e3f067ec6f9447e68 # Parent efb1b414d33e4098546a4985c60cfce880c52b81 Fixed Issue 63. diff -r efb1b414d33e -r 80065ab20b84 Hardware/LPC/F718XX.cs --- a/Hardware/LPC/F718XX.cs Sat May 29 13:49:20 2010 +0000 +++ b/Hardware/LPC/F718XX.cs Thu Jun 03 22:40:18 2010 +0000 @@ -37,18 +37,18 @@ using System; using System.Collections.Generic; -using System.Drawing; using System.Text; +using OpenHardwareMonitor.Utilities; namespace OpenHardwareMonitor.Hardware.LPC { - public class F718XX : LPCHardware, IHardware { + public class F718XX : ISuperIO { private ushort address; + private Chip chip; - private Sensor[] temperatures; - private Sensor[] fans; - private Sensor[] voltages; - private float[] voltageGains; + private float?[] voltages; + private float?[] temperatures; + private float?[] fans; // Hardware Monitor private const byte ADDRESS_REGISTER_OFFSET = 0x05; @@ -66,40 +66,21 @@ return WinRing0.ReadIoPortByte((ushort)(address + DATA_REGISTER_OFFSET)); } - public F718XX(Chip chip, ushort address) : base(chip) { + public F718XX(Chip chip, ushort address) { this.address = address; + this.chip = chip; - temperatures = new Sensor[3]; - for (int i = 0; i < temperatures.Length; i++) - temperatures[i] = new Sensor("Temperature #" + (i + 1), i, null, - SensorType.Temperature, this, new ParameterDescription[] { - new ParameterDescription("Offset [°C]", "Temperature offset.", 0) - }); - - fans = new Sensor[chip == Chip.F71882 ? 4 : 3]; - for (int i = 0; i < fans.Length; i++) - fans[i] = new Sensor("Fan #" + (i + 1), i, SensorType.Fan, this); - - switch (chip) { - case Chip.F71858: - voltageGains = new float[] { 1, 1, 1 }; - voltages = new Sensor[3]; - voltages[0] = new Sensor("VCC3V", 0, SensorType.Voltage, this); - voltages[1] = new Sensor("VSB3V", 1, SensorType.Voltage, this); - voltages[2] = new Sensor("Battery", 2, SensorType.Voltage, this); - break; - default: - voltageGains = new float[] { 1, 0.5f, 1, 1, 1, 1, 1, 1, 1 }; - voltages = new Sensor[4]; - voltages[0] = new Sensor("VCC3V", 0, SensorType.Voltage, this); - voltages[1] = new Sensor("CPU VCore", 1, SensorType.Voltage, this); - voltages[2] = new Sensor("VSB3V", 7, SensorType.Voltage, this); - voltages[3] = new Sensor("Battery", 8, SensorType.Voltage, this); - break; - } + voltages = new float?[chip == Chip.F71858 ? 3 : 9]; + temperatures = new float?[3]; + fans = new float?[chip == Chip.F71882 || chip == Chip.F71858? 4 : 3]; } - public override string GetReport() { + public Chip Chip { get { return chip; } } + public float?[] Voltages { get { return voltages; } } + public float?[] Temperatures { get { return temperatures; } } + public float?[] Fans { get { return fans; } } + + public string GetReport() { StringBuilder r = new StringBuilder(); r.AppendLine("LPC " + this.GetType().Name); @@ -123,23 +104,21 @@ return r.ToString(); } - public override void Update() { + public void Update() { - foreach (Sensor sensor in voltages) { - int value = ReadByte((byte)(VOLTAGE_BASE_REG + sensor.Index)); - sensor.Value = voltageGains[sensor.Index] * 0.001f * (value << 4); - if (sensor.Value > 0) - ActivateSensor(sensor); + for (int i = 0; i < voltages.Length; i++) { + int value = ReadByte((byte)(VOLTAGE_BASE_REG + i)); + voltages[i] = 0.001f * (value << 4); } - foreach (Sensor sensor in temperatures) { + for (int i = 0; i < temperatures.Length; i++) { switch (chip) { case Chip.F71858: { int tableMode = 0x3 & ReadByte((byte)(TEMPERATURE_CONFIG_REG)); int high = - ReadByte((byte)(TEMPERATURE_BASE_REG + 2 * sensor.Index)); + ReadByte((byte)(TEMPERATURE_BASE_REG + 2 * i)); int low = - ReadByte((byte)(TEMPERATURE_BASE_REG + 2 * sensor.Index + 1)); + ReadByte((byte)(TEMPERATURE_BASE_REG + 2 * i + 1)); if (high != 0xbb && high != 0xcc) { int bits = 0; switch (tableMode) { @@ -151,33 +130,30 @@ bits |= high << 7; bits |= (low & 0xe0) >> 1; short value = (short)(bits & 0xfff0); - sensor.Value = value / 128.0f; - ActivateSensor(sensor); + temperatures[i] = value / 128.0f; } else { - sensor.Value = null; + temperatures[i] = null; } } break; default: { sbyte value = (sbyte)ReadByte((byte)( - TEMPERATURE_BASE_REG + 2 * (sensor.Index + 1))); - sensor.Value = value + sensor.Parameters[0].Value; + TEMPERATURE_BASE_REG + 2 * (i + 1))); if (value < sbyte.MaxValue && value > 0) - ActivateSensor(sensor); + temperatures[i] = value; + else + temperatures[i] = null; } break; } } - foreach (Sensor sensor in fans) { - int value = ReadByte(FAN_TACHOMETER_REG[sensor.Index]) << 8; - value |= ReadByte((byte)(FAN_TACHOMETER_REG[sensor.Index] + 1)); + for (int i = 0; i < fans.Length; i++) { + int value = ReadByte(FAN_TACHOMETER_REG[i]) << 8; + value |= ReadByte((byte)(FAN_TACHOMETER_REG[i] + 1)); - if (value > 0) { - sensor.Value = (value < 0x0fff) ? 1.5e6f / value : 0; - if (sensor.Value > 0) - ActivateSensor(sensor); - } else { - sensor.Value = null; - } + if (value > 0) + fans[i] = (value < 0x0fff) ? 1.5e6f / value : 0; + else + fans[i] = null; } } } diff -r efb1b414d33e -r 80065ab20b84 Hardware/LPC/ISuperIO.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Hardware/LPC/ISuperIO.cs Thu Jun 03 22:40:18 2010 +0000 @@ -0,0 +1,54 @@ +/* + + Version: MPL 1.1/GPL 2.0/LGPL 2.1 + + The contents of this file are subject to the Mozilla Public License Version + 1.1 (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + for the specific language governing rights and limitations under the License. + + The Original Code is the Open Hardware Monitor code. + + The Initial Developer of the Original Code is + Michael Möller . + Portions created by the Initial Developer are Copyright (C) 2009-2010 + the Initial Developer. All Rights Reserved. + + Contributor(s): + + Alternatively, the contents of this file may be used under the terms of + either the GNU General Public License Version 2 or later (the "GPL"), or + the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + in which case the provisions of the GPL or the LGPL are applicable instead + of those above. If you wish to allow use of your version of this file only + under the terms of either the GPL or the LGPL, and not to allow others to + use your version of this file under the terms of the MPL, indicate your + decision by deleting the provisions above and replace them with the notice + and other provisions required by the GPL or the LGPL. If you do not delete + the provisions above, a recipient may use your version of this file under + the terms of any one of the MPL, the GPL or the LGPL. + +*/ + +using System; +using System.Collections.Generic; +using OpenHardwareMonitor.Utilities; + +namespace OpenHardwareMonitor.Hardware.LPC { + public interface ISuperIO { + + Chip Chip { get; } + + float?[] Voltages { get; } + float?[] Temperatures { get; } + float?[] Fans { get; } + + string GetReport(); + void Update(); + } +} diff -r efb1b414d33e -r 80065ab20b84 Hardware/LPC/IT87XX.cs --- a/Hardware/LPC/IT87XX.cs Sat May 29 13:49:20 2010 +0000 +++ b/Hardware/LPC/IT87XX.cs Thu Jun 03 22:40:18 2010 +0000 @@ -41,17 +41,17 @@ using System.Text; namespace OpenHardwareMonitor.Hardware.LPC { - public class IT87XX : LPCHardware, IHardware { - - private bool available = false; + public class IT87XX : ISuperIO { + private ushort address; + private Chip chip; private readonly ushort addressReg; private readonly ushort dataReg; - private List voltages = new List(9); - private List temperatures = new List(3); - private Sensor[] fans; + private float?[] voltages = new float?[0]; + private float?[] temperatures = new float?[0]; + private float?[] fans = new float?[0]; // Consts private const byte ITE_VENDOR_ID = 0x90; @@ -78,10 +78,10 @@ return value; } - public IT87XX(Chip chip, ushort address, Mainboard.Manufacturer - mainboardManufacturer, Mainboard.Model mainboardModel) : base (chip) { + public IT87XX(Chip chip, ushort address) { this.address = address; + this.chip = chip; this.addressReg = (ushort)(address + ADDRESS_REGISTER_OFFSET); this.dataReg = (ushort)(address + DATA_REGISTER_OFFSET); @@ -97,140 +97,22 @@ if (!valid) return; - string[] temperatureLabels; - List voltageConfigs = new List(); - switch (mainboardManufacturer) { - case Mainboard.Manufacturer.DFI: - switch (mainboardModel) { - case Mainboard.Model.LP_BI_P45_T2RS_Elite: - voltageConfigs.Add(new Voltage("CPU VCore", 0)); - voltageConfigs.Add(new Voltage("FSB VTT", 1)); - voltageConfigs.Add(new Voltage("+3.3V", 2)); - voltageConfigs.Add(new Voltage("+5V", 3, 6.8f, 10, 0)); - voltageConfigs.Add(new Voltage("+12V", 4, 30, 10, 0)); - voltageConfigs.Add(new Voltage("NB Core", 5)); - voltageConfigs.Add(new Voltage("VDIMM", 6)); - voltageConfigs.Add(new Voltage("+5VSB", 7, 6.8f, 10, 0)); - voltageConfigs.Add(new Voltage("VBat", 8)); - temperatureLabels = new string[] { - "CPU", "System", "Chipset" }; - break; - case Mainboard.Model.LP_DK_P55_T3eH9: - voltageConfigs.Add(new Voltage("CPU VCore", 0)); - voltageConfigs.Add(new Voltage("VTT", 1)); - voltageConfigs.Add(new Voltage("+3.3V", 2)); - voltageConfigs.Add(new Voltage("+5V", 3, 6.8f, 10, 0)); - voltageConfigs.Add(new Voltage("+12V", 4, 30, 10, 0)); - voltageConfigs.Add(new Voltage("CPU PLL", 5)); - voltageConfigs.Add(new Voltage("DRAM", 6)); - voltageConfigs.Add(new Voltage("+5VSB", 7, 6.8f, 10, 0)); - voltageConfigs.Add(new Voltage("VBat", 8)); - temperatureLabels = new string[] { - "Chipset", "CPU PWM", "CPU" }; - break; - default: - voltageConfigs.Add(new Voltage("CPU VCore", 0)); - voltageConfigs.Add(new Voltage("VTT", 1, true)); - voltageConfigs.Add(new Voltage("+3.3V", 2, true)); - voltageConfigs.Add(new Voltage("+5V", 3, 6.8f, 10, 0, true)); - voltageConfigs.Add(new Voltage("+12V", 4, 30, 10, 0, true)); - voltageConfigs.Add(new Voltage("Voltage #6", 5, true)); - voltageConfigs.Add(new Voltage("DRAM", 6, true)); - voltageConfigs.Add(new Voltage("+5VSB", 7, 6.8f, 10, 0, true)); - voltageConfigs.Add(new Voltage("VBat", 8)); - temperatureLabels = new string[] { - "Temperature #1", "Temperature #2", "Temperature #3" }; - break; - } - break; - - case Mainboard.Manufacturer.Gigabyte: - switch (mainboardModel) { - case Mainboard.Model.EP45_DS3R: - case Mainboard.Model.P35_DS3: - voltageConfigs.Add(new Voltage("CPU VCore", 0)); - voltageConfigs.Add(new Voltage("DRAM", 1)); - voltageConfigs.Add(new Voltage("+3.3V", 2)); - voltageConfigs.Add(new Voltage("+5V", 3, 6.8f, 10, 0)); - voltageConfigs.Add(new Voltage("+12V", 7, 27, 9.1f, 0)); - voltageConfigs.Add(new Voltage("VBat", 8)); - break; - case Mainboard.Model.GA_MA785GMT_UD2H: - voltageConfigs.Add(new Voltage("CPU VCore", 0)); - voltageConfigs.Add(new Voltage("DRAM", 1)); - voltageConfigs.Add(new Voltage("+3.3V", 2)); - voltageConfigs.Add(new Voltage("+5V", 3, 6.8f, 10, 0)); - voltageConfigs.Add(new Voltage("+12V", 4, 27, 9.1f, 0)); - voltageConfigs.Add(new Voltage("VBat", 8)); - break; - default: - voltageConfigs.Add(new Voltage("CPU VCore", 0)); - voltageConfigs.Add(new Voltage("DRAM", 1, true)); - voltageConfigs.Add(new Voltage("+3.3V", 2, true)); - voltageConfigs.Add(new Voltage("+5V", 3, 6.8f, 10, 0, true)); - voltageConfigs.Add(new Voltage("Voltage #5", 4, true)); - voltageConfigs.Add(new Voltage("Voltage #6", 5, true)); - voltageConfigs.Add(new Voltage("Voltage #7", 6, true)); - voltageConfigs.Add(new Voltage("+12V", 7, 27, 9.1f, 0, true)); - voltageConfigs.Add(new Voltage("VBat", 8)); - break; - } - temperatureLabels = new string[] { "System", "CPU" }; - break; - - default: - voltageConfigs.Add(new Voltage("CPU VCore", 0)); - voltageConfigs.Add(new Voltage("Voltage #2", 1, true)); - voltageConfigs.Add(new Voltage("Voltage #3", 2, true)); - voltageConfigs.Add(new Voltage("Voltage #4", 3, true)); - voltageConfigs.Add(new Voltage("Voltage #5", 4, true)); - voltageConfigs.Add(new Voltage("Voltage #6", 5, true)); - voltageConfigs.Add(new Voltage("Voltage #7", 6, true)); - voltageConfigs.Add(new Voltage("Voltage #8", 7, true)); - voltageConfigs.Add(new Voltage("VBat", 8)); - temperatureLabels = new string[] { - "Temperature #1", "Temperature #2", "Temperature #3" }; - break; - } - - string formula = "Voltage = value + (value - Vf) * Ri / Rf."; - foreach (Voltage voltage in voltageConfigs) - voltages.Add(new Sensor(voltage.Name, voltage.Index, voltage.Hidden, - null, SensorType.Voltage, this, new ParameterDescription[] { - new ParameterDescription("Ri [kΩ]", "Input resistance.\n" + - formula, voltage.Ri), - new ParameterDescription("Rf [kΩ]", "Reference resistance.\n" + - formula, voltage.Rf), - new ParameterDescription("Vf [V]", "Reference voltage.\n" + - formula, voltage.Vf) - })); - - for (int i = 0; i < temperatureLabels.Length; i++) - if (temperatureLabels[i] != null) { - temperatures.Add(new Sensor(temperatureLabels[i], i, null, - SensorType.Temperature, this, new ParameterDescription[] { - new ParameterDescription("Offset [°C]", "Temperature offset.", 0) - })); - } - - fans = new Sensor[5]; - for (int i = 0; i < fans.Length; i++) - fans[i] = new Sensor("Fan #" + (i + 1), i, SensorType.Fan, this); - - available = true; + voltages = new float?[9]; + temperatures = new float?[3]; + fans = new float?[5]; } - public bool IsAvailable { - get { return available; } - } + public Chip Chip { get { return chip; } } + public float?[] Voltages { get { return voltages; } } + public float?[] Temperatures { get { return temperatures; } } + public float?[] Fans { get { return fans; } } - public override string GetReport() { + public string GetReport() { StringBuilder r = new StringBuilder(); r.AppendLine("LPC " + this.GetType().Name); r.AppendLine(); r.Append("Chip ID: 0x"); r.AppendLine(chip.ToString("X")); - r.Append("Chip Name: "); r.AppendLine(name); r.Append("Base Address: 0x"); r.AppendLine(address.ToString("X4")); r.AppendLine(); r.AppendLine("Environment Controller Registers"); @@ -256,79 +138,48 @@ return r.ToString(); } - public override void Update() { + public void Update() { - foreach (Sensor sensor in voltages) { + for (int i = 0; i < voltages.Length; i++) { bool valid; float value = 0.001f * ((int)ReadByte( - (byte)(VOLTAGE_BASE_REG + sensor.Index), out valid) << 4); + (byte)(VOLTAGE_BASE_REG + i), out valid) << 4); + if (!valid) + continue; + if (value > 0) + voltages[i] = value; + else + voltages[i] = null; + } + + for (int i = 0; i < temperatures.Length; i++) { + bool valid; + sbyte value = (sbyte)ReadByte( + (byte)(TEMPERATURE_BASE_REG + i), out valid); if (!valid) continue; - sensor.Value = value + (value - sensor.Parameters[2].Value) * - sensor.Parameters[0].Value / sensor.Parameters[1].Value; - if (value > 0) - ActivateSensor(sensor); + if (value < sbyte.MaxValue && value > 0) + temperatures[i] = value; + else + temperatures[i] = null; } - foreach (Sensor sensor in temperatures) { + for (int i = 0; i < fans.Length; i++) { bool valid; - sbyte value = (sbyte)ReadByte( - (byte)(TEMPERATURE_BASE_REG + sensor.Index), out valid); - if (!valid) - continue; - - sensor.Value = value + sensor.Parameters[0].Value; - if (value < sbyte.MaxValue && value > 0) - ActivateSensor(sensor); - } - - foreach (Sensor sensor in fans) { - bool valid; - int value = ReadByte(FAN_TACHOMETER_REG[sensor.Index], out valid); + int value = ReadByte(FAN_TACHOMETER_REG[i], out valid); if (!valid) continue; - value |= ReadByte(FAN_TACHOMETER_EXT_REG[sensor.Index], out valid) << 8; + value |= ReadByte(FAN_TACHOMETER_EXT_REG[i], out valid) << 8; if (!valid) continue; if (value > 0x3f) { - sensor.Value = (value < 0xffff) ? 1.35e6f / ((value) * 2) : 0; - if (sensor.Value > 0) - ActivateSensor(sensor); + fans[i] = (value < 0xffff) ? 1.35e6f / ((value) * 2) : 0; } else { - sensor.Value = null; + fans[i] = null; } } } - - private class Voltage { - public readonly string Name; - public readonly int Index; - public readonly float Ri; - public readonly float Rf; - public readonly float Vf; - public readonly bool Hidden; - - public Voltage(string name, int index) : - this(name, index, 0, 1, 0, false) { } - - public Voltage(string name, int index, bool hidden) : - this(name, index, 0, 1, 0, hidden) { } - - public Voltage(string name, int index, float ri, float rf, float vf) : - this(name, index, ri, rf, vf, false) { } - - public Voltage(string name, int index, float ri, float rf, float vf, - bool hidden) - { - this.Name = name; - this.Index = index; - this.Ri = ri; - this.Rf = rf; - this.Vf = vf; - this.Hidden = hidden; - } - } - } + } } diff -r efb1b414d33e -r 80065ab20b84 Hardware/LPC/LPCHardware.cs --- a/Hardware/LPC/LPCHardware.cs Sat May 29 13:49:20 2010 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,88 +0,0 @@ -/* - - Version: MPL 1.1/GPL 2.0/LGPL 2.1 - - The contents of this file are subject to the Mozilla Public License Version - 1.1 (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" basis, - WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - for the specific language governing rights and limitations under the License. - - The Original Code is the Open Hardware Monitor code. - - The Initial Developer of the Original Code is - Michael Möller . - Portions created by the Initial Developer are Copyright (C) 2009-2010 - the Initial Developer. All Rights Reserved. - - Contributor(s): - - Alternatively, the contents of this file may be used under the terms of - either the GNU General Public License Version 2 or later (the "GPL"), or - the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - in which case the provisions of the GPL or the LGPL are applicable instead - of those above. If you wish to allow use of your version of this file only - under the terms of either the GPL or the LGPL, and not to allow others to - use your version of this file under the terms of the MPL, indicate your - decision by deleting the provisions above and replace them with the notice - and other provisions required by the GPL or the LGPL. If you do not delete - the provisions above, a recipient may use your version of this file under - the terms of any one of the MPL, the GPL or the LGPL. - -*/ - -using System; -using System.Collections.Generic; -using System.Drawing; - -namespace OpenHardwareMonitor.Hardware.LPC { - public abstract class LPCHardware : Hardware { - - private Image icon; - protected readonly string name; - protected readonly Chip chip; - - public LPCHardware(Chip chip) { - this.chip = chip; - this.icon = Utilities.EmbeddedResources.GetImage("chip.png"); - - switch (chip) { - case Chip.F71858: name = "Fintek F71858"; break; - case Chip.F71862: name = "Fintek F71862"; break; - case Chip.F71869: name = "Fintek F71869"; break; - case Chip.F71882: name = "Fintek F71882"; break; - case Chip.F71889ED: name = "Fintek F71889ED"; break; - case Chip.F71889F: name = "Fintek F71889F"; break; - case Chip.IT8712F: this.name = "ITE IT8712F"; break; - case Chip.IT8716F: this.name = "ITE IT8716F"; break; - case Chip.IT8718F: this.name = "ITE IT8718F"; break; - case Chip.IT8720F: this.name = "ITE IT8720F"; break; - case Chip.IT8726F: this.name = "ITE IT8726F"; break; - case Chip.W83627DHG: this.name = "Winbond W83627DHG"; break; - case Chip.W83627DHGP: this.name = "Winbond W83627DHG-P"; break; - case Chip.W83627EHF: this.name = "Winbond W83627EHF"; break; - case Chip.W83627HF: this.name = "Winbond W83627HF"; break; - case Chip.W83627THF: this.name = "Winbond W83627THF"; break; - case Chip.W83667HG: this.name = "Winbond W83667HG"; break; - case Chip.W83667HGB: this.name = "Winbond W83667HG-B"; break; - case Chip.W83687THF: this.name = "Winbond W83687THF"; break; - } - } - - public override Identifier Identifier { - get { return new Identifier("lpc", chip.ToString().ToLower()); } - } - - public override Image Icon { - get { return icon; } - } - - public override string Name { - get { return name; } - } - } -} diff -r efb1b414d33e -r 80065ab20b84 Hardware/LPC/LPCIO.cs --- a/Hardware/LPC/LPCIO.cs Sat May 29 13:49:20 2010 +0000 +++ b/Hardware/LPC/LPCIO.cs Thu Jun 03 22:40:18 2010 +0000 @@ -43,7 +43,7 @@ namespace OpenHardwareMonitor.Hardware.LPC { public class LPCIO { - private List hardware = new List(); + private List superIOs = new List(); private StringBuilder report = new StringBuilder(); private Chip chip = Chip.Unknown; @@ -87,7 +87,7 @@ WinRing0.WriteIoPortByte(registerPort, 0x55); } - internal void IT87Exit() { + private void IT87Exit() { WinRing0.WriteIoPortByte(registerPort, CONFIGURATION_CONTROL_REGISTER); WinRing0.WriteIoPortByte(valuePort, 0x02); } @@ -119,9 +119,7 @@ WinRing0.WriteIoPortByte(registerPort, 0xAA); } - public LPCIO(Mainboard.Manufacturer mainboardManufacturer, - Mainboard.Model mainboardModel) - { + public LPCIO() { if (!WinRing0.IsAvailable) return; @@ -289,9 +287,7 @@ case Chip.W83667HG: case Chip.W83667HGB: case Chip.W83687THF: - W836XX w836XX = new W836XX(chip, revision, address); - if (w836XX.IsAvailable) - hardware.Add(w836XX); + superIOs.Add(new W836XX(chip, revision, address)); break; case Chip.F71858: case Chip.F71862: @@ -309,7 +305,7 @@ report.AppendLine(); return; } - hardware.Add(new F718XX(chip, address)); + superIOs.Add(new F718XX(chip, address)); break; default: break; } @@ -353,10 +349,7 @@ return; } - IT87XX it87 = new IT87XX(chip, address, mainboardManufacturer, - mainboardModel); - if (it87.IsAvailable) - hardware.Add(it87); + superIOs.Add(new IT87XX(chip, address)); return; } @@ -383,9 +376,9 @@ } } - public IHardware[] Hardware { + public ISuperIO[] SuperIO { get { - return hardware.ToArray(); + return superIOs.ToArray(); } } diff -r efb1b414d33e -r 80065ab20b84 Hardware/LPC/W836XX.cs --- a/Hardware/LPC/W836XX.cs Sat May 29 13:49:20 2010 +0000 +++ b/Hardware/LPC/W836XX.cs Thu Jun 03 22:40:18 2010 +0000 @@ -37,23 +37,24 @@ using System; using System.Collections.Generic; -using System.Drawing; using System.Text; namespace OpenHardwareMonitor.Hardware.LPC { - public class W836XX : LPCHardware, IHardware { + public class W836XX : ISuperIO { private ushort address; private byte revision; - private bool available; + private Chip chip; - private Sensor[] temperatures; - private Sensor[] fans; - private Sensor[] voltages; + private float?[] voltages = new float?[0]; + private float?[] temperatures = new float?[0]; + private float?[] fans = new float?[0]; - private float[] voltageGains; - private string[] fanNames; + private bool[] peciTemperature = new bool[0]; + private byte[] voltageRegister = new byte[0]; + private byte[] voltageBank = new byte[0]; + private float voltageGain = 0.008f; // Consts private const ushort WINBOND_VENDOR_ID = 0x5CA3; @@ -64,13 +65,11 @@ private const byte DATA_REGISTER_OFFSET = 0x06; // Hardware Monitor Registers - private const byte VOLTAGE_BASE_REG = 0x20; + private const byte VOLTAGE_VBAT_REG = 0x51; private const byte BANK_SELECT_REGISTER = 0x4E; private const byte VENDOR_ID_REGISTER = 0x4F; private const byte TEMPERATURE_SOURCE_SELECT_REG = 0x49; - private string[] TEMPERATURE_NAME = - new string[] {"CPU", "Auxiliary", "System"}; private byte[] TEMPERATURE_REG = new byte[] { 0x50, 0x50, 0x27 }; private byte[] TEMPERATURE_BANK = new byte[] { 1, 2, 0 }; @@ -90,7 +89,7 @@ (ushort)(address + ADDRESS_REGISTER_OFFSET), register); return WinRing0.ReadIoPortByte( (ushort)(address + DATA_REGISTER_OFFSET)); - } + } private void WriteByte(byte bank, byte register, byte value) { WinRing0.WriteIoPortByte( @@ -103,90 +102,73 @@ (ushort)(address + DATA_REGISTER_OFFSET), value); } - public W836XX(Chip chip, byte revision, ushort address) - : base(chip) - { + public W836XX(Chip chip, byte revision, ushort address) { this.address = address; this.revision = revision; + this.chip = chip; - available = IsWinbondVendor(); - - ParameterDescription[] parameter = new ParameterDescription[] { - new ParameterDescription("Offset [°C]", "Temperature offset.", 0) - }; - List list = new List(); + if (!IsWinbondVendor()) + return; + + temperatures = new float?[3]; + peciTemperature = new bool[3]; switch (chip) { case Chip.W83667HG: case Chip.W83667HGB: - // do not add temperature sensor registers that read PECI + // note temperature sensor registers that read PECI byte flag = ReadByte(0, TEMPERATURE_SOURCE_SELECT_REG); - if ((flag & 0x04) == 0) - list.Add(new Sensor(TEMPERATURE_NAME[0], 0, null, - SensorType.Temperature, this, parameter)); - if ((flag & 0x40) == 0) - list.Add(new Sensor(TEMPERATURE_NAME[1], 1, null, - SensorType.Temperature, this, parameter)); - list.Add(new Sensor(TEMPERATURE_NAME[2], 2, null, - SensorType.Temperature, this, parameter)); + peciTemperature[0] = (flag & 0x04) != 0; + peciTemperature[1] = (flag & 0x40) != 0; + peciTemperature[2] = false; break; case Chip.W83627DHG: case Chip.W83627DHGP: // do not add temperature sensor registers that read PECI byte sel = ReadByte(0, TEMPERATURE_SOURCE_SELECT_REG); - if ((sel & 0x07) == 0) - list.Add(new Sensor(TEMPERATURE_NAME[0], 0, null, - SensorType.Temperature, this, parameter)); - if ((sel & 0x70) == 0) - list.Add(new Sensor(TEMPERATURE_NAME[1], 1, null, - SensorType.Temperature, this, parameter)); - list.Add(new Sensor(TEMPERATURE_NAME[2], 2, null, - SensorType.Temperature, this, parameter)); + peciTemperature[0] = (sel & 0x07) != 0; + peciTemperature[1] = (sel & 0x70) != 0; + peciTemperature[2] = false; break; default: - // no PECI support, add all sensors - for (int i = 0; i < TEMPERATURE_NAME.Length; i++) - list.Add(new Sensor(TEMPERATURE_NAME[i], i, null, - SensorType.Temperature, this, parameter)); + // no PECI support + peciTemperature[0] = false; + peciTemperature[1] = false; + peciTemperature[2] = false; break; } - temperatures = list.ToArray(); switch (chip) { + case Chip.W83627EHF: + voltages = new float?[10]; + voltageRegister = new byte[] { + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x50, 0x51, 0x52 }; + voltageBank = new byte[] { 0, 0, 0, 0, 0, 0, 0, 5, 5, 5 }; + voltageGain = 0.008f; + fans = new float?[5]; + break; case Chip.W83627DHG: - case Chip.W83627DHGP: - case Chip.W83627EHF: + case Chip.W83627DHGP: case Chip.W83667HG: - case Chip.W83667HGB: - fanNames = new string[] { "System", "CPU", "Auxiliary", - "CPU #2", "Auxiliary #2" }; - voltageGains = new float[] { 1, 1, 1, 2, 1, 1, 1, 2 }; - voltages = new Sensor[3]; - voltages[0] = new Sensor("CPU VCore", 0, SensorType.Voltage, this); - voltages[1] = new Sensor("+3.3V", 3, SensorType.Voltage, this); - voltages[2] = new Sensor("Battery", 7, SensorType.Voltage, this); + case Chip.W83667HGB: + voltages = new float?[9]; + voltageRegister = new byte[] { + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x50, 0x51 }; + voltageBank = new byte[] { 0, 0, 0, 0, 0, 0, 0, 5, 5 }; + voltageGain = 0.008f; + fans = new float?[5]; break; case Chip.W83627HF: case Chip.W83627THF: case Chip.W83687THF: - fanNames = new string[] { "System", "CPU", "Auxiliary" }; - voltageGains = new float[] { 2, 1, 2, 1, 1, 1, 1, 2 }; - voltages = new Sensor[3]; - voltages[0] = new Sensor("CPU VCore", 0, SensorType.Voltage, this); - voltages[1] = new Sensor("+3.3V", 2, SensorType.Voltage, this); - voltages[2] = new Sensor("Battery", 7, SensorType.Voltage, this); - break; - default: fanNames = new string[0]; + voltages = new float?[7]; + voltageRegister = new byte[] { + 0x20, 0x21, 0x22, 0x23, 0x24, 0x50, 0x51 }; + voltageBank = new byte[] { 0, 0, 0, 0, 0, 5, 5 }; + voltageGain = 0.016f; + fans = new float?[3]; break; } - - fans = new Sensor[fanNames.Length]; - for (int i = 0; i < fanNames.Length; i++) - fans[i] = new Sensor(fanNames[i], i, SensorType.Fan, this); - } - - public bool IsAvailable { - get { return available; } - } + } private bool IsWinbondVendor() { ushort vendorId = @@ -206,52 +188,57 @@ return value > 0 ? target | mask : target & ~mask; } - public override void Update() { + public Chip Chip { get { return chip; } } + public float?[] Voltages { get { return voltages; } } + public float?[] Temperatures { get { return temperatures; } } + public float?[] Fans { get { return fans; } } - foreach (Sensor sensor in voltages) { - if (sensor.Index < 7) { + public void Update() { + + for (int i = 0; i < voltages.Length; i++) { + if (voltageRegister[i] != VOLTAGE_VBAT_REG) { // two special VCore measurement modes for W83627THF + float fvalue; if ((chip == Chip.W83627HF || chip == Chip.W83627THF || - chip == Chip.W83687THF) && sensor.Index == 0) + chip == Chip.W83687THF) && i == 0) { byte vrmConfiguration = ReadByte(0, 0x18); - int value = ReadByte(0, VOLTAGE_BASE_REG); + int value = ReadByte(voltageBank[i], voltageRegister[i]); if ((vrmConfiguration & 0x01) == 0) - sensor.Value = 0.016f * value; // VRM8 formula + fvalue = 0.016f * value; // VRM8 formula else - sensor.Value = 0.00488f * value + 0.69f; // VRM9 formula + fvalue = 0.00488f * value + 0.69f; // VRM9 formula } else { - int value = ReadByte(0, (byte)(VOLTAGE_BASE_REG + sensor.Index)); - sensor.Value = 0.008f * voltageGains[sensor.Index] * value; + int value = ReadByte(voltageBank[i], voltageRegister[i]); + fvalue = voltageGain * value; } - if (sensor.Value > 0) - ActivateSensor(sensor); + if (fvalue > 0) + voltages[i] = fvalue; + else + voltages[i] = null; } else { // Battery voltage bool valid = (ReadByte(0, 0x5D) & 0x01) > 0; if (valid) { - sensor.Value = - 0.008f * voltageGains[sensor.Index] * ReadByte(5, 0x51); - ActivateSensor(sensor); + voltages[i] = voltageGain * ReadByte(5, VOLTAGE_VBAT_REG); } else { - sensor.Value = null; + voltages[i] = null; } } } - foreach (Sensor sensor in temperatures) { - int value = ((sbyte)ReadByte(TEMPERATURE_BANK[sensor.Index], - TEMPERATURE_REG[sensor.Index])) << 1; - if (TEMPERATURE_BANK[sensor.Index] > 0) - value |= ReadByte(TEMPERATURE_BANK[sensor.Index], - (byte)(TEMPERATURE_REG[sensor.Index] + 1)) >> 7; + for (int i = 0; i < temperatures.Length; i++) { + int value = ((sbyte)ReadByte(TEMPERATURE_BANK[i], + TEMPERATURE_REG[i])) << 1; + if (TEMPERATURE_BANK[i] > 0) + value |= ReadByte(TEMPERATURE_BANK[i], + (byte)(TEMPERATURE_REG[i] + 1)) >> 7; float temperature = value / 2.0f; - if (temperature <= 125 && temperature >= -55) { - sensor.Value = temperature + sensor.Parameters[0].Value; - ActivateSensor(sensor); + if (temperature <= 125 && temperature >= -55 && !peciTemperature[i]) { + temperatures[i] = temperature; } else { - sensor.Value = null; + temperatures[i] = null; } } @@ -259,21 +246,18 @@ for (int i = 0; i < FAN_BIT_REG.Length; i++) bits = (bits << 8) | ReadByte(0, FAN_BIT_REG[i]); ulong newBits = bits; - foreach (Sensor sensor in fans) { - int count = ReadByte(FAN_TACHO_BANK[sensor.Index], - FAN_TACHO_REG[sensor.Index]); + for (int i = 0; i < fans.Length; i++) { + int count = ReadByte(FAN_TACHO_BANK[i], FAN_TACHO_REG[i]); // assemble fan divisor int divisorBits = (int)( - (((bits >> FAN_DIV_BIT2[sensor.Index]) & 1) << 2) | - (((bits >> FAN_DIV_BIT1[sensor.Index]) & 1) << 1) | - ((bits >> FAN_DIV_BIT0[sensor.Index]) & 1)); + (((bits >> FAN_DIV_BIT2[i]) & 1) << 2) | + (((bits >> FAN_DIV_BIT1[i]) & 1) << 1) | + ((bits >> FAN_DIV_BIT0[i]) & 1)); int divisor = 1 << divisorBits; float value = (count < 0xff) ? 1.35e6f / (count * divisor) : 0; - sensor.Value = value; - if (value > 0) - ActivateSensor(sensor); + fans[i] = value; // update fan divisor if (count > 192 && divisorBits < 7) @@ -281,12 +265,9 @@ if (count < 96 && divisorBits > 0) divisorBits--; - newBits = SetBit(newBits, FAN_DIV_BIT2[sensor.Index], - (divisorBits >> 2) & 1); - newBits = SetBit(newBits, FAN_DIV_BIT1[sensor.Index], - (divisorBits >> 1) & 1); - newBits = SetBit(newBits, FAN_DIV_BIT0[sensor.Index], - divisorBits & 1); + newBits = SetBit(newBits, FAN_DIV_BIT2[i], (divisorBits >> 2) & 1); + newBits = SetBit(newBits, FAN_DIV_BIT1[i], (divisorBits >> 1) & 1); + newBits = SetBit(newBits, FAN_DIV_BIT0[i], divisorBits & 1); } // write new fan divisors @@ -300,7 +281,7 @@ } } - public override string GetReport() { + public string GetReport() { StringBuilder r = new StringBuilder(); r.AppendLine("LPC " + this.GetType().Name); @@ -337,5 +318,5 @@ return r.ToString(); } - } + } } diff -r efb1b414d33e -r 80065ab20b84 Hardware/Mainboard/Mainboard.cs --- a/Hardware/Mainboard/Mainboard.cs Sat May 29 13:49:20 2010 +0000 +++ b/Hardware/Mainboard/Mainboard.cs Thu Jun 03 22:40:18 2010 +0000 @@ -47,7 +47,8 @@ private string name; private Image icon; - private LPCIO lpcGroup; + private LPCIO lpcio; + private IHardware[] superIOHardware; public Mainboard() { this.smbios = new SMBIOS(); @@ -68,9 +69,14 @@ } this.icon = Utilities.EmbeddedResources.GetImage("mainboard.png"); - this.lpcGroup = new LPCIO( - smbios.Board != null ? smbios.Board.Manufacturer : Manufacturer.Unknown, - smbios.Board != null ? smbios.Board.Model : Model.Unknown); + this.lpcio = new LPCIO(); + ISuperIO[] superIO = lpcio.SuperIO; + superIOHardware = new IHardware[superIO.Length]; + for (int i = 0; i < superIO.Length; i++) + superIOHardware[i] = new SuperIOHardware(superIO[i], + smbios.Board != null ? smbios.Board.Manufacturer : + Manufacturer.Unknown, smbios.Board != null ? smbios.Board.Model : + Model.Unknown); } public string Name { @@ -92,7 +98,7 @@ r.AppendLine(); r.Append(smbios.GetReport()); - r.Append(lpcGroup.GetReport()); + r.Append(lpcio.GetReport()); return r.ToString(); } @@ -102,7 +108,7 @@ public void Close() { } public IHardware[] SubHardware { - get { return lpcGroup.Hardware; } + get { return superIOHardware; } } public ISensor[] Sensors { @@ -119,7 +125,7 @@ } public void Traverse(IVisitor visitor) { - foreach (IHardware hardware in lpcGroup.Hardware) + foreach (IHardware hardware in superIOHardware) hardware.Accept(visitor); } } diff -r efb1b414d33e -r 80065ab20b84 Hardware/Mainboard/Model.cs --- a/Hardware/Mainboard/Model.cs Sat May 29 13:49:20 2010 +0000 +++ b/Hardware/Mainboard/Model.cs Thu Jun 03 22:40:18 2010 +0000 @@ -5,14 +5,20 @@ namespace OpenHardwareMonitor.Hardware.Mainboard { public enum Model { + // ASUS + P5W_DH_Deluxe, + // DFI LP_BI_P45_T2RS_Elite, LP_DK_P55_T3eH9, // Gigabyte + _965P_S3, EP45_DS3R, + EP45_UD3R, GA_MA785GMT_UD2H, P35_DS3, + X38_DS5, // Unknown Unknown diff -r efb1b414d33e -r 80065ab20b84 Hardware/Mainboard/SMBIOS.cs --- a/Hardware/Mainboard/SMBIOS.cs Sat May 29 13:49:20 2010 +0000 +++ b/Hardware/Mainboard/SMBIOS.cs Thu Jun 03 22:40:18 2010 +0000 @@ -224,16 +224,24 @@ } switch (productName) { + case "P5W DH Deluxe": + model = Model.P5W_DH_Deluxe; break; case "LP BI P45-T2RS Elite": model = Model.LP_BI_P45_T2RS_Elite; break; case "LP DK P55-T3eH9": model = Model.LP_DK_P55_T3eH9; break; + case "965P-S3": + model = Model._965P_S3; break; case "EP45-DS3R": model = Model.EP45_DS3R; break; + case "EP45-UD3R": + model = Model.EP45_UD3R; break; case "GA-MA785GMT-UD2H": model = Model.GA_MA785GMT_UD2H; break; case "P35-DS3": model = Model.P35_DS3; break; + case "X38-DS5": + model = Model.X38_DS5; break; default: model = Model.Unknown; break; } diff -r efb1b414d33e -r 80065ab20b84 Hardware/Mainboard/SuperIOHardware.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Hardware/Mainboard/SuperIOHardware.cs Thu Jun 03 22:40:18 2010 +0000 @@ -0,0 +1,465 @@ +/* + + Version: MPL 1.1/GPL 2.0/LGPL 2.1 + + The contents of this file are subject to the Mozilla Public License Version + 1.1 (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + for the specific language governing rights and limitations under the License. + + The Original Code is the Open Hardware Monitor code. + + The Initial Developer of the Original Code is + Michael Möller . + Portions created by the Initial Developer are Copyright (C) 2009-2010 + the Initial Developer. All Rights Reserved. + + Contributor(s): + + Alternatively, the contents of this file may be used under the terms of + either the GNU General Public License Version 2 or later (the "GPL"), or + the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + in which case the provisions of the GPL or the LGPL are applicable instead + of those above. If you wish to allow use of your version of this file only + under the terms of either the GPL or the LGPL, and not to allow others to + use your version of this file under the terms of the MPL, indicate your + decision by deleting the provisions above and replace them with the notice + and other provisions required by the GPL or the LGPL. If you do not delete + the provisions above, a recipient may use your version of this file under + the terms of any one of the MPL, the GPL or the LGPL. + +*/ + +using System; +using System.Collections.Generic; +using System.Drawing; +using OpenHardwareMonitor.Hardware.LPC; + +namespace OpenHardwareMonitor.Hardware.Mainboard { + public class SuperIOHardware : Hardware { + + private ISuperIO superIO; + private Image icon; + protected readonly string name; + + private List voltages = new List(); + private List temperatures = new List(); + private List fans = new List(); + + public SuperIOHardware(ISuperIO superIO, Manufacturer manufacturer, + Model model) + { + this.superIO = superIO; + this.icon = Utilities.EmbeddedResources.GetImage("chip.png"); + + switch (superIO.Chip) { + case Chip.F71858: name = "Fintek F71858"; break; + case Chip.F71862: name = "Fintek F71862"; break; + case Chip.F71869: name = "Fintek F71869"; break; + case Chip.F71882: name = "Fintek F71882"; break; + case Chip.F71889ED: name = "Fintek F71889ED"; break; + case Chip.F71889F: name = "Fintek F71889F"; break; + case Chip.IT8712F: this.name = "ITE IT8712F"; break; + case Chip.IT8716F: this.name = "ITE IT8716F"; break; + case Chip.IT8718F: this.name = "ITE IT8718F"; break; + case Chip.IT8720F: this.name = "ITE IT8720F"; break; + case Chip.IT8726F: this.name = "ITE IT8726F"; break; + case Chip.W83627DHG: this.name = "Winbond W83627DHG"; break; + case Chip.W83627DHGP: this.name = "Winbond W83627DHG-P"; break; + case Chip.W83627EHF: this.name = "Winbond W83627EHF"; break; + case Chip.W83627HF: this.name = "Winbond W83627HF"; break; + case Chip.W83627THF: this.name = "Winbond W83627THF"; break; + case Chip.W83667HG: this.name = "Winbond W83667HG"; break; + case Chip.W83667HGB: this.name = "Winbond W83667HG-B"; break; + case Chip.W83687THF: this.name = "Winbond W83687THF"; break; + } + + List v = new List(); + List t = new List(); + List f = new List(); + + switch (superIO.Chip) { + case Chip.IT8712F: + case Chip.IT8716F: + case Chip.IT8718F: + case Chip.IT8720F: + case Chip.IT8726F: + switch (manufacturer) { + case Manufacturer.DFI: + switch (model) { + case Model.LP_BI_P45_T2RS_Elite: + v.Add(new Voltage("CPU VCore", 0)); + v.Add(new Voltage("FSB VTT", 1)); + v.Add(new Voltage("+3.3V", 2)); + v.Add(new Voltage("+5V", 3, 6.8f, 10, 0)); + v.Add(new Voltage("+12V", 4, 30, 10, 0)); + v.Add(new Voltage("NB Core", 5)); + v.Add(new Voltage("VDIMM", 6)); + v.Add(new Voltage("+5VSB", 7, 6.8f, 10, 0)); + v.Add(new Voltage("VBat", 8)); + t.Add(new Temperature("CPU", 0)); + t.Add(new Temperature("System", 1)); + t.Add(new Temperature("Chipset", 2)); + f.Add(new Fan("Fan #1", 0)); + f.Add(new Fan("Fan #2", 1)); + f.Add(new Fan("Fan #3", 2)); + break; + case Model.LP_DK_P55_T3eH9: + v.Add(new Voltage("CPU VCore", 0)); + v.Add(new Voltage("VTT", 1)); + v.Add(new Voltage("+3.3V", 2)); + v.Add(new Voltage("+5V", 3, 6.8f, 10, 0)); + v.Add(new Voltage("+12V", 4, 30, 10, 0)); + v.Add(new Voltage("CPU PLL", 5)); + v.Add(new Voltage("DRAM", 6)); + v.Add(new Voltage("+5VSB", 7, 6.8f, 10, 0)); + v.Add(new Voltage("VBat", 8)); + t.Add(new Temperature("Chipset", 0)); + t.Add(new Temperature("CPU PWM", 1)); + t.Add(new Temperature("CPU", 2)); + f.Add(new Fan("Fan #1", 0)); + f.Add(new Fan("Fan #2", 1)); + f.Add(new Fan("Fan #3", 2)); + break; + default: + v.Add(new Voltage("CPU VCore", 0)); + v.Add(new Voltage("VTT", 1, true)); + v.Add(new Voltage("+3.3V", 2, true)); + v.Add(new Voltage("+5V", 3, 6.8f, 10, 0, true)); + v.Add(new Voltage("+12V", 4, 30, 10, 0, true)); + v.Add(new Voltage("Voltage #6", 5, true)); + v.Add(new Voltage("DRAM", 6, true)); + v.Add(new Voltage("+5VSB", 7, 6.8f, 10, 0, true)); + v.Add(new Voltage("VBat", 8)); + for (int i = 0; i < superIO.Temperatures.Length; i++) + t.Add(new Temperature("Temperature #" + (i + 1), i)); + for (int i = 0; i < superIO.Fans.Length; i++) + f.Add(new Fan("Fan #" + (i + 1), i)); + break; + } + break; + + case Manufacturer.Gigabyte: + switch (model) { + case Model._965P_S3: + v.Add(new Voltage("CPU VCore", 0)); + v.Add(new Voltage("DRAM", 1)); + v.Add(new Voltage("+3.3V", 2)); + v.Add(new Voltage("+5V", 3, 6.8f, 10, 0)); + v.Add(new Voltage("+12V", 7, 27, 9.1f, 0)); + v.Add(new Voltage("VBat", 8)); + t.Add(new Temperature("System", 0)); + t.Add(new Temperature("CPU", 1)); + f.Add(new Fan("CPU Fan", 0)); + f.Add(new Fan("System Fan", 1)); + break; + case Model.EP45_DS3R: + case Model.EP45_UD3R: + case Model.X38_DS5: + v.Add(new Voltage("CPU VCore", 0)); + v.Add(new Voltage("DRAM", 1)); + v.Add(new Voltage("+3.3V", 2)); + v.Add(new Voltage("+5V", 3, 6.8f, 10, 0)); + v.Add(new Voltage("+12V", 7, 27, 9.1f, 0)); + v.Add(new Voltage("VBat", 8)); + t.Add(new Temperature("System", 0)); + t.Add(new Temperature("CPU", 1)); + f.Add(new Fan("CPU Fan", 0)); + f.Add(new Fan("System Fan #2", 1)); + f.Add(new Fan("Power Fan", 2)); + f.Add(new Fan("System Fan #1", 3)); + break; + case Model.P35_DS3: + v.Add(new Voltage("CPU VCore", 0)); + v.Add(new Voltage("DRAM", 1)); + v.Add(new Voltage("+3.3V", 2)); + v.Add(new Voltage("+5V", 3, 6.8f, 10, 0)); + v.Add(new Voltage("+12V", 7, 27, 9.1f, 0)); + v.Add(new Voltage("VBat", 8)); + t.Add(new Temperature("System", 0)); + t.Add(new Temperature("CPU", 1)); + f.Add(new Fan("CPU Fan", 0)); + f.Add(new Fan("System Fan #1", 1)); + f.Add(new Fan("System Fan #2", 2)); + f.Add(new Fan("Power Fan", 3)); + break; + case Model.GA_MA785GMT_UD2H: + v.Add(new Voltage("CPU VCore", 0)); + v.Add(new Voltage("DRAM", 1)); + v.Add(new Voltage("+3.3V", 2)); + v.Add(new Voltage("+5V", 3, 6.8f, 10, 0)); + v.Add(new Voltage("+12V", 4, 27, 9.1f, 0)); + v.Add(new Voltage("VBat", 8)); + t.Add(new Temperature("System", 0)); + t.Add(new Temperature("CPU", 1)); + f.Add(new Fan("CPU Fan", 0)); + f.Add(new Fan("System Fan", 1)); + f.Add(new Fan("NB Fan", 2)); + break; + default: + v.Add(new Voltage("CPU VCore", 0)); + v.Add(new Voltage("DRAM", 1, true)); + v.Add(new Voltage("+3.3V", 2, true)); + v.Add(new Voltage("+5V", 3, 6.8f, 10, 0, true)); + v.Add(new Voltage("Voltage #5", 4, true)); + v.Add(new Voltage("Voltage #6", 5, true)); + v.Add(new Voltage("Voltage #7", 6, true)); + v.Add(new Voltage("+12V", 7, 27, 9.1f, 0, true)); + v.Add(new Voltage("VBat", 8)); + for (int i = 0; i < superIO.Temperatures.Length; i++) + t.Add(new Temperature("Temperature #" + (i + 1), i)); + for (int i = 0; i < superIO.Fans.Length; i++) + f.Add(new Fan("Fan #" + (i + 1), i)); + break; + } + break; + + default: + v.Add(new Voltage("CPU VCore", 0)); + v.Add(new Voltage("Voltage #2", 1, true)); + v.Add(new Voltage("Voltage #3", 2, true)); + v.Add(new Voltage("Voltage #4", 3, true)); + v.Add(new Voltage("Voltage #5", 4, true)); + v.Add(new Voltage("Voltage #6", 5, true)); + v.Add(new Voltage("Voltage #7", 6, true)); + v.Add(new Voltage("Voltage #8", 7, true)); + v.Add(new Voltage("VBat", 8)); + for (int i = 0; i < superIO.Temperatures.Length; i++) + t.Add(new Temperature("Temperature #" + (i + 1), i)); + for (int i = 0; i < superIO.Fans.Length; i++) + f.Add(new Fan("Fan #" + (i + 1), i)); + break; + } + break; + + case Chip.F71858: + v.Add(new Voltage("VCC3V", 0)); + v.Add(new Voltage("VSB3V", 1)); + v.Add(new Voltage("Battery", 2)); + for (int i = 0; i < superIO.Temperatures.Length; i++) + t.Add(new Temperature("Temperature #" + (i + 1), i)); + for (int i = 0; i < superIO.Fans.Length; i++) + f.Add(new Fan("Fan #" + (i + 1), i)); + break; + case Chip.F71862: + case Chip.F71869: + case Chip.F71882: + case Chip.F71889ED: + case Chip.F71889F: + v.Add(new Voltage("VCC3V", 0)); + v.Add(new Voltage("CPU VCore", 1)); + v.Add(new Voltage("Voltage #3", 2, true)); + v.Add(new Voltage("Voltage #4", 3, true)); + v.Add(new Voltage("Voltage #5", 4, true)); + v.Add(new Voltage("Voltage #6", 5, true)); + v.Add(new Voltage("Voltage #7", 6, true)); + v.Add(new Voltage("VSB3V", 7)); + v.Add(new Voltage("Battery", 8)); + for (int i = 0; i < superIO.Temperatures.Length; i++) + t.Add(new Temperature("Temperature #" + (i + 1), i)); + for (int i = 0; i < superIO.Fans.Length; i++) + f.Add(new Fan("Fan #" + (i + 1), i)); + break; + + case Chip.W83627EHF: + v.Add(new Voltage("CPU VCore", 0)); + v.Add(new Voltage("Voltage #2", 1, true)); + v.Add(new Voltage("AVCC", 2, 34, 34, 0)); + v.Add(new Voltage("3VCC", 3, 34, 34, 0)); + v.Add(new Voltage("Voltage #5", 4, true)); + v.Add(new Voltage("Voltage #6", 5, true)); + v.Add(new Voltage("Voltage #7", 6, true)); + v.Add(new Voltage("3VSB", 7, 34, 34, 0)); + v.Add(new Voltage("VBAT", 8, 34, 34, 0)); + v.Add(new Voltage("Voltage #10", 9, true)); + t.Add(new Temperature("CPU", 0)); + t.Add(new Temperature("Auxiliary", 1)); + t.Add(new Temperature("System", 2)); + f.Add(new Fan("System", 0)); + f.Add(new Fan("CPU", 1)); + f.Add(new Fan("Auxiliary", 2)); + f.Add(new Fan("CPU #2", 3)); + f.Add(new Fan("Auxiliary #2", 4)); + break; + case Chip.W83627DHG: + case Chip.W83627DHGP: + case Chip.W83667HG: + case Chip.W83667HGB: + v.Add(new Voltage("CPU VCore", 0)); + v.Add(new Voltage("Voltage #2", 1, true)); + v.Add(new Voltage("AVCC", 2, 34, 34, 0)); + v.Add(new Voltage("3VCC", 3, 34, 34, 0)); + v.Add(new Voltage("Voltage #5", 4, true)); + v.Add(new Voltage("Voltage #6", 5, true)); + v.Add(new Voltage("Voltage #7", 6, true)); + v.Add(new Voltage("3VSB", 7, 34, 34, 0)); + v.Add(new Voltage("VBAT", 8, 34, 34, 0)); + t.Add(new Temperature("CPU", 0)); + t.Add(new Temperature("Auxiliary", 1)); + t.Add(new Temperature("System", 2)); + f.Add(new Fan("System", 0)); + f.Add(new Fan("CPU", 1)); + f.Add(new Fan("Auxiliary", 2)); + f.Add(new Fan("CPU #2", 3)); + f.Add(new Fan("Auxiliary #2", 4)); + break; + case Chip.W83627HF: + case Chip.W83627THF: + case Chip.W83687THF: + v.Add(new Voltage("CPU VCore", 0)); + v.Add(new Voltage("Voltage #2", 1, true)); + v.Add(new Voltage("Voltage #3", 2, true)); + v.Add(new Voltage("AVCC", 3, 34, 51, 0)); + v.Add(new Voltage("Voltage #5", 4, true)); + v.Add(new Voltage("5VSB", 5, 34, 51, 0)); + v.Add(new Voltage("VBAT", 6)); + t.Add(new Temperature("CPU", 0)); + t.Add(new Temperature("Auxiliary", 1)); + t.Add(new Temperature("System", 2)); + f.Add(new Fan("System", 0)); + f.Add(new Fan("CPU", 1)); + f.Add(new Fan("Auxiliary", 2)); + break; + default: + for (int i = 0; i < superIO.Voltages.Length; i++) + v.Add(new Voltage("Voltage #" + (i + 1), i, true)); + for (int i = 0; i < superIO.Temperatures.Length; i++) + t.Add(new Temperature("Temperature #" + (i + 1), i)); + for (int i = 0; i < superIO.Fans.Length; i++) + f.Add(new Fan("Fan #" + (i + 1), i)); + break; + } + + string formula = "Voltage = value + (value - Vf) * Ri / Rf."; + foreach (Voltage voltage in v) + if (voltage.Index < superIO.Voltages.Length) { + Sensor sensor = new Sensor(voltage.Name, voltage.Index, + voltage.Hidden, null, SensorType.Voltage, this, + new ParameterDescription[] { + new ParameterDescription("Ri [kΩ]", "Input resistance.\n" + + formula, voltage.Ri), + new ParameterDescription("Rf [kΩ]", "Reference resistance.\n" + + formula, voltage.Rf), + new ParameterDescription("Vf [V]", "Reference voltage.\n" + + formula, voltage.Vf) + }); + voltages.Add(sensor); + } + + foreach (Temperature temperature in t) + if (temperature.Index < superIO.Temperatures.Length) { + Sensor sensor = new Sensor(temperature.Name, temperature.Index, null, + SensorType.Temperature, this, new ParameterDescription[] { + new ParameterDescription("Offset [°C]", "Temperature offset.", 0) + }); + temperatures.Add(sensor); + } + + foreach (Fan fan in f) + if (fan.Index < superIO.Fans.Length) { + Sensor sensor = new Sensor(fan.Name, fan.Index, null, SensorType.Fan, + this, null); + fans.Add(sensor); + } + } + + public override Identifier Identifier { + get { return new Identifier("lpc", superIO.Chip.ToString().ToLower()); } + } + + public override Image Icon { + get { return icon; } + } + + public override string Name { + get { return name; } + } + + public override string GetReport() { + return superIO.GetReport(); + } + + public override void Update() { + superIO.Update(); + + foreach (Sensor sensor in voltages) { + float? value = superIO.Voltages[sensor.Index]; + if (value.HasValue) { + sensor.Value = value + (value - sensor.Parameters[2].Value) * + sensor.Parameters[0].Value / sensor.Parameters[1].Value; + ActivateSensor(sensor); + } + } + + foreach (Sensor sensor in temperatures) { + float? value = superIO.Temperatures[sensor.Index]; + if (value.HasValue) { + sensor.Value = value + sensor.Parameters[0].Value; + ActivateSensor(sensor); + } + } + + foreach (Sensor sensor in fans) { + float? value = superIO.Fans[sensor.Index]; + if (value.HasValue) { + sensor.Value = value; + if (value.Value > 0) + ActivateSensor(sensor); + } + } + } + + private class Voltage { + public readonly string Name; + public readonly int Index; + public readonly float Ri; + public readonly float Rf; + public readonly float Vf; + public readonly bool Hidden; + + public Voltage(string name, int index) : + this(name, index, 0, 1, 0, false) { } + + public Voltage(string name, int index, bool hidden) : + this(name, index, 0, 1, 0, hidden) { } + + public Voltage(string name, int index, float ri, float rf, float vf) : + this(name, index, ri, rf, vf, false) { } + + public Voltage(string name, int index, float ri, float rf, float vf, + bool hidden) { + this.Name = name; + this.Index = index; + this.Ri = ri; + this.Rf = rf; + this.Vf = vf; + this.Hidden = hidden; + } + } + + private class Temperature { + public readonly string Name; + public readonly int Index; + + public Temperature(string name, int index) { + this.Name = name; + this.Index = index; + } + } + + private class Fan { + public readonly string Name; + public readonly int Index; + + public Fan(string name, int index) { + this.Name = name; + this.Index = index; + } + } + } +} diff -r efb1b414d33e -r 80065ab20b84 OpenHardwareMonitor.csproj --- a/OpenHardwareMonitor.csproj Sat May 29 13:49:20 2010 +0000 +++ b/OpenHardwareMonitor.csproj Thu Jun 03 22:40:18 2010 +0000 @@ -52,10 +52,12 @@ + + @@ -94,7 +96,8 @@ - + +