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