Hardware/Mainboard/SuperIOHardware.cs
author moel.mich
Sun, 15 Aug 2010 17:56:57 +0000
changeset 168 7f90baeb96b0
parent 167 b7cc9d09aefe
child 170 31858ba46e9c
permissions -rw-r--r--
Fixed Issue 104.
moel@135
     1
/*
moel@130
     2
  
moel@130
     3
  Version: MPL 1.1/GPL 2.0/LGPL 2.1
moel@130
     4
moel@130
     5
  The contents of this file are subject to the Mozilla Public License Version
moel@130
     6
  1.1 (the "License"); you may not use this file except in compliance with
moel@130
     7
  the License. You may obtain a copy of the License at
moel@130
     8
 
moel@130
     9
  http://www.mozilla.org/MPL/
moel@130
    10
moel@130
    11
  Software distributed under the License is distributed on an "AS IS" basis,
moel@130
    12
  WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
moel@130
    13
  for the specific language governing rights and limitations under the License.
moel@130
    14
moel@130
    15
  The Original Code is the Open Hardware Monitor code.
moel@130
    16
moel@130
    17
  The Initial Developer of the Original Code is 
moel@130
    18
  Michael Möller <m.moeller@gmx.ch>.
moel@130
    19
  Portions created by the Initial Developer are Copyright (C) 2009-2010
moel@130
    20
  the Initial Developer. All Rights Reserved.
moel@130
    21
moel@130
    22
  Contributor(s):
moel@130
    23
moel@130
    24
  Alternatively, the contents of this file may be used under the terms of
moel@130
    25
  either the GNU General Public License Version 2 or later (the "GPL"), or
moel@130
    26
  the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
moel@130
    27
  in which case the provisions of the GPL or the LGPL are applicable instead
moel@130
    28
  of those above. If you wish to allow use of your version of this file only
moel@130
    29
  under the terms of either the GPL or the LGPL, and not to allow others to
moel@130
    30
  use your version of this file under the terms of the MPL, indicate your
moel@130
    31
  decision by deleting the provisions above and replace them with the notice
moel@130
    32
  and other provisions required by the GPL or the LGPL. If you do not delete
moel@130
    33
  the provisions above, a recipient may use your version of this file under
moel@130
    34
  the terms of any one of the MPL, the GPL or the LGPL.
moel@130
    35
 
moel@130
    36
*/
moel@130
    37
moel@130
    38
using System;
moel@130
    39
using System.Collections.Generic;
moel@166
    40
using System.Globalization;
moel@130
    41
using OpenHardwareMonitor.Hardware.LPC;
moel@130
    42
moel@130
    43
namespace OpenHardwareMonitor.Hardware.Mainboard {
moel@165
    44
  internal class SuperIOHardware : Hardware {
moel@130
    45
moel@130
    46
    private ISuperIO superIO;
moel@167
    47
    private string name;
moel@130
    48
moel@130
    49
    private List<Sensor> voltages = new List<Sensor>();
moel@130
    50
    private List<Sensor> temperatures = new List<Sensor>();
moel@167
    51
    private List<Sensor> fans = new List<Sensor>();
moel@167
    52
moel@130
    53
moel@165
    54
    public SuperIOHardware(ISuperIO superIO, Manufacturer manufacturer,
moel@165
    55
      Model model, ISettings settings) 
moel@130
    56
    {
moel@130
    57
      this.superIO = superIO;
moel@167
    58
      this.name = ChipName.GetName(superIO.Chip);
moel@130
    59
moel@130
    60
      List<Voltage> v = new List<Voltage>();
moel@130
    61
      List<Temperature> t = new List<Temperature>();
moel@130
    62
      List<Fan> f = new List<Fan>();
moel@130
    63
moel@130
    64
      switch (superIO.Chip) {
moel@130
    65
        case Chip.IT8712F:
moel@130
    66
        case Chip.IT8716F:
moel@130
    67
        case Chip.IT8718F:
moel@130
    68
        case Chip.IT8720F:
moel@130
    69
        case Chip.IT8726F:
moel@130
    70
          switch (manufacturer) {
moel@133
    71
            case Manufacturer.ASUS:
moel@133
    72
              switch (model) {
moel@168
    73
                case Model.Crosshair_III_Formula: // IT8720F
moel@133
    74
                  v.Add(new Voltage("VBat", 8));
moel@133
    75
                  t.Add(new Temperature("CPU", 0));
moel@133
    76
                  for (int i = 0; i < superIO.Fans.Length; i++)
moel@133
    77
                    f.Add(new Fan("Fan #" + (i + 1), i));
moel@133
    78
                  break;
moel@144
    79
                case Model.M2N_SLI_DELUXE:                
moel@133
    80
                  v.Add(new Voltage("CPU VCore", 0));
moel@133
    81
                  v.Add(new Voltage("+3.3V", 1));
moel@133
    82
                  v.Add(new Voltage("+5V", 3, 6.8f, 10, 0));
moel@133
    83
                  v.Add(new Voltage("+12V", 4, 30, 10, 0));
moel@133
    84
                  v.Add(new Voltage("+5VSB", 7, 6.8f, 10, 0));
moel@133
    85
                  v.Add(new Voltage("VBat", 8));
moel@133
    86
                  t.Add(new Temperature("CPU", 0));
moel@133
    87
                  t.Add(new Temperature("Motherboard", 1));
moel@133
    88
                  f.Add(new Fan("CPU Fan", 0));
moel@133
    89
                  f.Add(new Fan("Chassis Fan #1", 1));
moel@133
    90
                  f.Add(new Fan("Power Fan", 2));
moel@133
    91
                  break;
moel@168
    92
                case Model.M4A79XTD_EVO: // IT8720F           
moel@144
    93
                  v.Add(new Voltage("+5V", 3, 6.8f, 10, 0));
moel@144
    94
                  v.Add(new Voltage("VBat", 8));
moel@144
    95
                  t.Add(new Temperature("CPU", 0));
moel@144
    96
                  t.Add(new Temperature("Motherboard", 1));
moel@144
    97
                  f.Add(new Fan("CPU Fan", 0));
moel@144
    98
                  f.Add(new Fan("Chassis Fan #1", 1));
moel@144
    99
                  f.Add(new Fan("Chassis Fan #2", 2));
moel@144
   100
                  break;
moel@133
   101
                default:
moel@133
   102
                  v.Add(new Voltage("CPU VCore", 0));
moel@133
   103
                  v.Add(new Voltage("Voltage #2", 1, true));
moel@133
   104
                  v.Add(new Voltage("Voltage #3", 2, true));
moel@133
   105
                  v.Add(new Voltage("Voltage #4", 3, true));
moel@133
   106
                  v.Add(new Voltage("Voltage #5", 4, true));
moel@133
   107
                  v.Add(new Voltage("Voltage #6", 5, true));
moel@133
   108
                  v.Add(new Voltage("Voltage #7", 6, true));
moel@133
   109
                  v.Add(new Voltage("Voltage #8", 7, true));
moel@133
   110
                  v.Add(new Voltage("VBat", 8));
moel@133
   111
                  for (int i = 0; i < superIO.Temperatures.Length; i++)
moel@133
   112
                    t.Add(new Temperature("Temperature #" + (i + 1), i));
moel@133
   113
                  for (int i = 0; i < superIO.Fans.Length; i++)
moel@133
   114
                    f.Add(new Fan("Fan #" + (i + 1), i));
moel@133
   115
                  break;
moel@133
   116
              }
moel@133
   117
              break;
moel@130
   118
            case Manufacturer.DFI:
moel@130
   119
              switch (model) {
moel@168
   120
                case Model.LP_BI_P45_T2RS_Elite: // IT8718F
moel@130
   121
                  v.Add(new Voltage("CPU VCore", 0));
moel@130
   122
                  v.Add(new Voltage("FSB VTT", 1));
moel@130
   123
                  v.Add(new Voltage("+3.3V", 2));
moel@130
   124
                  v.Add(new Voltage("+5V", 3, 6.8f, 10, 0));
moel@130
   125
                  v.Add(new Voltage("+12V", 4, 30, 10, 0));
moel@130
   126
                  v.Add(new Voltage("NB Core", 5));
moel@130
   127
                  v.Add(new Voltage("VDIMM", 6));
moel@130
   128
                  v.Add(new Voltage("+5VSB", 7, 6.8f, 10, 0));
moel@130
   129
                  v.Add(new Voltage("VBat", 8));
moel@130
   130
                  t.Add(new Temperature("CPU", 0));
moel@130
   131
                  t.Add(new Temperature("System", 1));
moel@130
   132
                  t.Add(new Temperature("Chipset", 2));
moel@130
   133
                  f.Add(new Fan("Fan #1", 0));
moel@130
   134
                  f.Add(new Fan("Fan #2", 1));
moel@130
   135
                  f.Add(new Fan("Fan #3", 2));
moel@130
   136
                  break;
moel@168
   137
                case Model.LP_DK_P55_T3eH9: // IT8720F
moel@130
   138
                  v.Add(new Voltage("CPU VCore", 0));
moel@130
   139
                  v.Add(new Voltage("VTT", 1));
moel@130
   140
                  v.Add(new Voltage("+3.3V", 2));
moel@130
   141
                  v.Add(new Voltage("+5V", 3, 6.8f, 10, 0));
moel@130
   142
                  v.Add(new Voltage("+12V", 4, 30, 10, 0));
moel@130
   143
                  v.Add(new Voltage("CPU PLL", 5));
moel@130
   144
                  v.Add(new Voltage("DRAM", 6));
moel@130
   145
                  v.Add(new Voltage("+5VSB", 7, 6.8f, 10, 0));
moel@130
   146
                  v.Add(new Voltage("VBat", 8));
moel@130
   147
                  t.Add(new Temperature("Chipset", 0));
moel@130
   148
                  t.Add(new Temperature("CPU PWM", 1));
moel@130
   149
                  t.Add(new Temperature("CPU", 2));
moel@130
   150
                  f.Add(new Fan("Fan #1", 0));
moel@130
   151
                  f.Add(new Fan("Fan #2", 1));
moel@130
   152
                  f.Add(new Fan("Fan #3", 2));
moel@130
   153
                  break;
moel@130
   154
                default:
moel@130
   155
                  v.Add(new Voltage("CPU VCore", 0));
moel@130
   156
                  v.Add(new Voltage("VTT", 1, true));
moel@130
   157
                  v.Add(new Voltage("+3.3V", 2, true));
moel@130
   158
                  v.Add(new Voltage("+5V", 3, 6.8f, 10, 0, true));
moel@130
   159
                  v.Add(new Voltage("+12V", 4, 30, 10, 0, true));
moel@130
   160
                  v.Add(new Voltage("Voltage #6", 5, true));
moel@130
   161
                  v.Add(new Voltage("DRAM", 6, true));
moel@130
   162
                  v.Add(new Voltage("+5VSB", 7, 6.8f, 10, 0, true));
moel@130
   163
                  v.Add(new Voltage("VBat", 8));
moel@130
   164
                  for (int i = 0; i < superIO.Temperatures.Length; i++)
moel@130
   165
                    t.Add(new Temperature("Temperature #" + (i + 1), i));
moel@130
   166
                  for (int i = 0; i < superIO.Fans.Length; i++)
moel@130
   167
                    f.Add(new Fan("Fan #" + (i + 1), i));
moel@130
   168
                  break;
moel@130
   169
              }
moel@130
   170
              break;
moel@130
   171
moel@130
   172
            case Manufacturer.Gigabyte:
moel@130
   173
              switch (model) {
moel@168
   174
                case Model._965P_S3: // IT8718F
moel@130
   175
                  v.Add(new Voltage("CPU VCore", 0));
moel@130
   176
                  v.Add(new Voltage("DRAM", 1));
moel@130
   177
                  v.Add(new Voltage("+3.3V", 2));
moel@130
   178
                  v.Add(new Voltage("+5V", 3, 6.8f, 10, 0));
moel@130
   179
                  v.Add(new Voltage("+12V", 7, 27, 9.1f, 0));
moel@130
   180
                  v.Add(new Voltage("VBat", 8));
moel@130
   181
                  t.Add(new Temperature("System", 0));
moel@130
   182
                  t.Add(new Temperature("CPU", 1));
moel@130
   183
                  f.Add(new Fan("CPU Fan", 0));
moel@130
   184
                  f.Add(new Fan("System Fan", 1));
moel@130
   185
                  break;
moel@168
   186
                case Model.EP45_DS3R: // IT8718F
moel@130
   187
                case Model.EP45_UD3R: 
moel@138
   188
                case Model.X38_DS5:    
moel@130
   189
                  v.Add(new Voltage("CPU VCore", 0));
moel@130
   190
                  v.Add(new Voltage("DRAM", 1));
moel@130
   191
                  v.Add(new Voltage("+3.3V", 2));
moel@130
   192
                  v.Add(new Voltage("+5V", 3, 6.8f, 10, 0));
moel@130
   193
                  v.Add(new Voltage("+12V", 7, 27, 9.1f, 0));
moel@130
   194
                  v.Add(new Voltage("VBat", 8));
moel@130
   195
                  t.Add(new Temperature("System", 0));
moel@130
   196
                  t.Add(new Temperature("CPU", 1));
moel@130
   197
                  f.Add(new Fan("CPU Fan", 0));
moel@130
   198
                  f.Add(new Fan("System Fan #2", 1));
moel@130
   199
                  f.Add(new Fan("Power Fan", 2));
moel@130
   200
                  f.Add(new Fan("System Fan #1", 3));
moel@130
   201
                  break;
moel@168
   202
                case Model.EX58_EXTREME: // IT8720F 
moel@133
   203
                  v.Add(new Voltage("CPU VCore", 0));
moel@133
   204
                  v.Add(new Voltage("DRAM", 1));
moel@133
   205
                  v.Add(new Voltage("+5V", 3, 6.8f, 10, 0));
moel@133
   206
                  v.Add(new Voltage("VBat", 8));
moel@133
   207
                  t.Add(new Temperature("System", 0));
moel@133
   208
                  t.Add(new Temperature("CPU", 1));
moel@138
   209
                  t.Add(new Temperature("Northbridge", 2));
moel@133
   210
                  f.Add(new Fan("CPU Fan", 0));
moel@133
   211
                  f.Add(new Fan("System Fan #2", 1));
moel@133
   212
                  f.Add(new Fan("Power Fan", 2));
moel@133
   213
                  f.Add(new Fan("System Fan #1", 3));
moel@133
   214
                  break;
moel@168
   215
                case Model.P35_DS3: // IT8718F 
moel@168
   216
                case Model.P35_DS3L: // IT8718F
moel@130
   217
                  v.Add(new Voltage("CPU VCore", 0));
moel@130
   218
                  v.Add(new Voltage("DRAM", 1));
moel@130
   219
                  v.Add(new Voltage("+3.3V", 2));
moel@130
   220
                  v.Add(new Voltage("+5V", 3, 6.8f, 10, 0));
moel@130
   221
                  v.Add(new Voltage("+12V", 7, 27, 9.1f, 0));
moel@130
   222
                  v.Add(new Voltage("VBat", 8));
moel@130
   223
                  t.Add(new Temperature("System", 0));
moel@130
   224
                  t.Add(new Temperature("CPU", 1));
moel@130
   225
                  f.Add(new Fan("CPU Fan", 0));
moel@130
   226
                  f.Add(new Fan("System Fan #1", 1));
moel@130
   227
                  f.Add(new Fan("System Fan #2", 2));
moel@130
   228
                  f.Add(new Fan("Power Fan", 3));
moel@130
   229
                  break;
moel@168
   230
                case Model.P55_UD4: // IT8720F
moel@168
   231
                case Model.P55M_UD4: // IT8720F
moel@148
   232
                  v.Add(new Voltage("CPU VCore", 0));
moel@148
   233
                  v.Add(new Voltage("DRAM", 1));
moel@148
   234
                  v.Add(new Voltage("+3.3V", 2));
moel@148
   235
                  v.Add(new Voltage("+5V", 3, 6.8f, 10, 0));
moel@148
   236
                  v.Add(new Voltage("+12V", 5, 27, 9.1f, 0));
moel@148
   237
                  v.Add(new Voltage("VBat", 8));
moel@148
   238
                  t.Add(new Temperature("System", 0));
moel@148
   239
                  t.Add(new Temperature("CPU", 2));
moel@148
   240
                  f.Add(new Fan("CPU Fan", 0));
moel@148
   241
                  f.Add(new Fan("System Fan #2", 1));
moel@148
   242
                  f.Add(new Fan("Power Fan", 2));
moel@148
   243
                  f.Add(new Fan("System Fan #1", 3));
moel@148
   244
                  break;
moel@168
   245
                case Model.GA_MA770T_UD3: // IT8720F
moel@154
   246
                  v.Add(new Voltage("CPU VCore", 0));
moel@154
   247
                  v.Add(new Voltage("DRAM", 1));
moel@154
   248
                  v.Add(new Voltage("+3.3V", 2));
moel@154
   249
                  v.Add(new Voltage("+5V", 3, 6.8f, 10, 0));
moel@154
   250
                  v.Add(new Voltage("+12V", 4, 27, 9.1f, 0));
moel@154
   251
                  v.Add(new Voltage("VBat", 8));
moel@154
   252
                  t.Add(new Temperature("System", 0));
moel@154
   253
                  t.Add(new Temperature("CPU", 1));
moel@154
   254
                  f.Add(new Fan("CPU Fan", 0));
moel@154
   255
                  f.Add(new Fan("System Fan #1", 1));
moel@154
   256
                  f.Add(new Fan("System Fan #2", 2));
moel@154
   257
                  f.Add(new Fan("Power Fan", 3));
moel@154
   258
                  break;
moel@168
   259
                case Model.GA_MA785GMT_UD2H: // IT8718F
moel@130
   260
                  v.Add(new Voltage("CPU VCore", 0));
moel@130
   261
                  v.Add(new Voltage("DRAM", 1));
moel@130
   262
                  v.Add(new Voltage("+3.3V", 2));
moel@130
   263
                  v.Add(new Voltage("+5V", 3, 6.8f, 10, 0));
moel@130
   264
                  v.Add(new Voltage("+12V", 4, 27, 9.1f, 0));
moel@130
   265
                  v.Add(new Voltage("VBat", 8));
moel@130
   266
                  t.Add(new Temperature("System", 0));
moel@130
   267
                  t.Add(new Temperature("CPU", 1));
moel@130
   268
                  f.Add(new Fan("CPU Fan", 0));
moel@130
   269
                  f.Add(new Fan("System Fan", 1));
moel@130
   270
                  f.Add(new Fan("NB Fan", 2));
moel@130
   271
                  break;
moel@168
   272
                case Model.X58A_UD3R: // IT8720F 
moel@138
   273
                  v.Add(new Voltage("CPU VCore", 0));
moel@138
   274
                  v.Add(new Voltage("DRAM", 1));
moel@138
   275
                  v.Add(new Voltage("+3.3V", 2));
moel@138
   276
                  v.Add(new Voltage("+5V", 3, 6.8f, 10, 0));
moel@138
   277
                  v.Add(new Voltage("+12V", 5, 27, 9.1f, 0));
moel@138
   278
                  v.Add(new Voltage("VBat", 8));
moel@138
   279
                  t.Add(new Temperature("System", 0));
moel@138
   280
                  t.Add(new Temperature("CPU", 1));
moel@138
   281
                  t.Add(new Temperature("Northbridge", 2));
moel@138
   282
                  f.Add(new Fan("CPU Fan", 0));
moel@138
   283
                  f.Add(new Fan("System Fan #2", 1));
moel@138
   284
                  f.Add(new Fan("Power Fan", 2));
moel@138
   285
                  f.Add(new Fan("System Fan #1", 3));
moel@138
   286
                  break;
moel@130
   287
                default:
moel@130
   288
                  v.Add(new Voltage("CPU VCore", 0));
moel@130
   289
                  v.Add(new Voltage("DRAM", 1, true));
moel@130
   290
                  v.Add(new Voltage("+3.3V", 2, true));
moel@130
   291
                  v.Add(new Voltage("+5V", 3, 6.8f, 10, 0, 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("+12V", 7, 27, 9.1f, 0, 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@130
   301
                  break;
moel@130
   302
              }
moel@130
   303
              break;
moel@130
   304
moel@130
   305
            default:
moel@130
   306
              v.Add(new Voltage("CPU VCore", 0));
moel@130
   307
              v.Add(new Voltage("Voltage #2", 1, true));
moel@130
   308
              v.Add(new Voltage("Voltage #3", 2, true));
moel@130
   309
              v.Add(new Voltage("Voltage #4", 3, true));
moel@130
   310
              v.Add(new Voltage("Voltage #5", 4, true));
moel@130
   311
              v.Add(new Voltage("Voltage #6", 5, true));
moel@130
   312
              v.Add(new Voltage("Voltage #7", 6, true));
moel@130
   313
              v.Add(new Voltage("Voltage #8", 7, true));
moel@130
   314
              v.Add(new Voltage("VBat", 8));
moel@130
   315
              for (int i = 0; i < superIO.Temperatures.Length; i++)
moel@130
   316
                t.Add(new Temperature("Temperature #" + (i + 1), i));
moel@130
   317
              for (int i = 0; i < superIO.Fans.Length; i++)
moel@130
   318
                f.Add(new Fan("Fan #" + (i + 1), i));
moel@130
   319
              break;
moel@130
   320
          }
moel@130
   321
          break;
moel@130
   322
          
moel@130
   323
        case Chip.F71858:
moel@132
   324
          v.Add(new Voltage("VCC3V", 0, 150, 150, 0));
moel@132
   325
          v.Add(new Voltage("VSB3V", 1, 150, 150, 0));
moel@132
   326
          v.Add(new Voltage("Battery", 2, 150, 150, 0));
moel@130
   327
          for (int i = 0; i < superIO.Temperatures.Length; i++)
moel@130
   328
            t.Add(new Temperature("Temperature #" + (i + 1), i));
moel@130
   329
          for (int i = 0; i < superIO.Fans.Length; i++)
moel@130
   330
            f.Add(new Fan("Fan #" + (i + 1), i));
moel@130
   331
          break;
moel@130
   332
        case Chip.F71862: 
moel@130
   333
        case Chip.F71869: 
moel@130
   334
        case Chip.F71882:
moel@130
   335
        case Chip.F71889ED: 
moel@130
   336
        case Chip.F71889F:
moel@132
   337
          switch (manufacturer) {
moel@132
   338
            case Manufacturer.EVGA:
moel@132
   339
              switch (model) {
moel@168
   340
                case Model.X58_SLI_Classified: // F71882 
moel@132
   341
                  v.Add(new Voltage("VCC3V", 0, 150, 150, 0));
moel@132
   342
                  v.Add(new Voltage("CPU VCore", 1, 47, 100, 0));
moel@132
   343
                  v.Add(new Voltage("DIMM", 2, 47, 100, 0));
moel@132
   344
                  v.Add(new Voltage("CPU VTT", 3, 24, 100, 0));
moel@132
   345
                  v.Add(new Voltage("IOH Vcore", 4, 24, 100, 0));
moel@132
   346
                  v.Add(new Voltage("+5V", 5, 51, 12, 0));
moel@132
   347
                  v.Add(new Voltage("+12V", 6, 56, 6.8f, 0));
moel@132
   348
                  v.Add(new Voltage("3VSB", 7, 150, 150, 0));
moel@132
   349
                  v.Add(new Voltage("VBat", 8, 150, 150, 0));
moel@132
   350
                  t.Add(new Temperature("CPU", 0));
moel@132
   351
                  t.Add(new Temperature("VREG", 1));
moel@132
   352
                  t.Add(new Temperature("System", 2));
moel@132
   353
                  f.Add(new Fan("CPU Fan", 0));
moel@132
   354
                  f.Add(new Fan("Power Fan", 1));
moel@132
   355
                  f.Add(new Fan("Chassis Fan", 2));
moel@132
   356
                  break;
moel@132
   357
                default:
moel@132
   358
                  v.Add(new Voltage("VCC3V", 0, 150, 150, 0));
moel@132
   359
                  v.Add(new Voltage("CPU VCore", 1));
moel@132
   360
                  v.Add(new Voltage("Voltage #3", 2, true));
moel@132
   361
                  v.Add(new Voltage("Voltage #4", 3, true));
moel@132
   362
                  v.Add(new Voltage("Voltage #5", 4, true));
moel@132
   363
                  v.Add(new Voltage("Voltage #6", 5, true));
moel@132
   364
                  v.Add(new Voltage("Voltage #7", 6, true));
moel@132
   365
                  v.Add(new Voltage("VSB3V", 7, 150, 150, 0));
moel@132
   366
                  v.Add(new Voltage("VBat", 8, 150, 150, 0));
moel@132
   367
                  for (int i = 0; i < superIO.Temperatures.Length; i++)
moel@132
   368
                    t.Add(new Temperature("Temperature #" + (i + 1), i));
moel@132
   369
                  for (int i = 0; i < superIO.Fans.Length; i++)
moel@132
   370
                    f.Add(new Fan("Fan #" + (i + 1), i));
moel@132
   371
                  break;
moel@132
   372
              }
moel@132
   373
              break;
moel@132
   374
            default:
moel@132
   375
              v.Add(new Voltage("VCC3V", 0, 150, 150, 0));
moel@132
   376
              v.Add(new Voltage("CPU VCore", 1));
moel@132
   377
              v.Add(new Voltage("Voltage #3", 2, true));
moel@132
   378
              v.Add(new Voltage("Voltage #4", 3, true));
moel@132
   379
              v.Add(new Voltage("Voltage #5", 4, true));
moel@132
   380
              v.Add(new Voltage("Voltage #6", 5, true));
moel@132
   381
              v.Add(new Voltage("Voltage #7", 6, true));
moel@132
   382
              v.Add(new Voltage("VSB3V", 7, 150, 150, 0));
moel@132
   383
              v.Add(new Voltage("VBat", 8, 150, 150, 0));
moel@132
   384
              for (int i = 0; i < superIO.Temperatures.Length; i++)
moel@132
   385
                t.Add(new Temperature("Temperature #" + (i + 1), i));
moel@132
   386
              for (int i = 0; i < superIO.Fans.Length; i++)
moel@132
   387
                f.Add(new Fan("Fan #" + (i + 1), i));
moel@132
   388
              break;
moel@132
   389
          }
moel@130
   390
          break;
moel@130
   391
moel@130
   392
        case Chip.W83627EHF:          
moel@130
   393
          v.Add(new Voltage("CPU VCore", 0));
moel@130
   394
          v.Add(new Voltage("Voltage #2", 1, true));
moel@130
   395
          v.Add(new Voltage("AVCC", 2, 34, 34, 0));
moel@130
   396
          v.Add(new Voltage("3VCC", 3, 34, 34, 0));
moel@130
   397
          v.Add(new Voltage("Voltage #5", 4, true));
moel@130
   398
          v.Add(new Voltage("Voltage #6", 5, true));
moel@130
   399
          v.Add(new Voltage("Voltage #7", 6, true));
moel@130
   400
          v.Add(new Voltage("3VSB", 7, 34, 34, 0));
moel@130
   401
          v.Add(new Voltage("VBAT", 8, 34, 34, 0));
moel@130
   402
          v.Add(new Voltage("Voltage #10", 9, true));
moel@130
   403
          t.Add(new Temperature("CPU", 0));
moel@130
   404
          t.Add(new Temperature("Auxiliary", 1));
moel@130
   405
          t.Add(new Temperature("System", 2));
moel@153
   406
          f.Add(new Fan("System Fan", 0));
moel@153
   407
          f.Add(new Fan("CPU Fan", 1));
moel@153
   408
          f.Add(new Fan("Auxiliary Fan", 2));
moel@153
   409
          f.Add(new Fan("CPU Fan #2", 3));
moel@153
   410
          f.Add(new Fan("Auxiliary Fan #2", 4));
moel@130
   411
          break;
moel@130
   412
        case Chip.W83627DHG: 
moel@130
   413
        case Chip.W83627DHGP:                      
moel@130
   414
        case Chip.W83667HG:
moel@130
   415
        case Chip.W83667HGB:
moel@152
   416
          switch (manufacturer) {
moel@153
   417
            case Manufacturer.ASRock:
moel@153
   418
              switch (model) {
moel@168
   419
                case Model._880GMH_USB3: // W83627DHG-P
moel@153
   420
                  v.Add(new Voltage("CPU VCore", 0));
moel@153
   421
                  v.Add(new Voltage("+3.3V", 3, 34, 34, 0));
moel@153
   422
                  v.Add(new Voltage("+5V", 5, 15, 7.5f, 0));
moel@153
   423
                  v.Add(new Voltage("+12V", 6, 56, 10, 0));
moel@153
   424
                  v.Add(new Voltage("Standby +3.3V", 7, 34, 34, 0));
moel@153
   425
                  v.Add(new Voltage("VBAT", 8, 34, 34, 0));
moel@153
   426
                  t.Add(new Temperature("CPU", 0));
moel@153
   427
                  t.Add(new Temperature("Motherboard", 2));
moel@153
   428
                  f.Add(new Fan("Chassis Fan", 0));
moel@153
   429
                  f.Add(new Fan("CPU Fan", 1));
moel@153
   430
                  f.Add(new Fan("Power Fan", 2));
moel@153
   431
                  break;
moel@153
   432
                default:
moel@153
   433
                  v.Add(new Voltage("CPU VCore", 0));
moel@153
   434
                  v.Add(new Voltage("Voltage #2", 1, true));
moel@153
   435
                  v.Add(new Voltage("AVCC", 2, 34, 34, 0));
moel@153
   436
                  v.Add(new Voltage("3VCC", 3, 34, 34, 0));
moel@153
   437
                  v.Add(new Voltage("Voltage #5", 4, true));
moel@153
   438
                  v.Add(new Voltage("Voltage #6", 5, true));
moel@153
   439
                  v.Add(new Voltage("Voltage #7", 6, true));
moel@153
   440
                  v.Add(new Voltage("3VSB", 7, 34, 34, 0));
moel@153
   441
                  v.Add(new Voltage("VBAT", 8, 34, 34, 0));
moel@153
   442
                  t.Add(new Temperature("CPU", 0));
moel@153
   443
                  t.Add(new Temperature("Auxiliary", 1));
moel@153
   444
                  t.Add(new Temperature("System", 2));
moel@153
   445
                  f.Add(new Fan("System Fan", 0));
moel@153
   446
                  f.Add(new Fan("CPU Fan", 1));
moel@153
   447
                  f.Add(new Fan("Auxiliary Fan", 2));
moel@153
   448
                  f.Add(new Fan("CPU Fan #2", 3));
moel@153
   449
                  f.Add(new Fan("Auxiliary Fan #2", 4));
moel@153
   450
                  break;
moel@153
   451
              }
moel@153
   452
              break;
moel@152
   453
            case Manufacturer.ASUS:
moel@152
   454
              switch (model) {
moel@168
   455
                case Model.P6X58D_E: // W83667HG 
moel@152
   456
                  v.Add(new Voltage("CPU VCore", 0));
moel@152
   457
                  v.Add(new Voltage("+12V", 1, 11.5f, 1.91f, 0));
moel@152
   458
                  v.Add(new Voltage("Analog +3.3V", 2, 34, 34, 0));
moel@152
   459
                  v.Add(new Voltage("+3.3V", 3, 34, 34, 0));
moel@153
   460
                  v.Add(new Voltage("+5V", 4, 15, 7.5f, 0));
moel@152
   461
                  v.Add(new Voltage("Voltage #6", 5, true));
moel@152
   462
                  v.Add(new Voltage("Voltage #7", 6, true));
moel@152
   463
                  v.Add(new Voltage("Standby +3.3V", 7, 34, 34, 0));
moel@152
   464
                  v.Add(new Voltage("VBAT", 8, 34, 34, 0));
moel@152
   465
                  t.Add(new Temperature("CPU", 0));
moel@152
   466
                  t.Add(new Temperature("Motherboard", 2));
moel@152
   467
                  f.Add(new Fan("Chassis Fan #1", 0));
moel@153
   468
                  f.Add(new Fan("CPU Fan", 1));
moel@153
   469
                  f.Add(new Fan("Power Fan", 2));
moel@152
   470
                  f.Add(new Fan("Chassis Fan #2", 3));
moel@152
   471
                  f.Add(new Fan("Chassis Fan #3", 4));
moel@152
   472
                  break;
moel@152
   473
                default:
moel@152
   474
                  v.Add(new Voltage("CPU VCore", 0));
moel@152
   475
                  v.Add(new Voltage("Voltage #2", 1, true));
moel@152
   476
                  v.Add(new Voltage("AVCC", 2, 34, 34, 0));
moel@152
   477
                  v.Add(new Voltage("3VCC", 3, 34, 34, 0));
moel@152
   478
                  v.Add(new Voltage("Voltage #5", 4, true));
moel@152
   479
                  v.Add(new Voltage("Voltage #6", 5, true));
moel@152
   480
                  v.Add(new Voltage("Voltage #7", 6, true));
moel@152
   481
                  v.Add(new Voltage("3VSB", 7, 34, 34, 0));
moel@152
   482
                  v.Add(new Voltage("VBAT", 8, 34, 34, 0));
moel@152
   483
                  t.Add(new Temperature("CPU", 0));
moel@152
   484
                  t.Add(new Temperature("Auxiliary", 1));
moel@152
   485
                  t.Add(new Temperature("System", 2));
moel@153
   486
                  f.Add(new Fan("System Fan", 0));
moel@153
   487
                  f.Add(new Fan("CPU Fan", 1));
moel@153
   488
                  f.Add(new Fan("Auxiliary Fan", 2));
moel@153
   489
                  f.Add(new Fan("CPU Fan #2", 3));
moel@153
   490
                  f.Add(new Fan("Auxiliary Fan #2", 4));
moel@152
   491
                  break;
moel@152
   492
              }
moel@152
   493
              break;
moel@152
   494
            default:
moel@152
   495
              v.Add(new Voltage("CPU VCore", 0));
moel@152
   496
              v.Add(new Voltage("Voltage #2", 1, true));
moel@152
   497
              v.Add(new Voltage("AVCC", 2, 34, 34, 0));
moel@152
   498
              v.Add(new Voltage("3VCC", 3, 34, 34, 0));
moel@152
   499
              v.Add(new Voltage("Voltage #5", 4, true));
moel@152
   500
              v.Add(new Voltage("Voltage #6", 5, true));
moel@152
   501
              v.Add(new Voltage("Voltage #7", 6, true));
moel@152
   502
              v.Add(new Voltage("3VSB", 7, 34, 34, 0));
moel@152
   503
              v.Add(new Voltage("VBAT", 8, 34, 34, 0));
moel@152
   504
              t.Add(new Temperature("CPU", 0));
moel@152
   505
              t.Add(new Temperature("Auxiliary", 1));
moel@152
   506
              t.Add(new Temperature("System", 2));
moel@153
   507
              f.Add(new Fan("System Fan", 0));
moel@153
   508
              f.Add(new Fan("CPU Fan", 1));
moel@153
   509
              f.Add(new Fan("Auxiliary Fan", 2));
moel@153
   510
              f.Add(new Fan("CPU Fan #2", 3));
moel@153
   511
              f.Add(new Fan("Auxiliary Fan #2", 4));
moel@152
   512
              break;
moel@152
   513
          } 
moel@130
   514
          break;
moel@130
   515
        case Chip.W83627HF: 
moel@130
   516
        case Chip.W83627THF: 
moel@130
   517
        case Chip.W83687THF:
moel@130
   518
          v.Add(new Voltage("CPU VCore", 0));
moel@130
   519
          v.Add(new Voltage("Voltage #2", 1, true));
moel@130
   520
          v.Add(new Voltage("Voltage #3", 2, true));
moel@130
   521
          v.Add(new Voltage("AVCC", 3, 34, 51, 0));
moel@130
   522
          v.Add(new Voltage("Voltage #5", 4, true));
moel@130
   523
          v.Add(new Voltage("5VSB", 5, 34, 51, 0));
moel@130
   524
          v.Add(new Voltage("VBAT", 6));
moel@130
   525
          t.Add(new Temperature("CPU", 0));
moel@130
   526
          t.Add(new Temperature("Auxiliary", 1));
moel@130
   527
          t.Add(new Temperature("System", 2));
moel@153
   528
          f.Add(new Fan("System Fan", 0));
moel@153
   529
          f.Add(new Fan("CPU Fan", 1));
moel@153
   530
          f.Add(new Fan("Auxiliary Fan", 2));
moel@130
   531
          break;
moel@130
   532
        default:
moel@130
   533
          for (int i = 0; i < superIO.Voltages.Length; i++)
moel@130
   534
            v.Add(new Voltage("Voltage #" + (i + 1), i, true));
moel@130
   535
          for (int i = 0; i < superIO.Temperatures.Length; i++)
moel@130
   536
            t.Add(new Temperature("Temperature #" + (i + 1), i));
moel@130
   537
          for (int i = 0; i < superIO.Fans.Length; i++)
moel@130
   538
            f.Add(new Fan("Fan #" + (i + 1), i));
moel@130
   539
          break;
moel@130
   540
      }
moel@130
   541
moel@130
   542
      string formula = "Voltage = value + (value - Vf) * Ri / Rf.";
moel@130
   543
      foreach (Voltage voltage in v) 
moel@130
   544
        if (voltage.Index < superIO.Voltages.Length) {
moel@130
   545
          Sensor sensor = new Sensor(voltage.Name, voltage.Index, 
moel@134
   546
            voltage.Hidden, SensorType.Voltage, this, 
moel@130
   547
            new ParameterDescription[] {
moel@130
   548
            new ParameterDescription("Ri [kΩ]", "Input resistance.\n" + 
moel@130
   549
              formula, voltage.Ri),
moel@130
   550
            new ParameterDescription("Rf [kΩ]", "Reference resistance.\n" + 
moel@130
   551
              formula, voltage.Rf),
moel@130
   552
            new ParameterDescription("Vf [V]", "Reference voltage.\n" + 
moel@130
   553
              formula, voltage.Vf)
moel@165
   554
            }, settings);
moel@130
   555
          voltages.Add(sensor);
moel@130
   556
      }
moel@130
   557
moel@130
   558
      foreach (Temperature temperature in t) 
moel@130
   559
        if (temperature.Index < superIO.Temperatures.Length) {
moel@134
   560
        Sensor sensor = new Sensor(temperature.Name, temperature.Index,
moel@130
   561
          SensorType.Temperature, this, new ParameterDescription[] {
moel@130
   562
          new ParameterDescription("Offset [°C]", "Temperature offset.", 0)
moel@165
   563
        }, settings);
moel@130
   564
        temperatures.Add(sensor);
moel@130
   565
      }
moel@130
   566
moel@130
   567
      foreach (Fan fan in f)
moel@130
   568
        if (fan.Index < superIO.Fans.Length) {
moel@134
   569
          Sensor sensor = new Sensor(fan.Name, fan.Index, SensorType.Fan,
moel@165
   570
            this, settings);
moel@130
   571
          fans.Add(sensor);
moel@130
   572
        }
moel@130
   573
    }
moel@130
   574
moel@130
   575
    public override Identifier Identifier {
moel@166
   576
      get { 
moel@166
   577
        return new Identifier("lpc", 
moel@166
   578
          superIO.Chip.ToString().ToLower(CultureInfo.InvariantCulture)); 
moel@166
   579
      }
moel@130
   580
    }
moel@130
   581
moel@165
   582
    public override HardwareType HardwareType {
moel@165
   583
      get { return HardwareType.SuperIO; }
moel@130
   584
    }
moel@130
   585
moel@130
   586
    public override string Name {
moel@130
   587
      get { return name; }
moel@130
   588
    }
moel@130
   589
moel@130
   590
    public override string GetReport() {
moel@130
   591
      return superIO.GetReport();
moel@130
   592
    }
moel@130
   593
moel@130
   594
    public override void Update() {
moel@130
   595
      superIO.Update();
moel@130
   596
moel@130
   597
      foreach (Sensor sensor in voltages) {
moel@130
   598
        float? value = superIO.Voltages[sensor.Index];
moel@130
   599
        if (value.HasValue) {
moel@130
   600
          sensor.Value = value + (value - sensor.Parameters[2].Value) *
moel@130
   601
            sensor.Parameters[0].Value / sensor.Parameters[1].Value;
moel@130
   602
          ActivateSensor(sensor);
moel@130
   603
        }
moel@130
   604
      }
moel@130
   605
moel@130
   606
      foreach (Sensor sensor in temperatures) {
moel@130
   607
        float? value = superIO.Temperatures[sensor.Index];
moel@130
   608
        if (value.HasValue) {
moel@130
   609
          sensor.Value = value + sensor.Parameters[0].Value;
moel@130
   610
          ActivateSensor(sensor);
moel@130
   611
        }
moel@130
   612
      }
moel@130
   613
moel@130
   614
      foreach (Sensor sensor in fans) {
moel@130
   615
        float? value = superIO.Fans[sensor.Index];
moel@130
   616
        if (value.HasValue) {
moel@130
   617
          sensor.Value = value;
moel@130
   618
          if (value.Value > 0)
moel@130
   619
            ActivateSensor(sensor);
moel@130
   620
        }
moel@130
   621
      }
moel@130
   622
    }
moel@130
   623
moel@130
   624
    private class Voltage {
moel@130
   625
      public readonly string Name;
moel@130
   626
      public readonly int Index;
moel@130
   627
      public readonly float Ri;
moel@130
   628
      public readonly float Rf;
moel@130
   629
      public readonly float Vf;
moel@130
   630
      public readonly bool Hidden;
moel@130
   631
moel@130
   632
      public Voltage(string name, int index) :
moel@130
   633
        this(name, index, 0, 1, 0, false) { }
moel@130
   634
moel@130
   635
      public Voltage(string name, int index, bool hidden) :
moel@130
   636
        this(name, index, 0, 1, 0, hidden) { }
moel@130
   637
moel@130
   638
      public Voltage(string name, int index, float ri, float rf, float vf) :
moel@130
   639
        this(name, index, ri, rf, vf, false) { }
moel@130
   640
moel@130
   641
      public Voltage(string name, int index, float ri, float rf, float vf,
moel@130
   642
        bool hidden) {
moel@130
   643
        this.Name = name;
moel@130
   644
        this.Index = index;
moel@130
   645
        this.Ri = ri;
moel@130
   646
        this.Rf = rf;
moel@130
   647
        this.Vf = vf;
moel@130
   648
        this.Hidden = hidden;
moel@130
   649
      }
moel@130
   650
    }
moel@130
   651
moel@130
   652
    private class Temperature {
moel@130
   653
      public readonly string Name;
moel@130
   654
      public readonly int Index;
moel@130
   655
moel@167
   656
      public Temperature(string name, int index) {
moel@130
   657
        this.Name = name;
moel@130
   658
        this.Index = index;
moel@130
   659
      }
moel@130
   660
    }
moel@130
   661
moel@130
   662
    private class Fan {
moel@130
   663
      public readonly string Name;
moel@130
   664
      public readonly int Index;
moel@130
   665
moel@130
   666
      public Fan(string name, int index) {
moel@130
   667
        this.Name = name;
moel@130
   668
        this.Index = index;
moel@130
   669
      }
moel@130
   670
    }
moel@130
   671
  }
moel@130
   672
}