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