| 1 | /* SPDX-License-Identifier: LGPL-2.1-or-later */ |
| 2 | /* SPDX-FileCopyrightText: 2023-2024 Bartosz Golaszewski <[email protected]> */ |
| 3 | |
| 4 | #ifndef __GPIODGLIB_LINE_H__ |
| 5 | #define __GPIODGLIB_LINE_H__ |
| 6 | |
| 7 | #if !defined(__INSIDE_GPIOD_GLIB_H__) && !defined(GPIODGLIB_COMPILATION) |
| 8 | #error "Only <gpiod-glib.h> can be included directly." |
| 9 | #endif |
| 10 | |
| 11 | #include <glib.h> |
| 12 | |
| 13 | G_BEGIN_DECLS |
| 14 | |
| 15 | |
| 16 | /** |
| 17 | * GpiodglibLineValue: |
| 18 | * @GPIODGLIB_LINE_VALUE_INACTIVE: Line is logically inactive. |
| 19 | * @GPIODGLIB_LINE_VALUE_ACTIVE: Line is logically active. |
| 20 | * |
| 21 | * Logical line state. |
| 22 | */ |
| 23 | typedef enum { |
| 24 | GPIODGLIB_LINE_VALUE_INACTIVE = 0, |
| 25 | GPIODGLIB_LINE_VALUE_ACTIVE = 1, |
| 26 | } GpiodglibLineValue; |
| 27 | |
| 28 | /** |
| 29 | * GpiodglibLineDirection: |
| 30 | * @GPIODGLIB_LINE_DIRECTION_AS_IS: Request the line(s), but don't change |
| 31 | * direction. |
| 32 | * @GPIODGLIB_LINE_DIRECTION_INPUT: Direction is input - for reading the value |
| 33 | * of an externally driven GPIO line. |
| 34 | * @GPIODGLIB_LINE_DIRECTION_OUTPUT: Direction is output - for driving the GPIO |
| 35 | * line. |
| 36 | * |
| 37 | * Direction settings. |
| 38 | */ |
| 39 | typedef enum { |
| 40 | GPIODGLIB_LINE_DIRECTION_AS_IS = 1, |
| 41 | GPIODGLIB_LINE_DIRECTION_INPUT, |
| 42 | GPIODGLIB_LINE_DIRECTION_OUTPUT, |
| 43 | } GpiodglibLineDirection; |
| 44 | |
| 45 | /** |
| 46 | * GpiodglibLineEdge |
| 47 | * @GPIODGLIB_LINE_EDGE_NONE: Line edge detection is disabled. |
| 48 | * @GPIODGLIB_LINE_EDGE_RISING: Line detects rising edge events. |
| 49 | * @GPIODGLIB_LINE_EDGE_FALLING: Line detects falling edge events. |
| 50 | * @GPIODGLIB_LINE_EDGE_BOTH: Line detects both rising and falling edge events. |
| 51 | * |
| 52 | * Edge detection settings. |
| 53 | */ |
| 54 | typedef enum { |
| 55 | GPIODGLIB_LINE_EDGE_NONE = 1, |
| 56 | GPIODGLIB_LINE_EDGE_RISING, |
| 57 | GPIODGLIB_LINE_EDGE_FALLING, |
| 58 | GPIODGLIB_LINE_EDGE_BOTH, |
| 59 | } GpiodglibLineEdge; |
| 60 | |
| 61 | /** |
| 62 | * GpiodglibLineBias: |
| 63 | * @GPIODGLIB_LINE_BIAS_AS_IS: Don't change the bias setting when applying line |
| 64 | * config. |
| 65 | * @GPIODGLIB_LINE_BIAS_UNKNOWN: The internal bias state is unknown. |
| 66 | * @GPIODGLIB_LINE_BIAS_DISABLED: The internal bias is disabled. |
| 67 | * @GPIODGLIB_LINE_BIAS_PULL_UP: The internal pull-up bias is enabled. |
| 68 | * @GPIODGLIB_LINE_BIAS_PULL_DOWN: The internal pull-down bias is enabled. |
| 69 | * |
| 70 | * Internal bias settings. |
| 71 | */ |
| 72 | typedef enum { |
| 73 | GPIODGLIB_LINE_BIAS_AS_IS = 1, |
| 74 | GPIODGLIB_LINE_BIAS_UNKNOWN, |
| 75 | GPIODGLIB_LINE_BIAS_DISABLED, |
| 76 | GPIODGLIB_LINE_BIAS_PULL_UP, |
| 77 | GPIODGLIB_LINE_BIAS_PULL_DOWN, |
| 78 | } GpiodglibLineBias; |
| 79 | |
| 80 | /** |
| 81 | * GpiodglibLineDrive: |
| 82 | * @GPIODGLIB_LINE_DRIVE_PUSH_PULL: Drive setting is push-pull. |
| 83 | * @GPIODGLIB_LINE_DRIVE_OPEN_DRAIN: Line output is open-drain. |
| 84 | * @GPIODGLIB_LINE_DRIVE_OPEN_SOURCE: Line output is open-source. |
| 85 | * |
| 86 | * Drive settings. |
| 87 | */ |
| 88 | typedef enum { |
| 89 | GPIODGLIB_LINE_DRIVE_PUSH_PULL = 1, |
| 90 | GPIODGLIB_LINE_DRIVE_OPEN_DRAIN, |
| 91 | GPIODGLIB_LINE_DRIVE_OPEN_SOURCE, |
| 92 | } GpiodglibLineDrive; |
| 93 | |
| 94 | /** |
| 95 | * GpiodglibLineClock: |
| 96 | * @GPIODGLIB_LINE_CLOCK_MONOTONIC: Line uses the monotonic clock for edge |
| 97 | * event timestamps. |
| 98 | * @GPIODGLIB_LINE_CLOCK_REALTIME: Line uses the realtime clock for edge event |
| 99 | * timestamps. |
| 100 | * @GPIODGLIB_LINE_CLOCK_HTE: Line uses the hardware timestamp engine for event |
| 101 | * timestamps. |
| 102 | * |
| 103 | * Clock settings. |
| 104 | */ |
| 105 | typedef enum { |
| 106 | GPIODGLIB_LINE_CLOCK_MONOTONIC = 1, |
| 107 | GPIODGLIB_LINE_CLOCK_REALTIME, |
| 108 | GPIODGLIB_LINE_CLOCK_HTE, |
| 109 | } GpiodglibLineClock; |
| 110 | |
| 111 | G_END_DECLS |
| 112 | |
| 113 | #endif /* __GPIODGLIB_LINE_H__ */ |