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