1.1 --- a/Hardware/LPC/W836XX.cs Tue Feb 23 19:45:40 2010 +0000
1.2 +++ b/Hardware/LPC/W836XX.cs Sat Feb 27 15:55:17 2010 +0000
1.3 @@ -73,7 +73,6 @@
1.4 new string[] {"CPU", "Auxiliary", "System"};
1.5 private byte[] TEMPERATURE_REG = new byte[] { 0x50, 0x50, 0x27 };
1.6 private byte[] TEMPERATURE_BANK = new byte[] { 1, 2, 0 };
1.7 - private byte[] TEMPERATURE_SEL = new byte[] { 1, 2, 0 };
1.8
1.9 private byte[] FAN_TACHO_REG = new byte[] { 0x28, 0x29, 0x2A, 0x3F, 0x53 };
1.10 private byte[] FAN_TACHO_BANK = new byte[] { 0, 0, 0, 0, 5 };
1.11 @@ -112,26 +111,42 @@
1.12
1.13 available = IsWinbondVendor();
1.14
1.15 + ParameterDescription[] parameter = new ParameterDescription[] {
1.16 + new ParameterDescription("Offset", "Temperature offset.", 0)
1.17 + };
1.18 List<Sensor> list = new List<Sensor>();
1.19 switch (chip) {
1.20 - case Chip.W83627DHG:
1.21 - // do not add temperature sensor registers that read PECI agents
1.22 + case Chip.W83667HG:
1.23 + case Chip.W83667HGB:
1.24 + // do not add temperature sensor registers that read PECI
1.25 + byte flag = ReadByte(0, TEMPERATURE_SOURCE_SELECT_REG);
1.26 + if ((flag & 0x04) == 0)
1.27 + list.Add(new Sensor(TEMPERATURE_NAME[0], 0, null,
1.28 + SensorType.Temperature, this, parameter));
1.29 + if ((flag & 0x40) == 0)
1.30 + list.Add(new Sensor(TEMPERATURE_NAME[1], 1, null,
1.31 + SensorType.Temperature, this, parameter));
1.32 + list.Add(new Sensor(TEMPERATURE_NAME[2], 2, null,
1.33 + SensorType.Temperature, this, parameter));
1.34 + break;
1.35 + case Chip.W83627DHG:
1.36 + case Chip.W83627DHGP:
1.37 + // do not add temperature sensor registers that read PECI
1.38 byte sel = ReadByte(0, TEMPERATURE_SOURCE_SELECT_REG);
1.39 if ((sel & 0x07) == 0)
1.40 - list.Add(new Sensor(TEMPERATURE_NAME[0], 0,
1.41 - SensorType.Temperature, this));
1.42 + list.Add(new Sensor(TEMPERATURE_NAME[0], 0, null,
1.43 + SensorType.Temperature, this, parameter));
1.44 if ((sel & 0x70) == 0)
1.45 - list.Add(new Sensor(TEMPERATURE_NAME[1], 1,
1.46 - SensorType.Temperature, this));
1.47 - list.Add(new Sensor(TEMPERATURE_NAME[2], 2,
1.48 - SensorType.Temperature, this));
1.49 + list.Add(new Sensor(TEMPERATURE_NAME[1], 1, null,
1.50 + SensorType.Temperature, this, parameter));
1.51 + list.Add(new Sensor(TEMPERATURE_NAME[2], 2, null,
1.52 + SensorType.Temperature, this, parameter));
1.53 break;
1.54 default:
1.55 - // no PECI support or extra sensor report register
1.56 - for (int i = 0; i < TEMPERATURE_NAME.Length; i++) {
1.57 - list.Add(new Sensor(TEMPERATURE_NAME[i], i,
1.58 - SensorType.Temperature, this));
1.59 - }
1.60 + // no PECI support, add all sensors
1.61 + for (int i = 0; i < TEMPERATURE_NAME.Length; i++)
1.62 + list.Add(new Sensor(TEMPERATURE_NAME[i], i, null,
1.63 + SensorType.Temperature, this, parameter));
1.64 break;
1.65 }
1.66 temperatures = list.ToArray();
1.67 @@ -212,29 +227,15 @@
1.68 }
1.69
1.70 foreach (Sensor sensor in temperatures) {
1.71 - int value;
1.72 - switch (chip) {
1.73 - case Chip.W83667HG:
1.74 - case Chip.W83667HGB:
1.75 - WriteByte(0, 0x7D, TEMPERATURE_SEL[sensor.Index]);
1.76 - value = ((sbyte)ReadByte(0, 0x7E)) << 1;
1.77 - break;
1.78 - case Chip.W83627DHGP:
1.79 - WriteByte(0, 0x7C, TEMPERATURE_SEL[sensor.Index]);
1.80 - value = ((sbyte)ReadByte(0, 0x7D)) << 1;
1.81 - break;
1.82 - default:
1.83 - value = ((sbyte)ReadByte(TEMPERATURE_BANK[sensor.Index],
1.84 - TEMPERATURE_REG[sensor.Index])) << 1;
1.85 - if (TEMPERATURE_BANK[sensor.Index] > 0) {
1.86 - value |= ReadByte(TEMPERATURE_BANK[sensor.Index],
1.87 - (byte)(TEMPERATURE_REG[sensor.Index] + 1)) >> 7;
1.88 - }
1.89 - break;
1.90 - }
1.91 + int value = ((sbyte)ReadByte(TEMPERATURE_BANK[sensor.Index],
1.92 + TEMPERATURE_REG[sensor.Index])) << 1;
1.93 + if (TEMPERATURE_BANK[sensor.Index] > 0)
1.94 + value |= ReadByte(TEMPERATURE_BANK[sensor.Index],
1.95 + (byte)(TEMPERATURE_REG[sensor.Index] + 1)) >> 7;
1.96 +
1.97 float temperature = value / 2.0f;
1.98 if (temperature <= 125 && temperature >= -55) {
1.99 - sensor.Value = temperature;
1.100 + sensor.Value = temperature + sensor.Parameters[0].Value;
1.101 ActivateSensor(sensor);
1.102 } else {
1.103 DeactivateSensor(sensor);