Hardware/Mainboard/SuperIOHardware.cs
author moel.mich
Thu, 11 Nov 2010 21:22:24 +0000
changeset 241 52007c404f32
parent 221 a950ba30d4dd
child 245 f8e72b2efcc0
permissions -rw-r--r--
Fixed a problem, where the MainForm location and size was lost when the application is started minimized and exited without ever showing the form. This caused MainForm_Load to be never called (location and size was not loaded), but the default size and location were still saved. The new implementation only saves the location and size when one of the two is changed.
moel@135
     1
/*
moel@130
     2
  
moel@130
     3
  Version: MPL 1.1/GPL 2.0/LGPL 2.1
moel@130
     4
moel@130
     5
  The contents of this file are subject to the Mozilla Public License Version
moel@130
     6
  1.1 (the "License"); you may not use this file except in compliance with
moel@130
     7
  the License. You may obtain a copy of the License at
moel@130
     8
 
moel@130
     9
  http://www.mozilla.org/MPL/
moel@130
    10
moel@130
    11
  Software distributed under the License is distributed on an "AS IS" basis,
moel@130
    12
  WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
moel@130
    13
  for the specific language governing rights and limitations under the License.
moel@130
    14
moel@130
    15
  The Original Code is the Open Hardware Monitor code.
moel@130
    16
moel@130
    17
  The Initial Developer of the Original Code is 
moel@130
    18
  Michael Möller <m.moeller@gmx.ch>.
moel@130
    19
  Portions created by the Initial Developer are Copyright (C) 2009-2010
moel@130
    20
  the Initial Developer. All Rights Reserved.
moel@130
    21
moel@130
    22
  Contributor(s):
moel@130
    23
moel@130
    24
  Alternatively, the contents of this file may be used under the terms of
moel@130
    25
  either the GNU General Public License Version 2 or later (the "GPL"), or
moel@130
    26
  the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
moel@130
    27
  in which case the provisions of the GPL or the LGPL are applicable instead
moel@130
    28
  of those above. If you wish to allow use of your version of this file only
moel@130
    29
  under the terms of either the GPL or the LGPL, and not to allow others to
moel@130
    30
  use your version of this file under the terms of the MPL, indicate your
moel@130
    31
  decision by deleting the provisions above and replace them with the notice
moel@130
    32
  and other provisions required by the GPL or the LGPL. If you do not delete
moel@130
    33
  the provisions above, a recipient may use your version of this file under
moel@130
    34
  the terms of any one of the MPL, the GPL or the LGPL.
moel@130
    35
 
moel@130
    36
*/
moel@130
    37
moel@228
    38
using System;
moel@130
    39
using System.Collections.Generic;
moel@166
    40
using System.Globalization;
moel@228
    41
using System.Threading;
moel@130
    42
using OpenHardwareMonitor.Hardware.LPC;
moel@130
    43
moel@130
    44
namespace OpenHardwareMonitor.Hardware.Mainboard {
moel@165
    45
  internal class SuperIOHardware : Hardware {
moel@130
    46
moel@195
    47
    private readonly Mainboard mainboard;
moel@195
    48
    private readonly ISuperIO superIO;
moel@195
    49
    private readonly string name;
moel@130
    50
moel@195
    51
    private readonly List<Sensor> voltages = new List<Sensor>();
moel@195
    52
    private readonly List<Sensor> temperatures = new List<Sensor>();
moel@195
    53
    private readonly List<Sensor> fans = new List<Sensor>();
moel@167
    54
moel@228
    55
    private delegate float? ReadValueDelegate(int index);
moel@228
    56
    private delegate void UpdateDelegate();
moel@228
    57
moel@228
    58
    // delegates for mainboard specific sensor reading code
moel@228
    59
    private readonly ReadValueDelegate readVoltage;
moel@228
    60
    private readonly ReadValueDelegate readTemperature;
moel@228
    61
    private readonly ReadValueDelegate readFan;
moel@228
    62
moel@228
    63
    // delegate for post update mainboard specific code
moel@228
    64
    private readonly UpdateDelegate postUpdate;
moel@228
    65
moel@228
    66
    // mainboard specific mutex
moel@228
    67
    private readonly Mutex mutex;
moel@228
    68
moel@176
    69
    public SuperIOHardware(Mainboard mainboard, ISuperIO superIO, 
moel@176
    70
      Manufacturer manufacturer, Model model, ISettings settings) 
moel@130
    71
    {
moel@176
    72
      this.mainboard = mainboard;
moel@130
    73
      this.superIO = superIO;
moel@167
    74
      this.name = ChipName.GetName(superIO.Chip);
moel@130
    75
moel@228
    76
      this.readVoltage = (index) => superIO.Voltages[index];
moel@228
    77
      this.readTemperature = (index) => superIO.Temperatures[index];
moel@228
    78
      this.readFan = (index) => superIO.Fans[index];
moel@228
    79
moel@228
    80
      this.postUpdate = () => { };
moel@228
    81
moel@130
    82
      List<Voltage> v = new List<Voltage>();
moel@130
    83
      List<Temperature> t = new List<Temperature>();
moel@130
    84
      List<Fan> f = new List<Fan>();
moel@130
    85
moel@130
    86
      switch (superIO.Chip) {
moel@130
    87
        case Chip.IT8712F:
moel@130
    88
        case Chip.IT8716F:
moel@130
    89
        case Chip.IT8718F:
moel@177
    90
        case Chip.IT8720F: 
moel@130
    91
        case Chip.IT8726F:
moel@130
    92
          switch (manufacturer) {
moel@133
    93
            case Manufacturer.ASUS:
moel@133
    94
              switch (model) {
moel@168
    95
                case Model.Crosshair_III_Formula: // IT8720F
moel@133
    96
                  v.Add(new Voltage("VBat", 8));
moel@133
    97
                  t.Add(new Temperature("CPU", 0));
moel@133
    98
                  for (int i = 0; i < superIO.Fans.Length; i++)
moel@133
    99
                    f.Add(new Fan("Fan #" + (i + 1), i));
moel@133
   100
                  break;
moel@144
   101
                case Model.M2N_SLI_DELUXE:                
moel@133
   102
                  v.Add(new Voltage("CPU VCore", 0));
moel@133
   103
                  v.Add(new Voltage("+3.3V", 1));
moel@195
   104
                  v.Add(new Voltage("+5V", 3, 6.8f, 10));
moel@195
   105
                  v.Add(new Voltage("+12V", 4, 30, 10));
moel@195
   106
                  v.Add(new Voltage("+5VSB", 7, 6.8f, 10));
moel@133
   107
                  v.Add(new Voltage("VBat", 8));
moel@133
   108
                  t.Add(new Temperature("CPU", 0));
moel@133
   109
                  t.Add(new Temperature("Motherboard", 1));
moel@133
   110
                  f.Add(new Fan("CPU Fan", 0));
moel@133
   111
                  f.Add(new Fan("Chassis Fan #1", 1));
moel@133
   112
                  f.Add(new Fan("Power Fan", 2));
moel@133
   113
                  break;
moel@168
   114
                case Model.M4A79XTD_EVO: // IT8720F           
moel@195
   115
                  v.Add(new Voltage("+5V", 3, 6.8f, 10));
moel@144
   116
                  v.Add(new Voltage("VBat", 8));
moel@144
   117
                  t.Add(new Temperature("CPU", 0));
moel@144
   118
                  t.Add(new Temperature("Motherboard", 1));
moel@144
   119
                  f.Add(new Fan("CPU Fan", 0));
moel@144
   120
                  f.Add(new Fan("Chassis Fan #1", 1));
moel@144
   121
                  f.Add(new Fan("Chassis Fan #2", 2));
moel@144
   122
                  break;
moel@133
   123
                default:
moel@133
   124
                  v.Add(new Voltage("CPU VCore", 0));
moel@133
   125
                  v.Add(new Voltage("Voltage #2", 1, true));
moel@133
   126
                  v.Add(new Voltage("Voltage #3", 2, true));
moel@133
   127
                  v.Add(new Voltage("Voltage #4", 3, true));
moel@133
   128
                  v.Add(new Voltage("Voltage #5", 4, true));
moel@133
   129
                  v.Add(new Voltage("Voltage #6", 5, true));
moel@133
   130
                  v.Add(new Voltage("Voltage #7", 6, true));
moel@133
   131
                  v.Add(new Voltage("Voltage #8", 7, true));
moel@133
   132
                  v.Add(new Voltage("VBat", 8));
moel@133
   133
                  for (int i = 0; i < superIO.Temperatures.Length; i++)
moel@133
   134
                    t.Add(new Temperature("Temperature #" + (i + 1), i));
moel@133
   135
                  for (int i = 0; i < superIO.Fans.Length; i++)
moel@133
   136
                    f.Add(new Fan("Fan #" + (i + 1), i));
moel@133
   137
                  break;
moel@133
   138
              }
moel@133
   139
              break;
moel@221
   140
moel@221
   141
            case Manufacturer.ASRock:
moel@221
   142
              switch (model) {
moel@221
   143
                case Model.P55_Deluxe: // IT8720F
moel@228
   144
                  
moel@221
   145
                  v.Add(new Voltage("CPU VCore", 0));
moel@221
   146
                  v.Add(new Voltage("+3.3V", 2));
moel@221
   147
                  v.Add(new Voltage("+12V", 4, 30, 10));
moel@221
   148
                  v.Add(new Voltage("+5V", 5, 6.8f, 10));
moel@221
   149
                  v.Add(new Voltage("VBat", 8));                  
moel@221
   150
                  t.Add(new Temperature("CPU", 0));
moel@221
   151
                  t.Add(new Temperature("Motherboard", 1));
moel@221
   152
                  f.Add(new Fan("CPU Fan", 0));
moel@221
   153
                  f.Add(new Fan("Chassis Fan #1", 1));
moel@228
   154
moel@228
   155
                  // this mutex is also used by the official ASRock tool
moel@228
   156
                  mutex = new Mutex(false, "ASRockOCMark");
moel@228
   157
                  
moel@228
   158
                  bool exclusiveAccess = false;
moel@228
   159
                  try {
moel@228
   160
                    exclusiveAccess = mutex.WaitOne(10, false);
moel@228
   161
                  } catch (AbandonedMutexException) { } 
moel@228
   162
                    catch (InvalidOperationException) { }  
moel@228
   163
moel@228
   164
                  // only read additional fans if we get exclusive access
moel@228
   165
                  if (exclusiveAccess) {
moel@228
   166
moel@228
   167
                    f.Add(new Fan("Chassis Fan #2", 2));
moel@228
   168
                    f.Add(new Fan("Chassis Fan #3", 3));
moel@228
   169
                    f.Add(new Fan("Power Fan", 4));
moel@228
   170
moel@228
   171
                    readFan = (index) => {
moel@228
   172
                      if (index < 2) {
moel@228
   173
                        return superIO.Fans[index];
moel@228
   174
                      } else {
moel@228
   175
                        // get GPIO 80-87
moel@228
   176
                        byte? gpio = superIO.ReadGPIO(7);
moel@228
   177
                        if (!gpio.HasValue)
moel@228
   178
                          return null;
moel@228
   179
moel@228
   180
                        // read the last 3 fans based on GPIO 83-85
moel@228
   181
                        int[] masks = { 0x05, 0x03, 0x06 };
moel@228
   182
                        return (((gpio.Value >> 3) & 0x07) ==
moel@228
   183
                          masks[index - 2]) ? superIO.Fans[2] : null;
moel@228
   184
                      }
moel@228
   185
                    };
moel@228
   186
moel@228
   187
                    int fanIndex = 0;
moel@228
   188
                    postUpdate = () => {
moel@228
   189
                      // get GPIO 80-87
moel@228
   190
                      byte? gpio = superIO.ReadGPIO(7);
moel@228
   191
                      if (!gpio.HasValue)
moel@228
   192
                        return;
moel@228
   193
moel@228
   194
                      // prepare the GPIO 83-85 for the next update
moel@228
   195
                      int[] masks = { 0x05, 0x03, 0x06 };
moel@228
   196
                      superIO.WriteGPIO(7,
moel@228
   197
                        (byte)((gpio.Value & 0xC7) | (masks[fanIndex] << 3)));
moel@228
   198
                      fanIndex = (fanIndex + 1) % 3;
moel@228
   199
                    };
moel@228
   200
                  }
moel@228
   201
moel@221
   202
                  break;
moel@221
   203
                default:
moel@221
   204
                  v.Add(new Voltage("CPU VCore", 0));
moel@221
   205
                  v.Add(new Voltage("Voltage #2", 1, true));
moel@221
   206
                  v.Add(new Voltage("Voltage #3", 2, true));
moel@221
   207
                  v.Add(new Voltage("Voltage #4", 3, true));
moel@221
   208
                  v.Add(new Voltage("Voltage #5", 4, true));
moel@221
   209
                  v.Add(new Voltage("Voltage #6", 5, true));
moel@221
   210
                  v.Add(new Voltage("Voltage #7", 6, true));
moel@221
   211
                  v.Add(new Voltage("Voltage #8", 7, true));
moel@221
   212
                  v.Add(new Voltage("VBat", 8));
moel@221
   213
                  for (int i = 0; i < superIO.Temperatures.Length; i++)
moel@221
   214
                    t.Add(new Temperature("Temperature #" + (i + 1), i));
moel@221
   215
                  for (int i = 0; i < superIO.Fans.Length; i++)
moel@221
   216
                    f.Add(new Fan("Fan #" + (i + 1), i));
moel@221
   217
                  break;
moel@221
   218
              };
moel@221
   219
              break;
moel@221
   220
moel@130
   221
            case Manufacturer.DFI:
moel@130
   222
              switch (model) {
moel@168
   223
                case Model.LP_BI_P45_T2RS_Elite: // IT8718F
moel@130
   224
                  v.Add(new Voltage("CPU VCore", 0));
moel@130
   225
                  v.Add(new Voltage("FSB VTT", 1));
moel@130
   226
                  v.Add(new Voltage("+3.3V", 2));
moel@195
   227
                  v.Add(new Voltage("+5V", 3, 6.8f, 10));
moel@195
   228
                  v.Add(new Voltage("+12V", 4, 30, 10));
moel@130
   229
                  v.Add(new Voltage("NB Core", 5));
moel@130
   230
                  v.Add(new Voltage("VDIMM", 6));
moel@195
   231
                  v.Add(new Voltage("+5VSB", 7, 6.8f, 10));
moel@130
   232
                  v.Add(new Voltage("VBat", 8));
moel@130
   233
                  t.Add(new Temperature("CPU", 0));
moel@130
   234
                  t.Add(new Temperature("System", 1));
moel@130
   235
                  t.Add(new Temperature("Chipset", 2));
moel@130
   236
                  f.Add(new Fan("Fan #1", 0));
moel@130
   237
                  f.Add(new Fan("Fan #2", 1));
moel@130
   238
                  f.Add(new Fan("Fan #3", 2));
moel@130
   239
                  break;
moel@168
   240
                case Model.LP_DK_P55_T3eH9: // IT8720F
moel@130
   241
                  v.Add(new Voltage("CPU VCore", 0));
moel@130
   242
                  v.Add(new Voltage("VTT", 1));
moel@130
   243
                  v.Add(new Voltage("+3.3V", 2));
moel@195
   244
                  v.Add(new Voltage("+5V", 3, 6.8f, 10));
moel@195
   245
                  v.Add(new Voltage("+12V", 4, 30, 10));
moel@130
   246
                  v.Add(new Voltage("CPU PLL", 5));
moel@130
   247
                  v.Add(new Voltage("DRAM", 6));
moel@195
   248
                  v.Add(new Voltage("+5VSB", 7, 6.8f, 10));
moel@130
   249
                  v.Add(new Voltage("VBat", 8));
moel@130
   250
                  t.Add(new Temperature("Chipset", 0));
moel@130
   251
                  t.Add(new Temperature("CPU PWM", 1));
moel@130
   252
                  t.Add(new Temperature("CPU", 2));
moel@130
   253
                  f.Add(new Fan("Fan #1", 0));
moel@130
   254
                  f.Add(new Fan("Fan #2", 1));
moel@130
   255
                  f.Add(new Fan("Fan #3", 2));
moel@130
   256
                  break;
moel@130
   257
                default:
moel@130
   258
                  v.Add(new Voltage("CPU VCore", 0));
moel@130
   259
                  v.Add(new Voltage("VTT", 1, true));
moel@130
   260
                  v.Add(new Voltage("+3.3V", 2, true));
moel@130
   261
                  v.Add(new Voltage("+5V", 3, 6.8f, 10, 0, true));
moel@130
   262
                  v.Add(new Voltage("+12V", 4, 30, 10, 0, true));
moel@130
   263
                  v.Add(new Voltage("Voltage #6", 5, true));
moel@130
   264
                  v.Add(new Voltage("DRAM", 6, true));
moel@130
   265
                  v.Add(new Voltage("+5VSB", 7, 6.8f, 10, 0, true));
moel@130
   266
                  v.Add(new Voltage("VBat", 8));
moel@130
   267
                  for (int i = 0; i < superIO.Temperatures.Length; i++)
moel@130
   268
                    t.Add(new Temperature("Temperature #" + (i + 1), i));
moel@130
   269
                  for (int i = 0; i < superIO.Fans.Length; i++)
moel@130
   270
                    f.Add(new Fan("Fan #" + (i + 1), i));
moel@130
   271
                  break;
moel@130
   272
              }
moel@130
   273
              break;
moel@130
   274
moel@130
   275
            case Manufacturer.Gigabyte:
moel@130
   276
              switch (model) {
moel@168
   277
                case Model._965P_S3: // IT8718F
moel@130
   278
                  v.Add(new Voltage("CPU VCore", 0));
moel@130
   279
                  v.Add(new Voltage("DRAM", 1));
moel@130
   280
                  v.Add(new Voltage("+3.3V", 2));
moel@195
   281
                  v.Add(new Voltage("+5V", 3, 6.8f, 10));
moel@195
   282
                  v.Add(new Voltage("+12V", 7, 27, 9.1f));
moel@130
   283
                  v.Add(new Voltage("VBat", 8));
moel@130
   284
                  t.Add(new Temperature("System", 0));
moel@130
   285
                  t.Add(new Temperature("CPU", 1));
moel@130
   286
                  f.Add(new Fan("CPU Fan", 0));
moel@130
   287
                  f.Add(new Fan("System Fan", 1));
moel@130
   288
                  break;
moel@168
   289
                case Model.EP45_DS3R: // IT8718F
moel@130
   290
                case Model.EP45_UD3R: 
moel@138
   291
                case Model.X38_DS5:    
moel@130
   292
                  v.Add(new Voltage("CPU VCore", 0));
moel@130
   293
                  v.Add(new Voltage("DRAM", 1));
moel@130
   294
                  v.Add(new Voltage("+3.3V", 2));
moel@195
   295
                  v.Add(new Voltage("+5V", 3, 6.8f, 10));
moel@195
   296
                  v.Add(new Voltage("+12V", 7, 27, 9.1f));
moel@130
   297
                  v.Add(new Voltage("VBat", 8));
moel@130
   298
                  t.Add(new Temperature("System", 0));
moel@130
   299
                  t.Add(new Temperature("CPU", 1));
moel@130
   300
                  f.Add(new Fan("CPU Fan", 0));
moel@130
   301
                  f.Add(new Fan("System Fan #2", 1));
moel@130
   302
                  f.Add(new Fan("Power Fan", 2));
moel@130
   303
                  f.Add(new Fan("System Fan #1", 3));
moel@130
   304
                  break;
moel@168
   305
                case Model.EX58_EXTREME: // IT8720F 
moel@133
   306
                  v.Add(new Voltage("CPU VCore", 0));
moel@133
   307
                  v.Add(new Voltage("DRAM", 1));
moel@195
   308
                  v.Add(new Voltage("+5V", 3, 6.8f, 10));
moel@133
   309
                  v.Add(new Voltage("VBat", 8));
moel@133
   310
                  t.Add(new Temperature("System", 0));
moel@133
   311
                  t.Add(new Temperature("CPU", 1));
moel@138
   312
                  t.Add(new Temperature("Northbridge", 2));
moel@133
   313
                  f.Add(new Fan("CPU Fan", 0));
moel@133
   314
                  f.Add(new Fan("System Fan #2", 1));
moel@133
   315
                  f.Add(new Fan("Power Fan", 2));
moel@133
   316
                  f.Add(new Fan("System Fan #1", 3));
moel@133
   317
                  break;
moel@168
   318
                case Model.P35_DS3: // IT8718F 
moel@168
   319
                case Model.P35_DS3L: // IT8718F
moel@130
   320
                  v.Add(new Voltage("CPU VCore", 0));
moel@130
   321
                  v.Add(new Voltage("DRAM", 1));
moel@130
   322
                  v.Add(new Voltage("+3.3V", 2));
moel@195
   323
                  v.Add(new Voltage("+5V", 3, 6.8f, 10));
moel@195
   324
                  v.Add(new Voltage("+12V", 7, 27, 9.1f));
moel@130
   325
                  v.Add(new Voltage("VBat", 8));
moel@130
   326
                  t.Add(new Temperature("System", 0));
moel@130
   327
                  t.Add(new Temperature("CPU", 1));
moel@130
   328
                  f.Add(new Fan("CPU Fan", 0));
moel@130
   329
                  f.Add(new Fan("System Fan #1", 1));
moel@130
   330
                  f.Add(new Fan("System Fan #2", 2));
moel@130
   331
                  f.Add(new Fan("Power Fan", 3));
moel@130
   332
                  break;
moel@168
   333
                case Model.P55_UD4: // IT8720F
moel@168
   334
                case Model.P55M_UD4: // IT8720F
moel@148
   335
                  v.Add(new Voltage("CPU VCore", 0));
moel@148
   336
                  v.Add(new Voltage("DRAM", 1));
moel@148
   337
                  v.Add(new Voltage("+3.3V", 2));
moel@195
   338
                  v.Add(new Voltage("+5V", 3, 6.8f, 10));
moel@195
   339
                  v.Add(new Voltage("+12V", 5, 27, 9.1f));
moel@148
   340
                  v.Add(new Voltage("VBat", 8));
moel@148
   341
                  t.Add(new Temperature("System", 0));
moel@148
   342
                  t.Add(new Temperature("CPU", 2));
moel@148
   343
                  f.Add(new Fan("CPU Fan", 0));
moel@148
   344
                  f.Add(new Fan("System Fan #2", 1));
moel@148
   345
                  f.Add(new Fan("Power Fan", 2));
moel@148
   346
                  f.Add(new Fan("System Fan #1", 3));
moel@148
   347
                  break;
moel@168
   348
                case Model.GA_MA770T_UD3: // IT8720F
moel@154
   349
                  v.Add(new Voltage("CPU VCore", 0));
moel@154
   350
                  v.Add(new Voltage("DRAM", 1));
moel@154
   351
                  v.Add(new Voltage("+3.3V", 2));
moel@195
   352
                  v.Add(new Voltage("+5V", 3, 6.8f, 10));
moel@195
   353
                  v.Add(new Voltage("+12V", 4, 27, 9.1f));
moel@154
   354
                  v.Add(new Voltage("VBat", 8));
moel@154
   355
                  t.Add(new Temperature("System", 0));
moel@154
   356
                  t.Add(new Temperature("CPU", 1));
moel@154
   357
                  f.Add(new Fan("CPU Fan", 0));
moel@154
   358
                  f.Add(new Fan("System Fan #1", 1));
moel@154
   359
                  f.Add(new Fan("System Fan #2", 2));
moel@154
   360
                  f.Add(new Fan("Power Fan", 3));
moel@154
   361
                  break;
moel@168
   362
                case Model.GA_MA785GMT_UD2H: // IT8718F
moel@130
   363
                  v.Add(new Voltage("CPU VCore", 0));
moel@130
   364
                  v.Add(new Voltage("DRAM", 1));
moel@130
   365
                  v.Add(new Voltage("+3.3V", 2));
moel@195
   366
                  v.Add(new Voltage("+5V", 3, 6.8f, 10));
moel@195
   367
                  v.Add(new Voltage("+12V", 4, 27, 9.1f));
moel@130
   368
                  v.Add(new Voltage("VBat", 8));
moel@130
   369
                  t.Add(new Temperature("System", 0));
moel@130
   370
                  t.Add(new Temperature("CPU", 1));
moel@130
   371
                  f.Add(new Fan("CPU Fan", 0));
moel@130
   372
                  f.Add(new Fan("System Fan", 1));
moel@130
   373
                  f.Add(new Fan("NB Fan", 2));
moel@130
   374
                  break;
moel@168
   375
                case Model.X58A_UD3R: // IT8720F 
moel@138
   376
                  v.Add(new Voltage("CPU VCore", 0));
moel@138
   377
                  v.Add(new Voltage("DRAM", 1));
moel@138
   378
                  v.Add(new Voltage("+3.3V", 2));
moel@195
   379
                  v.Add(new Voltage("+5V", 3, 6.8f, 10));
moel@195
   380
                  v.Add(new Voltage("+12V", 5, 27, 9.1f));
moel@138
   381
                  v.Add(new Voltage("VBat", 8));
moel@138
   382
                  t.Add(new Temperature("System", 0));
moel@138
   383
                  t.Add(new Temperature("CPU", 1));
moel@138
   384
                  t.Add(new Temperature("Northbridge", 2));
moel@138
   385
                  f.Add(new Fan("CPU Fan", 0));
moel@138
   386
                  f.Add(new Fan("System Fan #2", 1));
moel@138
   387
                  f.Add(new Fan("Power Fan", 2));
moel@138
   388
                  f.Add(new Fan("System Fan #1", 3));
moel@138
   389
                  break;
moel@130
   390
                default:
moel@130
   391
                  v.Add(new Voltage("CPU VCore", 0));
moel@130
   392
                  v.Add(new Voltage("DRAM", 1, true));
moel@130
   393
                  v.Add(new Voltage("+3.3V", 2, true));
moel@130
   394
                  v.Add(new Voltage("+5V", 3, 6.8f, 10, 0, true));
moel@130
   395
                  v.Add(new Voltage("Voltage #5", 4, true));
moel@130
   396
                  v.Add(new Voltage("Voltage #6", 5, true));
moel@130
   397
                  v.Add(new Voltage("Voltage #7", 6, true));
moel@130
   398
                  v.Add(new Voltage("+12V", 7, 27, 9.1f, 0, true));
moel@130
   399
                  v.Add(new Voltage("VBat", 8));
moel@130
   400
                  for (int i = 0; i < superIO.Temperatures.Length; i++)
moel@130
   401
                    t.Add(new Temperature("Temperature #" + (i + 1), i));
moel@130
   402
                  for (int i = 0; i < superIO.Fans.Length; i++)
moel@130
   403
                    f.Add(new Fan("Fan #" + (i + 1), i));
moel@130
   404
                  break;
moel@130
   405
              }
moel@130
   406
              break;
moel@130
   407
moel@130
   408
            default:
moel@130
   409
              v.Add(new Voltage("CPU VCore", 0));
moel@130
   410
              v.Add(new Voltage("Voltage #2", 1, true));
moel@130
   411
              v.Add(new Voltage("Voltage #3", 2, true));
moel@130
   412
              v.Add(new Voltage("Voltage #4", 3, true));
moel@130
   413
              v.Add(new Voltage("Voltage #5", 4, true));
moel@130
   414
              v.Add(new Voltage("Voltage #6", 5, true));
moel@130
   415
              v.Add(new Voltage("Voltage #7", 6, true));
moel@130
   416
              v.Add(new Voltage("Voltage #8", 7, true));
moel@130
   417
              v.Add(new Voltage("VBat", 8));
moel@130
   418
              for (int i = 0; i < superIO.Temperatures.Length; i++)
moel@130
   419
                t.Add(new Temperature("Temperature #" + (i + 1), i));
moel@130
   420
              for (int i = 0; i < superIO.Fans.Length; i++)
moel@130
   421
                f.Add(new Fan("Fan #" + (i + 1), i));
moel@130
   422
              break;
moel@130
   423
          }
moel@130
   424
          break;
moel@170
   425
moel@170
   426
        case Chip.IT8721F:
moel@177
   427
          switch (manufacturer) {
moel@177
   428
            case Manufacturer.ECS:
moel@177
   429
              switch (model) {
moel@177
   430
                case Model.A890GXM_A: // IT8721F
moel@177
   431
                  v.Add(new Voltage("CPU VCore", 0));
moel@177
   432
                  v.Add(new Voltage("VDIMM", 1));
moel@177
   433
                  v.Add(new Voltage("NB Voltage", 2));
moel@195
   434
                  v.Add(new Voltage("Analog +3.3V", 3, 10, 10));
moel@177
   435
                  // v.Add(new Voltage("VDIMM", 6, true));
moel@195
   436
                  v.Add(new Voltage("Standby +3.3V", 7, 10, 10));
moel@195
   437
                  v.Add(new Voltage("VBat", 8, 10, 10));
moel@177
   438
                  t.Add(new Temperature("CPU", 0));
moel@177
   439
                  t.Add(new Temperature("System", 1));
moel@177
   440
                  t.Add(new Temperature("Northbridge", 2));
moel@177
   441
                  f.Add(new Fan("CPU Fan", 0));
moel@177
   442
                  f.Add(new Fan("System Fan", 1));
moel@177
   443
                  f.Add(new Fan("Power Fan", 2));
moel@177
   444
                  break;
moel@177
   445
                default:
moel@177
   446
                  v.Add(new Voltage("Voltage #1", 0, true));
moel@177
   447
                  v.Add(new Voltage("Voltage #2", 1, true));
moel@177
   448
                  v.Add(new Voltage("Voltage #3", 2, true));
moel@177
   449
                  v.Add(new Voltage("Analog +3.3V", 3, 10, 10, 0, true));
moel@177
   450
                  v.Add(new Voltage("Voltage #5", 4, true));
moel@177
   451
                  v.Add(new Voltage("Voltage #6", 5, true));
moel@177
   452
                  v.Add(new Voltage("Voltage #7", 6, true));
moel@177
   453
                  v.Add(new Voltage("Standby +3.3V", 7, 10, 10, 0, true));
moel@195
   454
                  v.Add(new Voltage("VBat", 8, 10, 10));
moel@177
   455
                  for (int i = 0; i < superIO.Temperatures.Length; i++)
moel@177
   456
                    t.Add(new Temperature("Temperature #" + (i + 1), i));
moel@177
   457
                  for (int i = 0; i < superIO.Fans.Length; i++)
moel@177
   458
                    f.Add(new Fan("Fan #" + (i + 1), i));
moel@177
   459
                  break;
moel@177
   460
              }
moel@177
   461
              break;
moel@177
   462
            default:
moel@177
   463
              v.Add(new Voltage("Voltage #1", 0, true));
moel@177
   464
              v.Add(new Voltage("Voltage #2", 1, true));
moel@177
   465
              v.Add(new Voltage("Voltage #3", 2, true));
moel@177
   466
              v.Add(new Voltage("Analog +3.3V", 3, 10, 10, 0, true));
moel@177
   467
              v.Add(new Voltage("Voltage #5", 4, true));
moel@177
   468
              v.Add(new Voltage("Voltage #6", 5, true));
moel@177
   469
              v.Add(new Voltage("Voltage #7", 6, true));
moel@177
   470
              v.Add(new Voltage("Standby +3.3V", 7, 10, 10, 0, true));
moel@195
   471
              v.Add(new Voltage("VBat", 8, 10, 10));
moel@177
   472
              for (int i = 0; i < superIO.Temperatures.Length; i++)
moel@177
   473
                t.Add(new Temperature("Temperature #" + (i + 1), i));
moel@177
   474
              for (int i = 0; i < superIO.Fans.Length; i++)
moel@177
   475
                f.Add(new Fan("Fan #" + (i + 1), i));
moel@177
   476
              break;
moel@177
   477
          }
moel@170
   478
          break;
moel@130
   479
          
moel@130
   480
        case Chip.F71858:
moel@195
   481
          v.Add(new Voltage("VCC3V", 0, 150, 150));
moel@195
   482
          v.Add(new Voltage("VSB3V", 1, 150, 150));
moel@195
   483
          v.Add(new Voltage("Battery", 2, 150, 150));
moel@130
   484
          for (int i = 0; i < superIO.Temperatures.Length; i++)
moel@130
   485
            t.Add(new Temperature("Temperature #" + (i + 1), i));
moel@130
   486
          for (int i = 0; i < superIO.Fans.Length; i++)
moel@130
   487
            f.Add(new Fan("Fan #" + (i + 1), i));
moel@130
   488
          break;
moel@130
   489
        case Chip.F71862: 
moel@130
   490
        case Chip.F71869: 
moel@130
   491
        case Chip.F71882:
moel@130
   492
        case Chip.F71889ED: 
moel@130
   493
        case Chip.F71889F:
moel@132
   494
          switch (manufacturer) {
moel@132
   495
            case Manufacturer.EVGA:
moel@132
   496
              switch (model) {
moel@168
   497
                case Model.X58_SLI_Classified: // F71882 
moel@195
   498
                  v.Add(new Voltage("VCC3V", 0, 150, 150));
moel@195
   499
                  v.Add(new Voltage("CPU VCore", 1, 47, 100));
moel@195
   500
                  v.Add(new Voltage("DIMM", 2, 47, 100));
moel@195
   501
                  v.Add(new Voltage("CPU VTT", 3, 24, 100));
moel@195
   502
                  v.Add(new Voltage("IOH Vcore", 4, 24, 100));
moel@195
   503
                  v.Add(new Voltage("+5V", 5, 51, 12));
moel@195
   504
                  v.Add(new Voltage("+12V", 6, 56, 6.8f));
moel@195
   505
                  v.Add(new Voltage("3VSB", 7, 150, 150));
moel@195
   506
                  v.Add(new Voltage("VBat", 8, 150, 150));
moel@132
   507
                  t.Add(new Temperature("CPU", 0));
moel@132
   508
                  t.Add(new Temperature("VREG", 1));
moel@132
   509
                  t.Add(new Temperature("System", 2));
moel@132
   510
                  f.Add(new Fan("CPU Fan", 0));
moel@132
   511
                  f.Add(new Fan("Power Fan", 1));
moel@132
   512
                  f.Add(new Fan("Chassis Fan", 2));
moel@132
   513
                  break;
moel@132
   514
                default:
moel@195
   515
                  v.Add(new Voltage("VCC3V", 0, 150, 150));
moel@132
   516
                  v.Add(new Voltage("CPU VCore", 1));
moel@132
   517
                  v.Add(new Voltage("Voltage #3", 2, true));
moel@132
   518
                  v.Add(new Voltage("Voltage #4", 3, true));
moel@132
   519
                  v.Add(new Voltage("Voltage #5", 4, true));
moel@132
   520
                  v.Add(new Voltage("Voltage #6", 5, true));
moel@132
   521
                  v.Add(new Voltage("Voltage #7", 6, true));
moel@195
   522
                  v.Add(new Voltage("VSB3V", 7, 150, 150));
moel@195
   523
                  v.Add(new Voltage("VBat", 8, 150, 150));
moel@132
   524
                  for (int i = 0; i < superIO.Temperatures.Length; i++)
moel@132
   525
                    t.Add(new Temperature("Temperature #" + (i + 1), i));
moel@132
   526
                  for (int i = 0; i < superIO.Fans.Length; i++)
moel@132
   527
                    f.Add(new Fan("Fan #" + (i + 1), i));
moel@132
   528
                  break;
moel@132
   529
              }
moel@132
   530
              break;
moel@132
   531
            default:
moel@195
   532
              v.Add(new Voltage("VCC3V", 0, 150, 150));
moel@132
   533
              v.Add(new Voltage("CPU VCore", 1));
moel@132
   534
              v.Add(new Voltage("Voltage #3", 2, true));
moel@132
   535
              v.Add(new Voltage("Voltage #4", 3, true));
moel@132
   536
              v.Add(new Voltage("Voltage #5", 4, true));
moel@132
   537
              v.Add(new Voltage("Voltage #6", 5, true));
moel@132
   538
              v.Add(new Voltage("Voltage #7", 6, true));
moel@195
   539
              v.Add(new Voltage("VSB3V", 7, 150, 150));
moel@195
   540
              v.Add(new Voltage("VBat", 8, 150, 150));
moel@132
   541
              for (int i = 0; i < superIO.Temperatures.Length; i++)
moel@132
   542
                t.Add(new Temperature("Temperature #" + (i + 1), i));
moel@132
   543
              for (int i = 0; i < superIO.Fans.Length; i++)
moel@132
   544
                f.Add(new Fan("Fan #" + (i + 1), i));
moel@132
   545
              break;
moel@132
   546
          }
moel@130
   547
          break;
moel@130
   548
moel@220
   549
        case Chip.W83627EHF:
moel@220
   550
          switch (manufacturer) {
moel@220
   551
            case Manufacturer.ASRock:
moel@220
   552
              switch (model) {
moel@220
   553
                case Model.AOD790GX_128M: // W83627EHF
moel@220
   554
                  v.Add(new Voltage("CPU VCore", 0));
moel@220
   555
                  v.Add(new Voltage("Analog +3.3V", 2, 34, 34));
moel@220
   556
                  v.Add(new Voltage("+3.3V", 4, 10, 10));
moel@220
   557
                  v.Add(new Voltage("+5V", 5, 20, 10));
moel@220
   558
                  v.Add(new Voltage("+12V", 6, 28, 5));
moel@220
   559
                  v.Add(new Voltage("Standby +3.3V", 7, 34, 34));
moel@220
   560
                  v.Add(new Voltage("VBAT", 8, 34, 34));
moel@220
   561
                  t.Add(new Temperature("CPU", 0));
moel@220
   562
                  t.Add(new Temperature("Motherboard", 2));
moel@221
   563
                  f.Add(new Fan("CPU Fan", 0));
moel@221
   564
                  f.Add(new Fan("Chassis Fan", 1));                 
moel@220
   565
                  break;
moel@220
   566
                default:
moel@220
   567
                  v.Add(new Voltage("CPU VCore", 0));
moel@220
   568
                  v.Add(new Voltage("Voltage #2", 1, true));
moel@220
   569
                  v.Add(new Voltage("AVCC", 2, 34, 34));
moel@220
   570
                  v.Add(new Voltage("3VCC", 3, 34, 34));
moel@220
   571
                  v.Add(new Voltage("Voltage #5", 4, true));
moel@220
   572
                  v.Add(new Voltage("Voltage #6", 5, true));
moel@220
   573
                  v.Add(new Voltage("Voltage #7", 6, true));
moel@220
   574
                  v.Add(new Voltage("3VSB", 7, 34, 34));
moel@220
   575
                  v.Add(new Voltage("VBAT", 8, 34, 34));
moel@220
   576
                  v.Add(new Voltage("Voltage #10", 9, true));
moel@220
   577
                  t.Add(new Temperature("CPU", 0));
moel@220
   578
                  t.Add(new Temperature("Auxiliary", 1));
moel@220
   579
                  t.Add(new Temperature("System", 2));
moel@220
   580
                  f.Add(new Fan("System Fan", 0));
moel@220
   581
                  f.Add(new Fan("CPU Fan", 1));
moel@220
   582
                  f.Add(new Fan("Auxiliary Fan", 2));
moel@220
   583
                  f.Add(new Fan("CPU Fan #2", 3));
moel@220
   584
                  f.Add(new Fan("Auxiliary Fan #2", 4));
moel@220
   585
                  break;
moel@220
   586
              } break;
moel@220
   587
            default:
moel@220
   588
              v.Add(new Voltage("CPU VCore", 0));
moel@220
   589
              v.Add(new Voltage("Voltage #2", 1, true));
moel@220
   590
              v.Add(new Voltage("AVCC", 2, 34, 34));
moel@220
   591
              v.Add(new Voltage("3VCC", 3, 34, 34));
moel@220
   592
              v.Add(new Voltage("Voltage #5", 4, true));
moel@220
   593
              v.Add(new Voltage("Voltage #6", 5, true));
moel@220
   594
              v.Add(new Voltage("Voltage #7", 6, true));
moel@220
   595
              v.Add(new Voltage("3VSB", 7, 34, 34));
moel@220
   596
              v.Add(new Voltage("VBAT", 8, 34, 34));
moel@220
   597
              v.Add(new Voltage("Voltage #10", 9, true));
moel@220
   598
              t.Add(new Temperature("CPU", 0));
moel@220
   599
              t.Add(new Temperature("Auxiliary", 1));
moel@220
   600
              t.Add(new Temperature("System", 2));
moel@220
   601
              f.Add(new Fan("System Fan", 0));
moel@220
   602
              f.Add(new Fan("CPU Fan", 1));
moel@220
   603
              f.Add(new Fan("Auxiliary Fan", 2));
moel@220
   604
              f.Add(new Fan("CPU Fan #2", 3));
moel@220
   605
              f.Add(new Fan("Auxiliary Fan #2", 4));
moel@220
   606
              break;
moel@220
   607
          }
moel@130
   608
          break;
moel@130
   609
        case Chip.W83627DHG: 
moel@130
   610
        case Chip.W83627DHGP:                      
moel@130
   611
        case Chip.W83667HG:
moel@130
   612
        case Chip.W83667HGB:
moel@152
   613
          switch (manufacturer) {
moel@153
   614
            case Manufacturer.ASRock:
moel@153
   615
              switch (model) {
moel@168
   616
                case Model._880GMH_USB3: // W83627DHG-P
moel@153
   617
                  v.Add(new Voltage("CPU VCore", 0));
moel@195
   618
                  v.Add(new Voltage("+3.3V", 3, 34, 34));
moel@195
   619
                  v.Add(new Voltage("+5V", 5, 15, 7.5f));
moel@195
   620
                  v.Add(new Voltage("+12V", 6, 56, 10));
moel@195
   621
                  v.Add(new Voltage("Standby +3.3V", 7, 34, 34));
moel@195
   622
                  v.Add(new Voltage("VBAT", 8, 34, 34));
moel@153
   623
                  t.Add(new Temperature("CPU", 0));
moel@153
   624
                  t.Add(new Temperature("Motherboard", 2));
moel@153
   625
                  f.Add(new Fan("Chassis Fan", 0));
moel@153
   626
                  f.Add(new Fan("CPU Fan", 1));
moel@153
   627
                  f.Add(new Fan("Power Fan", 2));
moel@153
   628
                  break;
moel@153
   629
                default:
moel@153
   630
                  v.Add(new Voltage("CPU VCore", 0));
moel@153
   631
                  v.Add(new Voltage("Voltage #2", 1, true));
moel@195
   632
                  v.Add(new Voltage("AVCC", 2, 34, 34));
moel@195
   633
                  v.Add(new Voltage("3VCC", 3, 34, 34));
moel@153
   634
                  v.Add(new Voltage("Voltage #5", 4, true));
moel@153
   635
                  v.Add(new Voltage("Voltage #6", 5, true));
moel@153
   636
                  v.Add(new Voltage("Voltage #7", 6, true));
moel@195
   637
                  v.Add(new Voltage("3VSB", 7, 34, 34));
moel@195
   638
                  v.Add(new Voltage("VBAT", 8, 34, 34));
moel@153
   639
                  t.Add(new Temperature("CPU", 0));
moel@153
   640
                  t.Add(new Temperature("Auxiliary", 1));
moel@153
   641
                  t.Add(new Temperature("System", 2));
moel@153
   642
                  f.Add(new Fan("System Fan", 0));
moel@153
   643
                  f.Add(new Fan("CPU Fan", 1));
moel@153
   644
                  f.Add(new Fan("Auxiliary Fan", 2));
moel@153
   645
                  f.Add(new Fan("CPU Fan #2", 3));
moel@153
   646
                  f.Add(new Fan("Auxiliary Fan #2", 4));
moel@153
   647
                  break;
moel@153
   648
              }
moel@153
   649
              break;
moel@152
   650
            case Manufacturer.ASUS:
moel@152
   651
              switch (model) {
moel@174
   652
                case Model.P6X58D_E: // W83667HG                 
moel@174
   653
                case Model.Rampage_II_GENE: // W83667HG 
moel@152
   654
                  v.Add(new Voltage("CPU VCore", 0));
moel@195
   655
                  v.Add(new Voltage("+12V", 1, 11.5f, 1.91f));
moel@195
   656
                  v.Add(new Voltage("Analog +3.3V", 2, 34, 34));
moel@195
   657
                  v.Add(new Voltage("+3.3V", 3, 34, 34));
moel@195
   658
                  v.Add(new Voltage("+5V", 4, 15, 7.5f));
moel@195
   659
                  v.Add(new Voltage("Standby +3.3V", 7, 34, 34));
moel@195
   660
                  v.Add(new Voltage("VBAT", 8, 34, 34));
moel@174
   661
                  t.Add(new Temperature("CPU", 0));
moel@174
   662
                  t.Add(new Temperature("Motherboard", 2));
moel@174
   663
                  f.Add(new Fan("Chassis Fan #1", 0));
moel@174
   664
                  f.Add(new Fan("CPU Fan", 1));
moel@174
   665
                  f.Add(new Fan("Power Fan", 2));
moel@174
   666
                  f.Add(new Fan("Chassis Fan #2", 3));
moel@174
   667
                  f.Add(new Fan("Chassis Fan #3", 4));
moel@174
   668
                  break;
moel@174
   669
                case Model.Rampage_Extreme: // W83667HG 
moel@174
   670
                  v.Add(new Voltage("CPU VCore", 0));
moel@195
   671
                  v.Add(new Voltage("+12V", 1, 12, 2));
moel@195
   672
                  v.Add(new Voltage("Analog +3.3V", 2, 34, 34));
moel@195
   673
                  v.Add(new Voltage("+3.3V", 3, 34, 34));
moel@195
   674
                  v.Add(new Voltage("+5V", 4, 15, 7.5f));
moel@195
   675
                  v.Add(new Voltage("Standby +3.3V", 7, 34, 34));
moel@195
   676
                  v.Add(new Voltage("VBAT", 8, 34, 34));
moel@152
   677
                  t.Add(new Temperature("CPU", 0));
moel@152
   678
                  t.Add(new Temperature("Motherboard", 2));
moel@152
   679
                  f.Add(new Fan("Chassis Fan #1", 0));
moel@153
   680
                  f.Add(new Fan("CPU Fan", 1));
moel@153
   681
                  f.Add(new Fan("Power Fan", 2));
moel@152
   682
                  f.Add(new Fan("Chassis Fan #2", 3));
moel@152
   683
                  f.Add(new Fan("Chassis Fan #3", 4));
moel@152
   684
                  break;
moel@152
   685
                default:
moel@152
   686
                  v.Add(new Voltage("CPU VCore", 0));
moel@152
   687
                  v.Add(new Voltage("Voltage #2", 1, true));
moel@195
   688
                  v.Add(new Voltage("AVCC", 2, 34, 34));
moel@195
   689
                  v.Add(new Voltage("3VCC", 3, 34, 34));
moel@152
   690
                  v.Add(new Voltage("Voltage #5", 4, true));
moel@152
   691
                  v.Add(new Voltage("Voltage #6", 5, true));
moel@152
   692
                  v.Add(new Voltage("Voltage #7", 6, true));
moel@195
   693
                  v.Add(new Voltage("3VSB", 7, 34, 34));
moel@195
   694
                  v.Add(new Voltage("VBAT", 8, 34, 34));
moel@152
   695
                  t.Add(new Temperature("CPU", 0));
moel@152
   696
                  t.Add(new Temperature("Auxiliary", 1));
moel@152
   697
                  t.Add(new Temperature("System", 2));
moel@153
   698
                  f.Add(new Fan("System Fan", 0));
moel@153
   699
                  f.Add(new Fan("CPU Fan", 1));
moel@153
   700
                  f.Add(new Fan("Auxiliary Fan", 2));
moel@153
   701
                  f.Add(new Fan("CPU Fan #2", 3));
moel@153
   702
                  f.Add(new Fan("Auxiliary Fan #2", 4));
moel@152
   703
                  break;
moel@152
   704
              }
moel@152
   705
              break;
moel@152
   706
            default:
moel@152
   707
              v.Add(new Voltage("CPU VCore", 0));
moel@152
   708
              v.Add(new Voltage("Voltage #2", 1, true));
moel@195
   709
              v.Add(new Voltage("AVCC", 2, 34, 34));
moel@195
   710
              v.Add(new Voltage("3VCC", 3, 34, 34));
moel@152
   711
              v.Add(new Voltage("Voltage #5", 4, true));
moel@152
   712
              v.Add(new Voltage("Voltage #6", 5, true));
moel@152
   713
              v.Add(new Voltage("Voltage #7", 6, true));
moel@195
   714
              v.Add(new Voltage("3VSB", 7, 34, 34));
moel@195
   715
              v.Add(new Voltage("VBAT", 8, 34, 34));
moel@152
   716
              t.Add(new Temperature("CPU", 0));
moel@152
   717
              t.Add(new Temperature("Auxiliary", 1));
moel@152
   718
              t.Add(new Temperature("System", 2));
moel@153
   719
              f.Add(new Fan("System Fan", 0));
moel@153
   720
              f.Add(new Fan("CPU Fan", 1));
moel@153
   721
              f.Add(new Fan("Auxiliary Fan", 2));
moel@153
   722
              f.Add(new Fan("CPU Fan #2", 3));
moel@153
   723
              f.Add(new Fan("Auxiliary Fan #2", 4));
moel@152
   724
              break;
moel@152
   725
          } 
moel@130
   726
          break;
moel@130
   727
        case Chip.W83627HF: 
moel@130
   728
        case Chip.W83627THF: 
moel@130
   729
        case Chip.W83687THF:
moel@130
   730
          v.Add(new Voltage("CPU VCore", 0));
moel@130
   731
          v.Add(new Voltage("Voltage #2", 1, true));
moel@130
   732
          v.Add(new Voltage("Voltage #3", 2, true));
moel@195
   733
          v.Add(new Voltage("AVCC", 3, 34, 51));
moel@130
   734
          v.Add(new Voltage("Voltage #5", 4, true));
moel@195
   735
          v.Add(new Voltage("5VSB", 5, 34, 51));
moel@130
   736
          v.Add(new Voltage("VBAT", 6));
moel@130
   737
          t.Add(new Temperature("CPU", 0));
moel@130
   738
          t.Add(new Temperature("Auxiliary", 1));
moel@130
   739
          t.Add(new Temperature("System", 2));
moel@153
   740
          f.Add(new Fan("System Fan", 0));
moel@153
   741
          f.Add(new Fan("CPU Fan", 1));
moel@153
   742
          f.Add(new Fan("Auxiliary Fan", 2));
moel@130
   743
          break;
moel@130
   744
        default:
moel@130
   745
          for (int i = 0; i < superIO.Voltages.Length; i++)
moel@130
   746
            v.Add(new Voltage("Voltage #" + (i + 1), i, true));
moel@130
   747
          for (int i = 0; i < superIO.Temperatures.Length; i++)
moel@130
   748
            t.Add(new Temperature("Temperature #" + (i + 1), i));
moel@130
   749
          for (int i = 0; i < superIO.Fans.Length; i++)
moel@130
   750
            f.Add(new Fan("Fan #" + (i + 1), i));
moel@130
   751
          break;
moel@130
   752
      }
moel@130
   753
moel@195
   754
      const string formula = "Voltage = value + (value - Vf) * Ri / Rf.";
moel@130
   755
      foreach (Voltage voltage in v) 
moel@130
   756
        if (voltage.Index < superIO.Voltages.Length) {
moel@130
   757
          Sensor sensor = new Sensor(voltage.Name, voltage.Index, 
moel@195
   758
            voltage.Hidden, SensorType.Voltage, this, new [] {
moel@130
   759
            new ParameterDescription("Ri [kΩ]", "Input resistance.\n" + 
moel@130
   760
              formula, voltage.Ri),
moel@130
   761
            new ParameterDescription("Rf [kΩ]", "Reference resistance.\n" + 
moel@130
   762
              formula, voltage.Rf),
moel@130
   763
            new ParameterDescription("Vf [V]", "Reference voltage.\n" + 
moel@130
   764
              formula, voltage.Vf)
moel@165
   765
            }, settings);
moel@130
   766
          voltages.Add(sensor);
moel@130
   767
      }
moel@130
   768
moel@130
   769
      foreach (Temperature temperature in t) 
moel@130
   770
        if (temperature.Index < superIO.Temperatures.Length) {
moel@134
   771
        Sensor sensor = new Sensor(temperature.Name, temperature.Index,
moel@195
   772
          SensorType.Temperature, this, new [] {
moel@130
   773
          new ParameterDescription("Offset [°C]", "Temperature offset.", 0)
moel@165
   774
        }, settings);
moel@130
   775
        temperatures.Add(sensor);
moel@130
   776
      }
moel@130
   777
moel@130
   778
      foreach (Fan fan in f)
moel@130
   779
        if (fan.Index < superIO.Fans.Length) {
moel@134
   780
          Sensor sensor = new Sensor(fan.Name, fan.Index, SensorType.Fan,
moel@165
   781
            this, settings);
moel@130
   782
          fans.Add(sensor);
moel@130
   783
        }
moel@130
   784
    }
moel@130
   785
moel@130
   786
    public override Identifier Identifier {
moel@166
   787
      get { 
moel@166
   788
        return new Identifier("lpc", 
moel@166
   789
          superIO.Chip.ToString().ToLower(CultureInfo.InvariantCulture)); 
moel@166
   790
      }
moel@130
   791
    }
moel@130
   792
moel@165
   793
    public override HardwareType HardwareType {
moel@165
   794
      get { return HardwareType.SuperIO; }
moel@130
   795
    }
moel@130
   796
moel@176
   797
    public override IHardware Parent {
moel@176
   798
      get { return mainboard; }
moel@176
   799
    }
moel@176
   800
moel@130
   801
    public override string Name {
moel@130
   802
      get { return name; }
moel@130
   803
    }
moel@130
   804
moel@130
   805
    public override string GetReport() {
moel@130
   806
      return superIO.GetReport();
moel@130
   807
    }
moel@130
   808
moel@130
   809
    public override void Update() {
moel@130
   810
      superIO.Update();
moel@130
   811
moel@130
   812
      foreach (Sensor sensor in voltages) {
moel@228
   813
        float? value = readVoltage(sensor.Index);
moel@130
   814
        if (value.HasValue) {
moel@130
   815
          sensor.Value = value + (value - sensor.Parameters[2].Value) *
moel@130
   816
            sensor.Parameters[0].Value / sensor.Parameters[1].Value;
moel@130
   817
          ActivateSensor(sensor);
moel@130
   818
        }
moel@130
   819
      }
moel@130
   820
moel@130
   821
      foreach (Sensor sensor in temperatures) {
moel@228
   822
        float? value = readTemperature(sensor.Index);
moel@130
   823
        if (value.HasValue) {
moel@130
   824
          sensor.Value = value + sensor.Parameters[0].Value;
moel@130
   825
          ActivateSensor(sensor);
moel@130
   826
        }
moel@130
   827
      }
moel@130
   828
moel@130
   829
      foreach (Sensor sensor in fans) {
moel@228
   830
        float? value = readFan(sensor.Index);
moel@130
   831
        if (value.HasValue) {
moel@130
   832
          sensor.Value = value;
moel@130
   833
          if (value.Value > 0)
moel@130
   834
            ActivateSensor(sensor);
moel@130
   835
        }
moel@130
   836
      }
moel@228
   837
moel@228
   838
      postUpdate();
moel@130
   839
    }
moel@130
   840
moel@130
   841
    private class Voltage {
moel@130
   842
      public readonly string Name;
moel@130
   843
      public readonly int Index;
moel@130
   844
      public readonly float Ri;
moel@130
   845
      public readonly float Rf;
moel@130
   846
      public readonly float Vf;
moel@130
   847
      public readonly bool Hidden;
moel@130
   848
moel@202
   849
      public Voltage(string name, int index) :
moel@202
   850
        this(name, index, false) { }
moel@202
   851
      
moel@130
   852
      public Voltage(string name, int index, bool hidden) :
moel@130
   853
        this(name, index, 0, 1, 0, hidden) { }
moel@202
   854
      
moel@202
   855
      public Voltage(string name, int index, float ri, float rf) :
moel@202
   856
        this(name, index, ri, rf, 0, false) { }
moel@202
   857
      
moel@202
   858
      // float ri = 0, float rf = 1, float vf = 0, bool hidden = false) 
moel@202
   859
      
moel@195
   860
      public Voltage(string name, int index, 
moel@202
   861
        float ri, float rf, float vf, bool hidden) 
moel@195
   862
      {
moel@130
   863
        this.Name = name;
moel@130
   864
        this.Index = index;
moel@130
   865
        this.Ri = ri;
moel@130
   866
        this.Rf = rf;
moel@130
   867
        this.Vf = vf;
moel@130
   868
        this.Hidden = hidden;
moel@130
   869
      }
moel@130
   870
    }
moel@130
   871
moel@130
   872
    private class Temperature {
moel@130
   873
      public readonly string Name;
moel@130
   874
      public readonly int Index;
moel@130
   875
moel@167
   876
      public Temperature(string name, int index) {
moel@130
   877
        this.Name = name;
moel@130
   878
        this.Index = index;
moel@130
   879
      }
moel@130
   880
    }
moel@130
   881
moel@130
   882
    private class Fan {
moel@130
   883
      public readonly string Name;
moel@130
   884
      public readonly int Index;
moel@130
   885
moel@130
   886
      public Fan(string name, int index) {
moel@130
   887
        this.Name = name;
moel@130
   888
        this.Index = index;
moel@130
   889
      }
moel@130
   890
    }
moel@130
   891
  }
moel@130
   892
}