diff options
author | Vic Yang <victoryang@chromium.org> | 2012-02-24 10:35:36 -0800 |
---|---|---|
committer | Vic Yang <victoryang@chromium.org> | 2012-02-24 13:09:44 -0800 |
commit | 675cddb258a282a41533d6976c799f42485ddcd2 (patch) | |
tree | 5f67d22fcdebcbeef9f4cb5f333a793107a98fc1 /util | |
parent | c977d241b3aec49fed7ed7344f2ebf6e59885d63 (diff) | |
download | chrome-ec-675cddb258a282a41533d6976c799f42485ddcd2.tar.gz |
Write temperature values to LPC mapped value space.
Add a task to update temperature values in LPC mapped value space every
second. Also modify ectool to read directly from LPC mapped space.
Signed-off-by: Vic Yang <victoryang@chromium.org>
BUG=chrome-os-partner:8065
TEST="ectool temps" gives same result as "temps" from ec console.
Change-Id: Idcdef8d822724f9bd22d7e819c717cba5af5eb77
Diffstat (limited to 'util')
-rw-r--r-- | util/ectool.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/util/ectool.c b/util/ectool.c index 5fa124e743..1a4ba232fb 100644 --- a/util/ectool.c +++ b/util/ectool.c @@ -117,6 +117,11 @@ int ec_command(int command, const void *indata, int insize, return 0; } +uint8_t read_mapped_mem8(uint8_t offset) +{ + return inb(EC_LPC_ADDR_MEMMAP + offset); +} + void print_help(const char *prog) { @@ -444,8 +449,6 @@ int cmd_serial_test(int argc, char *argv[]) int cmd_temperature(int argc, char *argv[]) { - struct lpc_params_temp_sensor_get_readings p; - struct lpc_response_temp_sensor_get_readings r; int rv; int id; char *e; @@ -461,14 +464,19 @@ int cmd_temperature(int argc, char *argv[]) return -1; } - p.temp_sensor_id = id; + /* Currently we only store up to 16 temperature sensor data in + * mapped memory. */ + if (id >= 16) { + printf("Sensor with ID greater than 16 unsupported.\n"); + return -1; + } + printf("Reading temperature..."); - rv = ec_command(EC_LPC_COMMAND_TEMP_SENSOR_GET_READINGS, - &p, sizeof(p), &r, sizeof(r)); - if (rv) + rv = read_mapped_mem8(id); + if (rv == 0xff) printf("Error\n"); else - printf("%d\n", r.value); + printf("%d\n", rv + EC_LPC_TEMP_SENSOR_OFFSET); return rv; } |