Hardware/Mainboard/SuperIOHardware.cs
author moel.mich
Tue, 30 Dec 2014 21:04:54 +0000
changeset 430 6b24e39f1b84
parent 416 f117373bd190
permissions -rw-r--r--
Fixed Issue 651.
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@428
     7
  Copyright (C) 2009-2014 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@228
    13
using System.Threading;
moel@130
    14
using OpenHardwareMonitor.Hardware.LPC;
moel@130
    15
moel@130
    16
namespace OpenHardwareMonitor.Hardware.Mainboard {
moel@416
    17
  internal sealed class SuperIOHardware : Hardware {
moel@130
    18
moel@195
    19
    private readonly Mainboard mainboard;
moel@195
    20
    private readonly ISuperIO superIO;
moel@130
    21
moel@195
    22
    private readonly List<Sensor> voltages = new List<Sensor>();
moel@195
    23
    private readonly List<Sensor> temperatures = new List<Sensor>();
moel@195
    24
    private readonly List<Sensor> fans = new List<Sensor>();
moel@323
    25
    private readonly List<Sensor> controls = new List<Sensor>();
moel@167
    26
moel@228
    27
    private delegate float? ReadValueDelegate(int index);
moel@228
    28
    private delegate void UpdateDelegate();
moel@228
    29
moel@228
    30
    // delegates for mainboard specific sensor reading code
moel@228
    31
    private readonly ReadValueDelegate readVoltage;
moel@228
    32
    private readonly ReadValueDelegate readTemperature;
moel@228
    33
    private readonly ReadValueDelegate readFan;
moel@323
    34
    private readonly ReadValueDelegate readControl;
moel@228
    35
moel@228
    36
    // delegate for post update mainboard specific code
moel@228
    37
    private readonly UpdateDelegate postUpdate;
moel@228
    38
moel@228
    39
    // mainboard specific mutex
moel@228
    40
    private readonly Mutex mutex;
moel@228
    41
moel@176
    42
    public SuperIOHardware(Mainboard mainboard, ISuperIO superIO, 
moel@176
    43
      Manufacturer manufacturer, Model model, ISettings settings) 
moel@275
    44
      : base(ChipName.GetName(superIO.Chip), new Identifier("lpc", 
moel@416
    45
        superIO.Chip.ToString().ToLowerInvariant()), settings)
moel@130
    46
    {
moel@176
    47
      this.mainboard = mainboard;
moel@130
    48
      this.superIO = superIO;
moel@130
    49
moel@416
    50
      IList<Voltage> v;
moel@416
    51
      IList<Temperature> t;
moel@416
    52
      IList<Fan> f;
moel@416
    53
      IList<Ctrl> c;
moel@416
    54
      GetBoardSpecificConfiguration(superIO, manufacturer, model,
moel@416
    55
        out v, out t, out f, out c,
moel@416
    56
        out readVoltage, out readTemperature, out readFan, out readControl,
moel@416
    57
        out postUpdate, out mutex);
moel@228
    58
moel@416
    59
      CreateVoltageSensors(superIO, settings, v);
moel@416
    60
      CreateTemperatureSensors(superIO, settings, t);
moel@416
    61
      CreateFanSensors(superIO, settings, f);
moel@416
    62
      CreateControlSensors(superIO, settings, c);
moel@416
    63
    }
moel@228
    64
moel@416
    65
    private void CreateControlSensors(ISuperIO superIO, ISettings settings, 
moel@416
    66
      IList<Ctrl> c) 
moel@416
    67
    {
moel@416
    68
      foreach (Ctrl ctrl in c) {
moel@416
    69
        int index = ctrl.Index;
moel@416
    70
        if (index < superIO.Controls.Length) {
moel@416
    71
          Sensor sensor = new Sensor(ctrl.Name, index, SensorType.Control,
moel@416
    72
            this, settings);
moel@416
    73
          Control control = new Control(sensor, settings, 0, 100);
moel@416
    74
          control.ControlModeChanged += (cc) => {
moel@428
    75
            switch (cc.ControlMode) {
moel@428
    76
              case ControlMode.Undefined:
moel@428
    77
                return;
moel@428
    78
              case ControlMode.Default:
moel@428
    79
                superIO.SetControl(index, null);
moel@428
    80
                break;
moel@428
    81
              case ControlMode.Software:
moel@428
    82
                superIO.SetControl(index, (byte)(cc.SoftwareValue * 2.55));
moel@428
    83
                break;
moel@428
    84
              default:
moel@428
    85
                return;
moel@416
    86
            }
moel@416
    87
          };
moel@416
    88
          control.SoftwareControlValueChanged += (cc) => {
moel@416
    89
            if (cc.ControlMode == ControlMode.Software)
moel@416
    90
              superIO.SetControl(index, (byte)(cc.SoftwareValue * 2.55));
moel@416
    91
          };
moel@428
    92
moel@428
    93
          switch (control.ControlMode) {
moel@428
    94
            case ControlMode.Undefined:
moel@428
    95
              break;
moel@428
    96
            case ControlMode.Default:
moel@428
    97
              superIO.SetControl(index, null);
moel@428
    98
              break;
moel@428
    99
            case ControlMode.Software:
moel@428
   100
              superIO.SetControl(index, (byte)(control.SoftwareValue * 2.55));
moel@428
   101
              break;
moel@428
   102
            default:
moel@428
   103
              break;
moel@428
   104
          }            
moel@428
   105
moel@416
   106
          sensor.Control = control;
moel@416
   107
          controls.Add(sensor);
moel@416
   108
          ActivateSensor(sensor);
moel@416
   109
        }
moel@416
   110
      }
moel@416
   111
    }
moel@416
   112
moel@416
   113
    private void CreateFanSensors(ISuperIO superIO, ISettings settings, 
moel@416
   114
      IList<Fan> f) 
moel@416
   115
    {
moel@416
   116
      foreach (Fan fan in f) {
moel@416
   117
        if (fan.Index < superIO.Fans.Length) {
moel@416
   118
          Sensor sensor = new Sensor(fan.Name, fan.Index, SensorType.Fan,
moel@416
   119
            this, settings);
moel@416
   120
          fans.Add(sensor);
moel@416
   121
        }
moel@416
   122
      }
moel@416
   123
    }
moel@416
   124
moel@416
   125
    private void CreateTemperatureSensors(ISuperIO superIO, ISettings settings, 
moel@416
   126
      IList<Temperature> t) 
moel@416
   127
    {
moel@416
   128
      foreach (Temperature temperature in t)
moel@416
   129
        if (temperature.Index < superIO.Temperatures.Length) {
moel@416
   130
          Sensor sensor = new Sensor(temperature.Name, temperature.Index,
moel@416
   131
            SensorType.Temperature, this, new[] {
moel@416
   132
          new ParameterDescription("Offset [°C]", "Temperature offset.", 0)
moel@416
   133
        }, settings);
moel@416
   134
          temperatures.Add(sensor);
moel@416
   135
        }
moel@416
   136
    }
moel@416
   137
moel@416
   138
    private void CreateVoltageSensors(ISuperIO superIO, ISettings settings, 
moel@416
   139
      IList<Voltage> v) 
moel@416
   140
    {
moel@416
   141
      const string formula = "Voltage = value + (value - Vf) * Ri / Rf.";
moel@416
   142
      foreach (Voltage voltage in v)
moel@416
   143
        if (voltage.Index < superIO.Voltages.Length) {
moel@416
   144
          Sensor sensor = new Sensor(voltage.Name, voltage.Index,
moel@416
   145
            voltage.Hidden, SensorType.Voltage, this, new[] {
moel@416
   146
            new ParameterDescription("Ri [kΩ]", "Input resistance.\n" + 
moel@416
   147
              formula, voltage.Ri),
moel@416
   148
            new ParameterDescription("Rf [kΩ]", "Reference resistance.\n" + 
moel@416
   149
              formula, voltage.Rf),
moel@416
   150
            new ParameterDescription("Vf [V]", "Reference voltage.\n" + 
moel@416
   151
              formula, voltage.Vf)
moel@416
   152
            }, settings);
moel@416
   153
          voltages.Add(sensor);
moel@416
   154
        }
moel@416
   155
    }
moel@416
   156
moel@416
   157
    private static void GetBoardSpecificConfiguration(ISuperIO superIO,
moel@416
   158
      Manufacturer manufacturer, Model model, out IList<Voltage> v,
moel@416
   159
      out IList<Temperature> t, out IList<Fan> f, out IList<Ctrl> c,
moel@416
   160
      out ReadValueDelegate readVoltage,
moel@416
   161
      out ReadValueDelegate readTemperature,
moel@416
   162
      out ReadValueDelegate readFan,
moel@416
   163
      out ReadValueDelegate readControl,
moel@416
   164
      out UpdateDelegate postUpdate, out Mutex mutex) {
moel@416
   165
      readVoltage = (index) => superIO.Voltages[index];
moel@416
   166
      readTemperature = (index) => superIO.Temperatures[index];
moel@416
   167
      readFan = (index) => superIO.Fans[index];
moel@416
   168
      readControl = (index) => superIO.Controls[index];
moel@416
   169
moel@416
   170
      postUpdate = () => { };
moel@416
   171
      mutex = null;
moel@416
   172
moel@416
   173
      v = new List<Voltage>();
moel@416
   174
      t = new List<Temperature>();
moel@416
   175
      f = new List<Fan>();
moel@416
   176
      c = new List<Ctrl>();
moel@130
   177
moel@130
   178
      switch (superIO.Chip) {
moel@353
   179
        case Chip.IT8705F:
moel@130
   180
        case Chip.IT8712F:
moel@130
   181
        case Chip.IT8716F:
moel@130
   182
        case Chip.IT8718F:
moel@416
   183
        case Chip.IT8720F:
moel@416
   184
        case Chip.IT8726F:
moel@416
   185
          GetITEConfigurationsA(superIO, manufacturer, model, v, t, f, c,
moel@416
   186
            ref readFan, ref postUpdate, ref mutex);
moel@416
   187
          break;
moel@416
   188
moel@416
   189
        case Chip.IT8721F:
moel@416
   190
        case Chip.IT8728F:
moel@416
   191
        case Chip.IT8771E:
moel@416
   192
        case Chip.IT8772E:
moel@416
   193
          GetITEConfigurationsB(superIO, manufacturer, model, v, t, f, c);
moel@416
   194
          break;
moel@416
   195
moel@416
   196
        case Chip.F71858:
moel@416
   197
          v.Add(new Voltage("VCC3V", 0, 150, 150));
moel@416
   198
          v.Add(new Voltage("VSB3V", 1, 150, 150));
moel@416
   199
          v.Add(new Voltage("Battery", 2, 150, 150));
moel@416
   200
          for (int i = 0; i < superIO.Temperatures.Length; i++)
moel@416
   201
            t.Add(new Temperature("Temperature #" + (i + 1), i));
moel@416
   202
          for (int i = 0; i < superIO.Fans.Length; i++)
moel@416
   203
            f.Add(new Fan("Fan #" + (i + 1), i));
moel@416
   204
          break;
moel@416
   205
        case Chip.F71862:
moel@416
   206
        case Chip.F71869:
moel@416
   207
        case Chip.F71869A:
moel@416
   208
        case Chip.F71882:
moel@416
   209
        case Chip.F71889AD:
moel@416
   210
        case Chip.F71889ED:
moel@416
   211
        case Chip.F71889F:
moel@416
   212
        case Chip.F71808E:
moel@416
   213
          GetFintekConfiguration(superIO, manufacturer, model, v, t, f);
moel@416
   214
          break;
moel@416
   215
moel@416
   216
        case Chip.W83627EHF:
moel@416
   217
          GetWinbondConfigurationEHF(manufacturer, model, v, t, f);
moel@416
   218
          break;
moel@416
   219
        case Chip.W83627DHG:
moel@416
   220
        case Chip.W83627DHGP:
moel@416
   221
        case Chip.W83667HG:
moel@416
   222
        case Chip.W83667HGB:
moel@416
   223
          GetWinbondConfigurationHG(manufacturer, model, v, t, f);
moel@416
   224
          break;
moel@416
   225
        case Chip.W83627HF:
moel@416
   226
        case Chip.W83627THF:
moel@416
   227
        case Chip.W83687THF:
moel@416
   228
          v.Add(new Voltage("CPU VCore", 0));
moel@416
   229
          v.Add(new Voltage("Voltage #2", 1, true));
moel@416
   230
          v.Add(new Voltage("Voltage #3", 2, true));
moel@416
   231
          v.Add(new Voltage("AVCC", 3, 34, 51));
moel@416
   232
          v.Add(new Voltage("Voltage #5", 4, true));
moel@416
   233
          v.Add(new Voltage("5VSB", 5, 34, 51));
moel@416
   234
          v.Add(new Voltage("VBAT", 6));
moel@416
   235
          t.Add(new Temperature("CPU", 0));
moel@416
   236
          t.Add(new Temperature("Auxiliary", 1));
moel@416
   237
          t.Add(new Temperature("System", 2));
moel@416
   238
          f.Add(new Fan("System Fan", 0));
moel@416
   239
          f.Add(new Fan("CPU Fan", 1));
moel@416
   240
          f.Add(new Fan("Auxiliary Fan", 2));
moel@416
   241
          break;
moel@416
   242
        case Chip.NCT6771F:
moel@416
   243
        case Chip.NCT6776F:
moel@416
   244
          GetNuvotonConfigurationF(superIO, manufacturer, model, v, t, f, c);
moel@416
   245
          break;
moel@416
   246
        case Chip.NCT6779D:
moel@416
   247
        case Chip.NCT6791D:
moel@416
   248
          GetNuvotonConfigurationD(superIO, manufacturer, model, v, t, f, c);
moel@416
   249
          break;
moel@416
   250
        default:
moel@416
   251
          GetDefaultConfiguration(superIO, v, t, f, c);
moel@416
   252
          break;
moel@416
   253
      }
moel@416
   254
    }
moel@416
   255
moel@416
   256
    private static void GetDefaultConfiguration(ISuperIO superIO, 
moel@416
   257
      IList<Voltage> v, IList<Temperature> t, IList<Fan> f, IList<Ctrl> c) 
moel@416
   258
    {
moel@416
   259
      for (int i = 0; i < superIO.Voltages.Length; i++)
moel@416
   260
        v.Add(new Voltage("Voltage #" + (i + 1), i, true));
moel@416
   261
      for (int i = 0; i < superIO.Temperatures.Length; i++)
moel@416
   262
        t.Add(new Temperature("Temperature #" + (i + 1), i));
moel@416
   263
      for (int i = 0; i < superIO.Fans.Length; i++)
moel@416
   264
        f.Add(new Fan("Fan #" + (i + 1), i));
moel@416
   265
      for (int i = 0; i < superIO.Controls.Length; i++)
moel@416
   266
        c.Add(new Ctrl("Fan Control #" + (i + 1), i));
moel@416
   267
    }
moel@416
   268
moel@416
   269
    private static void GetITEConfigurationsA(ISuperIO superIO, 
moel@416
   270
      Manufacturer manufacturer, Model model, 
moel@416
   271
      IList<Voltage> v, IList<Temperature> t, IList<Fan> f, IList<Ctrl> c, 
moel@416
   272
      ref ReadValueDelegate readFan, ref UpdateDelegate postUpdate, 
moel@416
   273
      ref Mutex mutex) 
moel@416
   274
    {
moel@416
   275
      switch (manufacturer) {
moel@416
   276
        case Manufacturer.ASUS:
moel@416
   277
          switch (model) {
moel@416
   278
            case Model.Crosshair_III_Formula: // IT8720F
moel@416
   279
              v.Add(new Voltage("VBat", 8));
moel@416
   280
              t.Add(new Temperature("CPU", 0));
moel@416
   281
              for (int i = 0; i < superIO.Fans.Length; i++)
moel@416
   282
                f.Add(new Fan("Fan #" + (i + 1), i));
moel@133
   283
              break;
moel@416
   284
            case Model.M2N_SLI_DELUXE:
moel@416
   285
              v.Add(new Voltage("CPU VCore", 0));
moel@416
   286
              v.Add(new Voltage("+3.3V", 1));
moel@416
   287
              v.Add(new Voltage("+5V", 3, 6.8f, 10));
moel@416
   288
              v.Add(new Voltage("+12V", 4, 30, 10));
moel@416
   289
              v.Add(new Voltage("+5VSB", 7, 6.8f, 10));
moel@416
   290
              v.Add(new Voltage("VBat", 8));
moel@416
   291
              t.Add(new Temperature("CPU", 0));
moel@416
   292
              t.Add(new Temperature("Motherboard", 1));
moel@416
   293
              f.Add(new Fan("CPU Fan", 0));
moel@416
   294
              f.Add(new Fan("Chassis Fan #1", 1));
moel@416
   295
              f.Add(new Fan("Power Fan", 2));
moel@221
   296
              break;
moel@416
   297
            case Model.M4A79XTD_EVO: // IT8720F           
moel@416
   298
              v.Add(new Voltage("+5V", 3, 6.8f, 10));
moel@416
   299
              v.Add(new Voltage("VBat", 8));
moel@416
   300
              t.Add(new Temperature("CPU", 0));
moel@416
   301
              t.Add(new Temperature("Motherboard", 1));
moel@416
   302
              f.Add(new Fan("CPU Fan", 0));
moel@416
   303
              f.Add(new Fan("Chassis Fan #1", 1));
moel@416
   304
              f.Add(new Fan("Chassis Fan #2", 2));
moel@130
   305
              break;
moel@130
   306
            default:
moel@130
   307
              v.Add(new Voltage("CPU VCore", 0));
moel@130
   308
              v.Add(new Voltage("Voltage #2", 1, true));
moel@130
   309
              v.Add(new Voltage("Voltage #3", 2, true));
moel@130
   310
              v.Add(new Voltage("Voltage #4", 3, true));
moel@130
   311
              v.Add(new Voltage("Voltage #5", 4, true));
moel@130
   312
              v.Add(new Voltage("Voltage #6", 5, true));
moel@130
   313
              v.Add(new Voltage("Voltage #7", 6, true));
moel@130
   314
              v.Add(new Voltage("Voltage #8", 7, true));
moel@130
   315
              v.Add(new Voltage("VBat", 8));
moel@130
   316
              for (int i = 0; i < superIO.Temperatures.Length; i++)
moel@130
   317
                t.Add(new Temperature("Temperature #" + (i + 1), i));
moel@130
   318
              for (int i = 0; i < superIO.Fans.Length; i++)
moel@130
   319
                f.Add(new Fan("Fan #" + (i + 1), i));
moel@383
   320
              for (int i = 0; i < superIO.Controls.Length; i++)
moel@383
   321
                c.Add(new Ctrl("Fan Control #" + (i + 1), i));
moel@130
   322
              break;
moel@130
   323
          }
moel@130
   324
          break;
moel@170
   325
moel@416
   326
        case Manufacturer.ASRock:
moel@416
   327
          switch (model) {
moel@416
   328
            case Model.P55_Deluxe: // IT8720F
moel@416
   329
              GetASRockConfiguration(superIO, v, t, f, 
moel@416
   330
                ref readFan, ref postUpdate, ref mutex);
moel@177
   331
              break;
moel@416
   332
            default:
moel@416
   333
              v.Add(new Voltage("CPU VCore", 0));
moel@416
   334
              v.Add(new Voltage("Voltage #2", 1, true));
moel@416
   335
              v.Add(new Voltage("Voltage #3", 2, true));
moel@416
   336
              v.Add(new Voltage("Voltage #4", 3, true));
moel@416
   337
              v.Add(new Voltage("Voltage #5", 4, true));
moel@416
   338
              v.Add(new Voltage("Voltage #6", 5, true));
moel@416
   339
              v.Add(new Voltage("Voltage #7", 6, true));
moel@416
   340
              v.Add(new Voltage("Voltage #8", 7, true));
moel@416
   341
              v.Add(new Voltage("VBat", 8));
moel@416
   342
              for (int i = 0; i < superIO.Temperatures.Length; i++)
moel@416
   343
                t.Add(new Temperature("Temperature #" + (i + 1), i));
moel@416
   344
              for (int i = 0; i < superIO.Fans.Length; i++)
moel@416
   345
                f.Add(new Fan("Fan #" + (i + 1), i));
moel@278
   346
              break;
moel@416
   347
          };
moel@416
   348
          break;
moel@416
   349
moel@416
   350
        case Manufacturer.DFI:
moel@416
   351
          switch (model) {
moel@416
   352
            case Model.LP_BI_P45_T2RS_Elite: // IT8718F
moel@416
   353
              v.Add(new Voltage("CPU VCore", 0));
moel@416
   354
              v.Add(new Voltage("FSB VTT", 1));
moel@416
   355
              v.Add(new Voltage("+3.3V", 2));
moel@416
   356
              v.Add(new Voltage("+5V", 3, 6.8f, 10));
moel@416
   357
              v.Add(new Voltage("+12V", 4, 30, 10));
moel@416
   358
              v.Add(new Voltage("NB Core", 5));
moel@416
   359
              v.Add(new Voltage("VDIMM", 6));
moel@416
   360
              v.Add(new Voltage("+5VSB", 7, 6.8f, 10));
moel@416
   361
              v.Add(new Voltage("VBat", 8));
moel@416
   362
              t.Add(new Temperature("CPU", 0));
moel@416
   363
              t.Add(new Temperature("System", 1));
moel@416
   364
              t.Add(new Temperature("Chipset", 2));
moel@416
   365
              f.Add(new Fan("Fan #1", 0));
moel@416
   366
              f.Add(new Fan("Fan #2", 1));
moel@416
   367
              f.Add(new Fan("Fan #3", 2));
moel@416
   368
              break;
moel@416
   369
            case Model.LP_DK_P55_T3eH9: // IT8720F
moel@416
   370
              v.Add(new Voltage("CPU VCore", 0));
moel@416
   371
              v.Add(new Voltage("VTT", 1));
moel@416
   372
              v.Add(new Voltage("+3.3V", 2));
moel@416
   373
              v.Add(new Voltage("+5V", 3, 6.8f, 10));
moel@416
   374
              v.Add(new Voltage("+12V", 4, 30, 10));
moel@416
   375
              v.Add(new Voltage("CPU PLL", 5));
moel@416
   376
              v.Add(new Voltage("DRAM", 6));
moel@416
   377
              v.Add(new Voltage("+5VSB", 7, 6.8f, 10));
moel@416
   378
              v.Add(new Voltage("VBat", 8));
moel@416
   379
              t.Add(new Temperature("Chipset", 0));
moel@416
   380
              t.Add(new Temperature("CPU PWM", 1));
moel@416
   381
              t.Add(new Temperature("CPU", 2));
moel@416
   382
              f.Add(new Fan("Fan #1", 0));
moel@416
   383
              f.Add(new Fan("Fan #2", 1));
moel@416
   384
              f.Add(new Fan("Fan #3", 2));
moel@416
   385
              break;
moel@416
   386
            default:
moel@416
   387
              v.Add(new Voltage("CPU VCore", 0));
moel@416
   388
              v.Add(new Voltage("VTT", 1, true));
moel@416
   389
              v.Add(new Voltage("+3.3V", 2, true));
moel@416
   390
              v.Add(new Voltage("+5V", 3, 6.8f, 10, 0, true));
moel@416
   391
              v.Add(new Voltage("+12V", 4, 30, 10, 0, true));
moel@416
   392
              v.Add(new Voltage("Voltage #6", 5, true));
moel@416
   393
              v.Add(new Voltage("DRAM", 6, true));
moel@416
   394
              v.Add(new Voltage("+5VSB", 7, 6.8f, 10, 0, true));
moel@416
   395
              v.Add(new Voltage("VBat", 8));
moel@416
   396
              for (int i = 0; i < superIO.Temperatures.Length; i++)
moel@416
   397
                t.Add(new Temperature("Temperature #" + (i + 1), i));
moel@416
   398
              for (int i = 0; i < superIO.Fans.Length; i++)
moel@416
   399
                f.Add(new Fan("Fan #" + (i + 1), i));
moel@416
   400
              for (int i = 0; i < superIO.Controls.Length; i++)
moel@416
   401
                c.Add(new Ctrl("Fan Control #" + (i + 1), i));
moel@416
   402
              break;
moel@416
   403
          }
moel@416
   404
          break;
moel@416
   405
moel@416
   406
        case Manufacturer.Gigabyte:
moel@416
   407
          switch (model) {
moel@416
   408
            case Model._965P_S3: // IT8718F
moel@416
   409
              v.Add(new Voltage("CPU VCore", 0));
moel@416
   410
              v.Add(new Voltage("DRAM", 1));
moel@416
   411
              v.Add(new Voltage("+3.3V", 2));
moel@416
   412
              v.Add(new Voltage("+5V", 3, 6.8f, 10));
moel@416
   413
              v.Add(new Voltage("+12V", 7, 24.3f, 8.2f));
moel@416
   414
              v.Add(new Voltage("VBat", 8));
moel@416
   415
              t.Add(new Temperature("System", 0));
moel@416
   416
              t.Add(new Temperature("CPU", 1));
moel@416
   417
              f.Add(new Fan("CPU Fan", 0));
moel@416
   418
              f.Add(new Fan("System Fan", 1));
moel@416
   419
              break;
moel@416
   420
            case Model.EP45_DS3R: // IT8718F
moel@416
   421
            case Model.EP45_UD3R:
moel@416
   422
            case Model.X38_DS5:
moel@416
   423
              v.Add(new Voltage("CPU VCore", 0));
moel@416
   424
              v.Add(new Voltage("DRAM", 1));
moel@416
   425
              v.Add(new Voltage("+3.3V", 2));
moel@416
   426
              v.Add(new Voltage("+5V", 3, 6.8f, 10));
moel@416
   427
              v.Add(new Voltage("+12V", 7, 24.3f, 8.2f));
moel@416
   428
              v.Add(new Voltage("VBat", 8));
moel@416
   429
              t.Add(new Temperature("System", 0));
moel@416
   430
              t.Add(new Temperature("CPU", 1));
moel@416
   431
              f.Add(new Fan("CPU Fan", 0));
moel@416
   432
              f.Add(new Fan("System Fan #2", 1));
moel@416
   433
              f.Add(new Fan("Power Fan", 2));
moel@416
   434
              f.Add(new Fan("System Fan #1", 3));
moel@416
   435
              break;
moel@416
   436
            case Model.EX58_EXTREME: // IT8720F                 
moel@416
   437
              v.Add(new Voltage("CPU VCore", 0));
moel@416
   438
              v.Add(new Voltage("DRAM", 1));
moel@416
   439
              v.Add(new Voltage("+5V", 3, 6.8f, 10));
moel@416
   440
              v.Add(new Voltage("VBat", 8));
moel@416
   441
              t.Add(new Temperature("System", 0));
moel@416
   442
              t.Add(new Temperature("CPU", 1));
moel@416
   443
              t.Add(new Temperature("Northbridge", 2));
moel@416
   444
              f.Add(new Fan("CPU Fan", 0));
moel@416
   445
              f.Add(new Fan("System Fan #2", 1));
moel@416
   446
              f.Add(new Fan("Power Fan", 2));
moel@416
   447
              f.Add(new Fan("System Fan #1", 3));
moel@416
   448
              break;
moel@416
   449
            case Model.P35_DS3: // IT8718F 
moel@416
   450
            case Model.P35_DS3L: // IT8718F
moel@416
   451
              v.Add(new Voltage("CPU VCore", 0));
moel@416
   452
              v.Add(new Voltage("DRAM", 1));
moel@416
   453
              v.Add(new Voltage("+3.3V", 2));
moel@416
   454
              v.Add(new Voltage("+5V", 3, 6.8f, 10));
moel@416
   455
              v.Add(new Voltage("+12V", 7, 24.3f, 8.2f));
moel@416
   456
              v.Add(new Voltage("VBat", 8));
moel@416
   457
              t.Add(new Temperature("System", 0));
moel@416
   458
              t.Add(new Temperature("CPU", 1));
moel@416
   459
              f.Add(new Fan("CPU Fan", 0));
moel@416
   460
              f.Add(new Fan("System Fan #1", 1));
moel@416
   461
              f.Add(new Fan("System Fan #2", 2));
moel@416
   462
              f.Add(new Fan("Power Fan", 3));
moel@416
   463
              break;
moel@416
   464
            case Model.P55_UD4: // IT8720F
moel@416
   465
            case Model.P55A_UD3: // IT8720F
moel@416
   466
            case Model.P55M_UD4: // IT8720F                
moel@416
   467
            case Model.H55_USB3: // IT8720F
moel@416
   468
            case Model.EX58_UD3R: // IT8720F 
moel@416
   469
              v.Add(new Voltage("CPU VCore", 0));
moel@416
   470
              v.Add(new Voltage("DRAM", 1));
moel@416
   471
              v.Add(new Voltage("+3.3V", 2));
moel@416
   472
              v.Add(new Voltage("+5V", 3, 6.8f, 10));
moel@416
   473
              v.Add(new Voltage("+12V", 5, 24.3f, 8.2f));
moel@416
   474
              v.Add(new Voltage("VBat", 8));
moel@416
   475
              t.Add(new Temperature("System", 0));
moel@416
   476
              t.Add(new Temperature("CPU", 2));
moel@416
   477
              f.Add(new Fan("CPU Fan", 0));
moel@416
   478
              f.Add(new Fan("System Fan #2", 1));
moel@416
   479
              f.Add(new Fan("Power Fan", 2));
moel@416
   480
              f.Add(new Fan("System Fan #1", 3));
moel@416
   481
              break;
moel@416
   482
            case Model.H55N_USB3: // IT8720F
moel@416
   483
              v.Add(new Voltage("CPU VCore", 0));
moel@416
   484
              v.Add(new Voltage("DRAM", 1));
moel@416
   485
              v.Add(new Voltage("+3.3V", 2));
moel@416
   486
              v.Add(new Voltage("+5V", 3, 6.8f, 10));
moel@416
   487
              v.Add(new Voltage("+12V", 5, 24.3f, 8.2f));
moel@416
   488
              v.Add(new Voltage("VBat", 8));
moel@416
   489
              t.Add(new Temperature("System", 0));
moel@416
   490
              t.Add(new Temperature("CPU", 2));
moel@416
   491
              f.Add(new Fan("CPU Fan", 0));
moel@416
   492
              f.Add(new Fan("System Fan", 1));
moel@416
   493
              break;
moel@416
   494
            case Model.G41M_Combo: // IT8718F
moel@416
   495
            case Model.G41MT_S2: // IT8718F
moel@416
   496
            case Model.G41MT_S2P: // IT8718F
moel@416
   497
              v.Add(new Voltage("CPU VCore", 0));
moel@416
   498
              v.Add(new Voltage("DRAM", 1));
moel@416
   499
              v.Add(new Voltage("+3.3V", 2));
moel@416
   500
              v.Add(new Voltage("+5V", 3, 6.8f, 10));
moel@416
   501
              v.Add(new Voltage("+12V", 7, 24.3f, 8.2f));
moel@416
   502
              v.Add(new Voltage("VBat", 8));
moel@416
   503
              t.Add(new Temperature("CPU", 2));
moel@416
   504
              f.Add(new Fan("CPU Fan", 0));
moel@416
   505
              f.Add(new Fan("System Fan", 1));
moel@416
   506
              break;
moel@416
   507
            case Model.GA_970A_UD3: // IT8720F
moel@416
   508
              v.Add(new Voltage("CPU VCore", 0));
moel@416
   509
              v.Add(new Voltage("DRAM", 1));
moel@416
   510
              v.Add(new Voltage("+3.3V", 2));
moel@416
   511
              v.Add(new Voltage("+5V", 3, 6.8f, 10));
moel@416
   512
              v.Add(new Voltage("+12V", 4, 24.3f, 8.2f));
moel@416
   513
              v.Add(new Voltage("VBat", 8));
moel@416
   514
              t.Add(new Temperature("System", 0));
moel@416
   515
              t.Add(new Temperature("CPU", 1));
moel@416
   516
              f.Add(new Fan("CPU Fan", 0));
moel@416
   517
              f.Add(new Fan("System Fan #1", 1));
moel@416
   518
              f.Add(new Fan("System Fan #2", 2));
moel@416
   519
              f.Add(new Fan("Power Fan", 4));
moel@416
   520
              c.Add(new Ctrl("PWM 1", 0));
moel@416
   521
              c.Add(new Ctrl("PWM 2", 1));
moel@416
   522
              c.Add(new Ctrl("PWM 3", 2));
moel@416
   523
              break;
moel@416
   524
            case Model.GA_MA770T_UD3: // IT8720F
moel@416
   525
            case Model.GA_MA770T_UD3P: // IT8720F                
moel@416
   526
            case Model.GA_MA790X_UD3P: // IT8720F
moel@416
   527
              v.Add(new Voltage("CPU VCore", 0));
moel@416
   528
              v.Add(new Voltage("DRAM", 1));
moel@416
   529
              v.Add(new Voltage("+3.3V", 2));
moel@416
   530
              v.Add(new Voltage("+5V", 3, 6.8f, 10));
moel@416
   531
              v.Add(new Voltage("+12V", 4, 24.3f, 8.2f));
moel@416
   532
              v.Add(new Voltage("VBat", 8));
moel@416
   533
              t.Add(new Temperature("System", 0));
moel@416
   534
              t.Add(new Temperature("CPU", 1));
moel@416
   535
              f.Add(new Fan("CPU Fan", 0));
moel@416
   536
              f.Add(new Fan("System Fan #1", 1));
moel@416
   537
              f.Add(new Fan("System Fan #2", 2));
moel@416
   538
              f.Add(new Fan("Power Fan", 3));
moel@416
   539
              break;
moel@416
   540
            case Model.GA_MA78LM_S2H: // IT8718F
moel@416
   541
              v.Add(new Voltage("CPU VCore", 0));
moel@416
   542
              v.Add(new Voltage("DRAM", 1));
moel@416
   543
              v.Add(new Voltage("+3.3V", 2));
moel@416
   544
              v.Add(new Voltage("+5V", 3, 6.8f, 10));
moel@416
   545
              v.Add(new Voltage("+12V", 4, 24.3f, 8.2f));
moel@416
   546
              v.Add(new Voltage("VBat", 8));
moel@416
   547
              t.Add(new Temperature("System", 0));
moel@416
   548
              t.Add(new Temperature("CPU", 1));
moel@416
   549
              t.Add(new Temperature("VRM", 2));
moel@416
   550
              f.Add(new Fan("CPU Fan", 0));
moel@416
   551
              f.Add(new Fan("System Fan #1", 1));
moel@416
   552
              f.Add(new Fan("System Fan #2", 2));
moel@416
   553
              f.Add(new Fan("Power Fan", 3));
moel@416
   554
              break;
moel@416
   555
            case Model.GA_MA785GM_US2H: // IT8718F
moel@416
   556
            case Model.GA_MA785GMT_UD2H: // IT8718F
moel@416
   557
              v.Add(new Voltage("CPU VCore", 0));
moel@416
   558
              v.Add(new Voltage("DRAM", 1));
moel@416
   559
              v.Add(new Voltage("+3.3V", 2));
moel@416
   560
              v.Add(new Voltage("+5V", 3, 6.8f, 10));
moel@416
   561
              v.Add(new Voltage("+12V", 4, 24.3f, 8.2f));
moel@416
   562
              v.Add(new Voltage("VBat", 8));
moel@416
   563
              t.Add(new Temperature("System", 0));
moel@416
   564
              t.Add(new Temperature("CPU", 1));
moel@416
   565
              f.Add(new Fan("CPU Fan", 0));
moel@416
   566
              f.Add(new Fan("System Fan", 1));
moel@416
   567
              f.Add(new Fan("NB Fan", 2));
moel@416
   568
              break;
moel@416
   569
            case Model.X58A_UD3R: // IT8720F 
moel@416
   570
              v.Add(new Voltage("CPU VCore", 0));
moel@416
   571
              v.Add(new Voltage("DRAM", 1));
moel@416
   572
              v.Add(new Voltage("+3.3V", 2));
moel@416
   573
              v.Add(new Voltage("+5V", 3, 6.8f, 10));
moel@416
   574
              v.Add(new Voltage("+12V", 5, 24.3f, 8.2f));
moel@416
   575
              v.Add(new Voltage("VBat", 8));
moel@416
   576
              t.Add(new Temperature("System", 0));
moel@416
   577
              t.Add(new Temperature("CPU", 1));
moel@416
   578
              t.Add(new Temperature("Northbridge", 2));
moel@416
   579
              f.Add(new Fan("CPU Fan", 0));
moel@416
   580
              f.Add(new Fan("System Fan #2", 1));
moel@416
   581
              f.Add(new Fan("Power Fan", 2));
moel@416
   582
              f.Add(new Fan("System Fan #1", 3));
moel@416
   583
              break;
moel@416
   584
            default:
moel@416
   585
              v.Add(new Voltage("CPU VCore", 0));
moel@416
   586
              v.Add(new Voltage("DRAM", 1, true));
moel@416
   587
              v.Add(new Voltage("+3.3V", 2, true));
moel@416
   588
              v.Add(new Voltage("+5V", 3, 6.8f, 10, 0, true));
moel@416
   589
              v.Add(new Voltage("Voltage #5", 4, true));
moel@416
   590
              v.Add(new Voltage("Voltage #6", 5, true));
moel@416
   591
              v.Add(new Voltage("Voltage #7", 6, true));
moel@416
   592
              v.Add(new Voltage("Voltage #8", 7, true));
moel@416
   593
              v.Add(new Voltage("VBat", 8));
moel@416
   594
              for (int i = 0; i < superIO.Temperatures.Length; i++)
moel@416
   595
                t.Add(new Temperature("Temperature #" + (i + 1), i));
moel@416
   596
              for (int i = 0; i < superIO.Fans.Length; i++)
moel@416
   597
                f.Add(new Fan("Fan #" + (i + 1), i));
moel@416
   598
              for (int i = 0; i < superIO.Controls.Length; i++)
moel@416
   599
                c.Add(new Ctrl("Fan Control #" + (i + 1), i));
moel@416
   600
              break;
moel@416
   601
          }
moel@416
   602
          break;
moel@416
   603
moel@416
   604
        default:
moel@416
   605
          v.Add(new Voltage("CPU VCore", 0));
moel@416
   606
          v.Add(new Voltage("Voltage #2", 1, true));
moel@416
   607
          v.Add(new Voltage("Voltage #3", 2, true));
moel@416
   608
          v.Add(new Voltage("Voltage #4", 3, true));
moel@416
   609
          v.Add(new Voltage("Voltage #5", 4, true));
moel@416
   610
          v.Add(new Voltage("Voltage #6", 5, true));
moel@416
   611
          v.Add(new Voltage("Voltage #7", 6, true));
moel@416
   612
          v.Add(new Voltage("Voltage #8", 7, true));
moel@416
   613
          v.Add(new Voltage("VBat", 8));
moel@416
   614
          for (int i = 0; i < superIO.Temperatures.Length; i++)
moel@416
   615
            t.Add(new Temperature("Temperature #" + (i + 1), i));
moel@416
   616
          for (int i = 0; i < superIO.Fans.Length; i++)
moel@416
   617
            f.Add(new Fan("Fan #" + (i + 1), i));
moel@416
   618
          for (int i = 0; i < superIO.Controls.Length; i++)
moel@416
   619
            c.Add(new Ctrl("Fan Control #" + (i + 1), i));
moel@416
   620
          break;
moel@416
   621
      }
moel@416
   622
    }
moel@416
   623
moel@416
   624
    private static void GetASRockConfiguration(ISuperIO superIO, 
moel@416
   625
      IList<Voltage> v, IList<Temperature> t, IList<Fan> f, 
moel@416
   626
      ref ReadValueDelegate readFan, ref UpdateDelegate postUpdate, 
moel@416
   627
      ref Mutex mutex) 
moel@416
   628
    {
moel@416
   629
      v.Add(new Voltage("CPU VCore", 0));
moel@416
   630
      v.Add(new Voltage("+3.3V", 2));
moel@416
   631
      v.Add(new Voltage("+12V", 4, 30, 10));
moel@416
   632
      v.Add(new Voltage("+5V", 5, 6.8f, 10));
moel@416
   633
      v.Add(new Voltage("VBat", 8));
moel@416
   634
      t.Add(new Temperature("CPU", 0));
moel@416
   635
      t.Add(new Temperature("Motherboard", 1));
moel@416
   636
      f.Add(new Fan("CPU Fan", 0));
moel@416
   637
      f.Add(new Fan("Chassis Fan #1", 1));
moel@416
   638
moel@416
   639
      // this mutex is also used by the official ASRock tool
moel@416
   640
      mutex = new Mutex(false, "ASRockOCMark");
moel@416
   641
moel@416
   642
      bool exclusiveAccess = false;
moel@416
   643
      try {
moel@416
   644
        exclusiveAccess = mutex.WaitOne(10, false);
moel@416
   645
      } catch (AbandonedMutexException) { } 
moel@416
   646
        catch (InvalidOperationException) { }
moel@416
   647
moel@416
   648
      // only read additional fans if we get exclusive access
moel@416
   649
      if (exclusiveAccess) {
moel@416
   650
moel@416
   651
        f.Add(new Fan("Chassis Fan #2", 2));
moel@416
   652
        f.Add(new Fan("Chassis Fan #3", 3));
moel@416
   653
        f.Add(new Fan("Power Fan", 4));
moel@416
   654
moel@416
   655
        readFan = (index) => {
moel@416
   656
          if (index < 2) {
moel@416
   657
            return superIO.Fans[index];
moel@416
   658
          } else {
moel@416
   659
            // get GPIO 80-87
moel@416
   660
            byte? gpio = superIO.ReadGPIO(7);
moel@416
   661
            if (!gpio.HasValue)
moel@416
   662
              return null;
moel@416
   663
moel@416
   664
            // read the last 3 fans based on GPIO 83-85
moel@416
   665
            int[] masks = { 0x05, 0x03, 0x06 };
moel@416
   666
            return (((gpio.Value >> 3) & 0x07) ==
moel@416
   667
              masks[index - 2]) ? superIO.Fans[2] : null;
moel@416
   668
          }
moel@416
   669
        };
moel@416
   670
moel@416
   671
        int fanIndex = 0;
moel@416
   672
        postUpdate = () => {
moel@416
   673
          // get GPIO 80-87
moel@416
   674
          byte? gpio = superIO.ReadGPIO(7);
moel@416
   675
          if (!gpio.HasValue)
moel@416
   676
            return;
moel@416
   677
moel@416
   678
          // prepare the GPIO 83-85 for the next update
moel@416
   679
          int[] masks = { 0x05, 0x03, 0x06 };
moel@416
   680
          superIO.WriteGPIO(7,
moel@416
   681
            (byte)((gpio.Value & 0xC7) | (masks[fanIndex] << 3)));
moel@416
   682
          fanIndex = (fanIndex + 1) % 3;
moel@416
   683
        };
moel@416
   684
      }
moel@416
   685
    }
moel@416
   686
moel@416
   687
    private static void GetITEConfigurationsB(ISuperIO superIO,
moel@416
   688
      Manufacturer manufacturer, Model model,
moel@416
   689
      IList<Voltage> v, IList<Temperature> t, IList<Fan> f, IList<Ctrl> c) 
moel@416
   690
    {
moel@416
   691
      switch (manufacturer) {
moel@416
   692
        case Manufacturer.ECS:
moel@416
   693
          switch (model) {
moel@416
   694
            case Model.A890GXM_A: // IT8721F
moel@416
   695
              v.Add(new Voltage("CPU VCore", 0));
moel@416
   696
              v.Add(new Voltage("VDIMM", 1));
moel@416
   697
              v.Add(new Voltage("NB Voltage", 2));
moel@416
   698
              v.Add(new Voltage("Analog +3.3V", 3, 10, 10));
moel@416
   699
              // v.Add(new Voltage("VDIMM", 6, true));
moel@416
   700
              v.Add(new Voltage("Standby +3.3V", 7, 10, 10));
moel@416
   701
              v.Add(new Voltage("VBat", 8, 10, 10));
moel@416
   702
              t.Add(new Temperature("CPU", 0));
moel@416
   703
              t.Add(new Temperature("System", 1));
moel@416
   704
              t.Add(new Temperature("Northbridge", 2));
moel@416
   705
              f.Add(new Fan("CPU Fan", 0));
moel@416
   706
              f.Add(new Fan("System Fan", 1));
moel@416
   707
              f.Add(new Fan("Power Fan", 2));
moel@416
   708
              break;
moel@416
   709
            default:
moel@416
   710
              v.Add(new Voltage("Voltage #1", 0, true));
moel@416
   711
              v.Add(new Voltage("Voltage #2", 1, true));
moel@416
   712
              v.Add(new Voltage("Voltage #3", 2, true));
moel@416
   713
              v.Add(new Voltage("Analog +3.3V", 3, 10, 10, 0, true));
moel@416
   714
              v.Add(new Voltage("Voltage #5", 4, true));
moel@416
   715
              v.Add(new Voltage("Voltage #6", 5, true));
moel@416
   716
              v.Add(new Voltage("Voltage #7", 6, true));
moel@416
   717
              v.Add(new Voltage("Standby +3.3V", 7, 10, 10, 0, true));
moel@416
   718
              v.Add(new Voltage("VBat", 8, 10, 10));
moel@416
   719
              for (int i = 0; i < superIO.Temperatures.Length; i++)
moel@416
   720
                t.Add(new Temperature("Temperature #" + (i + 1), i));
moel@416
   721
              for (int i = 0; i < superIO.Fans.Length; i++)
moel@416
   722
                f.Add(new Fan("Fan #" + (i + 1), i));
moel@416
   723
              for (int i = 0; i < superIO.Controls.Length; i++)
moel@416
   724
                c.Add(new Ctrl("Fan Control #" + (i + 1), i));
moel@416
   725
              break;
moel@416
   726
          }
moel@416
   727
          break;
moel@416
   728
        case Manufacturer.Gigabyte:
moel@416
   729
          switch (model) {
moel@416
   730
            case Model.H61M_DS2_REV_1_2: // IT8728F
moel@416
   731
            case Model.H61M_USB3_B3_REV_2_0: // IT8728F
moel@416
   732
              v.Add(new Voltage("VTT", 0));
moel@416
   733
              v.Add(new Voltage("+12V", 2, 30.9f, 10));
moel@416
   734
              v.Add(new Voltage("CPU VCore", 5));
moel@416
   735
              v.Add(new Voltage("DRAM", 6));
moel@416
   736
              v.Add(new Voltage("Standby +3.3V", 7, 10, 10));
moel@416
   737
              v.Add(new Voltage("VBat", 8, 10, 10));
moel@416
   738
              t.Add(new Temperature("System", 0));
moel@416
   739
              t.Add(new Temperature("CPU", 2));
moel@416
   740
              f.Add(new Fan("CPU Fan", 0));
moel@416
   741
              f.Add(new Fan("System Fan", 1));
moel@416
   742
              break;
moel@416
   743
            case Model.H67A_UD3H_B3: // IT8728F
moel@416
   744
            case Model.H67A_USB3_B3: // IT8728F                
moel@416
   745
              v.Add(new Voltage("VTT", 0));
moel@416
   746
              v.Add(new Voltage("+5V", 1, 15, 10));
moel@416
   747
              v.Add(new Voltage("+12V", 2, 30.9f, 10));
moel@416
   748
              v.Add(new Voltage("CPU VCore", 5));
moel@416
   749
              v.Add(new Voltage("DRAM", 6));
moel@416
   750
              v.Add(new Voltage("Standby +3.3V", 7, 10, 10));
moel@416
   751
              v.Add(new Voltage("VBat", 8, 10, 10));
moel@416
   752
              t.Add(new Temperature("System", 0));
moel@416
   753
              t.Add(new Temperature("CPU", 2));
moel@416
   754
              f.Add(new Fan("CPU Fan", 0));
moel@416
   755
              f.Add(new Fan("System Fan #1", 1));
moel@416
   756
              f.Add(new Fan("Power Fan", 2));
moel@416
   757
              f.Add(new Fan("System Fan #2", 3));
moel@416
   758
              break;
moel@416
   759
            case Model.Z68A_D3H_B3: // IT8728F
moel@416
   760
              v.Add(new Voltage("VTT", 0));
moel@416
   761
              v.Add(new Voltage("+3.3V", 1, 6.49f, 10));
moel@416
   762
              v.Add(new Voltage("+12V", 2, 30.9f, 10));
moel@416
   763
              v.Add(new Voltage("+5V", 3, 7.15f, 10));
moel@416
   764
              v.Add(new Voltage("CPU VCore", 5));
moel@416
   765
              v.Add(new Voltage("DRAM", 6));
moel@416
   766
              v.Add(new Voltage("Standby +3.3V", 7, 10, 10));
moel@416
   767
              v.Add(new Voltage("VBat", 8, 10, 10));
moel@416
   768
              t.Add(new Temperature("System", 0));
moel@416
   769
              t.Add(new Temperature("CPU", 2));
moel@416
   770
              f.Add(new Fan("CPU Fan", 0));
moel@416
   771
              f.Add(new Fan("System Fan #1", 1));
moel@416
   772
              f.Add(new Fan("Power Fan", 2));
moel@416
   773
              f.Add(new Fan("System Fan #2", 3));
moel@416
   774
              break;
moel@416
   775
            case Model.P67A_UD3_B3: // IT8728F
moel@416
   776
            case Model.P67A_UD3R_B3: // IT8728F
moel@416
   777
            case Model.P67A_UD4_B3: // IT8728F                
moel@416
   778
            case Model.Z68AP_D3: // IT8728F
moel@416
   779
            case Model.Z68X_UD3H_B3: // IT8728F               
moel@416
   780
              v.Add(new Voltage("VTT", 0));
moel@416
   781
              v.Add(new Voltage("+3.3V", 1, 6.49f, 10));
moel@416
   782
              v.Add(new Voltage("+12V", 2, 30.9f, 10));
moel@416
   783
              v.Add(new Voltage("+5V", 3, 7.15f, 10));
moel@416
   784
              v.Add(new Voltage("CPU VCore", 5));
moel@416
   785
              v.Add(new Voltage("DRAM", 6));
moel@416
   786
              v.Add(new Voltage("Standby +3.3V", 7, 10, 10));
moel@416
   787
              v.Add(new Voltage("VBat", 8, 10, 10));
moel@416
   788
              t.Add(new Temperature("System", 0));
moel@416
   789
              t.Add(new Temperature("CPU", 2));
moel@416
   790
              f.Add(new Fan("CPU Fan", 0));
moel@416
   791
              f.Add(new Fan("System Fan #2", 1));
moel@416
   792
              f.Add(new Fan("Power Fan", 2));
moel@416
   793
              f.Add(new Fan("System Fan #1", 3));
moel@416
   794
              break;
moel@416
   795
            case Model.Z68X_UD7_B3: // IT8728F
moel@416
   796
              v.Add(new Voltage("VTT", 0));
moel@416
   797
              v.Add(new Voltage("+3.3V", 1, 6.49f, 10));
moel@416
   798
              v.Add(new Voltage("+12V", 2, 30.9f, 10));
moel@416
   799
              v.Add(new Voltage("+5V", 3, 7.15f, 10));
moel@416
   800
              v.Add(new Voltage("CPU VCore", 5));
moel@416
   801
              v.Add(new Voltage("DRAM", 6));
moel@416
   802
              v.Add(new Voltage("Standby +3.3V", 7, 10, 10));
moel@416
   803
              v.Add(new Voltage("VBat", 8, 10, 10));
moel@416
   804
              t.Add(new Temperature("System", 0));
moel@416
   805
              t.Add(new Temperature("CPU", 1));
moel@416
   806
              t.Add(new Temperature("System 3", 2));
moel@416
   807
              f.Add(new Fan("CPU Fan", 0));
moel@416
   808
              f.Add(new Fan("Power Fan", 1));
moel@416
   809
              f.Add(new Fan("System Fan #1", 2));
moel@416
   810
              f.Add(new Fan("System Fan #2", 3));
moel@416
   811
              f.Add(new Fan("System Fan #3", 4));
moel@320
   812
              break;
moel@177
   813
            default:
moel@177
   814
              v.Add(new Voltage("Voltage #1", 0, true));
moel@177
   815
              v.Add(new Voltage("Voltage #2", 1, true));
moel@177
   816
              v.Add(new Voltage("Voltage #3", 2, true));
moel@277
   817
              v.Add(new Voltage("Voltage #4", 3, true));
moel@177
   818
              v.Add(new Voltage("Voltage #5", 4, true));
moel@177
   819
              v.Add(new Voltage("Voltage #6", 5, true));
moel@177
   820
              v.Add(new Voltage("Voltage #7", 6, true));
moel@177
   821
              v.Add(new Voltage("Standby +3.3V", 7, 10, 10, 0, true));
moel@195
   822
              v.Add(new Voltage("VBat", 8, 10, 10));
moel@177
   823
              for (int i = 0; i < superIO.Temperatures.Length; i++)
moel@177
   824
                t.Add(new Temperature("Temperature #" + (i + 1), i));
moel@177
   825
              for (int i = 0; i < superIO.Fans.Length; i++)
moel@177
   826
                f.Add(new Fan("Fan #" + (i + 1), i));
moel@383
   827
              for (int i = 0; i < superIO.Controls.Length; i++)
moel@383
   828
                c.Add(new Ctrl("Fan Control #" + (i + 1), i));
moel@177
   829
              break;
moel@177
   830
          }
moel@170
   831
          break;
moel@416
   832
        case Manufacturer.Shuttle:
moel@416
   833
          switch (model) {
moel@416
   834
            case Model.FH67: // IT8772E 
moel@416
   835
              v.Add(new Voltage("CPU VCore", 0));
moel@416
   836
              v.Add(new Voltage("DRAM", 1));
moel@416
   837
              v.Add(new Voltage("PCH VCCIO", 2));
moel@416
   838
              v.Add(new Voltage("CPU VCCIO", 3));
moel@416
   839
              v.Add(new Voltage("Graphic Voltage", 4));
moel@416
   840
              v.Add(new Voltage("Standby +3.3V", 7, 10, 10));
moel@416
   841
              v.Add(new Voltage("VBat", 8, 10, 10));
moel@416
   842
              t.Add(new Temperature("System", 0));
moel@416
   843
              t.Add(new Temperature("CPU", 1));
moel@416
   844
              f.Add(new Fan("Fan #1", 0));
moel@416
   845
              f.Add(new Fan("CPU Fan", 1));
moel@416
   846
              break;
moel@416
   847
            default:
moel@416
   848
              v.Add(new Voltage("Voltage #1", 0, true));
moel@416
   849
              v.Add(new Voltage("Voltage #2", 1, true));
moel@416
   850
              v.Add(new Voltage("Voltage #3", 2, true));
moel@416
   851
              v.Add(new Voltage("Voltage #4", 3, true));
moel@416
   852
              v.Add(new Voltage("Voltage #5", 4, true));
moel@416
   853
              v.Add(new Voltage("Voltage #6", 5, true));
moel@416
   854
              v.Add(new Voltage("Voltage #7", 6, true));
moel@416
   855
              v.Add(new Voltage("Standby +3.3V", 7, 10, 10, 0, true));
moel@416
   856
              v.Add(new Voltage("VBat", 8, 10, 10));
moel@416
   857
              for (int i = 0; i < superIO.Temperatures.Length; i++)
moel@416
   858
                t.Add(new Temperature("Temperature #" + (i + 1), i));
moel@416
   859
              for (int i = 0; i < superIO.Fans.Length; i++)
moel@416
   860
                f.Add(new Fan("Fan #" + (i + 1), i));
moel@416
   861
              for (int i = 0; i < superIO.Controls.Length; i++)
moel@416
   862
                c.Add(new Ctrl("Fan Control #" + (i + 1), i));
moel@416
   863
              break;
moel@416
   864
          }
moel@416
   865
          break;
moel@416
   866
        default:
moel@416
   867
          v.Add(new Voltage("Voltage #1", 0, true));
moel@416
   868
          v.Add(new Voltage("Voltage #2", 1, true));
moel@416
   869
          v.Add(new Voltage("Voltage #3", 2, true));
moel@416
   870
          v.Add(new Voltage("Voltage #4", 3, true));
moel@416
   871
          v.Add(new Voltage("Voltage #5", 4, true));
moel@416
   872
          v.Add(new Voltage("Voltage #6", 5, true));
moel@416
   873
          v.Add(new Voltage("Voltage #7", 6, true));
moel@416
   874
          v.Add(new Voltage("Standby +3.3V", 7, 10, 10, 0, true));
moel@416
   875
          v.Add(new Voltage("VBat", 8, 10, 10));
moel@130
   876
          for (int i = 0; i < superIO.Temperatures.Length; i++)
moel@130
   877
            t.Add(new Temperature("Temperature #" + (i + 1), i));
moel@130
   878
          for (int i = 0; i < superIO.Fans.Length; i++)
moel@130
   879
            f.Add(new Fan("Fan #" + (i + 1), i));
moel@416
   880
          for (int i = 0; i < superIO.Controls.Length; i++)
moel@416
   881
            c.Add(new Ctrl("Fan Control #" + (i + 1), i));
moel@130
   882
          break;
moel@416
   883
      }
moel@416
   884
    }
moel@416
   885
moel@416
   886
    private static void GetFintekConfiguration(ISuperIO superIO,
moel@416
   887
      Manufacturer manufacturer, Model model,
moel@416
   888
      IList<Voltage> v, IList<Temperature> t, IList<Fan> f) 
moel@416
   889
    {
moel@416
   890
      switch (manufacturer) {
moel@416
   891
        case Manufacturer.EVGA:
moel@416
   892
          switch (model) {
moel@416
   893
            case Model.X58_SLI_Classified: // F71882 
moel@416
   894
              v.Add(new Voltage("VCC3V", 0, 150, 150));
moel@416
   895
              v.Add(new Voltage("CPU VCore", 1, 47, 100));
moel@416
   896
              v.Add(new Voltage("DIMM", 2, 47, 100));
moel@416
   897
              v.Add(new Voltage("CPU VTT", 3, 24, 100));
moel@416
   898
              v.Add(new Voltage("IOH Vcore", 4, 24, 100));
moel@416
   899
              v.Add(new Voltage("+5V", 5, 51, 12));
moel@416
   900
              v.Add(new Voltage("+12V", 6, 56, 6.8f));
moel@416
   901
              v.Add(new Voltage("3VSB", 7, 150, 150));
moel@416
   902
              v.Add(new Voltage("VBat", 8, 150, 150));
moel@416
   903
              t.Add(new Temperature("CPU", 0));
moel@416
   904
              t.Add(new Temperature("VREG", 1));
moel@416
   905
              t.Add(new Temperature("System", 2));
moel@416
   906
              f.Add(new Fan("CPU Fan", 0));
moel@416
   907
              f.Add(new Fan("Power Fan", 1));
moel@416
   908
              f.Add(new Fan("Chassis Fan", 2));
moel@132
   909
              break;
moel@132
   910
            default:
moel@195
   911
              v.Add(new Voltage("VCC3V", 0, 150, 150));
moel@132
   912
              v.Add(new Voltage("CPU VCore", 1));
moel@132
   913
              v.Add(new Voltage("Voltage #3", 2, true));
moel@132
   914
              v.Add(new Voltage("Voltage #4", 3, true));
moel@132
   915
              v.Add(new Voltage("Voltage #5", 4, true));
moel@132
   916
              v.Add(new Voltage("Voltage #6", 5, true));
moel@416
   917
              v.Add(new Voltage("Voltage #7", 6, true));
moel@195
   918
              v.Add(new Voltage("VSB3V", 7, 150, 150));
moel@195
   919
              v.Add(new Voltage("VBat", 8, 150, 150));
moel@132
   920
              for (int i = 0; i < superIO.Temperatures.Length; i++)
moel@132
   921
                t.Add(new Temperature("Temperature #" + (i + 1), i));
moel@132
   922
              for (int i = 0; i < superIO.Fans.Length; i++)
moel@132
   923
                f.Add(new Fan("Fan #" + (i + 1), i));
moel@132
   924
              break;
moel@132
   925
          }
moel@130
   926
          break;
moel@416
   927
        default:
moel@416
   928
          v.Add(new Voltage("VCC3V", 0, 150, 150));
moel@416
   929
          v.Add(new Voltage("CPU VCore", 1));
moel@416
   930
          v.Add(new Voltage("Voltage #3", 2, true));
moel@416
   931
          v.Add(new Voltage("Voltage #4", 3, true));
moel@416
   932
          v.Add(new Voltage("Voltage #5", 4, true));
moel@416
   933
          v.Add(new Voltage("Voltage #6", 5, true));
moel@416
   934
          if (superIO.Chip != Chip.F71808E)
moel@416
   935
            v.Add(new Voltage("Voltage #7", 6, true));
moel@416
   936
          v.Add(new Voltage("VSB3V", 7, 150, 150));
moel@416
   937
          v.Add(new Voltage("VBat", 8, 150, 150));
moel@416
   938
          for (int i = 0; i < superIO.Temperatures.Length; i++)
moel@416
   939
            t.Add(new Temperature("Temperature #" + (i + 1), i));
moel@416
   940
          for (int i = 0; i < superIO.Fans.Length; i++)
moel@416
   941
            f.Add(new Fan("Fan #" + (i + 1), i));
moel@416
   942
          break;
moel@416
   943
      }
moel@416
   944
    }
moel@130
   945
moel@416
   946
    private static void GetNuvotonConfigurationF(ISuperIO superIO, 
moel@416
   947
      Manufacturer manufacturer, Model model, 
moel@416
   948
      IList<Voltage> v, IList<Temperature> t, IList<Fan> f, IList<Ctrl> c) 
moel@416
   949
    {
moel@416
   950
      switch (manufacturer) {
moel@416
   951
        case Manufacturer.ASUS:
moel@416
   952
          switch (model) {
moel@416
   953
            case Model.P8P67: // NCT6776F
moel@416
   954
            case Model.P8P67_EVO: // NCT6776F
moel@416
   955
            case Model.P8P67_PRO: // NCT6776F
moel@220
   956
              v.Add(new Voltage("CPU VCore", 0));
moel@416
   957
              v.Add(new Voltage("+12V", 1, 11, 1));
moel@416
   958
              v.Add(new Voltage("Analog +3.3V", 2, 34, 34));
moel@416
   959
              v.Add(new Voltage("+3.3V", 3, 34, 34));
moel@416
   960
              v.Add(new Voltage("+5V", 4, 12, 3));
moel@416
   961
              v.Add(new Voltage("Standby +3.3V", 7, 34, 34));
moel@416
   962
              v.Add(new Voltage("VBAT", 8, 34, 34));
moel@416
   963
              t.Add(new Temperature("CPU", 0));
moel@416
   964
              t.Add(new Temperature("Auxiliary", 2));
moel@416
   965
              t.Add(new Temperature("Motherboard", 3));
moel@416
   966
              f.Add(new Fan("Chassis Fan #1", 0));
moel@416
   967
              f.Add(new Fan("CPU Fan", 1));
moel@416
   968
              f.Add(new Fan("Power Fan", 2));
moel@416
   969
              f.Add(new Fan("Chassis Fan #2", 3));
moel@416
   970
              c.Add(new Ctrl("Chassis Fan #2", 0));
moel@416
   971
              c.Add(new Ctrl("CPU Fan", 1));
moel@416
   972
              c.Add(new Ctrl("Chassis Fan #1", 2));
moel@416
   973
              break;
moel@416
   974
            case Model.P8P67_M_PRO: // NCT6776F
moel@416
   975
              v.Add(new Voltage("CPU VCore", 0));
moel@416
   976
              v.Add(new Voltage("+12V", 1, 11, 1));
moel@416
   977
              v.Add(new Voltage("Analog +3.3V", 2, 34, 34));
moel@416
   978
              v.Add(new Voltage("+3.3V", 3, 34, 34));
moel@416
   979
              v.Add(new Voltage("+5V", 4, 12, 3));
moel@220
   980
              v.Add(new Voltage("Voltage #6", 5, true));
moel@220
   981
              v.Add(new Voltage("Voltage #7", 6, true));
moel@416
   982
              v.Add(new Voltage("Standby +3.3V", 7, 34, 34));
moel@195
   983
              v.Add(new Voltage("VBAT", 8, 34, 34));
moel@152
   984
              t.Add(new Temperature("CPU", 0));
moel@416
   985
              t.Add(new Temperature("Motherboard", 3));
moel@416
   986
              f.Add(new Fan("Chassis Fan #1", 0));
moel@153
   987
              f.Add(new Fan("CPU Fan", 1));
moel@416
   988
              f.Add(new Fan("Chassis Fan #2", 2));
moel@416
   989
              f.Add(new Fan("Power Fan", 3));
moel@416
   990
              f.Add(new Fan("Auxiliary Fan", 4));
moel@152
   991
              break;
moel@416
   992
            case Model.P8Z68_V_PRO: // NCT6776F
moel@416
   993
              v.Add(new Voltage("CPU VCore", 0));
moel@416
   994
              v.Add(new Voltage("+12V", 1, 11, 1));
moel@416
   995
              v.Add(new Voltage("Analog +3.3V", 2, 34, 34));
moel@416
   996
              v.Add(new Voltage("+3.3V", 3, 34, 34));
moel@416
   997
              v.Add(new Voltage("+5V", 4, 12, 3));
moel@416
   998
              v.Add(new Voltage("Standby +3.3V", 7, 34, 34));
moel@416
   999
              v.Add(new Voltage("VBAT", 8, 34, 34));
moel@416
  1000
              t.Add(new Temperature("CPU", 0));
moel@416
  1001
              t.Add(new Temperature("Auxiliary", 2));
moel@416
  1002
              t.Add(new Temperature("Motherboard", 3));
moel@416
  1003
              for (int i = 0; i < superIO.Fans.Length; i++)
moel@416
  1004
                f.Add(new Fan("Fan #" + (i + 1), i));
moel@416
  1005
              for (int i = 0; i < superIO.Controls.Length; i++)
moel@416
  1006
                c.Add(new Ctrl("Fan #" + (i + 1), i));
moel@416
  1007
              break;
moel@416
  1008
            case Model.P9X79: // NCT6776F
moel@416
  1009
              v.Add(new Voltage("CPU VCore", 0));
moel@416
  1010
              v.Add(new Voltage("+12V", 1, 11, 1));
moel@416
  1011
              v.Add(new Voltage("Analog +3.3V", 2, 34, 34));
moel@416
  1012
              v.Add(new Voltage("+3.3V", 3, 34, 34));
moel@416
  1013
              v.Add(new Voltage("+5V", 4, 12, 3));
moel@416
  1014
              v.Add(new Voltage("Standby +3.3V", 7, 34, 34));
moel@416
  1015
              v.Add(new Voltage("VBAT", 8, 34, 34));
moel@416
  1016
              t.Add(new Temperature("CPU", 0));
moel@416
  1017
              t.Add(new Temperature("Motherboard", 3));
moel@416
  1018
              for (int i = 0; i < superIO.Fans.Length; i++)
moel@416
  1019
                f.Add(new Fan("Fan #" + (i + 1), i));
moel@416
  1020
              for (int i = 0; i < superIO.Controls.Length; i++)
moel@416
  1021
                c.Add(new Ctrl("Fan Control #" + (i + 1), i));
moel@265
  1022
              break;
moel@265
  1023
            default:
moel@265
  1024
              v.Add(new Voltage("CPU VCore", 0));
moel@265
  1025
              v.Add(new Voltage("Voltage #2", 1, true));
moel@265
  1026
              v.Add(new Voltage("AVCC", 2, 34, 34));
moel@265
  1027
              v.Add(new Voltage("3VCC", 3, 34, 34));
moel@265
  1028
              v.Add(new Voltage("Voltage #5", 4, true));
moel@265
  1029
              v.Add(new Voltage("Voltage #6", 5, true));
moel@265
  1030
              v.Add(new Voltage("Voltage #7", 6, true));
moel@265
  1031
              v.Add(new Voltage("3VSB", 7, 34, 34));
moel@265
  1032
              v.Add(new Voltage("VBAT", 8, 34, 34));
moel@354
  1033
              t.Add(new Temperature("CPU Core", 0));
moel@354
  1034
              t.Add(new Temperature("Temperature #1", 1));
moel@354
  1035
              t.Add(new Temperature("Temperature #2", 2));
moel@354
  1036
              t.Add(new Temperature("Temperature #3", 3));
moel@265
  1037
              for (int i = 0; i < superIO.Fans.Length; i++)
moel@265
  1038
                f.Add(new Fan("Fan #" + (i + 1), i));
moel@383
  1039
              for (int i = 0; i < superIO.Controls.Length; i++)
moel@383
  1040
                c.Add(new Ctrl("Fan Control #" + (i + 1), i));
moel@265
  1041
              break;
moel@265
  1042
          }
moel@245
  1043
          break;
moel@416
  1044
        default:
moel@416
  1045
          v.Add(new Voltage("CPU VCore", 0));
moel@416
  1046
          v.Add(new Voltage("Voltage #2", 1, true));
moel@416
  1047
          v.Add(new Voltage("AVCC", 2, 34, 34));
moel@416
  1048
          v.Add(new Voltage("3VCC", 3, 34, 34));
moel@416
  1049
          v.Add(new Voltage("Voltage #5", 4, true));
moel@416
  1050
          v.Add(new Voltage("Voltage #6", 5, true));
moel@416
  1051
          v.Add(new Voltage("Voltage #7", 6, true));
moel@416
  1052
          v.Add(new Voltage("3VSB", 7, 34, 34));
moel@416
  1053
          v.Add(new Voltage("VBAT", 8, 34, 34));
moel@416
  1054
          t.Add(new Temperature("CPU Core", 0));
moel@416
  1055
          t.Add(new Temperature("Temperature #1", 1));
moel@416
  1056
          t.Add(new Temperature("Temperature #2", 2));
moel@416
  1057
          t.Add(new Temperature("Temperature #3", 3));
moel@416
  1058
          for (int i = 0; i < superIO.Fans.Length; i++)
moel@416
  1059
            f.Add(new Fan("Fan #" + (i + 1), i));
moel@416
  1060
          for (int i = 0; i < superIO.Controls.Length; i++)
moel@416
  1061
            c.Add(new Ctrl("Fan Control #" + (i + 1), i));
moel@416
  1062
          break;
moel@416
  1063
      }
moel@416
  1064
    }
moel@416
  1065
moel@416
  1066
    private static void GetNuvotonConfigurationD(ISuperIO superIO,
moel@416
  1067
      Manufacturer manufacturer, Model model,
moel@416
  1068
      IList<Voltage> v, IList<Temperature> t, IList<Fan> f, IList<Ctrl> c) 
moel@416
  1069
    {
moel@416
  1070
      switch (manufacturer) {
moel@416
  1071
        case Manufacturer.ASUS:
moel@416
  1072
          switch (model) {
moel@416
  1073
            case Model.P8Z77_V: // NCT6779D
moel@416
  1074
              v.Add(new Voltage("CPU VCore", 0));
moel@416
  1075
              v.Add(new Voltage("Voltage #2", 1, true));
moel@416
  1076
              v.Add(new Voltage("AVCC", 2, 34, 34));
moel@416
  1077
              v.Add(new Voltage("3VCC", 3, 34, 34));
moel@416
  1078
              v.Add(new Voltage("Voltage #5", 4, true));
moel@416
  1079
              v.Add(new Voltage("Voltage #6", 5, true));
moel@416
  1080
              v.Add(new Voltage("Voltage #7", 6, true));
moel@416
  1081
              v.Add(new Voltage("3VSB", 7, 34, 34));
moel@416
  1082
              v.Add(new Voltage("VBAT", 8, 34, 34));
moel@416
  1083
              v.Add(new Voltage("VTT", 9));
moel@416
  1084
              v.Add(new Voltage("Voltage #11", 10, true));
moel@416
  1085
              v.Add(new Voltage("Voltage #12", 11, true));
moel@416
  1086
              v.Add(new Voltage("Voltage #13", 12, true));
moel@416
  1087
              v.Add(new Voltage("Voltage #14", 13, true));
moel@416
  1088
              v.Add(new Voltage("Voltage #15", 14, true));
moel@416
  1089
              t.Add(new Temperature("CPU Core", 0));
moel@416
  1090
              t.Add(new Temperature("Auxiliary", 1));
moel@416
  1091
              t.Add(new Temperature("Motherboard", 2));
moel@416
  1092
              f.Add(new Fan("Chassis Fan #1", 0));
moel@416
  1093
              f.Add(new Fan("CPU Fan", 1));
moel@416
  1094
              f.Add(new Fan("Chassis Fan #2", 2));
moel@416
  1095
              f.Add(new Fan("Chassis Fan #3", 3));
moel@416
  1096
              c.Add(new Ctrl("Chassis Fan #1", 0));
moel@416
  1097
              c.Add(new Ctrl("CPU  Fan", 1));
moel@416
  1098
              c.Add(new Ctrl("Chassis Fan #2", 2));
moel@416
  1099
              c.Add(new Ctrl("Chassis Fan #3", 3));
moel@359
  1100
              break;
moel@359
  1101
            default:
moel@359
  1102
              v.Add(new Voltage("CPU VCore", 0));
moel@359
  1103
              v.Add(new Voltage("Voltage #2", 1, true));
moel@359
  1104
              v.Add(new Voltage("AVCC", 2, 34, 34));
moel@359
  1105
              v.Add(new Voltage("3VCC", 3, 34, 34));
moel@359
  1106
              v.Add(new Voltage("Voltage #5", 4, true));
moel@359
  1107
              v.Add(new Voltage("Voltage #6", 5, true));
moel@359
  1108
              v.Add(new Voltage("Voltage #7", 6, true));
moel@359
  1109
              v.Add(new Voltage("3VSB", 7, 34, 34));
moel@359
  1110
              v.Add(new Voltage("VBAT", 8, 34, 34));
moel@359
  1111
              v.Add(new Voltage("VTT", 9));
moel@359
  1112
              v.Add(new Voltage("Voltage #11", 10, true));
moel@359
  1113
              v.Add(new Voltage("Voltage #12", 11, true));
moel@359
  1114
              v.Add(new Voltage("Voltage #13", 12, true));
moel@359
  1115
              v.Add(new Voltage("Voltage #14", 13, true));
moel@359
  1116
              v.Add(new Voltage("Voltage #15", 14, true));
moel@359
  1117
              t.Add(new Temperature("CPU Core", 0));
moel@359
  1118
              t.Add(new Temperature("Temperature #1", 1));
moel@359
  1119
              t.Add(new Temperature("Temperature #2", 2));
moel@359
  1120
              t.Add(new Temperature("Temperature #3", 3));
moel@359
  1121
              t.Add(new Temperature("Temperature #4", 4));
moel@359
  1122
              t.Add(new Temperature("Temperature #5", 5));
moel@359
  1123
              t.Add(new Temperature("Temperature #6", 6));
moel@359
  1124
              for (int i = 0; i < superIO.Fans.Length; i++)
moel@359
  1125
                f.Add(new Fan("Fan #" + (i + 1), i));
moel@359
  1126
              for (int i = 0; i < superIO.Controls.Length; i++)
moel@359
  1127
                c.Add(new Ctrl("Fan Control #" + (i + 1), i));
moel@359
  1128
              break;
moel@359
  1129
          }
moel@356
  1130
          break;
moel@130
  1131
        default:
moel@416
  1132
          v.Add(new Voltage("CPU VCore", 0));
moel@416
  1133
          v.Add(new Voltage("Voltage #2", 1, true));
moel@416
  1134
          v.Add(new Voltage("AVCC", 2, 34, 34));
moel@416
  1135
          v.Add(new Voltage("3VCC", 3, 34, 34));
moel@416
  1136
          v.Add(new Voltage("Voltage #5", 4, true));
moel@416
  1137
          v.Add(new Voltage("Voltage #6", 5, true));
moel@416
  1138
          v.Add(new Voltage("Voltage #7", 6, true));
moel@416
  1139
          v.Add(new Voltage("3VSB", 7, 34, 34));
moel@416
  1140
          v.Add(new Voltage("VBAT", 8, 34, 34));
moel@416
  1141
          v.Add(new Voltage("VTT", 9));
moel@416
  1142
          v.Add(new Voltage("Voltage #11", 10, true));
moel@416
  1143
          v.Add(new Voltage("Voltage #12", 11, true));
moel@416
  1144
          v.Add(new Voltage("Voltage #13", 12, true));
moel@416
  1145
          v.Add(new Voltage("Voltage #14", 13, true));
moel@416
  1146
          v.Add(new Voltage("Voltage #15", 14, true));
moel@416
  1147
          t.Add(new Temperature("CPU Core", 0));
moel@416
  1148
          t.Add(new Temperature("Temperature #1", 1));
moel@416
  1149
          t.Add(new Temperature("Temperature #2", 2));
moel@416
  1150
          t.Add(new Temperature("Temperature #3", 3));
moel@416
  1151
          t.Add(new Temperature("Temperature #4", 4));
moel@416
  1152
          t.Add(new Temperature("Temperature #5", 5));
moel@416
  1153
          t.Add(new Temperature("Temperature #6", 6));
moel@130
  1154
          for (int i = 0; i < superIO.Fans.Length; i++)
moel@130
  1155
            f.Add(new Fan("Fan #" + (i + 1), i));
moel@323
  1156
          for (int i = 0; i < superIO.Controls.Length; i++)
moel@323
  1157
            c.Add(new Ctrl("Fan Control #" + (i + 1), i));
moel@130
  1158
          break;
moel@130
  1159
      }
moel@416
  1160
    }
moel@130
  1161
moel@416
  1162
    private static void GetWinbondConfigurationEHF(Manufacturer manufacturer,
moel@416
  1163
      Model model, IList<Voltage> v, IList<Temperature> t, IList<Fan> f) 
moel@416
  1164
    {
moel@416
  1165
      switch (manufacturer) {
moel@416
  1166
        case Manufacturer.ASRock:
moel@416
  1167
          switch (model) {
moel@416
  1168
            case Model.AOD790GX_128M: // W83627EHF
moel@416
  1169
              v.Add(new Voltage("CPU VCore", 0));
moel@416
  1170
              v.Add(new Voltage("Analog +3.3V", 2, 34, 34));
moel@416
  1171
              v.Add(new Voltage("+3.3V", 4, 10, 10));
moel@416
  1172
              v.Add(new Voltage("+5V", 5, 20, 10));
moel@416
  1173
              v.Add(new Voltage("+12V", 6, 28, 5));
moel@416
  1174
              v.Add(new Voltage("Standby +3.3V", 7, 34, 34));
moel@416
  1175
              v.Add(new Voltage("VBAT", 8, 34, 34));
moel@416
  1176
              t.Add(new Temperature("CPU", 0));
moel@416
  1177
              t.Add(new Temperature("Motherboard", 2));
moel@416
  1178
              f.Add(new Fan("CPU Fan", 0));
moel@416
  1179
              f.Add(new Fan("Chassis Fan", 1));
moel@416
  1180
              break;
moel@416
  1181
            default:
moel@416
  1182
              v.Add(new Voltage("CPU VCore", 0));
moel@416
  1183
              v.Add(new Voltage("Voltage #2", 1, true));
moel@416
  1184
              v.Add(new Voltage("AVCC", 2, 34, 34));
moel@416
  1185
              v.Add(new Voltage("3VCC", 3, 34, 34));
moel@416
  1186
              v.Add(new Voltage("Voltage #5", 4, true));
moel@416
  1187
              v.Add(new Voltage("Voltage #6", 5, true));
moel@416
  1188
              v.Add(new Voltage("Voltage #7", 6, true));
moel@416
  1189
              v.Add(new Voltage("3VSB", 7, 34, 34));
moel@416
  1190
              v.Add(new Voltage("VBAT", 8, 34, 34));
moel@416
  1191
              v.Add(new Voltage("Voltage #10", 9, true));
moel@416
  1192
              t.Add(new Temperature("CPU", 0));
moel@416
  1193
              t.Add(new Temperature("Auxiliary", 1));
moel@416
  1194
              t.Add(new Temperature("System", 2));
moel@416
  1195
              f.Add(new Fan("System Fan", 0));
moel@416
  1196
              f.Add(new Fan("CPU Fan", 1));
moel@416
  1197
              f.Add(new Fan("Auxiliary Fan", 2));
moel@416
  1198
              f.Add(new Fan("CPU Fan #2", 3));
moel@416
  1199
              f.Add(new Fan("Auxiliary Fan #2", 4));
moel@416
  1200
              break;
moel@416
  1201
          } break;
moel@416
  1202
        default:
moel@416
  1203
          v.Add(new Voltage("CPU VCore", 0));
moel@416
  1204
          v.Add(new Voltage("Voltage #2", 1, true));
moel@416
  1205
          v.Add(new Voltage("AVCC", 2, 34, 34));
moel@416
  1206
          v.Add(new Voltage("3VCC", 3, 34, 34));
moel@416
  1207
          v.Add(new Voltage("Voltage #5", 4, true));
moel@416
  1208
          v.Add(new Voltage("Voltage #6", 5, true));
moel@416
  1209
          v.Add(new Voltage("Voltage #7", 6, true));
moel@416
  1210
          v.Add(new Voltage("3VSB", 7, 34, 34));
moel@416
  1211
          v.Add(new Voltage("VBAT", 8, 34, 34));
moel@416
  1212
          v.Add(new Voltage("Voltage #10", 9, true));
moel@416
  1213
          t.Add(new Temperature("CPU", 0));
moel@416
  1214
          t.Add(new Temperature("Auxiliary", 1));
moel@416
  1215
          t.Add(new Temperature("System", 2));
moel@416
  1216
          f.Add(new Fan("System Fan", 0));
moel@416
  1217
          f.Add(new Fan("CPU Fan", 1));
moel@416
  1218
          f.Add(new Fan("Auxiliary Fan", 2));
moel@416
  1219
          f.Add(new Fan("CPU Fan #2", 3));
moel@416
  1220
          f.Add(new Fan("Auxiliary Fan #2", 4));
moel@416
  1221
          break;
moel@130
  1222
      }
moel@416
  1223
    }
moel@130
  1224
moel@416
  1225
    private static void GetWinbondConfigurationHG(Manufacturer manufacturer,
moel@416
  1226
      Model model, IList<Voltage> v, IList<Temperature> t, IList<Fan> f) 
moel@416
  1227
    {
moel@416
  1228
      switch (manufacturer) {
moel@416
  1229
        case Manufacturer.ASRock:
moel@416
  1230
          switch (model) {
moel@416
  1231
            case Model._880GMH_USB3: // W83627DHG-P
moel@416
  1232
              v.Add(new Voltage("CPU VCore", 0));
moel@416
  1233
              v.Add(new Voltage("+3.3V", 3, 34, 34));
moel@416
  1234
              v.Add(new Voltage("+5V", 5, 15, 7.5f));
moel@416
  1235
              v.Add(new Voltage("+12V", 6, 56, 10));
moel@416
  1236
              v.Add(new Voltage("Standby +3.3V", 7, 34, 34));
moel@416
  1237
              v.Add(new Voltage("VBAT", 8, 34, 34));
moel@416
  1238
              t.Add(new Temperature("CPU", 0));
moel@416
  1239
              t.Add(new Temperature("Motherboard", 2));
moel@416
  1240
              f.Add(new Fan("Chassis Fan", 0));
moel@416
  1241
              f.Add(new Fan("CPU Fan", 1));
moel@416
  1242
              f.Add(new Fan("Power Fan", 2));
moel@416
  1243
              break;
moel@416
  1244
            default:
moel@416
  1245
              v.Add(new Voltage("CPU VCore", 0));
moel@416
  1246
              v.Add(new Voltage("Voltage #2", 1, true));
moel@416
  1247
              v.Add(new Voltage("AVCC", 2, 34, 34));
moel@416
  1248
              v.Add(new Voltage("3VCC", 3, 34, 34));
moel@416
  1249
              v.Add(new Voltage("Voltage #5", 4, true));
moel@416
  1250
              v.Add(new Voltage("Voltage #6", 5, true));
moel@416
  1251
              v.Add(new Voltage("Voltage #7", 6, true));
moel@416
  1252
              v.Add(new Voltage("3VSB", 7, 34, 34));
moel@416
  1253
              v.Add(new Voltage("VBAT", 8, 34, 34));
moel@416
  1254
              t.Add(new Temperature("CPU", 0));
moel@416
  1255
              t.Add(new Temperature("Auxiliary", 1));
moel@416
  1256
              t.Add(new Temperature("System", 2));
moel@416
  1257
              f.Add(new Fan("System Fan", 0));
moel@416
  1258
              f.Add(new Fan("CPU Fan", 1));
moel@416
  1259
              f.Add(new Fan("Auxiliary Fan", 2));
moel@416
  1260
              f.Add(new Fan("CPU Fan #2", 3));
moel@416
  1261
              f.Add(new Fan("Auxiliary Fan #2", 4));
moel@416
  1262
              break;
moel@416
  1263
          }
moel@416
  1264
          break;
moel@416
  1265
        case Manufacturer.ASUS:
moel@416
  1266
          switch (model) {
moel@416
  1267
            case Model.P6T: // W83667HG
moel@416
  1268
            case Model.P6X58D_E: // W83667HG                 
moel@416
  1269
            case Model.Rampage_II_GENE: // W83667HG 
moel@416
  1270
              v.Add(new Voltage("CPU VCore", 0));
moel@416
  1271
              v.Add(new Voltage("+12V", 1, 11.5f, 1.91f));
moel@416
  1272
              v.Add(new Voltage("Analog +3.3V", 2, 34, 34));
moel@416
  1273
              v.Add(new Voltage("+3.3V", 3, 34, 34));
moel@416
  1274
              v.Add(new Voltage("+5V", 4, 15, 7.5f));
moel@416
  1275
              v.Add(new Voltage("Standby +3.3V", 7, 34, 34));
moel@416
  1276
              v.Add(new Voltage("VBAT", 8, 34, 34));
moel@416
  1277
              t.Add(new Temperature("CPU", 0));
moel@416
  1278
              t.Add(new Temperature("Motherboard", 2));
moel@416
  1279
              f.Add(new Fan("Chassis Fan #1", 0));
moel@416
  1280
              f.Add(new Fan("CPU Fan", 1));
moel@416
  1281
              f.Add(new Fan("Power Fan", 2));
moel@416
  1282
              f.Add(new Fan("Chassis Fan #2", 3));
moel@416
  1283
              f.Add(new Fan("Chassis Fan #3", 4));
moel@416
  1284
              break;
moel@416
  1285
            case Model.Rampage_Extreme: // W83667HG 
moel@416
  1286
              v.Add(new Voltage("CPU VCore", 0));
moel@416
  1287
              v.Add(new Voltage("+12V", 1, 12, 2));
moel@416
  1288
              v.Add(new Voltage("Analog +3.3V", 2, 34, 34));
moel@416
  1289
              v.Add(new Voltage("+3.3V", 3, 34, 34));
moel@416
  1290
              v.Add(new Voltage("+5V", 4, 15, 7.5f));
moel@416
  1291
              v.Add(new Voltage("Standby +3.3V", 7, 34, 34));
moel@416
  1292
              v.Add(new Voltage("VBAT", 8, 34, 34));
moel@416
  1293
              t.Add(new Temperature("CPU", 0));
moel@416
  1294
              t.Add(new Temperature("Motherboard", 2));
moel@416
  1295
              f.Add(new Fan("Chassis Fan #1", 0));
moel@416
  1296
              f.Add(new Fan("CPU Fan", 1));
moel@416
  1297
              f.Add(new Fan("Power Fan", 2));
moel@416
  1298
              f.Add(new Fan("Chassis Fan #2", 3));
moel@416
  1299
              f.Add(new Fan("Chassis Fan #3", 4));
moel@416
  1300
              break;
moel@416
  1301
            default:
moel@416
  1302
              v.Add(new Voltage("CPU VCore", 0));
moel@416
  1303
              v.Add(new Voltage("Voltage #2", 1, true));
moel@416
  1304
              v.Add(new Voltage("AVCC", 2, 34, 34));
moel@416
  1305
              v.Add(new Voltage("3VCC", 3, 34, 34));
moel@416
  1306
              v.Add(new Voltage("Voltage #5", 4, true));
moel@416
  1307
              v.Add(new Voltage("Voltage #6", 5, true));
moel@416
  1308
              v.Add(new Voltage("Voltage #7", 6, true));
moel@416
  1309
              v.Add(new Voltage("3VSB", 7, 34, 34));
moel@416
  1310
              v.Add(new Voltage("VBAT", 8, 34, 34));
moel@416
  1311
              t.Add(new Temperature("CPU", 0));
moel@416
  1312
              t.Add(new Temperature("Auxiliary", 1));
moel@416
  1313
              t.Add(new Temperature("System", 2));
moel@416
  1314
              f.Add(new Fan("System Fan", 0));
moel@416
  1315
              f.Add(new Fan("CPU Fan", 1));
moel@416
  1316
              f.Add(new Fan("Auxiliary Fan", 2));
moel@416
  1317
              f.Add(new Fan("CPU Fan #2", 3));
moel@416
  1318
              f.Add(new Fan("Auxiliary Fan #2", 4));
moel@416
  1319
              break;
moel@416
  1320
          }
moel@416
  1321
          break;
moel@416
  1322
        default:
moel@416
  1323
          v.Add(new Voltage("CPU VCore", 0));
moel@416
  1324
          v.Add(new Voltage("Voltage #2", 1, true));
moel@416
  1325
          v.Add(new Voltage("AVCC", 2, 34, 34));
moel@416
  1326
          v.Add(new Voltage("3VCC", 3, 34, 34));
moel@416
  1327
          v.Add(new Voltage("Voltage #5", 4, true));
moel@416
  1328
          v.Add(new Voltage("Voltage #6", 5, true));
moel@416
  1329
          v.Add(new Voltage("Voltage #7", 6, true));
moel@416
  1330
          v.Add(new Voltage("3VSB", 7, 34, 34));
moel@416
  1331
          v.Add(new Voltage("VBAT", 8, 34, 34));
moel@416
  1332
          t.Add(new Temperature("CPU", 0));
moel@416
  1333
          t.Add(new Temperature("Auxiliary", 1));
moel@416
  1334
          t.Add(new Temperature("System", 2));
moel@416
  1335
          f.Add(new Fan("System Fan", 0));
moel@416
  1336
          f.Add(new Fan("CPU Fan", 1));
moel@416
  1337
          f.Add(new Fan("Auxiliary Fan", 2));
moel@416
  1338
          f.Add(new Fan("CPU Fan #2", 3));
moel@416
  1339
          f.Add(new Fan("Auxiliary Fan #2", 4));
moel@416
  1340
          break;
moel@323
  1341
      }
moel@130
  1342
    }
moel@130
  1343
moel@165
  1344
    public override HardwareType HardwareType {
moel@165
  1345
      get { return HardwareType.SuperIO; }
moel@130
  1346
    }
moel@130
  1347
moel@176
  1348
    public override IHardware Parent {
moel@176
  1349
      get { return mainboard; }
moel@176
  1350
    }
moel@176
  1351
moel@130
  1352
moel@130
  1353
    public override string GetReport() {
moel@130
  1354
      return superIO.GetReport();
moel@130
  1355
    }
moel@130
  1356
moel@130
  1357
    public override void Update() {
moel@130
  1358
      superIO.Update();
moel@130
  1359
moel@130
  1360
      foreach (Sensor sensor in voltages) {
moel@228
  1361
        float? value = readVoltage(sensor.Index);
moel@130
  1362
        if (value.HasValue) {
moel@130
  1363
          sensor.Value = value + (value - sensor.Parameters[2].Value) *
moel@130
  1364
            sensor.Parameters[0].Value / sensor.Parameters[1].Value;
moel@130
  1365
          ActivateSensor(sensor);
moel@130
  1366
        }
moel@130
  1367
      }
moel@130
  1368
moel@130
  1369
      foreach (Sensor sensor in temperatures) {
moel@228
  1370
        float? value = readTemperature(sensor.Index);
moel@130
  1371
        if (value.HasValue) {
moel@130
  1372
          sensor.Value = value + sensor.Parameters[0].Value;
moel@130
  1373
          ActivateSensor(sensor);
moel@130
  1374
        }
moel@130
  1375
      }
moel@130
  1376
moel@130
  1377
      foreach (Sensor sensor in fans) {
moel@228
  1378
        float? value = readFan(sensor.Index);
moel@130
  1379
        if (value.HasValue) {
moel@130
  1380
          sensor.Value = value;
moel@130
  1381
          if (value.Value > 0)
moel@130
  1382
            ActivateSensor(sensor);
moel@130
  1383
        }
moel@130
  1384
      }
moel@228
  1385
moel@323
  1386
      foreach (Sensor sensor in controls) {
moel@323
  1387
        float? value = readControl(sensor.Index);
moel@389
  1388
        sensor.Value = value;                
moel@323
  1389
      }
moel@323
  1390
moel@228
  1391
      postUpdate();
moel@130
  1392
    }
moel@130
  1393
moel@323
  1394
    public override void Close() {
moel@323
  1395
      foreach (Sensor sensor in controls) {
moel@323
  1396
        // restore all controls back to default
moel@323
  1397
        superIO.SetControl(sensor.Index, null);
moel@323
  1398
      }
moel@323
  1399
      base.Close();
moel@323
  1400
    }
moel@323
  1401
moel@130
  1402
    private class Voltage {
moel@130
  1403
      public readonly string Name;
moel@130
  1404
      public readonly int Index;
moel@130
  1405
      public readonly float Ri;
moel@130
  1406
      public readonly float Rf;
moel@130
  1407
      public readonly float Vf;
moel@130
  1408
      public readonly bool Hidden;
moel@130
  1409
moel@202
  1410
      public Voltage(string name, int index) :
moel@202
  1411
        this(name, index, false) { }
moel@202
  1412
      
moel@130
  1413
      public Voltage(string name, int index, bool hidden) :
moel@130
  1414
        this(name, index, 0, 1, 0, hidden) { }
moel@202
  1415
      
moel@202
  1416
      public Voltage(string name, int index, float ri, float rf) :
moel@202
  1417
        this(name, index, ri, rf, 0, false) { }
moel@202
  1418
      
moel@202
  1419
      // float ri = 0, float rf = 1, float vf = 0, bool hidden = false) 
moel@202
  1420
      
moel@195
  1421
      public Voltage(string name, int index, 
moel@202
  1422
        float ri, float rf, float vf, bool hidden) 
moel@195
  1423
      {
moel@130
  1424
        this.Name = name;
moel@130
  1425
        this.Index = index;
moel@130
  1426
        this.Ri = ri;
moel@130
  1427
        this.Rf = rf;
moel@130
  1428
        this.Vf = vf;
moel@130
  1429
        this.Hidden = hidden;
moel@130
  1430
      }
moel@130
  1431
    }
moel@130
  1432
moel@130
  1433
    private class Temperature {
moel@130
  1434
      public readonly string Name;
moel@130
  1435
      public readonly int Index;
moel@130
  1436
moel@167
  1437
      public Temperature(string name, int index) {
moel@130
  1438
        this.Name = name;
moel@130
  1439
        this.Index = index;
moel@130
  1440
      }
moel@130
  1441
    }
moel@130
  1442
moel@130
  1443
    private class Fan {
moel@130
  1444
      public readonly string Name;
moel@130
  1445
      public readonly int Index;
moel@130
  1446
moel@130
  1447
      public Fan(string name, int index) {
moel@130
  1448
        this.Name = name;
moel@130
  1449
        this.Index = index;
moel@130
  1450
      }
moel@130
  1451
    }
moel@323
  1452
moel@323
  1453
    private class Ctrl {
moel@323
  1454
      public readonly string Name;
moel@323
  1455
      public readonly int Index;
moel@323
  1456
moel@323
  1457
      public Ctrl(string name, int index) {
moel@323
  1458
        this.Name = name;
moel@323
  1459
        this.Index = index;
moel@323
  1460
      }
moel@323
  1461
    }
moel@130
  1462
  }
moel@130
  1463
}