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