Hardware/LPC/NCT677X.cs
changeset 276 04905193c432
parent 265 961c07a3bd78
child 323 3f2d9ebacf38
     1.1 --- a/Hardware/LPC/NCT677X.cs	Sat Apr 30 16:03:58 2011 +0000
     1.2 +++ b/Hardware/LPC/NCT677X.cs	Sat Apr 30 21:01:54 2011 +0000
     1.3 @@ -47,7 +47,7 @@
     1.4      private readonly Chip chip;
     1.5  
     1.6      private readonly float?[] voltages = new float?[9];
     1.7 -    private readonly float?[] temperatures = new float?[3];
     1.8 +    private readonly float?[] temperatures = new float?[4];
     1.9      private readonly float?[] fans = new float?[0];
    1.10  
    1.11      // Hardware Monitor
    1.12 @@ -73,12 +73,13 @@
    1.13      private const ushort VOLTAGE_VBAT_REG = 0x0551;
    1.14  
    1.15      private readonly ushort[] TEMPERATURE_REG = 
    1.16 -      { 0x150, 0x250, 0x27, 0x62B, 0x62C, 0x62D };
    1.17 +      { 0x027, 0x73, 0x75, 0x77, 0x150, 0x250, 0x62B, 0x62C, 0x62D };
    1.18      private readonly ushort[] TEMPERATURE_HALF_REG = 
    1.19 -      { 0x151, 0x251, 0, 0x62E, 0x62E, 0x62E };    
    1.20 +      { 0, 0x74, 0x76, 0x78, 0x151, 0x251, 0x62E, 0x62E, 0x62E };    
    1.21      private readonly ushort[] TEMPERATURE_SRC_REG = 
    1.22 -      { 0x621, 0x622, 0x623, 0x624, 0x625, 0x626 };
    1.23 -    private readonly int[] TEMPERATURE_HALF_BIT = { 7, 7, -1, 0, 1, 2 };
    1.24 +      { 0x621, 0x100, 0x200, 0x300, 0x622, 0x623, 0x624, 0x625, 0x626 };
    1.25 +    private readonly int[] TEMPERATURE_HALF_BIT =
    1.26 +      { -1, 7, 7, 7, 7, 7, 0, 1, 2 };
    1.27      private readonly ushort[] VOLTAGE_REG = 
    1.28        { 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x550, 0x551 };
    1.29      private readonly ushort[] FAN_RPM_REG = 
    1.30 @@ -86,19 +87,19 @@
    1.31  
    1.32      private readonly int minFanRPM;
    1.33  
    1.34 -    private enum TemperatureSource : byte {
    1.35 +    private enum SourceNCT6771F : byte {
    1.36        SYSTIN = 1,
    1.37        CPUTIN = 2,
    1.38        AUXTIN = 3,
    1.39        SMBUSMASTER = 4,
    1.40 -      PECI0 = 5, 
    1.41 -      PECI1 = 6, 
    1.42 -      PECI2 = 7,
    1.43 -      PECI3 = 8,
    1.44 -      PECI4 = 9,
    1.45 -      PECI5 = 10,
    1.46 -      PECI6 = 11,
    1.47 -      PECI7 = 12,
    1.48 +      PECI_0 = 5, 
    1.49 +      PECI_1 = 6, 
    1.50 +      PECI_2 = 7,
    1.51 +      PECI_3 = 8,
    1.52 +      PECI_4 = 9,
    1.53 +      PECI_5 = 10,
    1.54 +      PECI_6 = 11,
    1.55 +      PECI_7 = 12,
    1.56        PCH_CHIP_CPU_MAX_TEMP = 13,
    1.57        PCH_CHIP_TEMP = 14,
    1.58        PCH_CPU_TEMP = 15,
    1.59 @@ -109,6 +110,31 @@
    1.60        PCH_DIM3_TEMP = 20
    1.61      }
    1.62  
    1.63 +    private enum SourceNCT6776F : byte {
    1.64 +      SYSTIN = 1,
    1.65 +      CPUTIN = 2,
    1.66 +      AUXTIN = 3,
    1.67 +      SMBUSMASTER_0 = 4,
    1.68 +      SMBUSMASTER_1 = 5,
    1.69 +      SMBUSMASTER_2 = 6,
    1.70 +      SMBUSMASTER_3 = 7,
    1.71 +      SMBUSMASTER_4 = 8,
    1.72 +      SMBUSMASTER_5 = 9,
    1.73 +      SMBUSMASTER_6 = 10,
    1.74 +      SMBUSMASTER_7 = 11,
    1.75 +      PECI_0 = 12,
    1.76 +      PECI_1 = 13,
    1.77 +      PCH_CHIP_CPU_MAX_TEMP = 14,
    1.78 +      PCH_CHIP_TEMP = 15,
    1.79 +      PCH_CPU_TEMP = 16,
    1.80 +      PCH_MCH_TEMP = 17,
    1.81 +      PCH_DIM0_TEMP = 18,
    1.82 +      PCH_DIM1_TEMP = 19,
    1.83 +      PCH_DIM2_TEMP = 20,
    1.84 +      PCH_DIM3_TEMP = 21,
    1.85 +      BYTE_TEMP = 22
    1.86 +    }
    1.87 +
    1.88      public NCT677X(Chip chip, byte revision, ushort port) {
    1.89        this.chip = chip;
    1.90        this.revision = revision;
    1.91 @@ -162,25 +188,36 @@
    1.92          voltages[i] = valid ? value : (float?)null;
    1.93        }
    1.94  
    1.95 -      for (int i = 0; i < TEMPERATURE_REG.Length; i++) {
    1.96 +      for (int i = TEMPERATURE_REG.Length - 1; i >= 0 ; i--) {
    1.97          int value = ((sbyte)ReadByte(TEMPERATURE_REG[i])) << 1;
    1.98          if (TEMPERATURE_HALF_BIT[i] > 0) {
    1.99            value |= ((ReadByte(TEMPERATURE_HALF_REG[i]) >>
   1.100              TEMPERATURE_HALF_BIT[i]) & 0x1);
   1.101          }
   1.102  
   1.103 -        TemperatureSource source = (TemperatureSource)
   1.104 -          ReadByte(TEMPERATURE_SRC_REG[i]);
   1.105 +        byte source = ReadByte(TEMPERATURE_SRC_REG[i]);
   1.106  
   1.107          float? temperature = 0.5f * value;
   1.108          if (temperature > 125 || temperature < -55)
   1.109            temperature = null;
   1.110  
   1.111 -        switch (source) {
   1.112 -          case TemperatureSource.CPUTIN: temperatures[0] = temperature; break;
   1.113 -          case TemperatureSource.AUXTIN: temperatures[1] = temperature; break;
   1.114 -          case TemperatureSource.SYSTIN: temperatures[2] = temperature; break;
   1.115 -        }
   1.116 +        switch (chip) {
   1.117 +          case Chip.NCT6771F:
   1.118 +            switch ((SourceNCT6771F)source) {
   1.119 +              case SourceNCT6771F.PECI_0: temperatures[0] = temperature; break;
   1.120 +              case SourceNCT6771F.CPUTIN: temperatures[1] = temperature; break;
   1.121 +              case SourceNCT6771F.AUXTIN: temperatures[2] = temperature; break;
   1.122 +              case SourceNCT6771F.SYSTIN: temperatures[3] = temperature; break;
   1.123 +              
   1.124 +            } break;
   1.125 +          case Chip.NCT6776F:
   1.126 +            switch ((SourceNCT6776F)source) {
   1.127 +              case SourceNCT6776F.PECI_0: temperatures[0] = temperature; break;
   1.128 +              case SourceNCT6776F.CPUTIN: temperatures[1] = temperature; break;
   1.129 +              case SourceNCT6776F.AUXTIN: temperatures[2] = temperature; break;
   1.130 +              case SourceNCT6776F.SYSTIN: temperatures[3] = temperature; break;              
   1.131 +            } break;
   1.132 +        }  
   1.133        }
   1.134  
   1.135        for (int i = 0; i < fans.Length; i++) {