summaryrefslogtreecommitdiff
path: root/util/comm-host.h
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2012-06-28 15:50:43 -0700
committerGerrit <chrome-bot@google.com>2012-06-29 10:46:18 -0700
commit7e50e844a3bf1888f5abfa57cc82a6f94b87cbe2 (patch)
treecae0ab6e5aa33bf14630ce93b2b02c62e2ff64c0 /util/comm-host.h
parent70718f97e3afd8621a15a5d281a82a057d35b21a (diff)
downloadchrome-ec-7e50e844a3bf1888f5abfa57cc82a6f94b87cbe2.tar.gz
Change ec_command() to return negative values for errors
This is more compatible with kernel and u-boot, and will make it easier to share code between the ec project and those. BUG=none TEST=manual: ectool version -> should work normally on ec, do 'hostevent set 0x40000'. Then at root shell ectool queryec EC returned error result code 19 ectool flashread 0x100000 16 foo Reading 16 bytes at offset 1048576... EC returned error result code 2 Read error at offset 0 Signed-off-by: Randall Spangler <rspangler@chromium.org> Change-Id: I5e2a85f96c874d0730c14e1438a533649cd594f8 Reviewed-on: https://gerrit.chromium.org/gerrit/26359 Commit-Ready: Randall Spangler <rspangler@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Tested-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'util/comm-host.h')
-rw-r--r--util/comm-host.h14
1 files changed, 9 insertions, 5 deletions
diff --git a/util/comm-host.h b/util/comm-host.h
index 9647a06218..969e71f4a6 100644
--- a/util/comm-host.h
+++ b/util/comm-host.h
@@ -13,14 +13,18 @@
* returns 0 in case of success or error code. */
int comm_init(void);
-/* Sends a command to the EC. Returns the command status code, or
- * -1 if other error. */
+/*
+ * Send a command to the EC. Returns the length of output data returned (0 if
+ * none), or a negative number if error; errors are -EC_RES_* constants from
+ * ec_commands.h.
+ */
int ec_command(int command, const void *indata, int insize,
void *outdata, int outsize);
-/* Returns the content of the EC information area mapped as "memory".
- *
- * the offsets are defined by the EC_MEMMAP_ constants. */
+/*
+ * Return the content of the EC information area mapped as "memory".
+ * The offsets are defined by the EC_MEMMAP_ constants.
+ */
uint8_t read_mapped_mem8(uint8_t offset);
uint16_t read_mapped_mem16(uint8_t offset);
uint32_t read_mapped_mem32(uint8_t offset);