Hardware/Mainboard/SuperIOHardware.cs
author moel.mich
Mon, 02 Jul 2012 21:14:40 +0000
changeset 357 fb8dc26f65a4
parent 356 e471b1c2b1a6
child 359 30bb76a1da24
permissions -rw-r--r--
Added mainboard specific configurations for the following Gigabyte mainboards: EX58-UD3R, G41M-Combo, G41MT-S2, G41MT-S2P, GA-MA770T-UD3P, GA-MA785GM-US2H, GA-MA78LM-S2H, GA-MA790X-UD3P, H55-USB3, H55N-USB3, H61M-DS2 REV 1.2, H61M-USB3-B3 REV 2.0, H67A-USB3-B3, P55A-UD3, P67A-UD3-B3, P67A-UD3R-B3, Z68A-D3H-B3, Z68AP-D3, Z68X-UD3H-B3.
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@357
   261
                  v.Add(new Voltage("+12V", 7, 24.3f, 8.2f));
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@357
   275
                  v.Add(new Voltage("+12V", 7, 24.3f, 8.2f));
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@357
   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@357
   303
                  v.Add(new Voltage("+12V", 7, 24.3f, 8.2f));
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@357
   313
                case Model.P55A_UD3: // IT8720F
moel@357
   314
                case Model.P55M_UD4: // IT8720F                
moel@357
   315
                case Model.H55_USB3: // IT8720F
moel@357
   316
                case Model.EX58_UD3R: // IT8720F 
moel@148
   317
                  v.Add(new Voltage("CPU VCore", 0));
moel@148
   318
                  v.Add(new Voltage("DRAM", 1));
moel@148
   319
                  v.Add(new Voltage("+3.3V", 2));
moel@195
   320
                  v.Add(new Voltage("+5V", 3, 6.8f, 10));
moel@357
   321
                  v.Add(new Voltage("+12V", 5, 24.3f, 8.2f));
moel@148
   322
                  v.Add(new Voltage("VBat", 8));
moel@148
   323
                  t.Add(new Temperature("System", 0));
moel@148
   324
                  t.Add(new Temperature("CPU", 2));
moel@148
   325
                  f.Add(new Fan("CPU Fan", 0));
moel@148
   326
                  f.Add(new Fan("System Fan #2", 1));
moel@148
   327
                  f.Add(new Fan("Power Fan", 2));
moel@148
   328
                  f.Add(new Fan("System Fan #1", 3));
moel@148
   329
                  break;
moel@357
   330
                case Model.H55N_USB3: // IT8720F
moel@154
   331
                  v.Add(new Voltage("CPU VCore", 0));
moel@154
   332
                  v.Add(new Voltage("DRAM", 1));
moel@154
   333
                  v.Add(new Voltage("+3.3V", 2));
moel@195
   334
                  v.Add(new Voltage("+5V", 3, 6.8f, 10));
moel@357
   335
                  v.Add(new Voltage("+12V", 5, 24.3f, 8.2f));
moel@357
   336
                  v.Add(new Voltage("VBat", 8));
moel@357
   337
                  t.Add(new Temperature("System", 0));
moel@357
   338
                  t.Add(new Temperature("CPU", 2));
moel@357
   339
                  f.Add(new Fan("CPU Fan", 0));
moel@357
   340
                  f.Add(new Fan("System Fan", 1));
moel@357
   341
                  break;
moel@357
   342
                case Model.G41M_Combo: // IT8718F
moel@357
   343
                case Model.G41MT_S2: // IT8718F
moel@357
   344
                case Model.G41MT_S2P: // IT8718F
moel@357
   345
                  v.Add(new Voltage("CPU VCore", 0));
moel@357
   346
                  v.Add(new Voltage("DRAM", 1));
moel@357
   347
                  v.Add(new Voltage("+3.3V", 2));
moel@357
   348
                  v.Add(new Voltage("+5V", 3, 6.8f, 10));
moel@357
   349
                  v.Add(new Voltage("+12V", 7, 24.3f, 8.2f));
moel@357
   350
                  v.Add(new Voltage("VBat", 8));
moel@357
   351
                  t.Add(new Temperature("CPU", 2));
moel@357
   352
                  f.Add(new Fan("CPU Fan", 0));
moel@357
   353
                  f.Add(new Fan("System Fan", 1));
moel@357
   354
                  break;
moel@357
   355
                case Model.GA_MA770T_UD3: // IT8720F
moel@357
   356
                case Model.GA_MA770T_UD3P: // IT8720F
moel@357
   357
                case Model.GA_MA78LM_S2H: // IT8718F
moel@357
   358
                case Model.GA_MA790X_UD3P: // IT8720F
moel@357
   359
                  v.Add(new Voltage("CPU VCore", 0));
moel@357
   360
                  v.Add(new Voltage("DRAM", 1));
moel@357
   361
                  v.Add(new Voltage("+3.3V", 2));
moel@357
   362
                  v.Add(new Voltage("+5V", 3, 6.8f, 10));
moel@357
   363
                  v.Add(new Voltage("+12V", 4, 24.3f, 8.2f));
moel@154
   364
                  v.Add(new Voltage("VBat", 8));
moel@154
   365
                  t.Add(new Temperature("System", 0));
moel@154
   366
                  t.Add(new Temperature("CPU", 1));
moel@154
   367
                  f.Add(new Fan("CPU Fan", 0));
moel@154
   368
                  f.Add(new Fan("System Fan #1", 1));
moel@154
   369
                  f.Add(new Fan("System Fan #2", 2));
moel@154
   370
                  f.Add(new Fan("Power Fan", 3));
moel@154
   371
                  break;
moel@357
   372
                case Model.GA_MA785GM_US2H: // IT8718F
moel@168
   373
                case Model.GA_MA785GMT_UD2H: // IT8718F
moel@130
   374
                  v.Add(new Voltage("CPU VCore", 0));
moel@130
   375
                  v.Add(new Voltage("DRAM", 1));
moel@130
   376
                  v.Add(new Voltage("+3.3V", 2));
moel@195
   377
                  v.Add(new Voltage("+5V", 3, 6.8f, 10));
moel@357
   378
                  v.Add(new Voltage("+12V", 4, 24.3f, 8.2f));
moel@130
   379
                  v.Add(new Voltage("VBat", 8));
moel@130
   380
                  t.Add(new Temperature("System", 0));
moel@130
   381
                  t.Add(new Temperature("CPU", 1));
moel@130
   382
                  f.Add(new Fan("CPU Fan", 0));
moel@130
   383
                  f.Add(new Fan("System Fan", 1));
moel@130
   384
                  f.Add(new Fan("NB Fan", 2));
moel@130
   385
                  break;
moel@168
   386
                case Model.X58A_UD3R: // IT8720F 
moel@138
   387
                  v.Add(new Voltage("CPU VCore", 0));
moel@138
   388
                  v.Add(new Voltage("DRAM", 1));
moel@138
   389
                  v.Add(new Voltage("+3.3V", 2));
moel@195
   390
                  v.Add(new Voltage("+5V", 3, 6.8f, 10));
moel@357
   391
                  v.Add(new Voltage("+12V", 5, 24.3f, 8.2f));
moel@138
   392
                  v.Add(new Voltage("VBat", 8));
moel@138
   393
                  t.Add(new Temperature("System", 0));
moel@138
   394
                  t.Add(new Temperature("CPU", 1));
moel@138
   395
                  t.Add(new Temperature("Northbridge", 2));
moel@138
   396
                  f.Add(new Fan("CPU Fan", 0));
moel@138
   397
                  f.Add(new Fan("System Fan #2", 1));
moel@138
   398
                  f.Add(new Fan("Power Fan", 2));
moel@138
   399
                  f.Add(new Fan("System Fan #1", 3));
moel@138
   400
                  break;
moel@130
   401
                default:
moel@130
   402
                  v.Add(new Voltage("CPU VCore", 0));
moel@130
   403
                  v.Add(new Voltage("DRAM", 1, true));
moel@130
   404
                  v.Add(new Voltage("+3.3V", 2, true));
moel@130
   405
                  v.Add(new Voltage("+5V", 3, 6.8f, 10, 0, true));
moel@130
   406
                  v.Add(new Voltage("Voltage #5", 4, true));
moel@130
   407
                  v.Add(new Voltage("Voltage #6", 5, true));
moel@130
   408
                  v.Add(new Voltage("Voltage #7", 6, true));
moel@257
   409
                  v.Add(new Voltage("Voltage #8", 7, true));
moel@130
   410
                  v.Add(new Voltage("VBat", 8));
moel@130
   411
                  for (int i = 0; i < superIO.Temperatures.Length; i++)
moel@130
   412
                    t.Add(new Temperature("Temperature #" + (i + 1), i));
moel@130
   413
                  for (int i = 0; i < superIO.Fans.Length; i++)
moel@130
   414
                    f.Add(new Fan("Fan #" + (i + 1), i));
moel@130
   415
                  break;
moel@130
   416
              }
moel@130
   417
              break;
moel@130
   418
moel@130
   419
            default:
moel@130
   420
              v.Add(new Voltage("CPU VCore", 0));
moel@130
   421
              v.Add(new Voltage("Voltage #2", 1, true));
moel@130
   422
              v.Add(new Voltage("Voltage #3", 2, true));
moel@130
   423
              v.Add(new Voltage("Voltage #4", 3, true));
moel@130
   424
              v.Add(new Voltage("Voltage #5", 4, true));
moel@130
   425
              v.Add(new Voltage("Voltage #6", 5, true));
moel@130
   426
              v.Add(new Voltage("Voltage #7", 6, true));
moel@130
   427
              v.Add(new Voltage("Voltage #8", 7, true));
moel@130
   428
              v.Add(new Voltage("VBat", 8));
moel@130
   429
              for (int i = 0; i < superIO.Temperatures.Length; i++)
moel@130
   430
                t.Add(new Temperature("Temperature #" + (i + 1), i));
moel@130
   431
              for (int i = 0; i < superIO.Fans.Length; i++)
moel@130
   432
                f.Add(new Fan("Fan #" + (i + 1), i));
moel@130
   433
              break;
moel@130
   434
          }
moel@130
   435
          break;
moel@170
   436
moel@170
   437
        case Chip.IT8721F:
moel@277
   438
        case Chip.IT8728F:
moel@341
   439
        case Chip.IT8771E:
moel@319
   440
        case Chip.IT8772E:
moel@177
   441
          switch (manufacturer) {
moel@177
   442
            case Manufacturer.ECS:
moel@177
   443
              switch (model) {
moel@177
   444
                case Model.A890GXM_A: // IT8721F
moel@177
   445
                  v.Add(new Voltage("CPU VCore", 0));
moel@177
   446
                  v.Add(new Voltage("VDIMM", 1));
moel@177
   447
                  v.Add(new Voltage("NB Voltage", 2));
moel@195
   448
                  v.Add(new Voltage("Analog +3.3V", 3, 10, 10));
moel@177
   449
                  // v.Add(new Voltage("VDIMM", 6, true));
moel@195
   450
                  v.Add(new Voltage("Standby +3.3V", 7, 10, 10));
moel@195
   451
                  v.Add(new Voltage("VBat", 8, 10, 10));
moel@177
   452
                  t.Add(new Temperature("CPU", 0));
moel@177
   453
                  t.Add(new Temperature("System", 1));
moel@177
   454
                  t.Add(new Temperature("Northbridge", 2));
moel@177
   455
                  f.Add(new Fan("CPU Fan", 0));
moel@177
   456
                  f.Add(new Fan("System Fan", 1));
moel@177
   457
                  f.Add(new Fan("Power Fan", 2));
moel@177
   458
                  break;
moel@177
   459
                default:
moel@177
   460
                  v.Add(new Voltage("Voltage #1", 0, true));
moel@177
   461
                  v.Add(new Voltage("Voltage #2", 1, true));
moel@177
   462
                  v.Add(new Voltage("Voltage #3", 2, true));
moel@177
   463
                  v.Add(new Voltage("Analog +3.3V", 3, 10, 10, 0, true));
moel@177
   464
                  v.Add(new Voltage("Voltage #5", 4, true));
moel@177
   465
                  v.Add(new Voltage("Voltage #6", 5, true));
moel@177
   466
                  v.Add(new Voltage("Voltage #7", 6, true));
moel@177
   467
                  v.Add(new Voltage("Standby +3.3V", 7, 10, 10, 0, true));
moel@195
   468
                  v.Add(new Voltage("VBat", 8, 10, 10));
moel@177
   469
                  for (int i = 0; i < superIO.Temperatures.Length; i++)
moel@177
   470
                    t.Add(new Temperature("Temperature #" + (i + 1), i));
moel@177
   471
                  for (int i = 0; i < superIO.Fans.Length; i++)
moel@177
   472
                    f.Add(new Fan("Fan #" + (i + 1), i));
moel@177
   473
                  break;
moel@177
   474
              }
moel@177
   475
              break;
moel@278
   476
            case Manufacturer.Gigabyte:
moel@278
   477
              switch (model) {
moel@357
   478
                case Model.H61M_DS2_REV_1_2: // IT8728F
moel@357
   479
                case Model.H61M_USB3_B3_REV_2_0: // IT8728F
moel@357
   480
                  v.Add(new Voltage("VTT", 0));
moel@357
   481
                  v.Add(new Voltage("+12V", 2, 30.9f, 10));
moel@278
   482
                  v.Add(new Voltage("CPU VCore", 5));
moel@278
   483
                  v.Add(new Voltage("DRAM", 6));
moel@278
   484
                  v.Add(new Voltage("Standby +3.3V", 7, 10, 10));
moel@278
   485
                  v.Add(new Voltage("VBat", 8, 10, 10));
moel@278
   486
                  t.Add(new Temperature("System", 0));
moel@278
   487
                  t.Add(new Temperature("CPU", 2));
moel@278
   488
                  f.Add(new Fan("CPU Fan", 0));
moel@357
   489
                  f.Add(new Fan("System Fan", 1));
moel@278
   490
                  break;
moel@290
   491
                case Model.H67A_UD3H_B3: // IT8728F
moel@357
   492
                case Model.H67A_USB3_B3: // IT8728F                
moel@290
   493
                  v.Add(new Voltage("VTT", 0));
moel@290
   494
                  v.Add(new Voltage("+5V", 1, 15, 10));
moel@357
   495
                  v.Add(new Voltage("+12V", 2, 30.9f, 10));
moel@290
   496
                  v.Add(new Voltage("CPU VCore", 5));
moel@290
   497
                  v.Add(new Voltage("DRAM", 6));
moel@290
   498
                  v.Add(new Voltage("Standby +3.3V", 7, 10, 10));
moel@290
   499
                  v.Add(new Voltage("VBat", 8, 10, 10));
moel@290
   500
                  t.Add(new Temperature("System", 0));
moel@290
   501
                  t.Add(new Temperature("CPU", 2));
moel@290
   502
                  f.Add(new Fan("CPU Fan", 0));
moel@290
   503
                  f.Add(new Fan("System Fan #1", 1));
moel@290
   504
                  f.Add(new Fan("Power Fan", 2));
moel@290
   505
                  f.Add(new Fan("System Fan #2", 3));
moel@290
   506
                  break;
moel@357
   507
                case Model.Z68A_D3H_B3: // IT8728F
moel@357
   508
                  v.Add(new Voltage("VTT", 0));
moel@357
   509
                  v.Add(new Voltage("+3.3V", 1, 6.49f, 10));
moel@357
   510
                  v.Add(new Voltage("+12V", 2, 30.9f, 10));
moel@357
   511
                  v.Add(new Voltage("+5V", 3, 7.15f, 10));
moel@357
   512
                  v.Add(new Voltage("CPU VCore", 5));
moel@357
   513
                  v.Add(new Voltage("DRAM", 6));
moel@357
   514
                  v.Add(new Voltage("Standby +3.3V", 7, 10, 10));
moel@357
   515
                  v.Add(new Voltage("VBat", 8, 10, 10));
moel@357
   516
                  t.Add(new Temperature("System", 0));
moel@357
   517
                  t.Add(new Temperature("CPU", 2));
moel@357
   518
                  f.Add(new Fan("CPU Fan", 0));
moel@357
   519
                  f.Add(new Fan("System Fan #1", 1));
moel@357
   520
                  f.Add(new Fan("Power Fan", 2));
moel@357
   521
                  f.Add(new Fan("System Fan #2", 3));
moel@357
   522
                  break;
moel@357
   523
                case Model.P67A_UD3_B3: // IT8728F
moel@357
   524
                case Model.P67A_UD3R_B3: // IT8728F
moel@357
   525
                case Model.P67A_UD4_B3: // IT8728F                
moel@357
   526
                case Model.Z68AP_D3: // IT8728F
moel@357
   527
                case Model.Z68X_UD3H_B3: // IT8728F               
moel@357
   528
                  v.Add(new Voltage("VTT", 0));
moel@357
   529
                  v.Add(new Voltage("+3.3V", 1, 6.49f, 10));
moel@357
   530
                  v.Add(new Voltage("+12V", 2, 30.9f, 10));
moel@357
   531
                  v.Add(new Voltage("+5V", 3, 7.15f, 10));
moel@357
   532
                  v.Add(new Voltage("CPU VCore", 5));
moel@357
   533
                  v.Add(new Voltage("DRAM", 6));
moel@357
   534
                  v.Add(new Voltage("Standby +3.3V", 7, 10, 10));
moel@357
   535
                  v.Add(new Voltage("VBat", 8, 10, 10));
moel@357
   536
                  t.Add(new Temperature("System", 0));
moel@357
   537
                  t.Add(new Temperature("CPU", 2));
moel@357
   538
                  f.Add(new Fan("CPU Fan", 0));
moel@357
   539
                  f.Add(new Fan("System Fan #2", 1));
moel@357
   540
                  f.Add(new Fan("Power Fan", 2));
moel@357
   541
                  f.Add(new Fan("System Fan #1", 3));
moel@357
   542
                  break;                
moel@305
   543
                case Model.Z68X_UD7_B3: // IT8728F
moel@305
   544
                  v.Add(new Voltage("VTT", 0));
moel@357
   545
                  v.Add(new Voltage("+3.3V", 1, 6.49f, 10));
moel@357
   546
                  v.Add(new Voltage("+12V", 2, 30.9f, 10));
moel@357
   547
                  v.Add(new Voltage("+5V", 3, 7.15f, 10));
moel@305
   548
                  v.Add(new Voltage("CPU VCore", 5));
moel@305
   549
                  v.Add(new Voltage("DRAM", 6));
moel@305
   550
                  v.Add(new Voltage("Standby +3.3V", 7, 10, 10));
moel@305
   551
                  v.Add(new Voltage("VBat", 8, 10, 10));
moel@305
   552
                  t.Add(new Temperature("System", 0));
moel@305
   553
                  t.Add(new Temperature("CPU", 1));
moel@305
   554
                  t.Add(new Temperature("System 3", 2));
moel@305
   555
                  f.Add(new Fan("CPU Fan", 0));
moel@305
   556
                  f.Add(new Fan("Power Fan", 1));
moel@305
   557
                  f.Add(new Fan("System Fan #1", 2));
moel@305
   558
                  f.Add(new Fan("System Fan #2", 3));
moel@305
   559
                  f.Add(new Fan("System Fan #3", 4));
moel@305
   560
                  break;
moel@278
   561
                default:
moel@278
   562
                  v.Add(new Voltage("Voltage #1", 0, true));
moel@278
   563
                  v.Add(new Voltage("Voltage #2", 1, true));
moel@278
   564
                  v.Add(new Voltage("Voltage #3", 2, true));
moel@278
   565
                  v.Add(new Voltage("Voltage #4", 3, true));
moel@278
   566
                  v.Add(new Voltage("Voltage #5", 4, true));
moel@278
   567
                  v.Add(new Voltage("Voltage #6", 5, true));
moel@278
   568
                  v.Add(new Voltage("Voltage #7", 6, true));
moel@278
   569
                  v.Add(new Voltage("Standby +3.3V", 7, 10, 10, 0, true));
moel@278
   570
                  v.Add(new Voltage("VBat", 8, 10, 10));
moel@278
   571
                  for (int i = 0; i < superIO.Temperatures.Length; i++)
moel@278
   572
                    t.Add(new Temperature("Temperature #" + (i + 1), i));
moel@278
   573
                  for (int i = 0; i < superIO.Fans.Length; i++)
moel@278
   574
                    f.Add(new Fan("Fan #" + (i + 1), i));
moel@278
   575
                  break;
moel@278
   576
              }
moel@278
   577
              break;
moel@320
   578
            case Manufacturer.Shuttle:
moel@320
   579
              switch (model) {
moel@320
   580
                case Model.FH67: // IT8772E 
moel@320
   581
                  v.Add(new Voltage("CPU VCore", 0));
moel@320
   582
                  v.Add(new Voltage("DRAM", 1));
moel@320
   583
                  v.Add(new Voltage("PCH VCCIO", 2));
moel@320
   584
                  v.Add(new Voltage("CPU VCCIO", 3));
moel@320
   585
                  v.Add(new Voltage("Graphic Voltage", 4));
moel@320
   586
                  v.Add(new Voltage("Standby +3.3V", 7, 10, 10));
moel@320
   587
                  v.Add(new Voltage("VBat", 8, 10, 10));
moel@320
   588
                  t.Add(new Temperature("System", 0));
moel@320
   589
                  t.Add(new Temperature("CPU", 1));                  
moel@320
   590
                  f.Add(new Fan("Fan #1", 0));
moel@320
   591
                  f.Add(new Fan("CPU Fan", 1));
moel@320
   592
                  break;
moel@320
   593
                default:
moel@320
   594
                  v.Add(new Voltage("Voltage #1", 0, true));
moel@320
   595
                  v.Add(new Voltage("Voltage #2", 1, true));
moel@320
   596
                  v.Add(new Voltage("Voltage #3", 2, true));
moel@320
   597
                  v.Add(new Voltage("Voltage #4", 3, true));
moel@320
   598
                  v.Add(new Voltage("Voltage #5", 4, true));
moel@320
   599
                  v.Add(new Voltage("Voltage #6", 5, true));
moel@320
   600
                  v.Add(new Voltage("Voltage #7", 6, true));
moel@320
   601
                  v.Add(new Voltage("Standby +3.3V", 7, 10, 10, 0, true));
moel@320
   602
                  v.Add(new Voltage("VBat", 8, 10, 10));
moel@320
   603
                  for (int i = 0; i < superIO.Temperatures.Length; i++)
moel@320
   604
                    t.Add(new Temperature("Temperature #" + (i + 1), i));
moel@320
   605
                  for (int i = 0; i < superIO.Fans.Length; i++)
moel@320
   606
                    f.Add(new Fan("Fan #" + (i + 1), i));
moel@320
   607
                  break;
moel@320
   608
              }
moel@320
   609
              break;
moel@177
   610
            default:
moel@177
   611
              v.Add(new Voltage("Voltage #1", 0, true));
moel@177
   612
              v.Add(new Voltage("Voltage #2", 1, true));
moel@177
   613
              v.Add(new Voltage("Voltage #3", 2, true));
moel@277
   614
              v.Add(new Voltage("Voltage #4", 3, true));
moel@177
   615
              v.Add(new Voltage("Voltage #5", 4, true));
moel@177
   616
              v.Add(new Voltage("Voltage #6", 5, true));
moel@177
   617
              v.Add(new Voltage("Voltage #7", 6, true));
moel@177
   618
              v.Add(new Voltage("Standby +3.3V", 7, 10, 10, 0, true));
moel@195
   619
              v.Add(new Voltage("VBat", 8, 10, 10));
moel@177
   620
              for (int i = 0; i < superIO.Temperatures.Length; i++)
moel@177
   621
                t.Add(new Temperature("Temperature #" + (i + 1), i));
moel@177
   622
              for (int i = 0; i < superIO.Fans.Length; i++)
moel@177
   623
                f.Add(new Fan("Fan #" + (i + 1), i));
moel@177
   624
              break;
moel@177
   625
          }
moel@170
   626
          break;
moel@130
   627
          
moel@130
   628
        case Chip.F71858:
moel@195
   629
          v.Add(new Voltage("VCC3V", 0, 150, 150));
moel@195
   630
          v.Add(new Voltage("VSB3V", 1, 150, 150));
moel@195
   631
          v.Add(new Voltage("Battery", 2, 150, 150));
moel@130
   632
          for (int i = 0; i < superIO.Temperatures.Length; i++)
moel@130
   633
            t.Add(new Temperature("Temperature #" + (i + 1), i));
moel@130
   634
          for (int i = 0; i < superIO.Fans.Length; i++)
moel@130
   635
            f.Add(new Fan("Fan #" + (i + 1), i));
moel@130
   636
          break;
moel@130
   637
        case Chip.F71862: 
moel@130
   638
        case Chip.F71869: 
moel@130
   639
        case Chip.F71882:
moel@296
   640
        case Chip.F71889AD: 
moel@130
   641
        case Chip.F71889ED: 
moel@130
   642
        case Chip.F71889F:
moel@352
   643
        case Chip.F71808E:
moel@132
   644
          switch (manufacturer) {
moel@132
   645
            case Manufacturer.EVGA:
moel@132
   646
              switch (model) {
moel@168
   647
                case Model.X58_SLI_Classified: // F71882 
moel@195
   648
                  v.Add(new Voltage("VCC3V", 0, 150, 150));
moel@195
   649
                  v.Add(new Voltage("CPU VCore", 1, 47, 100));
moel@195
   650
                  v.Add(new Voltage("DIMM", 2, 47, 100));
moel@195
   651
                  v.Add(new Voltage("CPU VTT", 3, 24, 100));
moel@195
   652
                  v.Add(new Voltage("IOH Vcore", 4, 24, 100));
moel@195
   653
                  v.Add(new Voltage("+5V", 5, 51, 12));
moel@195
   654
                  v.Add(new Voltage("+12V", 6, 56, 6.8f));
moel@195
   655
                  v.Add(new Voltage("3VSB", 7, 150, 150));
moel@195
   656
                  v.Add(new Voltage("VBat", 8, 150, 150));
moel@132
   657
                  t.Add(new Temperature("CPU", 0));
moel@132
   658
                  t.Add(new Temperature("VREG", 1));
moel@132
   659
                  t.Add(new Temperature("System", 2));
moel@132
   660
                  f.Add(new Fan("CPU Fan", 0));
moel@132
   661
                  f.Add(new Fan("Power Fan", 1));
moel@132
   662
                  f.Add(new Fan("Chassis Fan", 2));
moel@132
   663
                  break;
moel@132
   664
                default:
moel@195
   665
                  v.Add(new Voltage("VCC3V", 0, 150, 150));
moel@132
   666
                  v.Add(new Voltage("CPU VCore", 1));
moel@132
   667
                  v.Add(new Voltage("Voltage #3", 2, true));
moel@132
   668
                  v.Add(new Voltage("Voltage #4", 3, true));
moel@132
   669
                  v.Add(new Voltage("Voltage #5", 4, true));
moel@132
   670
                  v.Add(new Voltage("Voltage #6", 5, true));
moel@132
   671
                  v.Add(new Voltage("Voltage #7", 6, true));
moel@195
   672
                  v.Add(new Voltage("VSB3V", 7, 150, 150));
moel@195
   673
                  v.Add(new Voltage("VBat", 8, 150, 150));
moel@132
   674
                  for (int i = 0; i < superIO.Temperatures.Length; i++)
moel@132
   675
                    t.Add(new Temperature("Temperature #" + (i + 1), i));
moel@132
   676
                  for (int i = 0; i < superIO.Fans.Length; i++)
moel@132
   677
                    f.Add(new Fan("Fan #" + (i + 1), i));
moel@132
   678
                  break;
moel@132
   679
              }
moel@132
   680
              break;
moel@132
   681
            default:
moel@195
   682
              v.Add(new Voltage("VCC3V", 0, 150, 150));
moel@132
   683
              v.Add(new Voltage("CPU VCore", 1));
moel@132
   684
              v.Add(new Voltage("Voltage #3", 2, true));
moel@132
   685
              v.Add(new Voltage("Voltage #4", 3, true));
moel@132
   686
              v.Add(new Voltage("Voltage #5", 4, true));
moel@132
   687
              v.Add(new Voltage("Voltage #6", 5, true));
moel@352
   688
              if (superIO.Chip != Chip.F71808E) 
moel@352
   689
                  v.Add(new Voltage("Voltage #7", 6, true)); 
moel@195
   690
              v.Add(new Voltage("VSB3V", 7, 150, 150));
moel@195
   691
              v.Add(new Voltage("VBat", 8, 150, 150));
moel@132
   692
              for (int i = 0; i < superIO.Temperatures.Length; i++)
moel@132
   693
                t.Add(new Temperature("Temperature #" + (i + 1), i));
moel@132
   694
              for (int i = 0; i < superIO.Fans.Length; i++)
moel@132
   695
                f.Add(new Fan("Fan #" + (i + 1), i));
moel@132
   696
              break;
moel@132
   697
          }
moel@130
   698
          break;
moel@130
   699
moel@220
   700
        case Chip.W83627EHF:
moel@220
   701
          switch (manufacturer) {
moel@220
   702
            case Manufacturer.ASRock:
moel@220
   703
              switch (model) {
moel@220
   704
                case Model.AOD790GX_128M: // W83627EHF
moel@220
   705
                  v.Add(new Voltage("CPU VCore", 0));
moel@220
   706
                  v.Add(new Voltage("Analog +3.3V", 2, 34, 34));
moel@220
   707
                  v.Add(new Voltage("+3.3V", 4, 10, 10));
moel@220
   708
                  v.Add(new Voltage("+5V", 5, 20, 10));
moel@220
   709
                  v.Add(new Voltage("+12V", 6, 28, 5));
moel@220
   710
                  v.Add(new Voltage("Standby +3.3V", 7, 34, 34));
moel@220
   711
                  v.Add(new Voltage("VBAT", 8, 34, 34));
moel@220
   712
                  t.Add(new Temperature("CPU", 0));
moel@220
   713
                  t.Add(new Temperature("Motherboard", 2));
moel@221
   714
                  f.Add(new Fan("CPU Fan", 0));
moel@221
   715
                  f.Add(new Fan("Chassis Fan", 1));                 
moel@220
   716
                  break;
moel@220
   717
                default:
moel@220
   718
                  v.Add(new Voltage("CPU VCore", 0));
moel@220
   719
                  v.Add(new Voltage("Voltage #2", 1, true));
moel@220
   720
                  v.Add(new Voltage("AVCC", 2, 34, 34));
moel@220
   721
                  v.Add(new Voltage("3VCC", 3, 34, 34));
moel@220
   722
                  v.Add(new Voltage("Voltage #5", 4, true));
moel@220
   723
                  v.Add(new Voltage("Voltage #6", 5, true));
moel@220
   724
                  v.Add(new Voltage("Voltage #7", 6, true));
moel@220
   725
                  v.Add(new Voltage("3VSB", 7, 34, 34));
moel@220
   726
                  v.Add(new Voltage("VBAT", 8, 34, 34));
moel@220
   727
                  v.Add(new Voltage("Voltage #10", 9, true));
moel@220
   728
                  t.Add(new Temperature("CPU", 0));
moel@220
   729
                  t.Add(new Temperature("Auxiliary", 1));
moel@220
   730
                  t.Add(new Temperature("System", 2));
moel@220
   731
                  f.Add(new Fan("System Fan", 0));
moel@220
   732
                  f.Add(new Fan("CPU Fan", 1));
moel@220
   733
                  f.Add(new Fan("Auxiliary Fan", 2));
moel@220
   734
                  f.Add(new Fan("CPU Fan #2", 3));
moel@220
   735
                  f.Add(new Fan("Auxiliary Fan #2", 4));
moel@220
   736
                  break;
moel@220
   737
              } break;
moel@220
   738
            default:
moel@220
   739
              v.Add(new Voltage("CPU VCore", 0));
moel@220
   740
              v.Add(new Voltage("Voltage #2", 1, true));
moel@220
   741
              v.Add(new Voltage("AVCC", 2, 34, 34));
moel@220
   742
              v.Add(new Voltage("3VCC", 3, 34, 34));
moel@220
   743
              v.Add(new Voltage("Voltage #5", 4, true));
moel@220
   744
              v.Add(new Voltage("Voltage #6", 5, true));
moel@220
   745
              v.Add(new Voltage("Voltage #7", 6, true));
moel@220
   746
              v.Add(new Voltage("3VSB", 7, 34, 34));
moel@220
   747
              v.Add(new Voltage("VBAT", 8, 34, 34));
moel@220
   748
              v.Add(new Voltage("Voltage #10", 9, true));
moel@220
   749
              t.Add(new Temperature("CPU", 0));
moel@220
   750
              t.Add(new Temperature("Auxiliary", 1));
moel@220
   751
              t.Add(new Temperature("System", 2));
moel@220
   752
              f.Add(new Fan("System Fan", 0));
moel@220
   753
              f.Add(new Fan("CPU Fan", 1));
moel@220
   754
              f.Add(new Fan("Auxiliary Fan", 2));
moel@220
   755
              f.Add(new Fan("CPU Fan #2", 3));
moel@220
   756
              f.Add(new Fan("Auxiliary Fan #2", 4));
moel@220
   757
              break;
moel@220
   758
          }
moel@130
   759
          break;
moel@130
   760
        case Chip.W83627DHG: 
moel@130
   761
        case Chip.W83627DHGP:                      
moel@130
   762
        case Chip.W83667HG:
moel@130
   763
        case Chip.W83667HGB:
moel@152
   764
          switch (manufacturer) {
moel@153
   765
            case Manufacturer.ASRock:
moel@153
   766
              switch (model) {
moel@168
   767
                case Model._880GMH_USB3: // W83627DHG-P
moel@153
   768
                  v.Add(new Voltage("CPU VCore", 0));
moel@195
   769
                  v.Add(new Voltage("+3.3V", 3, 34, 34));
moel@195
   770
                  v.Add(new Voltage("+5V", 5, 15, 7.5f));
moel@195
   771
                  v.Add(new Voltage("+12V", 6, 56, 10));
moel@195
   772
                  v.Add(new Voltage("Standby +3.3V", 7, 34, 34));
moel@195
   773
                  v.Add(new Voltage("VBAT", 8, 34, 34));
moel@153
   774
                  t.Add(new Temperature("CPU", 0));
moel@153
   775
                  t.Add(new Temperature("Motherboard", 2));
moel@153
   776
                  f.Add(new Fan("Chassis Fan", 0));
moel@153
   777
                  f.Add(new Fan("CPU Fan", 1));
moel@153
   778
                  f.Add(new Fan("Power Fan", 2));
moel@153
   779
                  break;
moel@153
   780
                default:
moel@153
   781
                  v.Add(new Voltage("CPU VCore", 0));
moel@153
   782
                  v.Add(new Voltage("Voltage #2", 1, true));
moel@195
   783
                  v.Add(new Voltage("AVCC", 2, 34, 34));
moel@195
   784
                  v.Add(new Voltage("3VCC", 3, 34, 34));
moel@153
   785
                  v.Add(new Voltage("Voltage #5", 4, true));
moel@153
   786
                  v.Add(new Voltage("Voltage #6", 5, true));
moel@153
   787
                  v.Add(new Voltage("Voltage #7", 6, true));
moel@195
   788
                  v.Add(new Voltage("3VSB", 7, 34, 34));
moel@195
   789
                  v.Add(new Voltage("VBAT", 8, 34, 34));
moel@153
   790
                  t.Add(new Temperature("CPU", 0));
moel@153
   791
                  t.Add(new Temperature("Auxiliary", 1));
moel@153
   792
                  t.Add(new Temperature("System", 2));
moel@153
   793
                  f.Add(new Fan("System Fan", 0));
moel@153
   794
                  f.Add(new Fan("CPU Fan", 1));
moel@153
   795
                  f.Add(new Fan("Auxiliary Fan", 2));
moel@153
   796
                  f.Add(new Fan("CPU Fan #2", 3));
moel@153
   797
                  f.Add(new Fan("Auxiliary Fan #2", 4));
moel@153
   798
                  break;
moel@153
   799
              }
moel@153
   800
              break;
moel@152
   801
            case Manufacturer.ASUS:
moel@152
   802
              switch (model) {
moel@336
   803
                case Model.P6T: // W83667HG
moel@174
   804
                case Model.P6X58D_E: // W83667HG                 
moel@174
   805
                case Model.Rampage_II_GENE: // W83667HG 
moel@152
   806
                  v.Add(new Voltage("CPU VCore", 0));
moel@195
   807
                  v.Add(new Voltage("+12V", 1, 11.5f, 1.91f));
moel@195
   808
                  v.Add(new Voltage("Analog +3.3V", 2, 34, 34));
moel@195
   809
                  v.Add(new Voltage("+3.3V", 3, 34, 34));
moel@195
   810
                  v.Add(new Voltage("+5V", 4, 15, 7.5f));
moel@195
   811
                  v.Add(new Voltage("Standby +3.3V", 7, 34, 34));
moel@195
   812
                  v.Add(new Voltage("VBAT", 8, 34, 34));
moel@174
   813
                  t.Add(new Temperature("CPU", 0));
moel@174
   814
                  t.Add(new Temperature("Motherboard", 2));
moel@174
   815
                  f.Add(new Fan("Chassis Fan #1", 0));
moel@174
   816
                  f.Add(new Fan("CPU Fan", 1));
moel@174
   817
                  f.Add(new Fan("Power Fan", 2));
moel@174
   818
                  f.Add(new Fan("Chassis Fan #2", 3));
moel@174
   819
                  f.Add(new Fan("Chassis Fan #3", 4));
moel@174
   820
                  break;
moel@174
   821
                case Model.Rampage_Extreme: // W83667HG 
moel@174
   822
                  v.Add(new Voltage("CPU VCore", 0));
moel@195
   823
                  v.Add(new Voltage("+12V", 1, 12, 2));
moel@195
   824
                  v.Add(new Voltage("Analog +3.3V", 2, 34, 34));
moel@195
   825
                  v.Add(new Voltage("+3.3V", 3, 34, 34));
moel@195
   826
                  v.Add(new Voltage("+5V", 4, 15, 7.5f));
moel@195
   827
                  v.Add(new Voltage("Standby +3.3V", 7, 34, 34));
moel@195
   828
                  v.Add(new Voltage("VBAT", 8, 34, 34));
moel@152
   829
                  t.Add(new Temperature("CPU", 0));
moel@152
   830
                  t.Add(new Temperature("Motherboard", 2));
moel@152
   831
                  f.Add(new Fan("Chassis Fan #1", 0));
moel@153
   832
                  f.Add(new Fan("CPU Fan", 1));
moel@153
   833
                  f.Add(new Fan("Power Fan", 2));
moel@152
   834
                  f.Add(new Fan("Chassis Fan #2", 3));
moel@152
   835
                  f.Add(new Fan("Chassis Fan #3", 4));
moel@152
   836
                  break;
moel@152
   837
                default:
moel@152
   838
                  v.Add(new Voltage("CPU VCore", 0));
moel@152
   839
                  v.Add(new Voltage("Voltage #2", 1, true));
moel@195
   840
                  v.Add(new Voltage("AVCC", 2, 34, 34));
moel@195
   841
                  v.Add(new Voltage("3VCC", 3, 34, 34));
moel@152
   842
                  v.Add(new Voltage("Voltage #5", 4, true));
moel@152
   843
                  v.Add(new Voltage("Voltage #6", 5, true));
moel@152
   844
                  v.Add(new Voltage("Voltage #7", 6, true));
moel@195
   845
                  v.Add(new Voltage("3VSB", 7, 34, 34));
moel@195
   846
                  v.Add(new Voltage("VBAT", 8, 34, 34));
moel@152
   847
                  t.Add(new Temperature("CPU", 0));
moel@152
   848
                  t.Add(new Temperature("Auxiliary", 1));
moel@152
   849
                  t.Add(new Temperature("System", 2));
moel@153
   850
                  f.Add(new Fan("System Fan", 0));
moel@153
   851
                  f.Add(new Fan("CPU Fan", 1));
moel@153
   852
                  f.Add(new Fan("Auxiliary Fan", 2));
moel@153
   853
                  f.Add(new Fan("CPU Fan #2", 3));
moel@153
   854
                  f.Add(new Fan("Auxiliary Fan #2", 4));
moel@152
   855
                  break;
moel@152
   856
              }
moel@152
   857
              break;
moel@152
   858
            default:
moel@152
   859
              v.Add(new Voltage("CPU VCore", 0));
moel@152
   860
              v.Add(new Voltage("Voltage #2", 1, true));
moel@195
   861
              v.Add(new Voltage("AVCC", 2, 34, 34));
moel@195
   862
              v.Add(new Voltage("3VCC", 3, 34, 34));
moel@152
   863
              v.Add(new Voltage("Voltage #5", 4, true));
moel@152
   864
              v.Add(new Voltage("Voltage #6", 5, true));
moel@152
   865
              v.Add(new Voltage("Voltage #7", 6, true));
moel@195
   866
              v.Add(new Voltage("3VSB", 7, 34, 34));
moel@195
   867
              v.Add(new Voltage("VBAT", 8, 34, 34));
moel@152
   868
              t.Add(new Temperature("CPU", 0));
moel@152
   869
              t.Add(new Temperature("Auxiliary", 1));
moel@152
   870
              t.Add(new Temperature("System", 2));
moel@153
   871
              f.Add(new Fan("System Fan", 0));
moel@153
   872
              f.Add(new Fan("CPU Fan", 1));
moel@153
   873
              f.Add(new Fan("Auxiliary Fan", 2));
moel@153
   874
              f.Add(new Fan("CPU Fan #2", 3));
moel@153
   875
              f.Add(new Fan("Auxiliary Fan #2", 4));
moel@152
   876
              break;
moel@152
   877
          } 
moel@130
   878
          break;
moel@130
   879
        case Chip.W83627HF: 
moel@130
   880
        case Chip.W83627THF: 
moel@130
   881
        case Chip.W83687THF:
moel@130
   882
          v.Add(new Voltage("CPU VCore", 0));
moel@130
   883
          v.Add(new Voltage("Voltage #2", 1, true));
moel@130
   884
          v.Add(new Voltage("Voltage #3", 2, true));
moel@195
   885
          v.Add(new Voltage("AVCC", 3, 34, 51));
moel@130
   886
          v.Add(new Voltage("Voltage #5", 4, true));
moel@195
   887
          v.Add(new Voltage("5VSB", 5, 34, 51));
moel@130
   888
          v.Add(new Voltage("VBAT", 6));
moel@130
   889
          t.Add(new Temperature("CPU", 0));
moel@130
   890
          t.Add(new Temperature("Auxiliary", 1));
moel@130
   891
          t.Add(new Temperature("System", 2));
moel@153
   892
          f.Add(new Fan("System Fan", 0));
moel@153
   893
          f.Add(new Fan("CPU Fan", 1));
moel@153
   894
          f.Add(new Fan("Auxiliary Fan", 2));
moel@130
   895
          break;
moel@245
   896
        case Chip.NCT6771F:
moel@265
   897
        case Chip.NCT6776F:
moel@265
   898
          switch (manufacturer) {
moel@265
   899
            case Manufacturer.ASUS:
moel@265
   900
              switch (model) {
moel@312
   901
                case Model.P8P67: // NCT6776F
moel@311
   902
                case Model.P8P67_EVO: // NCT6776F
moel@265
   903
                case Model.P8P67_PRO: // NCT6776F
moel@265
   904
                  v.Add(new Voltage("CPU VCore", 0));
moel@310
   905
                  v.Add(new Voltage("+12V", 1, 11, 1));
moel@310
   906
                  v.Add(new Voltage("Analog +3.3V", 2, 34, 34));
moel@310
   907
                  v.Add(new Voltage("+3.3V", 3, 34, 34));
moel@310
   908
                  v.Add(new Voltage("+5V", 4, 12, 3));
moel@310
   909
                  v.Add(new Voltage("Standby +3.3V", 7, 34, 34));
moel@265
   910
                  v.Add(new Voltage("VBAT", 8, 34, 34));
moel@310
   911
                  t.Add(new Temperature("CPU", 0));
moel@276
   912
                  t.Add(new Temperature("Auxiliary", 2));
moel@310
   913
                  t.Add(new Temperature("Motherboard", 3));
moel@310
   914
                  f.Add(new Fan("Chassis Fan #1", 0));
moel@265
   915
                  f.Add(new Fan("CPU Fan", 1));
moel@310
   916
                  f.Add(new Fan("Power Fan", 2));
moel@310
   917
                  f.Add(new Fan("Chassis Fan #2", 3));
moel@323
   918
                  c.Add(new Ctrl("Chassis Fan #2", 0));
moel@323
   919
                  c.Add(new Ctrl("CPU Fan", 1));
moel@323
   920
                  c.Add(new Ctrl("Chassis Fan #1", 2));
moel@265
   921
                  break;
moel@276
   922
                case Model.P8P67_M_PRO: // NCT6776F
moel@276
   923
                  v.Add(new Voltage("CPU VCore", 0));
moel@276
   924
                  v.Add(new Voltage("+12V", 1, 11, 1));
moel@276
   925
                  v.Add(new Voltage("Analog +3.3V", 2, 34, 34));
moel@310
   926
                  v.Add(new Voltage("+3.3V", 3, 34, 34));
moel@276
   927
                  v.Add(new Voltage("+5V", 4, 12, 3));
moel@276
   928
                  v.Add(new Voltage("Voltage #6", 5, true));
moel@276
   929
                  v.Add(new Voltage("Voltage #7", 6, true));
moel@276
   930
                  v.Add(new Voltage("Standby +3.3V", 7, 34, 34));
moel@276
   931
                  v.Add(new Voltage("VBAT", 8, 34, 34));
moel@276
   932
                  t.Add(new Temperature("CPU", 0));
moel@276
   933
                  t.Add(new Temperature("Motherboard", 3));
moel@276
   934
                  f.Add(new Fan("Chassis Fan #1", 0));
moel@276
   935
                  f.Add(new Fan("CPU Fan", 1));
moel@276
   936
                  f.Add(new Fan("Chassis Fan #2", 2));
moel@276
   937
                  f.Add(new Fan("Power Fan", 3));
moel@276
   938
                  f.Add(new Fan("Auxiliary Fan", 4));
moel@276
   939
                  break;
moel@337
   940
                case Model.P8Z68_V_PRO: // NCT6776F
moel@337
   941
                  v.Add(new Voltage("CPU VCore", 0));
moel@337
   942
                  v.Add(new Voltage("+12V", 1, 11, 1));
moel@337
   943
                  v.Add(new Voltage("Analog +3.3V", 2, 34, 34));
moel@337
   944
                  v.Add(new Voltage("+3.3V", 3, 34, 34));
moel@337
   945
                  v.Add(new Voltage("+5V", 4, 12, 3));
moel@337
   946
                  v.Add(new Voltage("Standby +3.3V", 7, 34, 34));
moel@337
   947
                  v.Add(new Voltage("VBAT", 8, 34, 34));
moel@337
   948
                  t.Add(new Temperature("CPU", 0));
moel@337
   949
                  t.Add(new Temperature("Auxiliary", 2));
moel@337
   950
                  t.Add(new Temperature("Motherboard", 3));
moel@337
   951
                  for (int i = 0; i < superIO.Fans.Length; i++)
moel@337
   952
                    f.Add(new Fan("Fan #" + (i + 1), i));
moel@337
   953
                  for (int i = 0; i < superIO.Controls.Length; i++)
moel@337
   954
                    c.Add(new Ctrl("Fan #" + (i + 1), i));
moel@337
   955
                  break;
moel@332
   956
                case Model.P9X79: // NCT6776F
moel@332
   957
                  v.Add(new Voltage("CPU VCore", 0));
moel@332
   958
                  v.Add(new Voltage("+12V", 1, 11, 1));
moel@332
   959
                  v.Add(new Voltage("Analog +3.3V", 2, 34, 34));
moel@332
   960
                  v.Add(new Voltage("+3.3V", 3, 34, 34));
moel@332
   961
                  v.Add(new Voltage("+5V", 4, 12, 3));
moel@332
   962
                  v.Add(new Voltage("Standby +3.3V", 7, 34, 34));
moel@332
   963
                  v.Add(new Voltage("VBAT", 8, 34, 34));
moel@332
   964
                  t.Add(new Temperature("CPU", 0));
moel@332
   965
                  t.Add(new Temperature("Motherboard", 3));
moel@332
   966
                  for (int i = 0; i < superIO.Fans.Length; i++)
moel@332
   967
                    f.Add(new Fan("Fan #" + (i + 1), i));
moel@332
   968
                  break;
moel@265
   969
                default:
moel@265
   970
                  v.Add(new Voltage("CPU VCore", 0));
moel@265
   971
                  v.Add(new Voltage("Voltage #2", 1, true));
moel@265
   972
                  v.Add(new Voltage("AVCC", 2, 34, 34));
moel@265
   973
                  v.Add(new Voltage("3VCC", 3, 34, 34));
moel@265
   974
                  v.Add(new Voltage("Voltage #5", 4, true));
moel@265
   975
                  v.Add(new Voltage("Voltage #6", 5, true));
moel@265
   976
                  v.Add(new Voltage("Voltage #7", 6, true));
moel@265
   977
                  v.Add(new Voltage("3VSB", 7, 34, 34));
moel@265
   978
                  v.Add(new Voltage("VBAT", 8, 34, 34));
moel@354
   979
                  t.Add(new Temperature("CPU Core", 0));                  
moel@354
   980
                  t.Add(new Temperature("Temperature #1", 1));
moel@354
   981
                  t.Add(new Temperature("Temperature #2", 2));
moel@354
   982
                  t.Add(new Temperature("Temperature #3", 3));
moel@265
   983
                  for (int i = 0; i < superIO.Fans.Length; i++)
moel@265
   984
                    f.Add(new Fan("Fan #" + (i + 1), i));
moel@265
   985
                  break;
moel@265
   986
              }
moel@265
   987
              break;
moel@265
   988
            default:
moel@265
   989
              v.Add(new Voltage("CPU VCore", 0));
moel@265
   990
              v.Add(new Voltage("Voltage #2", 1, true));
moel@265
   991
              v.Add(new Voltage("AVCC", 2, 34, 34));
moel@265
   992
              v.Add(new Voltage("3VCC", 3, 34, 34));
moel@265
   993
              v.Add(new Voltage("Voltage #5", 4, true));
moel@265
   994
              v.Add(new Voltage("Voltage #6", 5, true));
moel@265
   995
              v.Add(new Voltage("Voltage #7", 6, true));
moel@265
   996
              v.Add(new Voltage("3VSB", 7, 34, 34));
moel@265
   997
              v.Add(new Voltage("VBAT", 8, 34, 34));
moel@354
   998
              t.Add(new Temperature("CPU Core", 0));
moel@354
   999
              t.Add(new Temperature("Temperature #1", 1));
moel@354
  1000
              t.Add(new Temperature("Temperature #2", 2));
moel@354
  1001
              t.Add(new Temperature("Temperature #3", 3));
moel@265
  1002
              for (int i = 0; i < superIO.Fans.Length; i++)
moel@265
  1003
                f.Add(new Fan("Fan #" + (i + 1), i));
moel@265
  1004
              break;
moel@265
  1005
          }
moel@245
  1006
          break;
moel@356
  1007
        case Chip.NCT6779D:
moel@356
  1008
          v.Add(new Voltage("CPU VCore", 0));
moel@356
  1009
          v.Add(new Voltage("Voltage #2", 1, true));
moel@356
  1010
          v.Add(new Voltage("AVCC", 2, 34, 34));
moel@356
  1011
          v.Add(new Voltage("3VCC", 3, 34, 34));
moel@356
  1012
          v.Add(new Voltage("Voltage #5", 4, true));
moel@356
  1013
          v.Add(new Voltage("Voltage #6", 5, true));
moel@356
  1014
          v.Add(new Voltage("Voltage #7", 6, true));
moel@356
  1015
          v.Add(new Voltage("3VSB", 7, 34, 34));
moel@356
  1016
          v.Add(new Voltage("VBAT", 8, 34, 34));
moel@356
  1017
          v.Add(new Voltage("VTT", 9));
moel@356
  1018
          v.Add(new Voltage("Voltage #11", 10, true));
moel@356
  1019
          v.Add(new Voltage("Voltage #12", 11, true));
moel@356
  1020
          v.Add(new Voltage("Voltage #13", 12, true));
moel@356
  1021
          v.Add(new Voltage("Voltage #14", 13, true));
moel@356
  1022
          v.Add(new Voltage("Voltage #15", 14, true));
moel@356
  1023
          t.Add(new Temperature("CPU Core", 0));
moel@356
  1024
          t.Add(new Temperature("Temperature #1", 1));
moel@356
  1025
          t.Add(new Temperature("Temperature #2", 2));
moel@356
  1026
          t.Add(new Temperature("Temperature #3", 3));
moel@356
  1027
          t.Add(new Temperature("Temperature #4", 4));
moel@356
  1028
          t.Add(new Temperature("Temperature #5", 5));
moel@356
  1029
          t.Add(new Temperature("Temperature #6", 6));
moel@356
  1030
          for (int i = 0; i < superIO.Fans.Length; i++)
moel@356
  1031
            f.Add(new Fan("Fan #" + (i + 1), i));
moel@356
  1032
          for (int i = 0; i < superIO.Controls.Length; i++)
moel@356
  1033
            c.Add(new Ctrl("Fan Control #" + (i + 1), i));
moel@356
  1034
          break;
moel@130
  1035
        default:
moel@130
  1036
          for (int i = 0; i < superIO.Voltages.Length; i++)
moel@130
  1037
            v.Add(new Voltage("Voltage #" + (i + 1), i, true));
moel@130
  1038
          for (int i = 0; i < superIO.Temperatures.Length; i++)
moel@130
  1039
            t.Add(new Temperature("Temperature #" + (i + 1), i));
moel@130
  1040
          for (int i = 0; i < superIO.Fans.Length; i++)
moel@130
  1041
            f.Add(new Fan("Fan #" + (i + 1), i));
moel@323
  1042
          for (int i = 0; i < superIO.Controls.Length; i++)
moel@323
  1043
            c.Add(new Ctrl("Fan Control #" + (i + 1), i));
moel@130
  1044
          break;
moel@130
  1045
      }
moel@130
  1046
moel@195
  1047
      const string formula = "Voltage = value + (value - Vf) * Ri / Rf.";
moel@130
  1048
      foreach (Voltage voltage in v) 
moel@130
  1049
        if (voltage.Index < superIO.Voltages.Length) {
moel@130
  1050
          Sensor sensor = new Sensor(voltage.Name, voltage.Index, 
moel@195
  1051
            voltage.Hidden, SensorType.Voltage, this, new [] {
moel@130
  1052
            new ParameterDescription("Ri [kΩ]", "Input resistance.\n" + 
moel@130
  1053
              formula, voltage.Ri),
moel@130
  1054
            new ParameterDescription("Rf [kΩ]", "Reference resistance.\n" + 
moel@130
  1055
              formula, voltage.Rf),
moel@130
  1056
            new ParameterDescription("Vf [V]", "Reference voltage.\n" + 
moel@130
  1057
              formula, voltage.Vf)
moel@165
  1058
            }, settings);
moel@130
  1059
          voltages.Add(sensor);
moel@130
  1060
      }
moel@130
  1061
moel@130
  1062
      foreach (Temperature temperature in t) 
moel@130
  1063
        if (temperature.Index < superIO.Temperatures.Length) {
moel@134
  1064
        Sensor sensor = new Sensor(temperature.Name, temperature.Index,
moel@195
  1065
          SensorType.Temperature, this, new [] {
moel@130
  1066
          new ParameterDescription("Offset [°C]", "Temperature offset.", 0)
moel@165
  1067
        }, settings);
moel@130
  1068
        temperatures.Add(sensor);
moel@130
  1069
      }
moel@130
  1070
moel@130
  1071
      foreach (Fan fan in f)
moel@130
  1072
        if (fan.Index < superIO.Fans.Length) {
moel@134
  1073
          Sensor sensor = new Sensor(fan.Name, fan.Index, SensorType.Fan,
moel@165
  1074
            this, settings);
moel@130
  1075
          fans.Add(sensor);
moel@130
  1076
        }
moel@323
  1077
moel@323
  1078
      foreach (Ctrl ctrl in c) {
moel@323
  1079
        int index = ctrl.Index;
moel@323
  1080
        if (index < superIO.Controls.Length) {
moel@323
  1081
          Sensor sensor = new Sensor(ctrl.Name, index, SensorType.Control,
moel@323
  1082
            this, settings);
moel@323
  1083
          Control control = new Control(sensor, settings, 0, 100);
moel@323
  1084
          control.ControlModeChanged += (cc) => {
moel@323
  1085
            if (cc.ControlMode == ControlMode.Default) {
moel@323
  1086
              superIO.SetControl(index, null);
moel@323
  1087
            } else {
moel@323
  1088
              superIO.SetControl(index, (byte)(cc.SoftwareValue * 2.55));
moel@323
  1089
            }
moel@323
  1090
          };
moel@323
  1091
          control.SoftwareControlValueChanged += (cc) => {
moel@323
  1092
            if (cc.ControlMode == ControlMode.Software) 
moel@323
  1093
              superIO.SetControl(index, (byte)(cc.SoftwareValue * 2.55));
moel@323
  1094
          };
moel@323
  1095
          if (control.ControlMode == ControlMode.Software) 
moel@323
  1096
            superIO.SetControl(index, (byte)(control.SoftwareValue * 2.55));
moel@323
  1097
          sensor.Control = control;
moel@323
  1098
          controls.Add(sensor);
moel@323
  1099
        }
moel@323
  1100
      }
moel@130
  1101
    }
moel@130
  1102
moel@165
  1103
    public override HardwareType HardwareType {
moel@165
  1104
      get { return HardwareType.SuperIO; }
moel@130
  1105
    }
moel@130
  1106
moel@176
  1107
    public override IHardware Parent {
moel@176
  1108
      get { return mainboard; }
moel@176
  1109
    }
moel@176
  1110
moel@130
  1111
moel@130
  1112
    public override string GetReport() {
moel@130
  1113
      return superIO.GetReport();
moel@130
  1114
    }
moel@130
  1115
moel@130
  1116
    public override void Update() {
moel@130
  1117
      superIO.Update();
moel@130
  1118
moel@130
  1119
      foreach (Sensor sensor in voltages) {
moel@228
  1120
        float? value = readVoltage(sensor.Index);
moel@130
  1121
        if (value.HasValue) {
moel@130
  1122
          sensor.Value = value + (value - sensor.Parameters[2].Value) *
moel@130
  1123
            sensor.Parameters[0].Value / sensor.Parameters[1].Value;
moel@130
  1124
          ActivateSensor(sensor);
moel@130
  1125
        }
moel@130
  1126
      }
moel@130
  1127
moel@130
  1128
      foreach (Sensor sensor in temperatures) {
moel@228
  1129
        float? value = readTemperature(sensor.Index);
moel@130
  1130
        if (value.HasValue) {
moel@130
  1131
          sensor.Value = value + sensor.Parameters[0].Value;
moel@130
  1132
          ActivateSensor(sensor);
moel@130
  1133
        }
moel@130
  1134
      }
moel@130
  1135
moel@130
  1136
      foreach (Sensor sensor in fans) {
moel@228
  1137
        float? value = readFan(sensor.Index);
moel@130
  1138
        if (value.HasValue) {
moel@130
  1139
          sensor.Value = value;
moel@130
  1140
          if (value.Value > 0)
moel@130
  1141
            ActivateSensor(sensor);
moel@130
  1142
        }
moel@130
  1143
      }
moel@228
  1144
moel@323
  1145
      foreach (Sensor sensor in controls) {
moel@323
  1146
        float? value = readControl(sensor.Index);
moel@323
  1147
        if (value.HasValue) {
moel@323
  1148
          sensor.Value = value;
moel@323
  1149
          ActivateSensor(sensor);
moel@323
  1150
        }
moel@323
  1151
      }
moel@323
  1152
moel@228
  1153
      postUpdate();
moel@130
  1154
    }
moel@130
  1155
moel@323
  1156
    public override void Close() {
moel@323
  1157
      foreach (Sensor sensor in controls) {
moel@323
  1158
        // restore all controls back to default
moel@323
  1159
        superIO.SetControl(sensor.Index, null);
moel@323
  1160
      }
moel@323
  1161
      base.Close();
moel@323
  1162
    }
moel@323
  1163
moel@130
  1164
    private class Voltage {
moel@130
  1165
      public readonly string Name;
moel@130
  1166
      public readonly int Index;
moel@130
  1167
      public readonly float Ri;
moel@130
  1168
      public readonly float Rf;
moel@130
  1169
      public readonly float Vf;
moel@130
  1170
      public readonly bool Hidden;
moel@130
  1171
moel@202
  1172
      public Voltage(string name, int index) :
moel@202
  1173
        this(name, index, false) { }
moel@202
  1174
      
moel@130
  1175
      public Voltage(string name, int index, bool hidden) :
moel@130
  1176
        this(name, index, 0, 1, 0, hidden) { }
moel@202
  1177
      
moel@202
  1178
      public Voltage(string name, int index, float ri, float rf) :
moel@202
  1179
        this(name, index, ri, rf, 0, false) { }
moel@202
  1180
      
moel@202
  1181
      // float ri = 0, float rf = 1, float vf = 0, bool hidden = false) 
moel@202
  1182
      
moel@195
  1183
      public Voltage(string name, int index, 
moel@202
  1184
        float ri, float rf, float vf, bool hidden) 
moel@195
  1185
      {
moel@130
  1186
        this.Name = name;
moel@130
  1187
        this.Index = index;
moel@130
  1188
        this.Ri = ri;
moel@130
  1189
        this.Rf = rf;
moel@130
  1190
        this.Vf = vf;
moel@130
  1191
        this.Hidden = hidden;
moel@130
  1192
      }
moel@130
  1193
    }
moel@130
  1194
moel@130
  1195
    private class Temperature {
moel@130
  1196
      public readonly string Name;
moel@130
  1197
      public readonly int Index;
moel@130
  1198
moel@167
  1199
      public Temperature(string name, int index) {
moel@130
  1200
        this.Name = name;
moel@130
  1201
        this.Index = index;
moel@130
  1202
      }
moel@130
  1203
    }
moel@130
  1204
moel@130
  1205
    private class Fan {
moel@130
  1206
      public readonly string Name;
moel@130
  1207
      public readonly int Index;
moel@130
  1208
moel@130
  1209
      public Fan(string name, int index) {
moel@130
  1210
        this.Name = name;
moel@130
  1211
        this.Index = index;
moel@130
  1212
      }
moel@130
  1213
    }
moel@323
  1214
moel@323
  1215
    private class Ctrl {
moel@323
  1216
      public readonly string Name;
moel@323
  1217
      public readonly int Index;
moel@323
  1218
moel@323
  1219
      public Ctrl(string name, int index) {
moel@323
  1220
        this.Name = name;
moel@323
  1221
        this.Index = index;
moel@323
  1222
      }
moel@323
  1223
    }
moel@130
  1224
  }
moel@130
  1225
}