summaryrefslogtreecommitdiff
path: root/include/gpio.h
blob: 5e4edf0593cad7b91143353acfc525c03a3b8ac6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/* 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 "common.h"

/* GPIO signal definitions. */
enum gpio_signal {
	/* Firmware write protect */
	EC_GPIO_WRITE_PROTECT = 0,
	/* Recovery switch */
	EC_GPIO_RECOVERY_SWITCH,
	/* Debug LED */
	EC_GPIO_DEBUG_LED
};


/* Pre-initializes the module.  This occurs before clocks or tasks are
 * set up. */
int gpio_pre_init(void);

/* Initializes the GPIO module. */
int gpio_init(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). */
int gpio_get_level(enum gpio_signal signal);

/* Sets the current value of a signal.  Returns error if the signal is
 * not supported or is an input signal. */
int gpio_set_level(enum gpio_signal signal, int value);

#endif  /* __CROS_EC_GPIO_H */