mirror of
https://github.com/openhardwaremonitor/openhardwaremonitor
synced 2025-08-29 13:28:04 +00:00
Added initial support for W83627HF. Some refactoring for IHardware classes.
This commit is contained in:
parent
37a788e7cb
commit
0060583e5b
@ -41,7 +41,7 @@ using System.Drawing;
|
||||
using System.Reflection;
|
||||
|
||||
namespace OpenHardwareMonitor.Hardware.ATI {
|
||||
public class ATIGPU : IHardware {
|
||||
public class ATIGPU : Hardware, IHardware {
|
||||
|
||||
private string name;
|
||||
private Image icon;
|
||||
@ -55,8 +55,6 @@ namespace OpenHardwareMonitor.Hardware.ATI {
|
||||
private Sensor coreVoltage;
|
||||
private Sensor coreLoad;
|
||||
|
||||
private List<ISensor> active = new List<ISensor>();
|
||||
|
||||
public ATIGPU(string name, int adapterIndex, int busNumber,
|
||||
int deviceNumber)
|
||||
{
|
||||
@ -95,10 +93,6 @@ namespace OpenHardwareMonitor.Hardware.ATI {
|
||||
get { return icon; }
|
||||
}
|
||||
|
||||
public ISensor[] Sensors {
|
||||
get { return active.ToArray(); }
|
||||
}
|
||||
|
||||
public string GetReport() {
|
||||
return null;
|
||||
}
|
||||
@ -144,24 +138,5 @@ namespace OpenHardwareMonitor.Hardware.ATI {
|
||||
DeactivateSensor(coreLoad);
|
||||
}
|
||||
}
|
||||
|
||||
private void ActivateSensor(Sensor sensor) {
|
||||
if (!active.Contains(sensor)) {
|
||||
active.Add(sensor);
|
||||
if (SensorAdded != null)
|
||||
SensorAdded(sensor);
|
||||
}
|
||||
}
|
||||
|
||||
private void DeactivateSensor(Sensor sensor) {
|
||||
if (active.Contains(sensor)) {
|
||||
active.Remove(sensor);
|
||||
if (SensorRemoved != null)
|
||||
SensorRemoved(sensor);
|
||||
}
|
||||
}
|
||||
|
||||
public event SensorEventHandler SensorAdded;
|
||||
public event SensorEventHandler SensorRemoved;
|
||||
}
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ using System.Text;
|
||||
|
||||
|
||||
namespace OpenHardwareMonitor.Hardware.CPU {
|
||||
public class AMD0FCPU : IHardware {
|
||||
public class AMD0FCPU : Hardware, IHardware {
|
||||
|
||||
private string name;
|
||||
private Image icon;
|
||||
@ -56,8 +56,6 @@ namespace OpenHardwareMonitor.Hardware.CPU {
|
||||
private Sensor totalLoad;
|
||||
private Sensor[] coreLoads;
|
||||
|
||||
private List<ISensor> active = new List<ISensor>();
|
||||
|
||||
private CPULoad cpuLoad;
|
||||
|
||||
private const ushort PCI_AMD_VENDOR_ID = 0x1022;
|
||||
@ -121,10 +119,6 @@ namespace OpenHardwareMonitor.Hardware.CPU {
|
||||
get { return icon; }
|
||||
}
|
||||
|
||||
public ISensor[] Sensors {
|
||||
get { return active.ToArray(); }
|
||||
}
|
||||
|
||||
public string GetReport() {
|
||||
return null;
|
||||
}
|
||||
@ -154,26 +148,6 @@ namespace OpenHardwareMonitor.Hardware.CPU {
|
||||
coreLoads[i].Value = cpuLoad.GetCoreLoad(i);
|
||||
totalLoad.Value = cpuLoad.GetTotalLoad();
|
||||
}
|
||||
}
|
||||
|
||||
private void ActivateSensor(Sensor sensor) {
|
||||
if (!active.Contains(sensor)) {
|
||||
active.Add(sensor);
|
||||
if (SensorAdded != null)
|
||||
SensorAdded(sensor);
|
||||
}
|
||||
}
|
||||
|
||||
private void DeactivateSensor(Sensor sensor) {
|
||||
if (active.Contains(sensor)) {
|
||||
active.Remove(sensor);
|
||||
if (SensorRemoved != null)
|
||||
SensorRemoved(sensor);
|
||||
}
|
||||
}
|
||||
|
||||
public event SensorEventHandler SensorAdded;
|
||||
public event SensorEventHandler SensorRemoved;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ using System.Text;
|
||||
|
||||
namespace OpenHardwareMonitor.Hardware.CPU {
|
||||
|
||||
public class AMD10CPU : IHardware {
|
||||
public class AMD10CPU : Hardware, IHardware {
|
||||
private string name;
|
||||
private Image icon;
|
||||
|
||||
@ -53,8 +53,6 @@ namespace OpenHardwareMonitor.Hardware.CPU {
|
||||
private Sensor totalLoad;
|
||||
private Sensor[] coreLoads;
|
||||
|
||||
private List<ISensor> active = new List<ISensor>();
|
||||
|
||||
private CPULoad cpuLoad;
|
||||
|
||||
private const ushort PCI_AMD_VENDOR_ID = 0x1022;
|
||||
@ -107,10 +105,6 @@ namespace OpenHardwareMonitor.Hardware.CPU {
|
||||
get { return icon; }
|
||||
}
|
||||
|
||||
public ISensor[] Sensors {
|
||||
get { return active.ToArray(); }
|
||||
}
|
||||
|
||||
public string GetReport() {
|
||||
return null;
|
||||
}
|
||||
@ -135,25 +129,5 @@ namespace OpenHardwareMonitor.Hardware.CPU {
|
||||
totalLoad.Value = cpuLoad.GetTotalLoad();
|
||||
}
|
||||
}
|
||||
|
||||
private void ActivateSensor(Sensor sensor) {
|
||||
if (!active.Contains(sensor)) {
|
||||
active.Add(sensor);
|
||||
if (SensorAdded != null)
|
||||
SensorAdded(sensor);
|
||||
}
|
||||
}
|
||||
|
||||
private void DeactivateSensor(Sensor sensor) {
|
||||
if (active.Contains(sensor)) {
|
||||
active.Remove(sensor);
|
||||
if (SensorRemoved != null)
|
||||
SensorRemoved(sensor);
|
||||
}
|
||||
}
|
||||
|
||||
public event SensorEventHandler SensorAdded;
|
||||
public event SensorEventHandler SensorRemoved;
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ using System.Reflection;
|
||||
using System.Text;
|
||||
|
||||
namespace OpenHardwareMonitor.Hardware.CPU {
|
||||
public class IntelCPU : IHardware {
|
||||
public class IntelCPU : Hardware, IHardware {
|
||||
|
||||
private string name;
|
||||
private Image icon;
|
||||
@ -52,8 +52,6 @@ namespace OpenHardwareMonitor.Hardware.CPU {
|
||||
private Sensor totalLoad;
|
||||
private Sensor[] coreLoads;
|
||||
|
||||
private List<ISensor> active = new List<ISensor>();
|
||||
|
||||
private float tjMax = 0;
|
||||
private uint logicalProcessors;
|
||||
private uint logicalProcessorsPerCore;
|
||||
@ -165,10 +163,6 @@ namespace OpenHardwareMonitor.Hardware.CPU {
|
||||
get { return icon; }
|
||||
}
|
||||
|
||||
public ISensor[] Sensors {
|
||||
get { return active.ToArray(); }
|
||||
}
|
||||
|
||||
public string GetReport() {
|
||||
StringBuilder r = new StringBuilder();
|
||||
|
||||
@ -210,25 +204,6 @@ namespace OpenHardwareMonitor.Hardware.CPU {
|
||||
coreLoads[i].Value = cpuLoad.GetCoreLoad(i);
|
||||
totalLoad.Value = cpuLoad.GetTotalLoad();
|
||||
}
|
||||
}
|
||||
|
||||
private void ActivateSensor(Sensor sensor) {
|
||||
if (!active.Contains(sensor)) {
|
||||
active.Add(sensor);
|
||||
if (SensorAdded != null)
|
||||
SensorAdded(sensor);
|
||||
}
|
||||
}
|
||||
|
||||
private void DeactivateSensor(Sensor sensor) {
|
||||
if (active.Contains(sensor)) {
|
||||
active.Remove(sensor);
|
||||
if (SensorRemoved != null)
|
||||
SensorRemoved(sensor);
|
||||
}
|
||||
}
|
||||
|
||||
public event SensorEventHandler SensorAdded;
|
||||
public event SensorEventHandler SensorRemoved;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
69
Hardware/Hardware.cs
Normal file
69
Hardware/Hardware.cs
Normal file
@ -0,0 +1,69 @@
|
||||
/*
|
||||
|
||||
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 <m.moeller@gmx.ch>.
|
||||
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;
|
||||
|
||||
namespace OpenHardwareMonitor.Hardware {
|
||||
public abstract class Hardware {
|
||||
|
||||
private List<ISensor> active = new List<ISensor>();
|
||||
|
||||
public ISensor[] Sensors {
|
||||
get { return active.ToArray(); }
|
||||
}
|
||||
|
||||
protected void ActivateSensor(Sensor sensor) {
|
||||
if (!active.Contains(sensor)) {
|
||||
active.Add(sensor);
|
||||
if (SensorAdded != null)
|
||||
SensorAdded(sensor);
|
||||
}
|
||||
}
|
||||
|
||||
protected void DeactivateSensor(Sensor sensor) {
|
||||
if (active.Contains(sensor)) {
|
||||
active.Remove(sensor);
|
||||
if (SensorRemoved != null)
|
||||
SensorRemoved(sensor);
|
||||
}
|
||||
}
|
||||
|
||||
public event SensorEventHandler SensorAdded;
|
||||
public event SensorEventHandler SensorRemoved;
|
||||
}
|
||||
}
|
@ -13,6 +13,7 @@ namespace OpenHardwareMonitor.Hardware.LPC {
|
||||
IT8726F = 0x8726,
|
||||
W83627DHG = 0xA020,
|
||||
W83627DHGP = 0xB070,
|
||||
W83627HF = 0x5200,
|
||||
F71862 = 0x0601,
|
||||
F71869 = 0x0814,
|
||||
F71882 = 0x0541,
|
||||
|
@ -41,16 +41,10 @@ using System.Drawing;
|
||||
using System.Text;
|
||||
|
||||
namespace OpenHardwareMonitor.Hardware.LPC {
|
||||
public class F718XX : IHardware {
|
||||
public class F718XX : LPCHardware, IHardware {
|
||||
|
||||
private string name;
|
||||
private Image icon;
|
||||
|
||||
private Chip chip;
|
||||
private ushort address;
|
||||
|
||||
private List<ISensor> active = new List<ISensor>();
|
||||
|
||||
private Sensor[] temperatures;
|
||||
private Sensor[] fans;
|
||||
private Sensor[] voltages;
|
||||
@ -71,18 +65,9 @@ namespace OpenHardwareMonitor.Hardware.LPC {
|
||||
return WinRing0.ReadIoPortByte((ushort)(address + DATA_REGISTER_OFFSET));
|
||||
}
|
||||
|
||||
public F718XX(Chip chip, ushort address) {
|
||||
this.chip = chip;
|
||||
public F718XX(Chip chip, ushort address) : base(chip) {
|
||||
this.address = address;
|
||||
|
||||
switch (chip) {
|
||||
case Chip.F71862: name = "Fintek F71862"; break;
|
||||
case Chip.F71869: name = "Fintek F71869"; break;
|
||||
case Chip.F71882: name = "Fintek F71882"; break;
|
||||
case Chip.F71889: name = "Fintek F71889"; break;
|
||||
default: return;
|
||||
}
|
||||
|
||||
temperatures = new Sensor[3];
|
||||
for (int i = 0; i < temperatures.Length; i++)
|
||||
temperatures[i] = new Sensor("Temperature #" + (i + 1), i,
|
||||
@ -98,30 +83,12 @@ namespace OpenHardwareMonitor.Hardware.LPC {
|
||||
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);
|
||||
|
||||
this.icon = Utilities.EmbeddedResources.GetImage("chip.png");
|
||||
}
|
||||
|
||||
public string Name {
|
||||
get { return name; }
|
||||
}
|
||||
|
||||
public string Identifier {
|
||||
get { return "/lpc/" + chip.ToString().ToLower(); }
|
||||
}
|
||||
|
||||
public Image Icon {
|
||||
get { return icon; }
|
||||
}
|
||||
|
||||
public ISensor[] Sensors {
|
||||
get { return active.ToArray(); }
|
||||
}
|
||||
|
||||
public string GetReport() {
|
||||
StringBuilder r = new StringBuilder();
|
||||
|
||||
r.AppendLine("LPC F718XX");
|
||||
r.AppendLine("LPC " + this.GetType().Name);
|
||||
r.AppendLine();
|
||||
r.Append("Base Adress: 0x"); r.AppendLine(address.ToString("X4"));
|
||||
r.AppendLine();
|
||||
@ -175,25 +142,5 @@ namespace OpenHardwareMonitor.Hardware.LPC {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ActivateSensor(Sensor sensor) {
|
||||
if (!active.Contains(sensor)) {
|
||||
active.Add(sensor);
|
||||
if (SensorAdded != null)
|
||||
SensorAdded(sensor);
|
||||
}
|
||||
}
|
||||
|
||||
private void DeactivateSensor(Sensor sensor) {
|
||||
if (active.Contains(sensor)) {
|
||||
active.Remove(sensor);
|
||||
if (SensorRemoved != null)
|
||||
SensorRemoved(sensor);
|
||||
}
|
||||
}
|
||||
|
||||
public event SensorEventHandler SensorAdded;
|
||||
public event SensorEventHandler SensorRemoved;
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -41,19 +41,14 @@ using System.Drawing;
|
||||
using System.Text;
|
||||
|
||||
namespace OpenHardwareMonitor.Hardware.LPC {
|
||||
public class IT87XX : IHardware {
|
||||
|
||||
private string name;
|
||||
private Image icon;
|
||||
public class IT87XX : LPCHardware, IHardware {
|
||||
|
||||
private bool available = false;
|
||||
private Chip chip;
|
||||
private ushort address;
|
||||
|
||||
private Sensor[] temperatures;
|
||||
private Sensor[] fans;
|
||||
private Sensor[] voltages;
|
||||
private List<ISensor> active = new List<ISensor>();
|
||||
private float[] voltageGains;
|
||||
|
||||
// Consts
|
||||
@ -80,18 +75,9 @@ namespace OpenHardwareMonitor.Hardware.LPC {
|
||||
return WinRing0.ReadIoPortByte((ushort)(address + DATA_REGISTER_OFFSET));
|
||||
}
|
||||
|
||||
public IT87XX(Chip chip, ushort address) {
|
||||
public IT87XX(Chip chip, ushort address) : base (chip) {
|
||||
|
||||
this.chip = chip;
|
||||
this.address = address;
|
||||
|
||||
switch (chip) {
|
||||
case Chip.IT8716F: name = "ITE IT8716F"; break;
|
||||
case Chip.IT8718F: name = "ITE IT8718F"; break;
|
||||
case Chip.IT8720F: name = "ITE IT8720F"; break;
|
||||
case Chip.IT8726F: name = "ITE IT8726F"; break;
|
||||
default: return;
|
||||
}
|
||||
|
||||
// Check vendor id
|
||||
byte vendorId = ReadByte(VENDOR_ID_REGISTER);
|
||||
@ -119,33 +105,16 @@ namespace OpenHardwareMonitor.Hardware.LPC {
|
||||
voltages[1] = new Sensor("Battery", 8, SensorType.Voltage, this);
|
||||
|
||||
available = true;
|
||||
icon = Utilities.EmbeddedResources.GetImage("chip.png");
|
||||
}
|
||||
|
||||
public bool IsAvailable {
|
||||
get { return available; }
|
||||
}
|
||||
|
||||
public string Name {
|
||||
get { return name; }
|
||||
}
|
||||
|
||||
public string Identifier {
|
||||
get { return "/lpc/" + chip.ToString().ToLower(); }
|
||||
}
|
||||
|
||||
public Image Icon {
|
||||
get { return icon; }
|
||||
}
|
||||
|
||||
public ISensor[] Sensors {
|
||||
get { return active.ToArray(); }
|
||||
}
|
||||
|
||||
public string GetReport() {
|
||||
StringBuilder r = new StringBuilder();
|
||||
|
||||
r.AppendLine("LPC IT87XX");
|
||||
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);
|
||||
@ -200,26 +169,6 @@ namespace OpenHardwareMonitor.Hardware.LPC {
|
||||
DeactivateSensor(sensor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ActivateSensor(Sensor sensor) {
|
||||
if (!active.Contains(sensor)) {
|
||||
active.Add(sensor);
|
||||
if (SensorAdded != null)
|
||||
SensorAdded(sensor);
|
||||
}
|
||||
}
|
||||
|
||||
private void DeactivateSensor(Sensor sensor) {
|
||||
if (active.Contains(sensor)) {
|
||||
active.Remove(sensor);
|
||||
if (SensorRemoved != null)
|
||||
SensorRemoved(sensor);
|
||||
}
|
||||
}
|
||||
|
||||
public event SensorEventHandler SensorAdded;
|
||||
public event SensorEventHandler SensorRemoved;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ namespace OpenHardwareMonitor.Hardware.LPC {
|
||||
private const byte FINTEK_VENDOR_ID_REGISTER = 0x23;
|
||||
private const ushort FINTEK_VENDOR_ID = 0x1934;
|
||||
|
||||
private const byte W83627DHG_HARDWARE_MONITOR_LDN = 0x0B;
|
||||
private const byte W83627_HARDWARE_MONITOR_LDN = 0x0B;
|
||||
|
||||
private const byte F71858_HARDWARE_MONITOR_LDN = 0x02;
|
||||
private const byte FINTEK_HARDWARE_MONITOR_LDN = 0x04;
|
||||
@ -165,11 +165,23 @@ namespace OpenHardwareMonitor.Hardware.LPC {
|
||||
logicalDeviceNumber = 0;
|
||||
break;
|
||||
} break;
|
||||
case 0x52:
|
||||
switch (revision) {
|
||||
case 0x17:
|
||||
case 0x3A:
|
||||
chip = Chip.W83627HF;
|
||||
logicalDeviceNumber = W83627_HARDWARE_MONITOR_LDN;
|
||||
break;
|
||||
default:
|
||||
chip = Chip.Unknown;
|
||||
logicalDeviceNumber = 0;
|
||||
break;
|
||||
} break;
|
||||
case 0xA0:
|
||||
switch (revision & 0xF0) {
|
||||
case 0x20:
|
||||
chip = Chip.W83627DHG;
|
||||
logicalDeviceNumber = W83627DHG_HARDWARE_MONITOR_LDN;
|
||||
logicalDeviceNumber = W83627_HARDWARE_MONITOR_LDN;
|
||||
break;
|
||||
default:
|
||||
chip = Chip.Unknown;
|
||||
@ -180,7 +192,7 @@ namespace OpenHardwareMonitor.Hardware.LPC {
|
||||
switch (revision & 0xF0) {
|
||||
case 0x70:
|
||||
chip = Chip.W83627DHGP;
|
||||
logicalDeviceNumber = W83627DHG_HARDWARE_MONITOR_LDN;
|
||||
logicalDeviceNumber = W83627_HARDWARE_MONITOR_LDN;
|
||||
break;
|
||||
default:
|
||||
chip = Chip.Unknown;
|
||||
@ -211,9 +223,10 @@ namespace OpenHardwareMonitor.Hardware.LPC {
|
||||
switch (chip) {
|
||||
case Chip.W83627DHG:
|
||||
case Chip.W83627DHGP:
|
||||
W83627DHG w83627dhg = new W83627DHG(chip, revision, address);
|
||||
if (w83627dhg.IsAvailable)
|
||||
hardware.Add(w83627dhg);
|
||||
case Chip.W83627HF:
|
||||
W83627 w83627 = new W83627(chip, revision, address);
|
||||
if (w83627.IsAvailable)
|
||||
hardware.Add(w83627);
|
||||
break;
|
||||
case Chip.F71862:
|
||||
case Chip.F71882:
|
||||
|
80
Hardware/LPC/LPCHardware.cs
Normal file
80
Hardware/LPC/LPCHardware.cs
Normal file
@ -0,0 +1,80 @@
|
||||
/*
|
||||
|
||||
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 <m.moeller@gmx.ch>.
|
||||
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.F71862: name = "Fintek F71862"; break;
|
||||
case Chip.F71869: name = "Fintek F71869"; break;
|
||||
case Chip.F71882: name = "Fintek F71882"; break;
|
||||
case Chip.F71889: name = "Fintek F71889"; 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.W83627HF: this.name = "Winbond W83627HF"; break;
|
||||
}
|
||||
}
|
||||
|
||||
public string Identifier {
|
||||
get { return "/lpc/" + chip.ToString().ToLower(); }
|
||||
}
|
||||
|
||||
public Image Icon {
|
||||
get { return icon; }
|
||||
}
|
||||
|
||||
public string Name {
|
||||
get { return name; }
|
||||
}
|
||||
}
|
||||
}
|
@ -41,155 +41,63 @@ using System.Drawing;
|
||||
using System.Text;
|
||||
|
||||
namespace OpenHardwareMonitor.Hardware.LPC {
|
||||
public class W83627DHG : IHardware {
|
||||
|
||||
private Chip chip;
|
||||
private byte revision;
|
||||
|
||||
private string name;
|
||||
private Image icon;
|
||||
|
||||
private bool available = false;
|
||||
private ushort address;
|
||||
|
||||
private List<ISensor> active = new List<ISensor>();
|
||||
|
||||
public class W83627 : Winbond, IHardware {
|
||||
|
||||
private Sensor[] temperatures;
|
||||
private Sensor[] fans;
|
||||
private Sensor[] voltages;
|
||||
|
||||
private float[] voltageGains;
|
||||
|
||||
// Consts
|
||||
private const ushort WINBOND_VENDOR_ID = 0x5CA3;
|
||||
private const byte HIGH_BYTE = 0x80;
|
||||
|
||||
// Hardware Monitor
|
||||
private const byte ADDRESS_REGISTER_OFFSET = 0x05;
|
||||
private const byte DATA_REGISTER_OFFSET = 0x06;
|
||||
private string[] fanNames;
|
||||
|
||||
// Hardware Monitor Registers
|
||||
private const byte VOLTAGE_BASE_REG = 0x20;
|
||||
private const byte BANK_SELECT_REGISTER = 0x04E;
|
||||
private const byte VENDOR_ID_REGISTER = 0x4F;
|
||||
private const byte FIRST_BANK_REGISTER = 0x50;
|
||||
private const byte VOLTAGE_BASE_REG = 0x20;
|
||||
private const byte TEMPERATURE_BASE_REG = 0x50;
|
||||
private const byte TEMPERATURE_SYS_REG = 0x27;
|
||||
|
||||
private byte[] FAN_TACHO_REG = new byte[] { 0x28, 0x29, 0x2A, 0x3F, 0x53 };
|
||||
private byte[] FAN_TACHO_BANK = new byte[] { 0, 0, 0, 0, 5 };
|
||||
private string[] FAN_NAME = new string[]
|
||||
{ "System", "CPU #1", "Auxiliary #1", "CPU #2", "Auxiliary #2" };
|
||||
private byte[] FAN_TACHO_BANK = new byte[] { 0, 0, 0, 0, 5 };
|
||||
private byte[] FAN_BIT_REG = new byte[] { 0x47, 0x4B, 0x4C, 0x59, 0x5D };
|
||||
private byte[] FAN_DIV_BIT0 = new byte[] { 36, 38, 30, 8, 10 };
|
||||
private byte[] FAN_DIV_BIT1 = new byte[] { 37, 39, 31, 9, 11 };
|
||||
private byte[] FAN_DIV_BIT2 = new byte[] { 5, 6, 7, 23, 15 };
|
||||
|
||||
private byte ReadByte(byte bank, byte register) {
|
||||
WinRing0.WriteIoPortByte(
|
||||
(ushort)(address + ADDRESS_REGISTER_OFFSET), BANK_SELECT_REGISTER);
|
||||
WinRing0.WriteIoPortByte(
|
||||
(ushort)(address + DATA_REGISTER_OFFSET), bank);
|
||||
WinRing0.WriteIoPortByte(
|
||||
(ushort)(address + ADDRESS_REGISTER_OFFSET), register);
|
||||
return WinRing0.ReadIoPortByte(
|
||||
(ushort)(address + DATA_REGISTER_OFFSET));
|
||||
}
|
||||
|
||||
public W83627DHG(Chip chip, byte revision, ushort address) {
|
||||
this.chip = chip;
|
||||
this.revision = revision;
|
||||
this.address = address;
|
||||
|
||||
// Check vendor id
|
||||
ushort vendorId =
|
||||
(ushort)((ReadByte(HIGH_BYTE, VENDOR_ID_REGISTER) << 8) |
|
||||
ReadByte(0, VENDOR_ID_REGISTER));
|
||||
if (vendorId != WINBOND_VENDOR_ID)
|
||||
return;
|
||||
|
||||
voltageGains = new float[] { 0.008f, 1, 1, 0.016f, 1, 1, 1, 0.016f };
|
||||
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);
|
||||
|
||||
public W83627(Chip chip, byte revision, ushort address)
|
||||
: base(chip, revision, address)
|
||||
{
|
||||
|
||||
temperatures = new Sensor[3];
|
||||
temperatures[0] = new Sensor("CPU", 0, SensorType.Temperature, this);
|
||||
temperatures[1] = new Sensor("Auxiliary", 1, SensorType.Temperature, this);
|
||||
temperatures[2] = new Sensor("System", 2, SensorType.Temperature, this);
|
||||
|
||||
fans = new Sensor[FAN_NAME.Length];
|
||||
for (int i = 0; i < FAN_NAME.Length; i++)
|
||||
fans[i] = new Sensor(FAN_NAME[i], i, SensorType.Fan, this);
|
||||
|
||||
switch (chip) {
|
||||
case Chip.W83627DHG: name = "Winbond W83627DHG"; break;
|
||||
case Chip.W83627DHGP: name = "Winbond W83627DHG-P"; break;
|
||||
default: return;
|
||||
case Chip.W83627DHG:
|
||||
case Chip.W83627DHGP:
|
||||
fanNames = new string[] { "System", "CPU #1", "Auxiliary #1",
|
||||
"CPU #2", "Auxiliary #2" };
|
||||
voltageGains = new float[] { 0.008f, 1, 1, 0.016f, 1, 1, 1, 0.016f };
|
||||
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);
|
||||
break;
|
||||
case Chip.W83627HF:
|
||||
fanNames = new string[] { "Fan #1", "Fan #2", "Fan #3" };
|
||||
voltageGains = new float[] { 0.016f, 1, 0.016f, 1, 1, 1, 1, 0.016f };
|
||||
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];
|
||||
break;
|
||||
}
|
||||
|
||||
this.icon = Utilities.EmbeddedResources.GetImage("chip.png");
|
||||
available = true;
|
||||
}
|
||||
|
||||
public bool IsAvailable {
|
||||
get { return available; }
|
||||
}
|
||||
|
||||
public string Name {
|
||||
get { return name; }
|
||||
}
|
||||
|
||||
public string Identifier {
|
||||
get { return "/lpc/" + chip.ToString().ToLower(); }
|
||||
}
|
||||
|
||||
public Image Icon {
|
||||
get { return icon; }
|
||||
}
|
||||
|
||||
public ISensor[] Sensors {
|
||||
get { return active.ToArray(); }
|
||||
}
|
||||
|
||||
public string GetReport() {
|
||||
StringBuilder r = new StringBuilder();
|
||||
|
||||
r.AppendLine("LPC W83627DHG");
|
||||
r.AppendLine();
|
||||
r.Append("Chip ID: 0x"); r.AppendLine(chip.ToString("X"));
|
||||
r.Append("Chip revision: 0x"); r.AppendLine(revision.ToString("X"));
|
||||
r.Append("Base Adress: 0x"); r.AppendLine(address.ToString("X4"));
|
||||
r.AppendLine();
|
||||
r.AppendLine("Hardware Monitor Registers");
|
||||
r.AppendLine();
|
||||
r.AppendLine(" 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F");
|
||||
r.AppendLine();
|
||||
for (int i = 0; i < 0x7; i++) {
|
||||
r.Append(" "); r.Append((i << 4).ToString("X2")); r.Append(" ");
|
||||
for (int j = 0; j <= 0xF; j++) {
|
||||
r.Append(" ");
|
||||
r.Append(ReadByte(0, (byte)((i << 4) | j)).ToString("X2"));
|
||||
}
|
||||
r.AppendLine();
|
||||
}
|
||||
for (int k = 1; k <=5; k++) {
|
||||
r.AppendLine("Bank " + k);
|
||||
for (int i = 0x5; i < 0x6; i++) {
|
||||
r.Append(" "); r.Append((i << 4).ToString("X2")); r.Append(" ");
|
||||
for (int j = 0; j <= 0xF; j++) {
|
||||
r.Append(" ");
|
||||
r.Append(ReadByte((byte)(k),
|
||||
(byte)((i << 4) | j)).ToString("X2"));
|
||||
}
|
||||
r.AppendLine();
|
||||
}
|
||||
}
|
||||
r.AppendLine();
|
||||
|
||||
return r.ToString();
|
||||
}
|
||||
|
||||
fans = new Sensor[fanNames.Length];
|
||||
for (int i = 0; i < fanNames.Length; i++)
|
||||
fans[i] = new Sensor(fanNames[i], i, SensorType.Fan, this);
|
||||
}
|
||||
|
||||
public void Update() {
|
||||
foreach (Sensor sensor in voltages) {
|
||||
@ -243,24 +151,5 @@ namespace OpenHardwareMonitor.Hardware.LPC {
|
||||
ActivateSensor(sensor);
|
||||
}
|
||||
}
|
||||
|
||||
private void ActivateSensor(Sensor sensor) {
|
||||
if (!active.Contains(sensor)) {
|
||||
active.Add(sensor);
|
||||
if (SensorAdded != null)
|
||||
SensorAdded(sensor);
|
||||
}
|
||||
}
|
||||
|
||||
private void DeactivateSensor(Sensor sensor) {
|
||||
if (active.Contains(sensor)) {
|
||||
active.Remove(sensor);
|
||||
if (SensorRemoved != null)
|
||||
SensorRemoved(sensor);
|
||||
}
|
||||
}
|
||||
|
||||
public event SensorEventHandler SensorAdded;
|
||||
public event SensorEventHandler SensorRemoved;
|
||||
}
|
||||
}
|
||||
|
132
Hardware/LPC/Winbond.cs
Normal file
132
Hardware/LPC/Winbond.cs
Normal file
@ -0,0 +1,132 @@
|
||||
/*
|
||||
|
||||
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 <m.moeller@gmx.ch>.
|
||||
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 System.Text;
|
||||
|
||||
namespace OpenHardwareMonitor.Hardware.LPC {
|
||||
public abstract class Winbond : LPCHardware {
|
||||
|
||||
private ushort address;
|
||||
private byte revision;
|
||||
|
||||
private bool available;
|
||||
|
||||
// Consts
|
||||
private const ushort WINBOND_VENDOR_ID = 0x5CA3;
|
||||
private const byte HIGH_BYTE = 0x80;
|
||||
|
||||
// Hardware Monitor
|
||||
private const byte ADDRESS_REGISTER_OFFSET = 0x05;
|
||||
private const byte DATA_REGISTER_OFFSET = 0x06;
|
||||
|
||||
// Hardware Monitor Registers
|
||||
private const byte BANK_SELECT_REGISTER = 0x04E;
|
||||
private const byte VENDOR_ID_REGISTER = 0x4F;
|
||||
|
||||
protected byte ReadByte(byte bank, byte register) {
|
||||
WinRing0.WriteIoPortByte(
|
||||
(ushort)(address + ADDRESS_REGISTER_OFFSET), BANK_SELECT_REGISTER);
|
||||
WinRing0.WriteIoPortByte(
|
||||
(ushort)(address + DATA_REGISTER_OFFSET), bank);
|
||||
WinRing0.WriteIoPortByte(
|
||||
(ushort)(address + ADDRESS_REGISTER_OFFSET), register);
|
||||
return WinRing0.ReadIoPortByte(
|
||||
(ushort)(address + DATA_REGISTER_OFFSET));
|
||||
}
|
||||
|
||||
private bool IsWinbondVendor() {
|
||||
ushort vendorId =
|
||||
(ushort)((ReadByte(HIGH_BYTE, VENDOR_ID_REGISTER) << 8) |
|
||||
ReadByte(0, VENDOR_ID_REGISTER));
|
||||
return vendorId == WINBOND_VENDOR_ID;
|
||||
}
|
||||
|
||||
public Winbond(Chip chip, byte revision, ushort address)
|
||||
: base(chip)
|
||||
{
|
||||
this.address = address;
|
||||
this.revision = revision;
|
||||
|
||||
available = IsWinbondVendor();
|
||||
}
|
||||
|
||||
public bool IsAvailable {
|
||||
get { return available; }
|
||||
}
|
||||
|
||||
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 revision: 0x"); r.AppendLine(revision.ToString("X"));
|
||||
r.Append("Base Adress: 0x"); r.AppendLine(address.ToString("X4"));
|
||||
r.AppendLine();
|
||||
r.AppendLine("Hardware Monitor Registers");
|
||||
r.AppendLine();
|
||||
r.AppendLine(" 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F");
|
||||
r.AppendLine();
|
||||
for (int i = 0; i < 0x7; i++) {
|
||||
r.Append(" "); r.Append((i << 4).ToString("X2")); r.Append(" ");
|
||||
for (int j = 0; j <= 0xF; j++) {
|
||||
r.Append(" ");
|
||||
r.Append(ReadByte(0, (byte)((i << 4) | j)).ToString("X2"));
|
||||
}
|
||||
r.AppendLine();
|
||||
}
|
||||
for (int k = 1; k <= 5; k++) {
|
||||
r.AppendLine("Bank " + k);
|
||||
for (int i = 0x5; i < 0x6; i++) {
|
||||
r.Append(" "); r.Append((i << 4).ToString("X2")); r.Append(" ");
|
||||
for (int j = 0; j <= 0xF; j++) {
|
||||
r.Append(" ");
|
||||
r.Append(ReadByte((byte)(k),
|
||||
(byte)((i << 4) | j)).ToString("X2"));
|
||||
}
|
||||
r.AppendLine();
|
||||
}
|
||||
}
|
||||
r.AppendLine();
|
||||
|
||||
return r.ToString();
|
||||
}
|
||||
}
|
||||
}
|
@ -62,13 +62,16 @@
|
||||
<Compile Include="Hardware\CPU\AMD10CPU.cs" />
|
||||
<Compile Include="Hardware\CPU\AMD0FCPU.cs" />
|
||||
<Compile Include="Hardware\CPU\CPULoad.cs" />
|
||||
<Compile Include="Hardware\Hardware.cs" />
|
||||
<Compile Include="Hardware\HDD\HDD.cs" />
|
||||
<Compile Include="Hardware\HDD\HDDGroup.cs" />
|
||||
<Compile Include="Hardware\HDD\SMART.cs" />
|
||||
<Compile Include="Hardware\LPC\Chip.cs" />
|
||||
<Compile Include="Hardware\LPC\F718XX.cs" />
|
||||
<Compile Include="Hardware\LPC\LPCHardware.cs" />
|
||||
<Compile Include="Hardware\LPC\Winbond.cs" />
|
||||
<Compile Include="Hardware\SMBIOS\SMBIOSGroup.cs" />
|
||||
<Compile Include="Hardware\LPC\W83627DHG.cs" />
|
||||
<Compile Include="Hardware\LPC\W83627.cs" />
|
||||
<Compile Include="Hardware\Computer.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="GUI\AboutBox.cs">
|
||||
|
@ -69,5 +69,5 @@ using System.Runtime.InteropServices;
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("0.1.13.0")]
|
||||
[assembly: AssemblyFileVersion("0.1.13.0")]
|
||||
[assembly: AssemblyVersion("0.1.14.0")]
|
||||
[assembly: AssemblyFileVersion("0.1.14.0")]
|
||||
|
Loading…
x
Reference in New Issue
Block a user