Line data Source code
1 0 : /*
2 : * Copyright (c) 2019 Piotr Mienkowski
3 : * Copyright (c) 2018 Linaro Limited
4 : *
5 : * SPDX-License-Identifier: Apache-2.0
6 : */
7 : #ifndef ZEPHYR_INCLUDE_DT_BINDINGS_GPIO_GPIO_H_
8 : #define ZEPHYR_INCLUDE_DT_BINDINGS_GPIO_GPIO_H_
9 :
10 : /**
11 : * @addtogroup gpio_interface
12 : * @{
13 : */
14 :
15 : /** Mask for DT GPIO flags. */
16 1 : #define GPIO_DT_FLAGS_MASK 0x7F
17 :
18 : /**
19 : * @name GPIO pin active level flags
20 : * @{
21 : */
22 :
23 : /** GPIO pin is active (has logical value '1') in low state. */
24 1 : #define GPIO_ACTIVE_LOW (1 << 0)
25 : /** GPIO pin is active (has logical value '1') in high state. */
26 1 : #define GPIO_ACTIVE_HIGH (0 << 0)
27 :
28 : /** @} */
29 :
30 : /**
31 : * @name GPIO pin drive flags
32 : * @{
33 : */
34 :
35 : /** @cond INTERNAL_HIDDEN */
36 :
37 : /* Configures GPIO output in single-ended mode (open drain or open source). */
38 : #define GPIO_SINGLE_ENDED (1 << 1)
39 : /* Configures GPIO output in push-pull mode */
40 : #define GPIO_PUSH_PULL (0 << 1)
41 :
42 : /* Indicates single ended open drain mode (wired AND). */
43 : #define GPIO_LINE_OPEN_DRAIN (1 << 2)
44 : /* Indicates single ended open source mode (wired OR). */
45 : #define GPIO_LINE_OPEN_SOURCE (0 << 2)
46 :
47 : /** @endcond */
48 :
49 : /** Configures GPIO output in open drain mode (wired AND).
50 : *
51 : * @note 'Open Drain' mode also known as 'Open Collector' is an output
52 : * configuration which behaves like a switch that is either connected to ground
53 : * or disconnected.
54 : */
55 1 : #define GPIO_OPEN_DRAIN (GPIO_SINGLE_ENDED | GPIO_LINE_OPEN_DRAIN)
56 : /** Configures GPIO output in open source mode (wired OR).
57 : *
58 : * @note 'Open Source' is a term used by software engineers to describe output
59 : * mode opposite to 'Open Drain'. It behaves like a switch that is either
60 : * connected to power supply or disconnected. There exist no corresponding
61 : * hardware schematic and the term is generally unknown to hardware engineers.
62 : */
63 1 : #define GPIO_OPEN_SOURCE (GPIO_SINGLE_ENDED | GPIO_LINE_OPEN_SOURCE)
64 :
65 : /** @} */
66 :
67 : /**
68 : * @name GPIO pin bias flags
69 : * @{
70 : */
71 :
72 : /** Enables GPIO pin pull-up. */
73 1 : #define GPIO_PULL_UP (1 << 4)
74 :
75 : /** Enable GPIO pin pull-down. */
76 1 : #define GPIO_PULL_DOWN (1 << 5)
77 :
78 : /** @} */
79 :
80 : /**
81 : * Configures GPIO interrupt to wakeup the system from low power mode.
82 : */
83 1 : #define GPIO_INT_WAKEUP (1 << 6)
84 :
85 : /* Note: Bits 15 downto 8 are reserved for SoC specific flags. */
86 :
87 : /**
88 : * @}
89 : */
90 :
91 : #endif /* ZEPHYR_INCLUDE_DT_BINDINGS_GPIO_GPIO_H_ */
|