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