diff -r bb5696abab23 -r d706e16a79c0 Hardware/LPC/F718XX.cs --- a/Hardware/LPC/F718XX.cs Mon Mar 01 22:12:29 2010 +0000 +++ b/Hardware/LPC/F718XX.cs Tue Mar 02 20:32:24 2010 +0000 @@ -56,7 +56,8 @@ // Hardware Monitor Registers private const byte VOLTAGE_BASE_REG = 0x20; - private const byte TEMPERATURE_BASE_REG = 0x72; + private const byte TEMPERATURE_CONFIG_REG = 0x69; + private const byte TEMPERATURE_BASE_REG = 0x70; private byte[] FAN_TACHOMETER_REG = new byte[] { 0xA0, 0xB0, 0xC0, 0xD0 }; private byte ReadByte(byte register) { @@ -75,16 +76,27 @@ new ParameterDescription("Offset", "Temperature offset.", 0) }); - fans = new Sensor[4]; + fans = new Sensor[chip == Chip.F71882 ? 4 : 3]; for (int i = 0; i < fans.Length; i++) fans[i] = new Sensor("Fan #" + (i + 1), i, SensorType.Fan, this); - voltageGains = new float[] { 1, 0.5f, 1, 1, 1, 1, 1, 1, 1 }; - voltages = new Sensor[4]; - voltages[0] = new Sensor("VCC3V", 0, SensorType.Voltage, this); - voltages[1] = new Sensor("CPU VCore", 1, SensorType.Voltage, this); - voltages[2] = new Sensor("VSB3V", 7, SensorType.Voltage, this); - voltages[3] = new Sensor("Battery", 8, SensorType.Voltage, this); + switch (chip) { + case Chip.F71858: + voltageGains = new float[] { 1, 1, 1 }; + voltages = new Sensor[3]; + voltages[0] = new Sensor("VCC3V", 0, SensorType.Voltage, this); + voltages[1] = new Sensor("VSB3V", 1, SensorType.Voltage, this); + voltages[2] = new Sensor("Battery", 2, SensorType.Voltage, this); + break; + default: + voltageGains = new float[] { 1, 0.5f, 1, 1, 1, 1, 1, 1, 1 }; + voltages = new Sensor[4]; + voltages[0] = new Sensor("VCC3V", 0, SensorType.Voltage, this); + voltages[1] = new Sensor("CPU VCore", 1, SensorType.Voltage, this); + voltages[2] = new Sensor("VSB3V", 7, SensorType.Voltage, this); + voltages[3] = new Sensor("Battery", 8, SensorType.Voltage, this); + break; + } } public string GetReport() { @@ -121,15 +133,42 @@ else DeactivateSensor(sensor); } - + foreach (Sensor sensor in temperatures) { - sbyte value = (sbyte)ReadByte((byte)( - TEMPERATURE_BASE_REG + 2 * sensor.Index)); - sensor.Value = value + sensor.Parameters[0].Value; - if (value < sbyte.MaxValue && value > 0) - ActivateSensor(sensor); - else - DeactivateSensor(sensor); + switch (chip) { + case Chip.F71858: { + int tableMode = 0x3 & ReadByte((byte)(TEMPERATURE_CONFIG_REG)); + int high = + ReadByte((byte)(TEMPERATURE_BASE_REG + 2 * sensor.Index)); + int low = + ReadByte((byte)(TEMPERATURE_BASE_REG + 2 * sensor.Index + 1)); + if (high != 0xbb && high != 0xcc) { + int bits = 0; + switch (tableMode) { + case 0: bits = 0; break; + case 1: bits = 0; break; + case 2: bits = (high & 0x80) << 8; break; + case 3: bits = (low & 0x01) << 15; break; + } + bits |= high << 7; + bits |= (low & 0xe0) >> 1; + short value = (short)(bits & 0xfff0); + sensor.Value = value / 128.0f; + ActivateSensor(sensor); + } else { + DeactivateSensor(sensor); + } + } break; + default: { + sbyte value = (sbyte)ReadByte((byte)( + TEMPERATURE_BASE_REG + 2 * (sensor.Index + 1))); + sensor.Value = value + sensor.Parameters[0].Value; + if (value < sbyte.MaxValue && value > 0) + ActivateSensor(sensor); + else + DeactivateSensor(sensor); + } break; + } } foreach (Sensor sensor in fans) {