Added initial support for W83627HF. Some refactoring for IHardware classes.
1.1 --- a/Hardware/ATI/ATIGPU.cs Sun Feb 07 19:48:32 2010 +0000
1.2 +++ b/Hardware/ATI/ATIGPU.cs Sun Feb 07 19:53:51 2010 +0000
1.3 @@ -41,7 +41,7 @@
1.4 using System.Reflection;
1.5
1.6 namespace OpenHardwareMonitor.Hardware.ATI {
1.7 - public class ATIGPU : IHardware {
1.8 + public class ATIGPU : Hardware, IHardware {
1.9
1.10 private string name;
1.11 private Image icon;
1.12 @@ -55,8 +55,6 @@
1.13 private Sensor coreVoltage;
1.14 private Sensor coreLoad;
1.15
1.16 - private List<ISensor> active = new List<ISensor>();
1.17 -
1.18 public ATIGPU(string name, int adapterIndex, int busNumber,
1.19 int deviceNumber)
1.20 {
1.21 @@ -95,10 +93,6 @@
1.22 get { return icon; }
1.23 }
1.24
1.25 - public ISensor[] Sensors {
1.26 - get { return active.ToArray(); }
1.27 - }
1.28 -
1.29 public string GetReport() {
1.30 return null;
1.31 }
1.32 @@ -144,24 +138,5 @@
1.33 DeactivateSensor(coreLoad);
1.34 }
1.35 }
1.36 -
1.37 - private void ActivateSensor(Sensor sensor) {
1.38 - if (!active.Contains(sensor)) {
1.39 - active.Add(sensor);
1.40 - if (SensorAdded != null)
1.41 - SensorAdded(sensor);
1.42 - }
1.43 - }
1.44 -
1.45 - private void DeactivateSensor(Sensor sensor) {
1.46 - if (active.Contains(sensor)) {
1.47 - active.Remove(sensor);
1.48 - if (SensorRemoved != null)
1.49 - SensorRemoved(sensor);
1.50 - }
1.51 - }
1.52 -
1.53 - public event SensorEventHandler SensorAdded;
1.54 - public event SensorEventHandler SensorRemoved;
1.55 }
1.56 }
2.1 --- a/Hardware/CPU/AMD0FCPU.cs Sun Feb 07 19:48:32 2010 +0000
2.2 +++ b/Hardware/CPU/AMD0FCPU.cs Sun Feb 07 19:53:51 2010 +0000
2.3 @@ -43,7 +43,7 @@
2.4
2.5
2.6 namespace OpenHardwareMonitor.Hardware.CPU {
2.7 - public class AMD0FCPU : IHardware {
2.8 + public class AMD0FCPU : Hardware, IHardware {
2.9
2.10 private string name;
2.11 private Image icon;
2.12 @@ -56,8 +56,6 @@
2.13 private Sensor totalLoad;
2.14 private Sensor[] coreLoads;
2.15
2.16 - private List<ISensor> active = new List<ISensor>();
2.17 -
2.18 private CPULoad cpuLoad;
2.19
2.20 private const ushort PCI_AMD_VENDOR_ID = 0x1022;
2.21 @@ -121,10 +119,6 @@
2.22 get { return icon; }
2.23 }
2.24
2.25 - public ISensor[] Sensors {
2.26 - get { return active.ToArray(); }
2.27 - }
2.28 -
2.29 public string GetReport() {
2.30 return null;
2.31 }
2.32 @@ -154,26 +148,6 @@
2.33 coreLoads[i].Value = cpuLoad.GetCoreLoad(i);
2.34 totalLoad.Value = cpuLoad.GetTotalLoad();
2.35 }
2.36 - }
2.37 -
2.38 - private void ActivateSensor(Sensor sensor) {
2.39 - if (!active.Contains(sensor)) {
2.40 - active.Add(sensor);
2.41 - if (SensorAdded != null)
2.42 - SensorAdded(sensor);
2.43 - }
2.44 - }
2.45 -
2.46 - private void DeactivateSensor(Sensor sensor) {
2.47 - if (active.Contains(sensor)) {
2.48 - active.Remove(sensor);
2.49 - if (SensorRemoved != null)
2.50 - SensorRemoved(sensor);
2.51 - }
2.52 - }
2.53 -
2.54 - public event SensorEventHandler SensorAdded;
2.55 - public event SensorEventHandler SensorRemoved;
2.56 -
2.57 + }
2.58 }
2.59 }
3.1 --- a/Hardware/CPU/AMD10CPU.cs Sun Feb 07 19:48:32 2010 +0000
3.2 +++ b/Hardware/CPU/AMD10CPU.cs Sun Feb 07 19:53:51 2010 +0000
3.3 @@ -43,7 +43,7 @@
3.4
3.5 namespace OpenHardwareMonitor.Hardware.CPU {
3.6
3.7 - public class AMD10CPU : IHardware {
3.8 + public class AMD10CPU : Hardware, IHardware {
3.9 private string name;
3.10 private Image icon;
3.11
3.12 @@ -53,8 +53,6 @@
3.13 private Sensor totalLoad;
3.14 private Sensor[] coreLoads;
3.15
3.16 - private List<ISensor> active = new List<ISensor>();
3.17 -
3.18 private CPULoad cpuLoad;
3.19
3.20 private const ushort PCI_AMD_VENDOR_ID = 0x1022;
3.21 @@ -107,10 +105,6 @@
3.22 get { return icon; }
3.23 }
3.24
3.25 - public ISensor[] Sensors {
3.26 - get { return active.ToArray(); }
3.27 - }
3.28 -
3.29 public string GetReport() {
3.30 return null;
3.31 }
3.32 @@ -135,25 +129,5 @@
3.33 totalLoad.Value = cpuLoad.GetTotalLoad();
3.34 }
3.35 }
3.36 -
3.37 - private void ActivateSensor(Sensor sensor) {
3.38 - if (!active.Contains(sensor)) {
3.39 - active.Add(sensor);
3.40 - if (SensorAdded != null)
3.41 - SensorAdded(sensor);
3.42 - }
3.43 - }
3.44 -
3.45 - private void DeactivateSensor(Sensor sensor) {
3.46 - if (active.Contains(sensor)) {
3.47 - active.Remove(sensor);
3.48 - if (SensorRemoved != null)
3.49 - SensorRemoved(sensor);
3.50 - }
3.51 - }
3.52 -
3.53 - public event SensorEventHandler SensorAdded;
3.54 - public event SensorEventHandler SensorRemoved;
3.55 -
3.56 }
3.57 }
4.1 --- a/Hardware/CPU/IntelCPU.cs Sun Feb 07 19:48:32 2010 +0000
4.2 +++ b/Hardware/CPU/IntelCPU.cs Sun Feb 07 19:53:51 2010 +0000
4.3 @@ -43,7 +43,7 @@
4.4 using System.Text;
4.5
4.6 namespace OpenHardwareMonitor.Hardware.CPU {
4.7 - public class IntelCPU : IHardware {
4.8 + public class IntelCPU : Hardware, IHardware {
4.9
4.10 private string name;
4.11 private Image icon;
4.12 @@ -52,8 +52,6 @@
4.13 private Sensor totalLoad;
4.14 private Sensor[] coreLoads;
4.15
4.16 - private List<ISensor> active = new List<ISensor>();
4.17 -
4.18 private float tjMax = 0;
4.19 private uint logicalProcessors;
4.20 private uint logicalProcessorsPerCore;
4.21 @@ -165,10 +163,6 @@
4.22 get { return icon; }
4.23 }
4.24
4.25 - public ISensor[] Sensors {
4.26 - get { return active.ToArray(); }
4.27 - }
4.28 -
4.29 public string GetReport() {
4.30 StringBuilder r = new StringBuilder();
4.31
4.32 @@ -210,25 +204,6 @@
4.33 coreLoads[i].Value = cpuLoad.GetCoreLoad(i);
4.34 totalLoad.Value = cpuLoad.GetTotalLoad();
4.35 }
4.36 - }
4.37 -
4.38 - private void ActivateSensor(Sensor sensor) {
4.39 - if (!active.Contains(sensor)) {
4.40 - active.Add(sensor);
4.41 - if (SensorAdded != null)
4.42 - SensorAdded(sensor);
4.43 - }
4.44 - }
4.45 -
4.46 - private void DeactivateSensor(Sensor sensor) {
4.47 - if (active.Contains(sensor)) {
4.48 - active.Remove(sensor);
4.49 - if (SensorRemoved != null)
4.50 - SensorRemoved(sensor);
4.51 - }
4.52 - }
4.53 -
4.54 - public event SensorEventHandler SensorAdded;
4.55 - public event SensorEventHandler SensorRemoved;
4.56 + }
4.57 }
4.58 }
5.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
5.2 +++ b/Hardware/Hardware.cs Sun Feb 07 19:53:51 2010 +0000
5.3 @@ -0,0 +1,69 @@
5.4 +/*
5.5 +
5.6 + Version: MPL 1.1/GPL 2.0/LGPL 2.1
5.7 +
5.8 + The contents of this file are subject to the Mozilla Public License Version
5.9 + 1.1 (the "License"); you may not use this file except in compliance with
5.10 + the License. You may obtain a copy of the License at
5.11 +
5.12 + http://www.mozilla.org/MPL/
5.13 +
5.14 + Software distributed under the License is distributed on an "AS IS" basis,
5.15 + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
5.16 + for the specific language governing rights and limitations under the License.
5.17 +
5.18 + The Original Code is the Open Hardware Monitor code.
5.19 +
5.20 + The Initial Developer of the Original Code is
5.21 + Michael Möller <m.moeller@gmx.ch>.
5.22 + Portions created by the Initial Developer are Copyright (C) 2009-2010
5.23 + the Initial Developer. All Rights Reserved.
5.24 +
5.25 + Contributor(s):
5.26 +
5.27 + Alternatively, the contents of this file may be used under the terms of
5.28 + either the GNU General Public License Version 2 or later (the "GPL"), or
5.29 + the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
5.30 + in which case the provisions of the GPL or the LGPL are applicable instead
5.31 + of those above. If you wish to allow use of your version of this file only
5.32 + under the terms of either the GPL or the LGPL, and not to allow others to
5.33 + use your version of this file under the terms of the MPL, indicate your
5.34 + decision by deleting the provisions above and replace them with the notice
5.35 + and other provisions required by the GPL or the LGPL. If you do not delete
5.36 + the provisions above, a recipient may use your version of this file under
5.37 + the terms of any one of the MPL, the GPL or the LGPL.
5.38 +
5.39 +*/
5.40 +
5.41 +using System;
5.42 +using System.Collections.Generic;
5.43 +
5.44 +namespace OpenHardwareMonitor.Hardware {
5.45 + public abstract class Hardware {
5.46 +
5.47 + private List<ISensor> active = new List<ISensor>();
5.48 +
5.49 + public ISensor[] Sensors {
5.50 + get { return active.ToArray(); }
5.51 + }
5.52 +
5.53 + protected void ActivateSensor(Sensor sensor) {
5.54 + if (!active.Contains(sensor)) {
5.55 + active.Add(sensor);
5.56 + if (SensorAdded != null)
5.57 + SensorAdded(sensor);
5.58 + }
5.59 + }
5.60 +
5.61 + protected void DeactivateSensor(Sensor sensor) {
5.62 + if (active.Contains(sensor)) {
5.63 + active.Remove(sensor);
5.64 + if (SensorRemoved != null)
5.65 + SensorRemoved(sensor);
5.66 + }
5.67 + }
5.68 +
5.69 + public event SensorEventHandler SensorAdded;
5.70 + public event SensorEventHandler SensorRemoved;
5.71 + }
5.72 +}
6.1 --- a/Hardware/LPC/Chip.cs Sun Feb 07 19:48:32 2010 +0000
6.2 +++ b/Hardware/LPC/Chip.cs Sun Feb 07 19:53:51 2010 +0000
6.3 @@ -13,6 +13,7 @@
6.4 IT8726F = 0x8726,
6.5 W83627DHG = 0xA020,
6.6 W83627DHGP = 0xB070,
6.7 + W83627HF = 0x5200,
6.8 F71862 = 0x0601,
6.9 F71869 = 0x0814,
6.10 F71882 = 0x0541,
7.1 --- a/Hardware/LPC/F718XX.cs Sun Feb 07 19:48:32 2010 +0000
7.2 +++ b/Hardware/LPC/F718XX.cs Sun Feb 07 19:53:51 2010 +0000
7.3 @@ -41,16 +41,10 @@
7.4 using System.Text;
7.5
7.6 namespace OpenHardwareMonitor.Hardware.LPC {
7.7 - public class F718XX : IHardware {
7.8 + public class F718XX : LPCHardware, IHardware {
7.9
7.10 - private string name;
7.11 - private Image icon;
7.12 -
7.13 - private Chip chip;
7.14 private ushort address;
7.15
7.16 - private List<ISensor> active = new List<ISensor>();
7.17 -
7.18 private Sensor[] temperatures;
7.19 private Sensor[] fans;
7.20 private Sensor[] voltages;
7.21 @@ -71,18 +65,9 @@
7.22 return WinRing0.ReadIoPortByte((ushort)(address + DATA_REGISTER_OFFSET));
7.23 }
7.24
7.25 - public F718XX(Chip chip, ushort address) {
7.26 - this.chip = chip;
7.27 + public F718XX(Chip chip, ushort address) : base(chip) {
7.28 this.address = address;
7.29
7.30 - switch (chip) {
7.31 - case Chip.F71862: name = "Fintek F71862"; break;
7.32 - case Chip.F71869: name = "Fintek F71869"; break;
7.33 - case Chip.F71882: name = "Fintek F71882"; break;
7.34 - case Chip.F71889: name = "Fintek F71889"; break;
7.35 - default: return;
7.36 - }
7.37 -
7.38 temperatures = new Sensor[3];
7.39 for (int i = 0; i < temperatures.Length; i++)
7.40 temperatures[i] = new Sensor("Temperature #" + (i + 1), i,
7.41 @@ -98,30 +83,12 @@
7.42 voltages[1] = new Sensor("CPU VCore", 1, SensorType.Voltage, this);
7.43 voltages[2] = new Sensor("VSB3V", 7, SensorType.Voltage, this);
7.44 voltages[3] = new Sensor("Battery", 8, SensorType.Voltage, this);
7.45 -
7.46 - this.icon = Utilities.EmbeddedResources.GetImage("chip.png");
7.47 - }
7.48 -
7.49 - public string Name {
7.50 - get { return name; }
7.51 - }
7.52 -
7.53 - public string Identifier {
7.54 - get { return "/lpc/" + chip.ToString().ToLower(); }
7.55 - }
7.56 -
7.57 - public Image Icon {
7.58 - get { return icon; }
7.59 - }
7.60 -
7.61 - public ISensor[] Sensors {
7.62 - get { return active.ToArray(); }
7.63 }
7.64
7.65 public string GetReport() {
7.66 StringBuilder r = new StringBuilder();
7.67
7.68 - r.AppendLine("LPC F718XX");
7.69 + r.AppendLine("LPC " + this.GetType().Name);
7.70 r.AppendLine();
7.71 r.Append("Base Adress: 0x"); r.AppendLine(address.ToString("X4"));
7.72 r.AppendLine();
7.73 @@ -175,25 +142,5 @@
7.74 }
7.75 }
7.76 }
7.77 -
7.78 - private void ActivateSensor(Sensor sensor) {
7.79 - if (!active.Contains(sensor)) {
7.80 - active.Add(sensor);
7.81 - if (SensorAdded != null)
7.82 - SensorAdded(sensor);
7.83 - }
7.84 - }
7.85 -
7.86 - private void DeactivateSensor(Sensor sensor) {
7.87 - if (active.Contains(sensor)) {
7.88 - active.Remove(sensor);
7.89 - if (SensorRemoved != null)
7.90 - SensorRemoved(sensor);
7.91 - }
7.92 - }
7.93 -
7.94 - public event SensorEventHandler SensorAdded;
7.95 - public event SensorEventHandler SensorRemoved;
7.96 -
7.97 }
7.98 }
8.1 --- a/Hardware/LPC/IT87XX.cs Sun Feb 07 19:48:32 2010 +0000
8.2 +++ b/Hardware/LPC/IT87XX.cs Sun Feb 07 19:53:51 2010 +0000
8.3 @@ -41,19 +41,14 @@
8.4 using System.Text;
8.5
8.6 namespace OpenHardwareMonitor.Hardware.LPC {
8.7 - public class IT87XX : IHardware {
8.8 -
8.9 - private string name;
8.10 - private Image icon;
8.11 + public class IT87XX : LPCHardware, IHardware {
8.12
8.13 private bool available = false;
8.14 - private Chip chip;
8.15 private ushort address;
8.16
8.17 private Sensor[] temperatures;
8.18 private Sensor[] fans;
8.19 private Sensor[] voltages;
8.20 - private List<ISensor> active = new List<ISensor>();
8.21 private float[] voltageGains;
8.22
8.23 // Consts
8.24 @@ -80,18 +75,9 @@
8.25 return WinRing0.ReadIoPortByte((ushort)(address + DATA_REGISTER_OFFSET));
8.26 }
8.27
8.28 - public IT87XX(Chip chip, ushort address) {
8.29 + public IT87XX(Chip chip, ushort address) : base (chip) {
8.30
8.31 - this.chip = chip;
8.32 this.address = address;
8.33 -
8.34 - switch (chip) {
8.35 - case Chip.IT8716F: name = "ITE IT8716F"; break;
8.36 - case Chip.IT8718F: name = "ITE IT8718F"; break;
8.37 - case Chip.IT8720F: name = "ITE IT8720F"; break;
8.38 - case Chip.IT8726F: name = "ITE IT8726F"; break;
8.39 - default: return;
8.40 - }
8.41
8.42 // Check vendor id
8.43 byte vendorId = ReadByte(VENDOR_ID_REGISTER);
8.44 @@ -119,33 +105,16 @@
8.45 voltages[1] = new Sensor("Battery", 8, SensorType.Voltage, this);
8.46
8.47 available = true;
8.48 - icon = Utilities.EmbeddedResources.GetImage("chip.png");
8.49 }
8.50
8.51 public bool IsAvailable {
8.52 get { return available; }
8.53 }
8.54
8.55 - public string Name {
8.56 - get { return name; }
8.57 - }
8.58 -
8.59 - public string Identifier {
8.60 - get { return "/lpc/" + chip.ToString().ToLower(); }
8.61 - }
8.62 -
8.63 - public Image Icon {
8.64 - get { return icon; }
8.65 - }
8.66 -
8.67 - public ISensor[] Sensors {
8.68 - get { return active.ToArray(); }
8.69 - }
8.70 -
8.71 public string GetReport() {
8.72 StringBuilder r = new StringBuilder();
8.73
8.74 - r.AppendLine("LPC IT87XX");
8.75 + r.AppendLine("LPC " + this.GetType().Name);
8.76 r.AppendLine();
8.77 r.Append("Chip ID: 0x"); r.AppendLine(chip.ToString("X"));
8.78 r.Append("Chip Name: "); r.AppendLine(name);
8.79 @@ -200,26 +169,6 @@
8.80 DeactivateSensor(sensor);
8.81 }
8.82 }
8.83 - }
8.84 -
8.85 - private void ActivateSensor(Sensor sensor) {
8.86 - if (!active.Contains(sensor)) {
8.87 - active.Add(sensor);
8.88 - if (SensorAdded != null)
8.89 - SensorAdded(sensor);
8.90 - }
8.91 - }
8.92 -
8.93 - private void DeactivateSensor(Sensor sensor) {
8.94 - if (active.Contains(sensor)) {
8.95 - active.Remove(sensor);
8.96 - if (SensorRemoved != null)
8.97 - SensorRemoved(sensor);
8.98 - }
8.99 - }
8.100 -
8.101 - public event SensorEventHandler SensorAdded;
8.102 - public event SensorEventHandler SensorRemoved;
8.103 -
8.104 + }
8.105 }
8.106 }
9.1 --- a/Hardware/LPC/LPCGroup.cs Sun Feb 07 19:48:32 2010 +0000
9.2 +++ b/Hardware/LPC/LPCGroup.cs Sun Feb 07 19:53:51 2010 +0000
9.3 @@ -93,7 +93,7 @@
9.4 private const byte FINTEK_VENDOR_ID_REGISTER = 0x23;
9.5 private const ushort FINTEK_VENDOR_ID = 0x1934;
9.6
9.7 - private const byte W83627DHG_HARDWARE_MONITOR_LDN = 0x0B;
9.8 + private const byte W83627_HARDWARE_MONITOR_LDN = 0x0B;
9.9
9.10 private const byte F71858_HARDWARE_MONITOR_LDN = 0x02;
9.11 private const byte FINTEK_HARDWARE_MONITOR_LDN = 0x04;
9.12 @@ -165,11 +165,23 @@
9.13 logicalDeviceNumber = 0;
9.14 break;
9.15 } break;
9.16 + case 0x52:
9.17 + switch (revision) {
9.18 + case 0x17:
9.19 + case 0x3A:
9.20 + chip = Chip.W83627HF;
9.21 + logicalDeviceNumber = W83627_HARDWARE_MONITOR_LDN;
9.22 + break;
9.23 + default:
9.24 + chip = Chip.Unknown;
9.25 + logicalDeviceNumber = 0;
9.26 + break;
9.27 + } break;
9.28 case 0xA0:
9.29 switch (revision & 0xF0) {
9.30 case 0x20:
9.31 chip = Chip.W83627DHG;
9.32 - logicalDeviceNumber = W83627DHG_HARDWARE_MONITOR_LDN;
9.33 + logicalDeviceNumber = W83627_HARDWARE_MONITOR_LDN;
9.34 break;
9.35 default:
9.36 chip = Chip.Unknown;
9.37 @@ -180,7 +192,7 @@
9.38 switch (revision & 0xF0) {
9.39 case 0x70:
9.40 chip = Chip.W83627DHGP;
9.41 - logicalDeviceNumber = W83627DHG_HARDWARE_MONITOR_LDN;
9.42 + logicalDeviceNumber = W83627_HARDWARE_MONITOR_LDN;
9.43 break;
9.44 default:
9.45 chip = Chip.Unknown;
9.46 @@ -211,9 +223,10 @@
9.47 switch (chip) {
9.48 case Chip.W83627DHG:
9.49 case Chip.W83627DHGP:
9.50 - W83627DHG w83627dhg = new W83627DHG(chip, revision, address);
9.51 - if (w83627dhg.IsAvailable)
9.52 - hardware.Add(w83627dhg);
9.53 + case Chip.W83627HF:
9.54 + W83627 w83627 = new W83627(chip, revision, address);
9.55 + if (w83627.IsAvailable)
9.56 + hardware.Add(w83627);
9.57 break;
9.58 case Chip.F71862:
9.59 case Chip.F71882:
10.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
10.2 +++ b/Hardware/LPC/LPCHardware.cs Sun Feb 07 19:53:51 2010 +0000
10.3 @@ -0,0 +1,80 @@
10.4 +/*
10.5 +
10.6 + Version: MPL 1.1/GPL 2.0/LGPL 2.1
10.7 +
10.8 + The contents of this file are subject to the Mozilla Public License Version
10.9 + 1.1 (the "License"); you may not use this file except in compliance with
10.10 + the License. You may obtain a copy of the License at
10.11 +
10.12 + http://www.mozilla.org/MPL/
10.13 +
10.14 + Software distributed under the License is distributed on an "AS IS" basis,
10.15 + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
10.16 + for the specific language governing rights and limitations under the License.
10.17 +
10.18 + The Original Code is the Open Hardware Monitor code.
10.19 +
10.20 + The Initial Developer of the Original Code is
10.21 + Michael Möller <m.moeller@gmx.ch>.
10.22 + Portions created by the Initial Developer are Copyright (C) 2009-2010
10.23 + the Initial Developer. All Rights Reserved.
10.24 +
10.25 + Contributor(s):
10.26 +
10.27 + Alternatively, the contents of this file may be used under the terms of
10.28 + either the GNU General Public License Version 2 or later (the "GPL"), or
10.29 + the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
10.30 + in which case the provisions of the GPL or the LGPL are applicable instead
10.31 + of those above. If you wish to allow use of your version of this file only
10.32 + under the terms of either the GPL or the LGPL, and not to allow others to
10.33 + use your version of this file under the terms of the MPL, indicate your
10.34 + decision by deleting the provisions above and replace them with the notice
10.35 + and other provisions required by the GPL or the LGPL. If you do not delete
10.36 + the provisions above, a recipient may use your version of this file under
10.37 + the terms of any one of the MPL, the GPL or the LGPL.
10.38 +
10.39 +*/
10.40 +
10.41 +using System;
10.42 +using System.Collections.Generic;
10.43 +using System.Drawing;
10.44 +
10.45 +namespace OpenHardwareMonitor.Hardware.LPC {
10.46 + public abstract class LPCHardware : Hardware {
10.47 +
10.48 + private Image icon;
10.49 + protected readonly string name;
10.50 + protected readonly Chip chip;
10.51 +
10.52 + public LPCHardware(Chip chip) {
10.53 + this.chip = chip;
10.54 + this.icon = Utilities.EmbeddedResources.GetImage("chip.png");
10.55 +
10.56 + switch (chip) {
10.57 + case Chip.F71862: name = "Fintek F71862"; break;
10.58 + case Chip.F71869: name = "Fintek F71869"; break;
10.59 + case Chip.F71882: name = "Fintek F71882"; break;
10.60 + case Chip.F71889: name = "Fintek F71889"; break;
10.61 + case Chip.IT8716F: this.name = "ITE IT8716F"; break;
10.62 + case Chip.IT8718F: this.name = "ITE IT8718F"; break;
10.63 + case Chip.IT8720F: this.name = "ITE IT8720F"; break;
10.64 + case Chip.IT8726F: this.name = "ITE IT8726F"; break;
10.65 + case Chip.W83627DHG: this.name = "Winbond W83627DHG"; break;
10.66 + case Chip.W83627DHGP: this.name = "Winbond W83627DHG-P"; break;
10.67 + case Chip.W83627HF: this.name = "Winbond W83627HF"; break;
10.68 + }
10.69 + }
10.70 +
10.71 + public string Identifier {
10.72 + get { return "/lpc/" + chip.ToString().ToLower(); }
10.73 + }
10.74 +
10.75 + public Image Icon {
10.76 + get { return icon; }
10.77 + }
10.78 +
10.79 + public string Name {
10.80 + get { return name; }
10.81 + }
10.82 + }
10.83 +}
11.1 --- a/Hardware/LPC/W83627.cs Sun Feb 07 19:48:32 2010 +0000
11.2 +++ b/Hardware/LPC/W83627.cs Sun Feb 07 19:53:51 2010 +0000
11.3 @@ -41,155 +41,63 @@
11.4 using System.Text;
11.5
11.6 namespace OpenHardwareMonitor.Hardware.LPC {
11.7 - public class W83627DHG : IHardware {
11.8 -
11.9 - private Chip chip;
11.10 - private byte revision;
11.11 -
11.12 - private string name;
11.13 - private Image icon;
11.14 -
11.15 - private bool available = false;
11.16 - private ushort address;
11.17 -
11.18 - private List<ISensor> active = new List<ISensor>();
11.19 -
11.20 + public class W83627 : Winbond, IHardware {
11.21 +
11.22 private Sensor[] temperatures;
11.23 private Sensor[] fans;
11.24 private Sensor[] voltages;
11.25
11.26 private float[] voltageGains;
11.27 -
11.28 - // Consts
11.29 - private const ushort WINBOND_VENDOR_ID = 0x5CA3;
11.30 - private const byte HIGH_BYTE = 0x80;
11.31 -
11.32 - // Hardware Monitor
11.33 - private const byte ADDRESS_REGISTER_OFFSET = 0x05;
11.34 - private const byte DATA_REGISTER_OFFSET = 0x06;
11.35 + private string[] fanNames;
11.36
11.37 // Hardware Monitor Registers
11.38 - private const byte VOLTAGE_BASE_REG = 0x20;
11.39 - private const byte BANK_SELECT_REGISTER = 0x04E;
11.40 - private const byte VENDOR_ID_REGISTER = 0x4F;
11.41 - private const byte FIRST_BANK_REGISTER = 0x50;
11.42 + private const byte VOLTAGE_BASE_REG = 0x20;
11.43 private const byte TEMPERATURE_BASE_REG = 0x50;
11.44 private const byte TEMPERATURE_SYS_REG = 0x27;
11.45
11.46 private byte[] FAN_TACHO_REG = new byte[] { 0x28, 0x29, 0x2A, 0x3F, 0x53 };
11.47 - private byte[] FAN_TACHO_BANK = new byte[] { 0, 0, 0, 0, 5 };
11.48 - private string[] FAN_NAME = new string[]
11.49 - { "System", "CPU #1", "Auxiliary #1", "CPU #2", "Auxiliary #2" };
11.50 + private byte[] FAN_TACHO_BANK = new byte[] { 0, 0, 0, 0, 5 };
11.51 private byte[] FAN_BIT_REG = new byte[] { 0x47, 0x4B, 0x4C, 0x59, 0x5D };
11.52 private byte[] FAN_DIV_BIT0 = new byte[] { 36, 38, 30, 8, 10 };
11.53 private byte[] FAN_DIV_BIT1 = new byte[] { 37, 39, 31, 9, 11 };
11.54 private byte[] FAN_DIV_BIT2 = new byte[] { 5, 6, 7, 23, 15 };
11.55
11.56 - private byte ReadByte(byte bank, byte register) {
11.57 - WinRing0.WriteIoPortByte(
11.58 - (ushort)(address + ADDRESS_REGISTER_OFFSET), BANK_SELECT_REGISTER);
11.59 - WinRing0.WriteIoPortByte(
11.60 - (ushort)(address + DATA_REGISTER_OFFSET), bank);
11.61 - WinRing0.WriteIoPortByte(
11.62 - (ushort)(address + ADDRESS_REGISTER_OFFSET), register);
11.63 - return WinRing0.ReadIoPortByte(
11.64 - (ushort)(address + DATA_REGISTER_OFFSET));
11.65 - }
11.66 -
11.67 - public W83627DHG(Chip chip, byte revision, ushort address) {
11.68 - this.chip = chip;
11.69 - this.revision = revision;
11.70 - this.address = address;
11.71 -
11.72 - // Check vendor id
11.73 - ushort vendorId =
11.74 - (ushort)((ReadByte(HIGH_BYTE, VENDOR_ID_REGISTER) << 8) |
11.75 - ReadByte(0, VENDOR_ID_REGISTER));
11.76 - if (vendorId != WINBOND_VENDOR_ID)
11.77 - return;
11.78 -
11.79 - voltageGains = new float[] { 0.008f, 1, 1, 0.016f, 1, 1, 1, 0.016f };
11.80 - voltages = new Sensor[3];
11.81 - voltages[0] = new Sensor("CPU VCore", 0, SensorType.Voltage, this);
11.82 - voltages[1] = new Sensor("+3.3V", 3, SensorType.Voltage, this);
11.83 - voltages[2] = new Sensor("Battery", 7, SensorType.Voltage, this);
11.84 -
11.85 + public W83627(Chip chip, byte revision, ushort address)
11.86 + : base(chip, revision, address)
11.87 + {
11.88 +
11.89 temperatures = new Sensor[3];
11.90 temperatures[0] = new Sensor("CPU", 0, SensorType.Temperature, this);
11.91 temperatures[1] = new Sensor("Auxiliary", 1, SensorType.Temperature, this);
11.92 temperatures[2] = new Sensor("System", 2, SensorType.Temperature, this);
11.93
11.94 - fans = new Sensor[FAN_NAME.Length];
11.95 - for (int i = 0; i < FAN_NAME.Length; i++)
11.96 - fans[i] = new Sensor(FAN_NAME[i], i, SensorType.Fan, this);
11.97 -
11.98 switch (chip) {
11.99 - case Chip.W83627DHG: name = "Winbond W83627DHG"; break;
11.100 - case Chip.W83627DHGP: name = "Winbond W83627DHG-P"; break;
11.101 - default: return;
11.102 + case Chip.W83627DHG:
11.103 + case Chip.W83627DHGP:
11.104 + fanNames = new string[] { "System", "CPU #1", "Auxiliary #1",
11.105 + "CPU #2", "Auxiliary #2" };
11.106 + voltageGains = new float[] { 0.008f, 1, 1, 0.016f, 1, 1, 1, 0.016f };
11.107 + voltages = new Sensor[3];
11.108 + voltages[0] = new Sensor("CPU VCore", 0, SensorType.Voltage, this);
11.109 + voltages[1] = new Sensor("+3.3V", 3, SensorType.Voltage, this);
11.110 + voltages[2] = new Sensor("Battery", 7, SensorType.Voltage, this);
11.111 + break;
11.112 + case Chip.W83627HF:
11.113 + fanNames = new string[] { "Fan #1", "Fan #2", "Fan #3" };
11.114 + voltageGains = new float[] { 0.016f, 1, 0.016f, 1, 1, 1, 1, 0.016f };
11.115 + voltages = new Sensor[3];
11.116 + voltages[0] = new Sensor("CPU VCore", 0, SensorType.Voltage, this);
11.117 + voltages[1] = new Sensor("+3.3V", 2, SensorType.Voltage, this);
11.118 + voltages[2] = new Sensor("Battery", 7, SensorType.Voltage, this);
11.119 + break;
11.120 + default: fanNames = new string[0];
11.121 + break;
11.122 }
11.123 -
11.124 - this.icon = Utilities.EmbeddedResources.GetImage("chip.png");
11.125 - available = true;
11.126 - }
11.127 -
11.128 - public bool IsAvailable {
11.129 - get { return available; }
11.130 - }
11.131 -
11.132 - public string Name {
11.133 - get { return name; }
11.134 - }
11.135 -
11.136 - public string Identifier {
11.137 - get { return "/lpc/" + chip.ToString().ToLower(); }
11.138 - }
11.139 -
11.140 - public Image Icon {
11.141 - get { return icon; }
11.142 - }
11.143 -
11.144 - public ISensor[] Sensors {
11.145 - get { return active.ToArray(); }
11.146 - }
11.147 -
11.148 - public string GetReport() {
11.149 - StringBuilder r = new StringBuilder();
11.150 -
11.151 - r.AppendLine("LPC W83627DHG");
11.152 - r.AppendLine();
11.153 - r.Append("Chip ID: 0x"); r.AppendLine(chip.ToString("X"));
11.154 - r.Append("Chip revision: 0x"); r.AppendLine(revision.ToString("X"));
11.155 - r.Append("Base Adress: 0x"); r.AppendLine(address.ToString("X4"));
11.156 - r.AppendLine();
11.157 - r.AppendLine("Hardware Monitor Registers");
11.158 - r.AppendLine();
11.159 - r.AppendLine(" 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F");
11.160 - r.AppendLine();
11.161 - for (int i = 0; i < 0x7; i++) {
11.162 - r.Append(" "); r.Append((i << 4).ToString("X2")); r.Append(" ");
11.163 - for (int j = 0; j <= 0xF; j++) {
11.164 - r.Append(" ");
11.165 - r.Append(ReadByte(0, (byte)((i << 4) | j)).ToString("X2"));
11.166 - }
11.167 - r.AppendLine();
11.168 - }
11.169 - for (int k = 1; k <=5; k++) {
11.170 - r.AppendLine("Bank " + k);
11.171 - for (int i = 0x5; i < 0x6; i++) {
11.172 - r.Append(" "); r.Append((i << 4).ToString("X2")); r.Append(" ");
11.173 - for (int j = 0; j <= 0xF; j++) {
11.174 - r.Append(" ");
11.175 - r.Append(ReadByte((byte)(k),
11.176 - (byte)((i << 4) | j)).ToString("X2"));
11.177 - }
11.178 - r.AppendLine();
11.179 - }
11.180 - }
11.181 - r.AppendLine();
11.182 -
11.183 - return r.ToString();
11.184 - }
11.185 +
11.186 + fans = new Sensor[fanNames.Length];
11.187 + for (int i = 0; i < fanNames.Length; i++)
11.188 + fans[i] = new Sensor(fanNames[i], i, SensorType.Fan, this);
11.189 + }
11.190
11.191 public void Update() {
11.192 foreach (Sensor sensor in voltages) {
11.193 @@ -243,24 +151,5 @@
11.194 ActivateSensor(sensor);
11.195 }
11.196 }
11.197 -
11.198 - private void ActivateSensor(Sensor sensor) {
11.199 - if (!active.Contains(sensor)) {
11.200 - active.Add(sensor);
11.201 - if (SensorAdded != null)
11.202 - SensorAdded(sensor);
11.203 - }
11.204 - }
11.205 -
11.206 - private void DeactivateSensor(Sensor sensor) {
11.207 - if (active.Contains(sensor)) {
11.208 - active.Remove(sensor);
11.209 - if (SensorRemoved != null)
11.210 - SensorRemoved(sensor);
11.211 - }
11.212 - }
11.213 -
11.214 - public event SensorEventHandler SensorAdded;
11.215 - public event SensorEventHandler SensorRemoved;
11.216 }
11.217 }
12.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
12.2 +++ b/Hardware/LPC/Winbond.cs Sun Feb 07 19:53:51 2010 +0000
12.3 @@ -0,0 +1,132 @@
12.4 +/*
12.5 +
12.6 + Version: MPL 1.1/GPL 2.0/LGPL 2.1
12.7 +
12.8 + The contents of this file are subject to the Mozilla Public License Version
12.9 + 1.1 (the "License"); you may not use this file except in compliance with
12.10 + the License. You may obtain a copy of the License at
12.11 +
12.12 + http://www.mozilla.org/MPL/
12.13 +
12.14 + Software distributed under the License is distributed on an "AS IS" basis,
12.15 + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12.16 + for the specific language governing rights and limitations under the License.
12.17 +
12.18 + The Original Code is the Open Hardware Monitor code.
12.19 +
12.20 + The Initial Developer of the Original Code is
12.21 + Michael Möller <m.moeller@gmx.ch>.
12.22 + Portions created by the Initial Developer are Copyright (C) 2009-2010
12.23 + the Initial Developer. All Rights Reserved.
12.24 +
12.25 + Contributor(s):
12.26 +
12.27 + Alternatively, the contents of this file may be used under the terms of
12.28 + either the GNU General Public License Version 2 or later (the "GPL"), or
12.29 + the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
12.30 + in which case the provisions of the GPL or the LGPL are applicable instead
12.31 + of those above. If you wish to allow use of your version of this file only
12.32 + under the terms of either the GPL or the LGPL, and not to allow others to
12.33 + use your version of this file under the terms of the MPL, indicate your
12.34 + decision by deleting the provisions above and replace them with the notice
12.35 + and other provisions required by the GPL or the LGPL. If you do not delete
12.36 + the provisions above, a recipient may use your version of this file under
12.37 + the terms of any one of the MPL, the GPL or the LGPL.
12.38 +
12.39 +*/
12.40 +
12.41 +using System;
12.42 +using System.Collections.Generic;
12.43 +using System.Drawing;
12.44 +using System.Text;
12.45 +
12.46 +namespace OpenHardwareMonitor.Hardware.LPC {
12.47 + public abstract class Winbond : LPCHardware {
12.48 +
12.49 + private ushort address;
12.50 + private byte revision;
12.51 +
12.52 + private bool available;
12.53 +
12.54 + // Consts
12.55 + private const ushort WINBOND_VENDOR_ID = 0x5CA3;
12.56 + private const byte HIGH_BYTE = 0x80;
12.57 +
12.58 + // Hardware Monitor
12.59 + private const byte ADDRESS_REGISTER_OFFSET = 0x05;
12.60 + private const byte DATA_REGISTER_OFFSET = 0x06;
12.61 +
12.62 + // Hardware Monitor Registers
12.63 + private const byte BANK_SELECT_REGISTER = 0x04E;
12.64 + private const byte VENDOR_ID_REGISTER = 0x4F;
12.65 +
12.66 + protected byte ReadByte(byte bank, byte register) {
12.67 + WinRing0.WriteIoPortByte(
12.68 + (ushort)(address + ADDRESS_REGISTER_OFFSET), BANK_SELECT_REGISTER);
12.69 + WinRing0.WriteIoPortByte(
12.70 + (ushort)(address + DATA_REGISTER_OFFSET), bank);
12.71 + WinRing0.WriteIoPortByte(
12.72 + (ushort)(address + ADDRESS_REGISTER_OFFSET), register);
12.73 + return WinRing0.ReadIoPortByte(
12.74 + (ushort)(address + DATA_REGISTER_OFFSET));
12.75 + }
12.76 +
12.77 + private bool IsWinbondVendor() {
12.78 + ushort vendorId =
12.79 + (ushort)((ReadByte(HIGH_BYTE, VENDOR_ID_REGISTER) << 8) |
12.80 + ReadByte(0, VENDOR_ID_REGISTER));
12.81 + return vendorId == WINBOND_VENDOR_ID;
12.82 + }
12.83 +
12.84 + public Winbond(Chip chip, byte revision, ushort address)
12.85 + : base(chip)
12.86 + {
12.87 + this.address = address;
12.88 + this.revision = revision;
12.89 +
12.90 + available = IsWinbondVendor();
12.91 + }
12.92 +
12.93 + public bool IsAvailable {
12.94 + get { return available; }
12.95 + }
12.96 +
12.97 + public string GetReport() {
12.98 + StringBuilder r = new StringBuilder();
12.99 +
12.100 + r.AppendLine("LPC " + this.GetType().Name);
12.101 + r.AppendLine();
12.102 + r.Append("Chip ID: 0x"); r.AppendLine(chip.ToString("X"));
12.103 + r.Append("Chip revision: 0x"); r.AppendLine(revision.ToString("X"));
12.104 + r.Append("Base Adress: 0x"); r.AppendLine(address.ToString("X4"));
12.105 + r.AppendLine();
12.106 + r.AppendLine("Hardware Monitor Registers");
12.107 + r.AppendLine();
12.108 + r.AppendLine(" 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F");
12.109 + r.AppendLine();
12.110 + for (int i = 0; i < 0x7; i++) {
12.111 + r.Append(" "); r.Append((i << 4).ToString("X2")); r.Append(" ");
12.112 + for (int j = 0; j <= 0xF; j++) {
12.113 + r.Append(" ");
12.114 + r.Append(ReadByte(0, (byte)((i << 4) | j)).ToString("X2"));
12.115 + }
12.116 + r.AppendLine();
12.117 + }
12.118 + for (int k = 1; k <= 5; k++) {
12.119 + r.AppendLine("Bank " + k);
12.120 + for (int i = 0x5; i < 0x6; i++) {
12.121 + r.Append(" "); r.Append((i << 4).ToString("X2")); r.Append(" ");
12.122 + for (int j = 0; j <= 0xF; j++) {
12.123 + r.Append(" ");
12.124 + r.Append(ReadByte((byte)(k),
12.125 + (byte)((i << 4) | j)).ToString("X2"));
12.126 + }
12.127 + r.AppendLine();
12.128 + }
12.129 + }
12.130 + r.AppendLine();
12.131 +
12.132 + return r.ToString();
12.133 + }
12.134 + }
12.135 +}
13.1 --- a/OpenHardwareMonitor.csproj Sun Feb 07 19:48:32 2010 +0000
13.2 +++ b/OpenHardwareMonitor.csproj Sun Feb 07 19:53:51 2010 +0000
13.3 @@ -62,13 +62,16 @@
13.4 <Compile Include="Hardware\CPU\AMD10CPU.cs" />
13.5 <Compile Include="Hardware\CPU\AMD0FCPU.cs" />
13.6 <Compile Include="Hardware\CPU\CPULoad.cs" />
13.7 + <Compile Include="Hardware\Hardware.cs" />
13.8 <Compile Include="Hardware\HDD\HDD.cs" />
13.9 <Compile Include="Hardware\HDD\HDDGroup.cs" />
13.10 <Compile Include="Hardware\HDD\SMART.cs" />
13.11 <Compile Include="Hardware\LPC\Chip.cs" />
13.12 <Compile Include="Hardware\LPC\F718XX.cs" />
13.13 + <Compile Include="Hardware\LPC\LPCHardware.cs" />
13.14 + <Compile Include="Hardware\LPC\Winbond.cs" />
13.15 <Compile Include="Hardware\SMBIOS\SMBIOSGroup.cs" />
13.16 - <Compile Include="Hardware\LPC\W83627DHG.cs" />
13.17 + <Compile Include="Hardware\LPC\W83627.cs" />
13.18 <Compile Include="Hardware\Computer.cs" />
13.19 <Compile Include="Properties\AssemblyInfo.cs" />
13.20 <Compile Include="GUI\AboutBox.cs">
14.1 --- a/Properties/AssemblyInfo.cs Sun Feb 07 19:48:32 2010 +0000
14.2 +++ b/Properties/AssemblyInfo.cs Sun Feb 07 19:53:51 2010 +0000
14.3 @@ -69,5 +69,5 @@
14.4 // You can specify all the values or you can default the Build and Revision Numbers
14.5 // by using the '*' as shown below:
14.6 // [assembly: AssemblyVersion("1.0.*")]
14.7 -[assembly: AssemblyVersion("0.1.13.0")]
14.8 -[assembly: AssemblyFileVersion("0.1.13.0")]
14.9 +[assembly: AssemblyVersion("0.1.14.0")]
14.10 +[assembly: AssemblyFileVersion("0.1.14.0")]