summaryrefslogtreecommitdiff
path: root/util/comm-host.h
diff options
context:
space:
mode:
authorVincent Palatin <vpalatin@chromium.org>2012-05-24 21:39:12 +0000
committerVincent Palatin <vpalatin@chromium.org>2012-05-24 23:34:01 +0000
commit304d207117bb82db7f38303ba402c6f1be1112a8 (patch)
tree49e832bffd61dcd981c856237dabdf13424beb0f /util/comm-host.h
parentb0fe45560828542ec3dd129db7d9cf59e92349d4 (diff)
downloadchrome-ec-304d207117bb82db7f38303ba402c6f1be1112a8.tar.gz
Split communication functions from host tools
Preparatory work to re-use the tools on ARM boards using I2C communications. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BUG=None TEST=make BOARD=link && make BOARD=bds && make BOard=DAISY Change-Id: I31d41f30c3231a4a9349b939bf6bba871ed4c383
Diffstat (limited to 'util/comm-host.h')
-rw-r--r--util/comm-host.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/util/comm-host.h b/util/comm-host.h
new file mode 100644
index 0000000000..9647a06218
--- /dev/null
+++ b/util/comm-host.h
@@ -0,0 +1,29 @@
+/* Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef COMM_HOST_H
+#define COMM_HOST_H
+
+#include <stdint.h>
+
+/* Perform initializations needed for subsequent requests
+ *
+ * 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. */
+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. */
+uint8_t read_mapped_mem8(uint8_t offset);
+uint16_t read_mapped_mem16(uint8_t offset);
+uint32_t read_mapped_mem32(uint8_t offset);
+int read_mapped_string(uint8_t offset, char *buf);
+
+#endif /* COMM_HOST_H */