Added support for Winbond W83627EHF, W83667HG, W83667HG-B mainboard chips.
authormoel.mich
Mon, 08 Feb 2010 20:18:25 +0000
changeset 34dc276daadb2c
parent 33 800a36a1ca8e
child 35 2daf59392c88
Added support for Winbond W83627EHF, W83667HG, W83667HG-B mainboard chips.
GUI/MainForm.cs
Hardware/Computer.cs
Hardware/LPC/Chip.cs
Hardware/LPC/F718XX.cs
Hardware/LPC/IT87XX.cs
Hardware/LPC/LPCGroup.cs
Hardware/LPC/LPCHardware.cs
Hardware/LPC/W83627.cs
Hardware/LPC/W836XX.cs
Hardware/LPC/Winbond.cs
Hardware/TBalancer/TBalancerGroup.cs
OpenHardwareMonitor.csproj
Properties/AssemblyInfo.cs
     1.1 --- a/GUI/MainForm.cs	Sun Feb 07 20:59:13 2010 +0000
     1.2 +++ b/GUI/MainForm.cs	Mon Feb 08 20:18:25 2010 +0000
     1.3 @@ -319,7 +319,7 @@
     1.4        } else {
     1.5          Visible = true;
     1.6          notifyIcon.Visible = false;
     1.7 -        BringToFront();
     1.8 +        Activate();
     1.9        }
    1.10      }
    1.11  
     2.1 --- a/Hardware/Computer.cs	Sun Feb 07 20:59:13 2010 +0000
     2.2 +++ b/Hardware/Computer.cs	Mon Feb 08 20:18:25 2010 +0000
     2.3 @@ -38,6 +38,7 @@
     2.4  using System;
     2.5  using System.Collections.Generic;
     2.6  using System.IO;
     2.7 +using System.Globalization;
     2.8  using System.Text;
     2.9  
    2.10  namespace OpenHardwareMonitor.Hardware {
    2.11 @@ -133,7 +134,7 @@
    2.12      public void SaveReport(Version version) {
    2.13  
    2.14        using (TextWriter w =
    2.15 -        new StreamWriter("OpenHardwareMonitor.Report.txt")) {
    2.16 +        new StreamWriter("OpenHardwareMonitor.Report.txt")) {        
    2.17  
    2.18          w.WriteLine();
    2.19          w.WriteLine("Open Hardware Monitor Report");
    2.20 @@ -152,7 +153,8 @@
    2.21              foreach (ISensor sensor in hardware.Sensors) {
    2.22                w.WriteLine("|   +- {0} : {1} : {2} : {3}",
    2.23                  new object[] { sensor.SensorType, sensor.Index, sensor.Name, 
    2.24 -                  sensor.Value });
    2.25 +                  string.Format(CultureInfo.InvariantCulture, "{0}", 
    2.26 +                  sensor.Value) });
    2.27              }
    2.28            }
    2.29          }
     3.1 --- a/Hardware/LPC/Chip.cs	Sun Feb 07 20:59:13 2010 +0000
     3.2 +++ b/Hardware/LPC/Chip.cs	Mon Feb 08 20:18:25 2010 +0000
     3.3 @@ -13,7 +13,10 @@
     3.4      IT8726F = 0x8726,
     3.5      W83627DHG = 0xA020,
     3.6      W83627DHGP = 0xB070,
     3.7 +    W83627EHF = 0x8860,
     3.8      W83627HF = 0x5200,
     3.9 +    W83667HG = 0xA510,
    3.10 +    W83667HGB = 0xB350,
    3.11      F71862 = 0x0601, 
    3.12      F71869 = 0x0814,
    3.13      F71882 = 0x0541,
     4.1 --- a/Hardware/LPC/F718XX.cs	Sun Feb 07 20:59:13 2010 +0000
     4.2 +++ b/Hardware/LPC/F718XX.cs	Mon Feb 08 20:18:25 2010 +0000
     4.3 @@ -136,7 +136,8 @@
     4.4  
     4.5          if (value > 0) {
     4.6            sensor.Value = (value < 0x0fff) ? 1.5e6f / value : 0;
     4.7 -          ActivateSensor(sensor);
     4.8 +          if (sensor.Value > 0)
     4.9 +            ActivateSensor(sensor);
    4.10          } else {
    4.11            DeactivateSensor(sensor);
    4.12          }
     5.1 --- a/Hardware/LPC/IT87XX.cs	Sun Feb 07 20:59:13 2010 +0000
     5.2 +++ b/Hardware/LPC/IT87XX.cs	Mon Feb 08 20:18:25 2010 +0000
     5.3 @@ -164,7 +164,8 @@
     5.4  
     5.5          if (value > 0) {
     5.6            sensor.Value = (value < 0xffff) ? 1.35e6f / ((value) * 2) : 0;
     5.7 -          ActivateSensor(sensor);
     5.8 +          if (sensor.Value > 0)
     5.9 +            ActivateSensor(sensor);
    5.10          } else {
    5.11            DeactivateSensor(sensor);
    5.12          }
     6.1 --- a/Hardware/LPC/LPCGroup.cs	Sun Feb 07 20:59:13 2010 +0000
     6.2 +++ b/Hardware/LPC/LPCGroup.cs	Mon Feb 08 20:18:25 2010 +0000
     6.3 @@ -75,6 +75,7 @@
     6.4        WinRing0.WriteIoPortByte(valuePort, logicalDeviceNumber);
     6.5      }
     6.6  
     6.7 +    // ITE
     6.8      private const byte IT87_ENVIRONMENT_CONTROLLER_LDN = 0x04;    
     6.9  
    6.10      private void IT87Enter() {
    6.11 @@ -93,7 +94,7 @@
    6.12      private const byte FINTEK_VENDOR_ID_REGISTER = 0x23;
    6.13      private const ushort FINTEK_VENDOR_ID = 0x1934;
    6.14  
    6.15 -    private const byte W83627_HARDWARE_MONITOR_LDN = 0x0B;
    6.16 +    private const byte WINBOND_HARDWARE_MONITOR_LDN = 0x0B;
    6.17  
    6.18      private const byte F71858_HARDWARE_MONITOR_LDN = 0x02;
    6.19      private const byte FINTEK_HARDWARE_MONITOR_LDN = 0x04;
    6.20 @@ -120,89 +121,80 @@
    6.21          byte logicalDeviceNumber;
    6.22          byte id = ReadByte(CHIP_ID_REGISTER);
    6.23          byte revision = ReadByte(CHIP_REVISION_REGISTER);
    6.24 +        chip = Chip.Unknown;
    6.25 +        logicalDeviceNumber = 0;
    6.26          switch (id) {
    6.27            case 0x05:
    6.28              switch (revision) {
    6.29                case 0x41:
    6.30                  chip = Chip.F71882;
    6.31                  logicalDeviceNumber = FINTEK_HARDWARE_MONITOR_LDN;
    6.32 -                break;
    6.33 -              default:
    6.34 -                chip = Chip.Unknown;
    6.35 -                logicalDeviceNumber = 0;
    6.36 -                break;
    6.37 +                break;              
    6.38              } break;
    6.39            case 0x06:
    6.40              switch (revision) {             
    6.41                case 0x01:
    6.42                  chip = Chip.F71862;
    6.43                  logicalDeviceNumber = FINTEK_HARDWARE_MONITOR_LDN;
    6.44 -                break;
    6.45 -              default:
    6.46 -                chip = Chip.Unknown;
    6.47 -                logicalDeviceNumber = 0;
    6.48 -                break;
    6.49 +                break;              
    6.50              } break;
    6.51            case 0x07:
    6.52              switch (revision) {
    6.53                case 0x23:
    6.54                  chip = Chip.F71889;
    6.55                  logicalDeviceNumber = FINTEK_HARDWARE_MONITOR_LDN;
    6.56 -                break;
    6.57 -              default:
    6.58 -                chip = Chip.Unknown;
    6.59 -                logicalDeviceNumber = 0;
    6.60 -                break;
    6.61 +                break;              
    6.62              } break;
    6.63            case 0x08:
    6.64              switch (revision) {
    6.65                case 0x14:
    6.66                  chip = Chip.F71869;
    6.67                  logicalDeviceNumber = FINTEK_HARDWARE_MONITOR_LDN;
    6.68 -                break;
    6.69 -              default:
    6.70 -                chip = Chip.Unknown;
    6.71 -                logicalDeviceNumber = 0;
    6.72 -                break;
    6.73 +                break;              
    6.74              } break;
    6.75            case 0x52:
    6.76              switch (revision) {
    6.77                case 0x17:
    6.78                case 0x3A:
    6.79                  chip = Chip.W83627HF;
    6.80 -                logicalDeviceNumber = W83627_HARDWARE_MONITOR_LDN;
    6.81 -                break;
    6.82 -              default:
    6.83 -                chip = Chip.Unknown;
    6.84 -                logicalDeviceNumber = 0;
    6.85 +                logicalDeviceNumber = WINBOND_HARDWARE_MONITOR_LDN;
    6.86 +                break;             
    6.87 +            } break;
    6.88 +          case 0x88:
    6.89 +            switch (revision & 0xF0) {
    6.90 +              case 0x60:
    6.91 +                chip = Chip.W83627EHF;
    6.92 +                logicalDeviceNumber = WINBOND_HARDWARE_MONITOR_LDN;
    6.93                  break;
    6.94              } break;
    6.95            case 0xA0:
    6.96              switch (revision & 0xF0) {
    6.97                case 0x20: 
    6.98                  chip = Chip.W83627DHG;
    6.99 -                logicalDeviceNumber = W83627_HARDWARE_MONITOR_LDN;  
   6.100 -                break;
   6.101 -              default: 
   6.102 -                chip = Chip.Unknown;
   6.103 -                logicalDeviceNumber = 0;
   6.104 +                logicalDeviceNumber = WINBOND_HARDWARE_MONITOR_LDN;  
   6.105 +                break;             
   6.106 +            } break;
   6.107 +          case 0xA5:
   6.108 +            switch (revision & 0xF0) {
   6.109 +              case 0x10:
   6.110 +                chip = Chip.W83667HG;
   6.111 +                logicalDeviceNumber = WINBOND_HARDWARE_MONITOR_LDN;
   6.112                  break;
   6.113              } break;
   6.114            case 0xB0:
   6.115              switch (revision & 0xF0) {
   6.116                case 0x70:
   6.117                  chip = Chip.W83627DHGP;
   6.118 -                logicalDeviceNumber = W83627_HARDWARE_MONITOR_LDN;
   6.119 +                logicalDeviceNumber = WINBOND_HARDWARE_MONITOR_LDN;
   6.120 +                break;             
   6.121 +            } break;
   6.122 +          case 0xB3:
   6.123 +            switch (revision & 0xF0) {
   6.124 +              case 0x50:
   6.125 +                chip = Chip.W83667HGB;
   6.126 +                logicalDeviceNumber = WINBOND_HARDWARE_MONITOR_LDN;
   6.127                  break;
   6.128 -              default:
   6.129 -                chip = Chip.Unknown;
   6.130 -                logicalDeviceNumber = 0;
   6.131 -                break;
   6.132 -            } break;  
   6.133 -          default:
   6.134 -            chip = Chip.Unknown; 
   6.135 -            logicalDeviceNumber = 0;
   6.136 -            break;
   6.137 +            } break; 
   6.138          }
   6.139          if (chip != Chip.Unknown) {
   6.140  
   6.141 @@ -217,16 +209,19 @@
   6.142  
   6.143            WinbondFintekExit();
   6.144  
   6.145 -          if (address != verify || address == 0 || (address & 0xF007) != 0)
   6.146 +          if (address != verify || address < 0x100 || (address & 0xF007) != 0)
   6.147              return;
   6.148            
   6.149            switch (chip) {
   6.150              case Chip.W83627DHG:
   6.151              case Chip.W83627DHGP:
   6.152 +            case Chip.W83627EHF:
   6.153              case Chip.W83627HF:
   6.154 -              W83627 w83627 = new W83627(chip, revision, address);
   6.155 -              if (w83627.IsAvailable)
   6.156 -                hardware.Add(w83627);
   6.157 +            case Chip.W83667HG:
   6.158 +            case Chip.W83667HGB:
   6.159 +              W836XX w836XX = new W836XX(chip, revision, address);
   6.160 +              if (w836XX.IsAvailable)
   6.161 +                hardware.Add(w836XX);
   6.162                break;
   6.163              case Chip.F71862:
   6.164              case Chip.F71882:
   6.165 @@ -261,7 +256,7 @@
   6.166  
   6.167            IT87Exit();
   6.168  
   6.169 -          if (address != verify || address == 0 || (address & 0xF007) != 0)
   6.170 +          if (address != verify || address < 0x100 || (address & 0xF007) != 0)
   6.171              return;
   6.172  
   6.173            IT87XX it87 = new IT87XX(chip, address);
     7.1 --- a/Hardware/LPC/LPCHardware.cs	Sun Feb 07 20:59:13 2010 +0000
     7.2 +++ b/Hardware/LPC/LPCHardware.cs	Mon Feb 08 20:18:25 2010 +0000
     7.3 @@ -61,7 +61,10 @@
     7.4          case Chip.IT8726F: this.name = "ITE IT8726F"; break;
     7.5          case Chip.W83627DHG: this.name = "Winbond W83627DHG"; break;
     7.6          case Chip.W83627DHGP: this.name = "Winbond W83627DHG-P"; break;
     7.7 +        case Chip.W83627EHF: this.name = "Winbond W83627EHF"; break;
     7.8          case Chip.W83627HF: this.name = "Winbond W83627HF"; break;
     7.9 +        case Chip.W83667HG: this.name = "Winbond W83667HG"; break;
    7.10 +        case Chip.W83667HGB: this.name = "Winbond W83667HG-B"; break;
    7.11        }
    7.12      }
    7.13  
     8.1 --- a/Hardware/LPC/W83627.cs	Sun Feb 07 20:59:13 2010 +0000
     8.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.3 @@ -1,155 +0,0 @@
     8.4 -/*
     8.5 -  
     8.6 -  Version: MPL 1.1/GPL 2.0/LGPL 2.1
     8.7 -
     8.8 -  The contents of this file are subject to the Mozilla Public License Version
     8.9 -  1.1 (the "License"); you may not use this file except in compliance with
    8.10 -  the License. You may obtain a copy of the License at
    8.11 - 
    8.12 -  http://www.mozilla.org/MPL/
    8.13 -
    8.14 -  Software distributed under the License is distributed on an "AS IS" basis,
    8.15 -  WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
    8.16 -  for the specific language governing rights and limitations under the License.
    8.17 -
    8.18 -  The Original Code is the Open Hardware Monitor code.
    8.19 -
    8.20 -  The Initial Developer of the Original Code is 
    8.21 -  Michael Möller <m.moeller@gmx.ch>.
    8.22 -  Portions created by the Initial Developer are Copyright (C) 2009-2010
    8.23 -  the Initial Developer. All Rights Reserved.
    8.24 -
    8.25 -  Contributor(s):
    8.26 -
    8.27 -  Alternatively, the contents of this file may be used under the terms of
    8.28 -  either the GNU General Public License Version 2 or later (the "GPL"), or
    8.29 -  the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
    8.30 -  in which case the provisions of the GPL or the LGPL are applicable instead
    8.31 -  of those above. If you wish to allow use of your version of this file only
    8.32 -  under the terms of either the GPL or the LGPL, and not to allow others to
    8.33 -  use your version of this file under the terms of the MPL, indicate your
    8.34 -  decision by deleting the provisions above and replace them with the notice
    8.35 -  and other provisions required by the GPL or the LGPL. If you do not delete
    8.36 -  the provisions above, a recipient may use your version of this file under
    8.37 -  the terms of any one of the MPL, the GPL or the LGPL.
    8.38 - 
    8.39 -*/
    8.40 -
    8.41 -using System;
    8.42 -using System.Collections.Generic;
    8.43 -using System.Drawing;
    8.44 -using System.Text;
    8.45 -
    8.46 -namespace OpenHardwareMonitor.Hardware.LPC {
    8.47 -  public class W83627 : Winbond, IHardware {
    8.48 -   
    8.49 -    private Sensor[] temperatures;
    8.50 -    private Sensor[] fans;
    8.51 -    private Sensor[] voltages;
    8.52 -
    8.53 -    private float[] voltageGains;
    8.54 -    private string[] fanNames;
    8.55 -
    8.56 -    // Hardware Monitor Registers
    8.57 -    private const byte VOLTAGE_BASE_REG = 0x20;   
    8.58 -    private const byte TEMPERATURE_BASE_REG = 0x50;
    8.59 -    private const byte TEMPERATURE_SYS_REG = 0x27;
    8.60 -
    8.61 -    private byte[] FAN_TACHO_REG = new byte[] { 0x28, 0x29, 0x2A, 0x3F, 0x53 };
    8.62 -    private byte[] FAN_TACHO_BANK = new byte[] { 0, 0, 0, 0, 5 };       
    8.63 -    private byte[] FAN_BIT_REG = new byte[] { 0x47, 0x4B, 0x4C, 0x59, 0x5D };
    8.64 -    private byte[] FAN_DIV_BIT0 = new byte[] { 36, 38, 30, 8, 10 };
    8.65 -    private byte[] FAN_DIV_BIT1 = new byte[] { 37, 39, 31, 9, 11 };
    8.66 -    private byte[] FAN_DIV_BIT2 = new byte[] { 5, 6, 7, 23, 15 };
    8.67 -
    8.68 -    public W83627(Chip chip, byte revision, ushort address) 
    8.69 -      : base(chip, revision, address)
    8.70 -    {
    8.71 -     
    8.72 -      temperatures = new Sensor[3];
    8.73 -      temperatures[0] = new Sensor("CPU", 0, SensorType.Temperature, this);
    8.74 -      temperatures[1] = new Sensor("Auxiliary", 1, SensorType.Temperature, this);
    8.75 -      temperatures[2] = new Sensor("System", 2, SensorType.Temperature, this);
    8.76 -
    8.77 -      switch (chip) {
    8.78 -        case Chip.W83627DHG:
    8.79 -        case Chip.W83627DHGP: 
    8.80 -          fanNames = new string[] { "System", "CPU #1", "Auxiliary #1", 
    8.81 -            "CPU #2", "Auxiliary #2" };
    8.82 -          voltageGains = new float[] { 0.008f, 1, 1, 0.016f, 1, 1, 1, 0.016f };
    8.83 -          voltages = new Sensor[3];
    8.84 -          voltages[0] = new Sensor("CPU VCore", 0, SensorType.Voltage, this);
    8.85 -          voltages[1] = new Sensor("+3.3V", 3, SensorType.Voltage, this);
    8.86 -          voltages[2] = new Sensor("Battery", 7, SensorType.Voltage, this);
    8.87 -          break;
    8.88 -        case Chip.W83627HF: 
    8.89 -          fanNames = new string[] { "Fan #1", "Fan #2", "Fan #3" };
    8.90 -          voltageGains = new float[] { 0.016f, 1, 0.016f, 1, 1, 1, 1, 0.016f };
    8.91 -          voltages = new Sensor[3];
    8.92 -          voltages[0] = new Sensor("CPU VCore", 0, SensorType.Voltage, this);
    8.93 -          voltages[1] = new Sensor("+3.3V", 2, SensorType.Voltage, this);
    8.94 -          voltages[2] = new Sensor("Battery", 7, SensorType.Voltage, this);
    8.95 -          break;
    8.96 -        default: fanNames = new string[0];
    8.97 -          break;
    8.98 -      }
    8.99 -      
   8.100 -      fans = new Sensor[fanNames.Length];
   8.101 -      for (int i = 0; i < fanNames.Length; i++)
   8.102 -        fans[i] = new Sensor(fanNames[i], i, SensorType.Fan, this);
   8.103 -    }    
   8.104 -
   8.105 -    public void Update() {
   8.106 -      foreach (Sensor sensor in voltages) {
   8.107 -        if (sensor.Index < 7) {
   8.108 -          int value = ReadByte(0, (byte)(VOLTAGE_BASE_REG + sensor.Index));
   8.109 -          sensor.Value = voltageGains[sensor.Index] * value;
   8.110 -          if (sensor.Value > 0)
   8.111 -            ActivateSensor(sensor);
   8.112 -          else
   8.113 -            DeactivateSensor(sensor);
   8.114 -        } else {
   8.115 -          // Battery voltage
   8.116 -          bool valid = (ReadByte(0, 0x5D) & 0x01) > 0;
   8.117 -          if (valid) {
   8.118 -            sensor.Value = voltageGains[sensor.Index] * 
   8.119 -              ReadByte(5, 0x51);
   8.120 -            ActivateSensor(sensor);
   8.121 -          } else
   8.122 -            DeactivateSensor(sensor);
   8.123 -        }
   8.124 -      }
   8.125 -
   8.126 -      foreach (Sensor sensor in temperatures) {
   8.127 -        int value;
   8.128 -        if (sensor.Index < 2) {
   8.129 -          value = (sbyte)ReadByte((byte)(sensor.Index + 1), TEMPERATURE_BASE_REG);
   8.130 -          value = (value << 1) | ReadByte((byte)(sensor.Index + 1),
   8.131 -            (byte)(TEMPERATURE_BASE_REG + 1)) >> 7;
   8.132 -        } else {
   8.133 -          value = (sbyte)ReadByte(0, TEMPERATURE_SYS_REG) << 1;
   8.134 -        }
   8.135 -        sensor.Value = value / 2.0f;
   8.136 -        if (value < 0xFE)
   8.137 -          ActivateSensor(sensor);
   8.138 -        else
   8.139 -          DeactivateSensor(sensor);
   8.140 -      }
   8.141 -
   8.142 -      long bits = 0;
   8.143 -      for (int i = 0; i < FAN_BIT_REG.Length; i++)
   8.144 -        bits = (bits << 8) | ReadByte(0, FAN_BIT_REG[i]);
   8.145 -      foreach (Sensor sensor in fans) {
   8.146 -        int count = ReadByte(FAN_TACHO_BANK[sensor.Index], 
   8.147 -          FAN_TACHO_REG[sensor.Index]);
   8.148 -        int divisorBits = (int)(
   8.149 -          (((bits >> FAN_DIV_BIT2[sensor.Index]) & 1) << 2) |
   8.150 -          (((bits >> FAN_DIV_BIT1[sensor.Index]) & 1) << 1) |
   8.151 -           ((bits >> FAN_DIV_BIT0[sensor.Index]) & 1));
   8.152 -        int divisor = 1 << divisorBits;
   8.153 -        sensor.Value = (count < 0xff) ? 1.35e6f / (count * divisor) : 0;
   8.154 -        ActivateSensor(sensor);        
   8.155 -      }     
   8.156 -    }
   8.157 -  }
   8.158 -}
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/Hardware/LPC/W836XX.cs	Mon Feb 08 20:18:25 2010 +0000
     9.3 @@ -0,0 +1,239 @@
     9.4 +/*
     9.5 +  
     9.6 +  Version: MPL 1.1/GPL 2.0/LGPL 2.1
     9.7 +
     9.8 +  The contents of this file are subject to the Mozilla Public License Version
     9.9 +  1.1 (the "License"); you may not use this file except in compliance with
    9.10 +  the License. You may obtain a copy of the License at
    9.11 + 
    9.12 +  http://www.mozilla.org/MPL/
    9.13 +
    9.14 +  Software distributed under the License is distributed on an "AS IS" basis,
    9.15 +  WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
    9.16 +  for the specific language governing rights and limitations under the License.
    9.17 +
    9.18 +  The Original Code is the Open Hardware Monitor code.
    9.19 +
    9.20 +  The Initial Developer of the Original Code is 
    9.21 +  Michael Möller <m.moeller@gmx.ch>.
    9.22 +  Portions created by the Initial Developer are Copyright (C) 2009-2010
    9.23 +  the Initial Developer. All Rights Reserved.
    9.24 +
    9.25 +  Contributor(s):
    9.26 +
    9.27 +  Alternatively, the contents of this file may be used under the terms of
    9.28 +  either the GNU General Public License Version 2 or later (the "GPL"), or
    9.29 +  the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
    9.30 +  in which case the provisions of the GPL or the LGPL are applicable instead
    9.31 +  of those above. If you wish to allow use of your version of this file only
    9.32 +  under the terms of either the GPL or the LGPL, and not to allow others to
    9.33 +  use your version of this file under the terms of the MPL, indicate your
    9.34 +  decision by deleting the provisions above and replace them with the notice
    9.35 +  and other provisions required by the GPL or the LGPL. If you do not delete
    9.36 +  the provisions above, a recipient may use your version of this file under
    9.37 +  the terms of any one of the MPL, the GPL or the LGPL.
    9.38 + 
    9.39 +*/
    9.40 +
    9.41 +using System;
    9.42 +using System.Collections.Generic;
    9.43 +using System.Drawing;
    9.44 +using System.Text;
    9.45 +
    9.46 +namespace OpenHardwareMonitor.Hardware.LPC {
    9.47 +  public class W836XX : LPCHardware, IHardware {
    9.48 +
    9.49 +    private ushort address;
    9.50 +    private byte revision;
    9.51 +
    9.52 +    private bool available;
    9.53 +
    9.54 +    private Sensor[] temperatures;
    9.55 +    private Sensor[] fans;
    9.56 +    private Sensor[] voltages;
    9.57 +
    9.58 +    private float[] voltageGains;
    9.59 +    private string[] fanNames;
    9.60 +
    9.61 +    // Consts 
    9.62 +    private const ushort WINBOND_VENDOR_ID = 0x5CA3;
    9.63 +    private const byte HIGH_BYTE = 0x80;
    9.64 +
    9.65 +    // Hardware Monitor
    9.66 +    private const byte ADDRESS_REGISTER_OFFSET = 0x05;
    9.67 +    private const byte DATA_REGISTER_OFFSET = 0x06;
    9.68 +
    9.69 +    // Hardware Monitor Registers
    9.70 +    private const byte VOLTAGE_BASE_REG = 0x20;
    9.71 +    private const byte BANK_SELECT_REGISTER = 0x04E;
    9.72 +    private const byte VENDOR_ID_REGISTER = 0x4F;
    9.73 +    private const byte TEMPERATURE_BASE_REG = 0x50;
    9.74 +    private const byte TEMPERATURE_SYS_REG = 0x27;    
    9.75 +
    9.76 +    private byte[] FAN_TACHO_REG = new byte[] { 0x28, 0x29, 0x2A, 0x3F, 0x53 };
    9.77 +    private byte[] FAN_TACHO_BANK = new byte[] { 0, 0, 0, 0, 5 };       
    9.78 +    private byte[] FAN_BIT_REG = new byte[] { 0x47, 0x4B, 0x4C, 0x59, 0x5D };
    9.79 +    private byte[] FAN_DIV_BIT0 = new byte[] { 36, 38, 30, 8, 10 };
    9.80 +    private byte[] FAN_DIV_BIT1 = new byte[] { 37, 39, 31, 9, 11 };
    9.81 +    private byte[] FAN_DIV_BIT2 = new byte[] { 5, 6, 7, 23, 15 };
    9.82 +
    9.83 +    private byte ReadByte(byte bank, byte register) {
    9.84 +      WinRing0.WriteIoPortByte(
    9.85 +         (ushort)(address + ADDRESS_REGISTER_OFFSET), BANK_SELECT_REGISTER);
    9.86 +      WinRing0.WriteIoPortByte(
    9.87 +         (ushort)(address + DATA_REGISTER_OFFSET), bank);
    9.88 +      WinRing0.WriteIoPortByte(
    9.89 +         (ushort)(address + ADDRESS_REGISTER_OFFSET), register);
    9.90 +      return WinRing0.ReadIoPortByte(
    9.91 +        (ushort)(address + DATA_REGISTER_OFFSET));
    9.92 +    } 
    9.93 +
    9.94 +    public W836XX(Chip chip, byte revision, ushort address) 
    9.95 +      : base(chip)
    9.96 +    {
    9.97 +      this.address = address;
    9.98 +      this.revision = revision;
    9.99 +
   9.100 +      available = IsWinbondVendor();
   9.101 +
   9.102 +      temperatures = new Sensor[3];
   9.103 +      temperatures[0] = new Sensor("CPU", 0, SensorType.Temperature, this);
   9.104 +      temperatures[1] = new Sensor("Auxiliary", 1, SensorType.Temperature, this);
   9.105 +      temperatures[2] = new Sensor("System", 2, SensorType.Temperature, this);
   9.106 +
   9.107 +      switch (chip) {
   9.108 +        case Chip.W83627DHG:
   9.109 +        case Chip.W83627DHGP:
   9.110 +        case Chip.W83627EHF:
   9.111 +        case Chip.W83667HG:
   9.112 +        case Chip.W83667HGB: 
   9.113 +          fanNames = new string[] { "System", "CPU", "Auxiliary", 
   9.114 +            "CPU #2", "Auxiliary #2" };
   9.115 +          voltageGains = new float[] { 1, 1, 1, 2, 1, 1, 1, 2 };
   9.116 +          voltages = new Sensor[3];
   9.117 +          voltages[0] = new Sensor("CPU VCore", 0, SensorType.Voltage, this);
   9.118 +          voltages[1] = new Sensor("+3.3V", 3, SensorType.Voltage, this);
   9.119 +          voltages[2] = new Sensor("Battery", 7, SensorType.Voltage, this);
   9.120 +          break;
   9.121 +        case Chip.W83627HF: 
   9.122 +          fanNames = new string[] { "Fan #1", "Fan #2", "Fan #3" };
   9.123 +          voltageGains = new float[] { 2, 1, 2, 1, 1, 1, 1, 2 };
   9.124 +          voltages = new Sensor[3];
   9.125 +          voltages[0] = new Sensor("CPU VCore", 0, SensorType.Voltage, this);
   9.126 +          voltages[1] = new Sensor("+3.3V", 2, SensorType.Voltage, this);
   9.127 +          voltages[2] = new Sensor("Battery", 7, SensorType.Voltage, this);
   9.128 +          break;
   9.129 +        default: fanNames = new string[0];
   9.130 +          break;
   9.131 +      }
   9.132 +      
   9.133 +      fans = new Sensor[fanNames.Length];
   9.134 +      for (int i = 0; i < fanNames.Length; i++)
   9.135 +        fans[i] = new Sensor(fanNames[i], i, SensorType.Fan, this);
   9.136 +    }
   9.137 +
   9.138 +    public bool IsAvailable {
   9.139 +      get { return available; }
   9.140 +    }        
   9.141 +
   9.142 +    private bool IsWinbondVendor() {
   9.143 +      ushort vendorId =
   9.144 +        (ushort)((ReadByte(HIGH_BYTE, VENDOR_ID_REGISTER) << 8) |
   9.145 +           ReadByte(0, VENDOR_ID_REGISTER));
   9.146 +      return vendorId == WINBOND_VENDOR_ID;
   9.147 +    }
   9.148 +
   9.149 +    public void Update() {
   9.150 +      foreach (Sensor sensor in voltages) {
   9.151 +        if (sensor.Index < 7) {
   9.152 +          int value = ReadByte(0, (byte)(VOLTAGE_BASE_REG + sensor.Index));
   9.153 +          sensor.Value = 0.008f * voltageGains[sensor.Index] * value;
   9.154 +          if (sensor.Value > 0)
   9.155 +            ActivateSensor(sensor);
   9.156 +          else
   9.157 +            DeactivateSensor(sensor);
   9.158 +        } else {
   9.159 +          // Battery voltage
   9.160 +          bool valid = (ReadByte(0, 0x5D) & 0x01) > 0;
   9.161 +          if (valid) {
   9.162 +            sensor.Value = 
   9.163 +              0.008f * voltageGains[sensor.Index] * ReadByte(5, 0x51);
   9.164 +            ActivateSensor(sensor);
   9.165 +          } else
   9.166 +            DeactivateSensor(sensor);
   9.167 +        }
   9.168 +      }
   9.169 +
   9.170 +      foreach (Sensor sensor in temperatures) {
   9.171 +        int value;
   9.172 +        if (sensor.Index < 2) {
   9.173 +          value = (sbyte)ReadByte((byte)(sensor.Index + 1), TEMPERATURE_BASE_REG);
   9.174 +          value = (value << 1) | ReadByte((byte)(sensor.Index + 1),
   9.175 +            (byte)(TEMPERATURE_BASE_REG + 1)) >> 7;
   9.176 +        } else {
   9.177 +          value = (sbyte)ReadByte(0, TEMPERATURE_SYS_REG) << 1;
   9.178 +        }
   9.179 +        sensor.Value = value / 2.0f;
   9.180 +        if (value < 0xFE)
   9.181 +          ActivateSensor(sensor);
   9.182 +        else
   9.183 +          DeactivateSensor(sensor);
   9.184 +      }
   9.185 +
   9.186 +      long bits = 0;
   9.187 +      for (int i = 0; i < FAN_BIT_REG.Length; i++)
   9.188 +        bits = (bits << 8) | ReadByte(0, FAN_BIT_REG[i]);
   9.189 +      foreach (Sensor sensor in fans) {
   9.190 +        int count = ReadByte(FAN_TACHO_BANK[sensor.Index], 
   9.191 +          FAN_TACHO_REG[sensor.Index]);
   9.192 +        int divisorBits = (int)(
   9.193 +          (((bits >> FAN_DIV_BIT2[sensor.Index]) & 1) << 2) |
   9.194 +          (((bits >> FAN_DIV_BIT1[sensor.Index]) & 1) << 1) |
   9.195 +           ((bits >> FAN_DIV_BIT0[sensor.Index]) & 1));
   9.196 +        int divisor = 1 << divisorBits;
   9.197 +        float value = (count < 0xff) ? 1.35e6f / (count * divisor) : 0;
   9.198 +        sensor.Value = value;
   9.199 +        if (value > 0)
   9.200 +          ActivateSensor(sensor);        
   9.201 +      }     
   9.202 +    }
   9.203 +
   9.204 +    public string GetReport() {
   9.205 +      StringBuilder r = new StringBuilder();
   9.206 +
   9.207 +      r.AppendLine("LPC " + this.GetType().Name);
   9.208 +      r.AppendLine();
   9.209 +      r.Append("Chip ID: 0x"); r.AppendLine(chip.ToString("X"));
   9.210 +      r.Append("Chip revision: 0x"); r.AppendLine(revision.ToString("X"));
   9.211 +      r.Append("Base Adress: 0x"); r.AppendLine(address.ToString("X4"));
   9.212 +      r.AppendLine();
   9.213 +      r.AppendLine("Hardware Monitor Registers");
   9.214 +      r.AppendLine();
   9.215 +      r.AppendLine("      00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F");
   9.216 +      r.AppendLine();
   9.217 +      for (int i = 0; i < 0x7; i++) {
   9.218 +        r.Append(" "); r.Append((i << 4).ToString("X2")); r.Append("  ");
   9.219 +        for (int j = 0; j <= 0xF; j++) {
   9.220 +          r.Append(" ");
   9.221 +          r.Append(ReadByte(0, (byte)((i << 4) | j)).ToString("X2"));
   9.222 +        }
   9.223 +        r.AppendLine();
   9.224 +      }
   9.225 +      for (int k = 1; k <= 5; k++) {
   9.226 +        r.AppendLine("Bank " + k);
   9.227 +        for (int i = 0x5; i < 0x6; i++) {
   9.228 +          r.Append(" "); r.Append((i << 4).ToString("X2")); r.Append("  ");
   9.229 +          for (int j = 0; j <= 0xF; j++) {
   9.230 +            r.Append(" ");
   9.231 +            r.Append(ReadByte((byte)(k),
   9.232 +              (byte)((i << 4) | j)).ToString("X2"));
   9.233 +          }
   9.234 +          r.AppendLine();
   9.235 +        }
   9.236 +      }
   9.237 +      r.AppendLine();
   9.238 +
   9.239 +      return r.ToString();
   9.240 +    }
   9.241 +  }
   9.242 +}
    10.1 --- a/Hardware/LPC/Winbond.cs	Sun Feb 07 20:59:13 2010 +0000
    10.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.3 @@ -1,132 +0,0 @@
    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 -using System.Text;
   10.45 -
   10.46 -namespace OpenHardwareMonitor.Hardware.LPC {
   10.47 -  public abstract class Winbond : LPCHardware {
   10.48 -
   10.49 -    private ushort address;
   10.50 -    private byte revision;
   10.51 -
   10.52 -    private bool available;
   10.53 -
   10.54 -    // Consts 
   10.55 -    private const ushort WINBOND_VENDOR_ID = 0x5CA3;
   10.56 -    private const byte HIGH_BYTE = 0x80;
   10.57 -
   10.58 -    // Hardware Monitor
   10.59 -    private const byte ADDRESS_REGISTER_OFFSET = 0x05;
   10.60 -    private const byte DATA_REGISTER_OFFSET = 0x06;
   10.61 -
   10.62 -    // Hardware Monitor Registers
   10.63 -    private const byte BANK_SELECT_REGISTER = 0x04E;
   10.64 -    private const byte VENDOR_ID_REGISTER = 0x4F;
   10.65 -
   10.66 -    protected byte ReadByte(byte bank, byte register) {
   10.67 -      WinRing0.WriteIoPortByte(
   10.68 -         (ushort)(address + ADDRESS_REGISTER_OFFSET), BANK_SELECT_REGISTER);
   10.69 -      WinRing0.WriteIoPortByte(
   10.70 -         (ushort)(address + DATA_REGISTER_OFFSET), bank);
   10.71 -      WinRing0.WriteIoPortByte(
   10.72 -         (ushort)(address + ADDRESS_REGISTER_OFFSET), register);
   10.73 -      return WinRing0.ReadIoPortByte(
   10.74 -        (ushort)(address + DATA_REGISTER_OFFSET));
   10.75 -    } 
   10.76 -
   10.77 -    private bool IsWinbondVendor() {
   10.78 -      ushort vendorId =
   10.79 -        (ushort)((ReadByte(HIGH_BYTE, VENDOR_ID_REGISTER) << 8) |
   10.80 -           ReadByte(0, VENDOR_ID_REGISTER));
   10.81 -      return vendorId == WINBOND_VENDOR_ID;
   10.82 -    }
   10.83 -
   10.84 -    public Winbond(Chip chip, byte revision, ushort address)
   10.85 -      : base(chip) 
   10.86 -    {
   10.87 -      this.address = address;
   10.88 -      this.revision = revision;
   10.89 -
   10.90 -      available = IsWinbondVendor();
   10.91 -    }
   10.92 -
   10.93 -    public bool IsAvailable {
   10.94 -      get { return available; }
   10.95 -    }    
   10.96 -   
   10.97 -    public string GetReport() {
   10.98 -      StringBuilder r = new StringBuilder();
   10.99 -
  10.100 -      r.AppendLine("LPC " + this.GetType().Name);
  10.101 -      r.AppendLine();
  10.102 -      r.Append("Chip ID: 0x"); r.AppendLine(chip.ToString("X"));
  10.103 -      r.Append("Chip revision: 0x"); r.AppendLine(revision.ToString("X"));
  10.104 -      r.Append("Base Adress: 0x"); r.AppendLine(address.ToString("X4"));
  10.105 -      r.AppendLine();
  10.106 -      r.AppendLine("Hardware Monitor Registers");
  10.107 -      r.AppendLine();
  10.108 -      r.AppendLine("      00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F");
  10.109 -      r.AppendLine();
  10.110 -      for (int i = 0; i < 0x7; i++) {
  10.111 -        r.Append(" "); r.Append((i << 4).ToString("X2")); r.Append("  ");
  10.112 -        for (int j = 0; j <= 0xF; j++) {
  10.113 -          r.Append(" ");
  10.114 -          r.Append(ReadByte(0, (byte)((i << 4) | j)).ToString("X2"));
  10.115 -        }
  10.116 -        r.AppendLine();
  10.117 -      }
  10.118 -      for (int k = 1; k <= 5; k++) {
  10.119 -        r.AppendLine("Bank " + k);
  10.120 -        for (int i = 0x5; i < 0x6; i++) {
  10.121 -          r.Append(" "); r.Append((i << 4).ToString("X2")); r.Append("  ");
  10.122 -          for (int j = 0; j <= 0xF; j++) {
  10.123 -            r.Append(" ");
  10.124 -            r.Append(ReadByte((byte)(k),
  10.125 -              (byte)((i << 4) | j)).ToString("X2"));
  10.126 -          }
  10.127 -          r.AppendLine();
  10.128 -        }
  10.129 -      }
  10.130 -      r.AppendLine();
  10.131 -
  10.132 -      return r.ToString();
  10.133 -    }
  10.134 -  }
  10.135 -}
    11.1 --- a/Hardware/TBalancer/TBalancerGroup.cs	Sun Feb 07 20:59:13 2010 +0000
    11.2 +++ b/Hardware/TBalancer/TBalancerGroup.cs	Mon Feb 08 20:18:25 2010 +0000
    11.3 @@ -62,7 +62,7 @@
    11.4            if (serialPort.IsOpen && serialPort.CDHolding &&
    11.5              serialPort.CtsHolding) {
    11.6  
    11.7 -            report.Append("Port name: "); report.AppendLine(portNames[i]);            
    11.8 +            report.Append("Port Name: "); report.AppendLine(portNames[i]);            
    11.9  
   11.10              serialPort.DiscardInBuffer();
   11.11              serialPort.DiscardOutBuffer();
    12.1 --- a/OpenHardwareMonitor.csproj	Sun Feb 07 20:59:13 2010 +0000
    12.2 +++ b/OpenHardwareMonitor.csproj	Mon Feb 08 20:18:25 2010 +0000
    12.3 @@ -69,9 +69,8 @@
    12.4      <Compile Include="Hardware\LPC\Chip.cs" />
    12.5      <Compile Include="Hardware\LPC\F718XX.cs" />
    12.6      <Compile Include="Hardware\LPC\LPCHardware.cs" />
    12.7 -    <Compile Include="Hardware\LPC\Winbond.cs" />
    12.8      <Compile Include="Hardware\SMBIOS\SMBIOSGroup.cs" />
    12.9 -    <Compile Include="Hardware\LPC\W83627.cs" />
   12.10 +    <Compile Include="Hardware\LPC\W836XX.cs" />
   12.11      <Compile Include="Hardware\Computer.cs" />
   12.12      <Compile Include="Properties\AssemblyInfo.cs" />
   12.13      <Compile Include="GUI\AboutBox.cs">
    13.1 --- a/Properties/AssemblyInfo.cs	Sun Feb 07 20:59:13 2010 +0000
    13.2 +++ b/Properties/AssemblyInfo.cs	Mon Feb 08 20:18:25 2010 +0000
    13.3 @@ -69,5 +69,5 @@
    13.4  // You can specify all the values or you can default the Build and Revision Numbers 
    13.5  // by using the '*' as shown below:
    13.6  // [assembly: AssemblyVersion("1.0.*")]
    13.7 -[assembly: AssemblyVersion("0.1.15.0")]
    13.8 -[assembly: AssemblyFileVersion("0.1.15.0")]
    13.9 +[assembly: AssemblyVersion("0.1.16.0")]
   13.10 +[assembly: AssemblyFileVersion("0.1.16.0")]