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