diff options
-rw-r--r-- | chip_interface/ec_gpio.h | 37 | ||||
-rw-r--r-- | chip_interface/ec_system.h | 59 | ||||
-rw-r--r-- | chip_interface/ec_uart.h (renamed from cros_ec/include/ec_uart.h) | 0 | ||||
-rw-r--r-- | cros_ec/Makefile | 4 |
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 |