1.1 --- a/Hardware/LPC/F718XX.cs Mon Mar 01 22:12:29 2010 +0000
1.2 +++ b/Hardware/LPC/F718XX.cs Tue Mar 02 20:32:24 2010 +0000
1.3 @@ -56,7 +56,8 @@
1.4
1.5 // Hardware Monitor Registers
1.6 private const byte VOLTAGE_BASE_REG = 0x20;
1.7 - private const byte TEMPERATURE_BASE_REG = 0x72;
1.8 + private const byte TEMPERATURE_CONFIG_REG = 0x69;
1.9 + private const byte TEMPERATURE_BASE_REG = 0x70;
1.10 private byte[] FAN_TACHOMETER_REG = new byte[] { 0xA0, 0xB0, 0xC0, 0xD0 };
1.11
1.12 private byte ReadByte(byte register) {
1.13 @@ -75,16 +76,27 @@
1.14 new ParameterDescription("Offset", "Temperature offset.", 0)
1.15 });
1.16
1.17 - fans = new Sensor[4];
1.18 + fans = new Sensor[chip == Chip.F71882 ? 4 : 3];
1.19 for (int i = 0; i < fans.Length; i++)
1.20 fans[i] = new Sensor("Fan #" + (i + 1), i, SensorType.Fan, this);
1.21
1.22 - voltageGains = new float[] { 1, 0.5f, 1, 1, 1, 1, 1, 1, 1 };
1.23 - voltages = new Sensor[4];
1.24 - voltages[0] = new Sensor("VCC3V", 0, SensorType.Voltage, this);
1.25 - voltages[1] = new Sensor("CPU VCore", 1, SensorType.Voltage, this);
1.26 - voltages[2] = new Sensor("VSB3V", 7, SensorType.Voltage, this);
1.27 - voltages[3] = new Sensor("Battery", 8, SensorType.Voltage, this);
1.28 + switch (chip) {
1.29 + case Chip.F71858:
1.30 + voltageGains = new float[] { 1, 1, 1 };
1.31 + voltages = new Sensor[3];
1.32 + voltages[0] = new Sensor("VCC3V", 0, SensorType.Voltage, this);
1.33 + voltages[1] = new Sensor("VSB3V", 1, SensorType.Voltage, this);
1.34 + voltages[2] = new Sensor("Battery", 2, SensorType.Voltage, this);
1.35 + break;
1.36 + default:
1.37 + voltageGains = new float[] { 1, 0.5f, 1, 1, 1, 1, 1, 1, 1 };
1.38 + voltages = new Sensor[4];
1.39 + voltages[0] = new Sensor("VCC3V", 0, SensorType.Voltage, this);
1.40 + voltages[1] = new Sensor("CPU VCore", 1, SensorType.Voltage, this);
1.41 + voltages[2] = new Sensor("VSB3V", 7, SensorType.Voltage, this);
1.42 + voltages[3] = new Sensor("Battery", 8, SensorType.Voltage, this);
1.43 + break;
1.44 + }
1.45 }
1.46
1.47 public string GetReport() {
1.48 @@ -121,15 +133,42 @@
1.49 else
1.50 DeactivateSensor(sensor);
1.51 }
1.52 -
1.53 +
1.54 foreach (Sensor sensor in temperatures) {
1.55 - sbyte value = (sbyte)ReadByte((byte)(
1.56 - TEMPERATURE_BASE_REG + 2 * sensor.Index));
1.57 - sensor.Value = value + sensor.Parameters[0].Value;
1.58 - if (value < sbyte.MaxValue && value > 0)
1.59 - ActivateSensor(sensor);
1.60 - else
1.61 - DeactivateSensor(sensor);
1.62 + switch (chip) {
1.63 + case Chip.F71858: {
1.64 + int tableMode = 0x3 & ReadByte((byte)(TEMPERATURE_CONFIG_REG));
1.65 + int high =
1.66 + ReadByte((byte)(TEMPERATURE_BASE_REG + 2 * sensor.Index));
1.67 + int low =
1.68 + ReadByte((byte)(TEMPERATURE_BASE_REG + 2 * sensor.Index + 1));
1.69 + if (high != 0xbb && high != 0xcc) {
1.70 + int bits = 0;
1.71 + switch (tableMode) {
1.72 + case 0: bits = 0; break;
1.73 + case 1: bits = 0; break;
1.74 + case 2: bits = (high & 0x80) << 8; break;
1.75 + case 3: bits = (low & 0x01) << 15; break;
1.76 + }
1.77 + bits |= high << 7;
1.78 + bits |= (low & 0xe0) >> 1;
1.79 + short value = (short)(bits & 0xfff0);
1.80 + sensor.Value = value / 128.0f;
1.81 + ActivateSensor(sensor);
1.82 + } else {
1.83 + DeactivateSensor(sensor);
1.84 + }
1.85 + } break;
1.86 + default: {
1.87 + sbyte value = (sbyte)ReadByte((byte)(
1.88 + TEMPERATURE_BASE_REG + 2 * (sensor.Index + 1)));
1.89 + sensor.Value = value + sensor.Parameters[0].Value;
1.90 + if (value < sbyte.MaxValue && value > 0)
1.91 + ActivateSensor(sensor);
1.92 + else
1.93 + DeactivateSensor(sensor);
1.94 + } break;
1.95 + }
1.96 }
1.97
1.98 foreach (Sensor sensor in fans) {