summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2011-10-24 12:52:08 -0700
committerRandall Spangler <rspangler@chromium.org>2011-10-24 15:32:47 -0700
commit9f297442735c16f77f9bc8379262044072f0cd6b (patch)
treebdd1840c7882f733a08299775bd9819f7f5a1443
parentee3d25fa92aa15210b9cd4361828838fd5c8ae31 (diff)
downloadchrome-ec-9f297442735c16f77f9bc8379262044072f0cd6b.tar.gz
Move chip interface headers, add GPIO and system headers.
BUG=None TEST=make && make runtests Change-Id: I88f23366147224825f231f1c10ddcf1a112d5ebc
-rw-r--r--chip_interface/ec_gpio.h37
-rw-r--r--chip_interface/ec_system.h59
-rw-r--r--chip_interface/ec_uart.h (renamed from cros_ec/include/ec_uart.h)0
-rw-r--r--cros_ec/Makefile4
4 files changed, 97 insertions, 3 deletions
diff --git a/chip_interface/ec_gpio.h b/chip_interface/ec_gpio.h
new file mode 100644
index 0000000000..9f4f5ba81f
--- /dev/null
+++ b/chip_interface/ec_gpio.h
@@ -0,0 +1,37 @@
+/* Copyright (c) 2011 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.
+ */
+
+/* GPIO module for Chrome EC */
+
+#ifndef __CROS_EC_GPIO_H
+#define __CROS_EC_GPIO_H
+
+#include "ec_common.h"
+
+/* GPIO signal definitions. */
+typedef enum EcGpioSignal {
+ /* Firmware write protect */
+ EC_GPIO_WRITE_PROTECT = 0,
+ /* Recovery switch */
+ EC_GPIO_RECOVERY_SWITCH,
+ /* Debug LED */
+ EC_GPIO_DEBUG_LED
+} EcGpioSignal;
+
+
+/* Initializes the GPIO module. */
+EcError EcGpioInit(void);
+
+/* Functions should return an error if the requested signal is not
+ * supported / not present on the board. */
+
+/* Gets the current value of a signal (0=low, 1=hi). */
+EcError EcGpioGet(EcGpioSignal signal, int* value_ptr);
+
+/* Sets the current value of a signal. Returns error if the signal is
+ * not supported or is an input signal. */
+EcError EcGpioSet(EcGpioSignal signal, int value);
+
+#endif /* __CROS_EC_GPIO_H */
diff --git a/chip_interface/ec_system.h b/chip_interface/ec_system.h
new file mode 100644
index 0000000000..da3874d8c1
--- /dev/null
+++ b/chip_interface/ec_system.h
@@ -0,0 +1,59 @@
+/* Copyright (c) 2011 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.
+ */
+
+/* System module for Chrome EC */
+
+#ifndef __CROS_EC_SYSTEM_H
+#define __CROS_EC_SYSTEM_H
+
+#include "ec_common.h"
+
+/* Reset causes */
+typedef enum EcSystemResetCause {
+ /* Unknown reset cause */
+ EC_SYSTEM_RESET_UNKNOWN = 0,
+ /* System reset cause is known, but not one of the causes listed below */
+ EC_SYSTEM_RESET_OTHER,
+ /* Brownout */
+ EC_SYSTEM_RESET_BROWNOUT,
+ /* Power-on reset */
+ EC_SYSTEM_RESET_POWER_ON,
+ /* Reset caused by asserting reset (RST#) pin */
+ EC_SYSTEM_RESET_RESET_PIN,
+ /* Software requested cold reset */
+ EC_SYSTEM_RESET_SOFT_COLD,
+ /* Software requested warm reset */
+ EC_SYSTEM_RESET_SOFT_WARM,
+ /* Watchdog timer reset */
+ EC_SYSTEM_RESET_WATCHDOG,
+} EcSystemResetCause;
+
+
+/* Initializes the system module. */
+EcError EcSystemInit(void);
+
+/* Returns the cause of the last reset, or EC_SYSTEM_RESET_UNKNOWN if
+ * the cause is not known. */
+EcSystemResetCause EcSystemGetResetCause(void);
+
+/* Resets the system. If is_cold!=0, performs a cold reset (which
+ * resets on-chip peripherals); else performs a warm reset (which does
+ * not reset on-chip peripherals). If successful, does not return.
+ * Returns error if the reboot type cannot be requested (e.g. brownout
+ * or reset pin). */
+EcError EcSystemReset(int is_cold);
+
+/* Sets a scratchpad register to the specified value. The scratchpad
+ * register must maintain its contents across a software-requested
+ * warm reset. */
+EcError EcSystemSetScratchpad(uint32_t value);
+
+/* Stores the current scratchpad register value into <value_ptr>. */
+EcError EcSystemGetScratchpad(uint32_t* value_ptr);
+
+/* TODO: request sleep. How do we want to handle transitioning
+ * to/from low-power states? */
+
+#endif /* __CROS_EC_SYSTEM_H */
diff --git a/cros_ec/include/ec_uart.h b/chip_interface/ec_uart.h
index 8f49d43cce..8f49d43cce 100644
--- a/cros_ec/include/ec_uart.h
+++ b/chip_interface/ec_uart.h
diff --git a/cros_ec/Makefile b/cros_ec/Makefile
index 8653fa5fb8..33433fd1f1 100644
--- a/cros_ec/Makefile
+++ b/cros_ec/Makefile
@@ -9,9 +9,7 @@ TESTDIR = $(CROS_EC_TOP)/test
BUILD_ROOT := ${BUILD}/$(shell basename ${CROS_EC_TOP})
LIBS = $(CROS_EC_LIB) # Firmware library must be self-contained
-INCLUDES = \
- -I$(CROS_EC_TOP)/include \
- -I$(LIBDIR)/include
+INCLUDES += -I$(LIBDIR)/include
ifeq ($(FIRMWARE_ARCH),)
INCLUDES += -I$(STUBDIR)/include