|
36 | 36 | ffi.cdef(
|
37 | 37 | """
|
38 | 38 | enum {
|
39 |
| - GPIOD_CTXLESS_EVENT_CB_TIMEOUT, |
40 |
| - GPIOD_CTXLESS_EVENT_CB_RISING_EDGE, |
41 |
| - GPIOD_CTXLESS_EVENT_CB_FALLING_EDGE, |
| 39 | + GPIOD_CTXLESS_EVENT_CB_TIMEOUT, |
| 40 | + GPIOD_CTXLESS_EVENT_CB_RISING_EDGE, |
| 41 | + GPIOD_CTXLESS_EVENT_CB_FALLING_EDGE, |
42 | 42 | };
|
43 | 43 |
|
44 | 44 | enum {
|
45 |
| - GPIOD_CTXLESS_EVENT_CB_RET_ERR = -1, |
46 |
| - GPIOD_CTXLESS_EVENT_CB_RET_OK = 0, |
47 |
| - GPIOD_CTXLESS_EVENT_CB_RET_STOP = 1, |
| 45 | + GPIOD_CTXLESS_EVENT_CB_RET_ERR = -1, |
| 46 | + GPIOD_CTXLESS_EVENT_CB_RET_OK = 0, |
| 47 | + GPIOD_CTXLESS_EVENT_CB_RET_STOP = 1, |
48 | 48 | };
|
49 | 49 |
|
50 | 50 | enum {
|
51 |
| - GPIOD_CTXLESS_EVENT_POLL_RET_STOP = -2, |
52 |
| - GPIOD_CTXLESS_EVENT_POLL_RET_ERR = -1, |
53 |
| - GPIOD_CTXLESS_EVENT_POLL_RET_TIMEOUT = 0, |
| 51 | + GPIOD_CTXLESS_EVENT_POLL_RET_STOP = -2, |
| 52 | + GPIOD_CTXLESS_EVENT_POLL_RET_ERR = -1, |
| 53 | + GPIOD_CTXLESS_EVENT_POLL_RET_TIMEOUT = 0, |
54 | 54 | };
|
55 | 55 |
|
56 | 56 | enum {
|
57 |
| - GPIOD_LINE_DIRECTION_INPUT, |
58 |
| - GPIOD_LINE_DIRECTION_OUTPUT, |
| 57 | + GPIOD_LINE_DIRECTION_INPUT, |
| 58 | + GPIOD_LINE_DIRECTION_OUTPUT, |
59 | 59 | };
|
60 | 60 |
|
61 | 61 | enum {
|
62 |
| - GPIOD_LINE_ACTIVE_STATE_HIGH, |
63 |
| - GPIOD_LINE_ACTIVE_STATE_LOW, |
| 62 | + GPIOD_LINE_ACTIVE_STATE_HIGH, |
| 63 | + GPIOD_LINE_ACTIVE_STATE_LOW, |
64 | 64 | };
|
65 | 65 |
|
66 | 66 | enum {
|
67 |
| - GPIOD_LINE_REQUEST_DIRECTION_AS_IS, |
68 |
| - GPIOD_LINE_REQUEST_DIRECTION_INPUT, |
69 |
| - GPIOD_LINE_REQUEST_DIRECTION_OUTPUT, |
70 |
| - GPIOD_LINE_REQUEST_EVENT_FALLING_EDGE, |
71 |
| - GPIOD_LINE_REQUEST_EVENT_RISING_EDGE, |
72 |
| - GPIOD_LINE_REQUEST_EVENT_BOTH_EDGES, |
| 67 | + GPIOD_LINE_REQUEST_DIRECTION_AS_IS, |
| 68 | + GPIOD_LINE_REQUEST_DIRECTION_INPUT, |
| 69 | + GPIOD_LINE_REQUEST_DIRECTION_OUTPUT, |
| 70 | + GPIOD_LINE_REQUEST_EVENT_FALLING_EDGE, |
| 71 | + GPIOD_LINE_REQUEST_EVENT_RISING_EDGE, |
| 72 | + GPIOD_LINE_REQUEST_EVENT_BOTH_EDGES, |
73 | 73 | };
|
74 | 74 |
|
75 | 75 | enum {
|
76 |
| - GPIOD_LINE_REQUEST_FLAG_OPEN_DRAIN = 1, |
77 |
| - GPIOD_LINE_REQUEST_FLAG_OPEN_SOURCE = 2, |
78 |
| - GPIOD_LINE_REQUEST_FLAG_ACTIVE_LOW = 4, |
| 76 | + GPIOD_LINE_REQUEST_FLAG_OPEN_DRAIN = 1, |
| 77 | + GPIOD_LINE_REQUEST_FLAG_OPEN_SOURCE = 2, |
| 78 | + GPIOD_LINE_REQUEST_FLAG_ACTIVE_LOW = 4, |
79 | 79 | };
|
80 | 80 |
|
81 | 81 | enum {
|
82 |
| - GPIOD_LINE_EVENT_RISING_EDGE, |
83 |
| - GPIOD_LINE_EVENT_FALLING_EDGE, |
| 82 | + GPIOD_LINE_EVENT_RISING_EDGE, |
| 83 | + GPIOD_LINE_EVENT_FALLING_EDGE, |
84 | 84 | };
|
85 | 85 |
|
86 | 86 | struct timespec {
|
87 |
| - long tv_sec; |
88 |
| - long tv_nsec; |
| 87 | + long tv_sec; |
| 88 | + long tv_nsec; |
89 | 89 | };
|
90 | 90 |
|
91 | 91 | struct gpiod_line {
|
92 |
| - unsigned int offset; |
93 |
| - int direction; |
94 |
| - int active_state; |
95 |
| - bool used; |
96 |
| - bool open_source; |
97 |
| - bool open_drain; |
98 |
| - int state; |
99 |
| - bool up_to_date; |
100 |
| - struct gpiod_chip *chip; |
101 |
| - int fd; |
102 |
| - char name[32]; |
103 |
| - char consumer[32]; |
| 92 | + unsigned int offset; |
| 93 | + int direction; |
| 94 | + int active_state; |
| 95 | + bool used; |
| 96 | + bool open_source; |
| 97 | + bool open_drain; |
| 98 | + int state; |
| 99 | + bool up_to_date; |
| 100 | + struct gpiod_chip *chip; |
| 101 | + int fd; |
| 102 | + char name[32]; |
| 103 | + char consumer[32]; |
104 | 104 | };
|
105 | 105 |
|
106 | 106 | struct gpiod_chip {
|
107 |
| - struct gpiod_line **lines; |
108 |
| - unsigned int num_lines; |
109 |
| - int fd; |
110 |
| - char name[32]; |
111 |
| - char label[32]; |
| 107 | + struct gpiod_line **lines; |
| 108 | + unsigned int num_lines; |
| 109 | + int fd; |
| 110 | + char name[32]; |
| 111 | + char label[32]; |
112 | 112 | };
|
113 | 113 |
|
114 | 114 | struct gpiod_ctxless_event_poll_fd {
|
115 |
| - int fd; |
116 |
| - /**< File descriptor number. */ |
117 |
| - bool event; |
118 |
| - /**< Indicates whether an event occurred on this file descriptor. */ |
| 115 | + int fd; |
| 116 | + /**< File descriptor number. */ |
| 117 | + bool event; |
| 118 | + /**< Indicates whether an event occurred on this file descriptor. */ |
119 | 119 | };
|
120 | 120 |
|
121 | 121 | struct gpiod_line_request_config {
|
122 |
| - const char *consumer; |
123 |
| - int request_type; |
124 |
| - int flags; |
| 122 | + const char *consumer; |
| 123 | + int request_type; |
| 124 | + int flags; |
125 | 125 | };
|
126 | 126 |
|
127 | 127 | struct gpiod_line_event {
|
128 |
| - struct timespec ts; |
129 |
| - int event_type; |
| 128 | + struct timespec ts; |
| 129 | + int event_type; |
130 | 130 | };
|
131 | 131 |
|
132 | 132 | struct gpiod_chip;
|
|
140 | 140 | typedef void (*gpiod_ctxless_set_value_cb)(void *);
|
141 | 141 |
|
142 | 142 | typedef int (*gpiod_ctxless_event_handle_cb)(int, unsigned int,
|
143 |
| - const struct timespec *, void *); |
| 143 | + const struct timespec *, void *); |
144 | 144 |
|
145 | 145 | typedef int (*gpiod_ctxless_event_poll_cb)(unsigned int,
|
146 |
| - struct gpiod_ctxless_event_poll_fd *, |
147 |
| - const struct timespec *, void *); |
| 146 | + struct gpiod_ctxless_event_poll_fd *, |
| 147 | + const struct timespec *, void *); |
148 | 148 |
|
149 | 149 | int gpiod_ctxless_set_value(const char *device, unsigned int offset, int value,
|
150 |
| - bool active_low, const char *consumer, |
151 |
| - gpiod_ctxless_set_value_cb cb, |
152 |
| - void *data); |
| 150 | + bool active_low, const char *consumer, |
| 151 | + gpiod_ctxless_set_value_cb cb, |
| 152 | + void *data); |
153 | 153 |
|
154 | 154 | int gpiod_ctxless_set_value_multiple(const char *device,
|
155 |
| - const unsigned int *offsets, |
156 |
| - const int *values, unsigned int num_lines, |
157 |
| - bool active_low, const char *consumer, |
158 |
| - gpiod_ctxless_set_value_cb cb, |
159 |
| - void *data); |
160 |
| - |
| 155 | + const unsigned int *offsets, |
| 156 | + const int *values, unsigned int num_lines, |
| 157 | + bool active_low, const char *consumer, |
| 158 | + gpiod_ctxless_set_value_cb cb, |
| 159 | + void *data); |
| 160 | +
|
161 | 161 | int gpiod_ctxless_find_line(const char *name, char *chipname,
|
162 |
| - size_t chipname_size, |
163 |
| - unsigned int *offset); |
| 162 | + size_t chipname_size, |
| 163 | + unsigned int *offset); |
164 | 164 |
|
165 | 165 | struct gpiod_chip *gpiod_chip_open(const char *path);
|
166 | 166 |
|
|
207 | 207 | bool gpiod_line_needs_update(struct gpiod_line *line);
|
208 | 208 |
|
209 | 209 | int gpiod_line_request(struct gpiod_line *line,
|
210 |
| - const struct gpiod_line_request_config *config, |
211 |
| - int default_val); |
| 210 | + const struct gpiod_line_request_config *config, |
| 211 | + int default_val); |
212 | 212 |
|
213 | 213 | int gpiod_line_request_input(struct gpiod_line *line,
|
214 |
| - const char *consumer); |
| 214 | + const char *consumer); |
215 | 215 |
|
216 | 216 | int gpiod_line_request_output(struct gpiod_line *line,
|
217 |
| - const char *consumer, int default_val); |
| 217 | + const char *consumer, int default_val); |
218 | 218 |
|
219 | 219 | int gpiod_line_request_rising_edge_events(struct gpiod_line *line,
|
220 |
| - const char *consumer); |
| 220 | + const char *consumer); |
221 | 221 |
|
222 | 222 | int gpiod_line_request_falling_edge_events(struct gpiod_line *line,
|
223 |
| - const char *consumer); |
| 223 | + const char *consumer); |
224 | 224 |
|
225 | 225 | int gpiod_line_request_both_edges_events(struct gpiod_line *line,
|
226 |
| - const char *consumer); |
| 226 | + const char *consumer); |
227 | 227 |
|
228 | 228 | int gpiod_line_request_input_flags(struct gpiod_line *line,
|
229 |
| - const char *consumer, int flags); |
| 229 | + const char *consumer, int flags); |
230 | 230 |
|
231 | 231 | int gpiod_line_request_output_flags(struct gpiod_line *line,
|
232 |
| - const char *consumer, int flags, |
233 |
| - int default_val); |
| 232 | + const char *consumer, int flags, |
| 233 | + int default_val); |
234 | 234 |
|
235 | 235 | int gpiod_line_request_rising_edge_events_flags(struct gpiod_line *line,
|
236 |
| - const char *consumer, |
237 |
| - int flags); |
| 236 | + const char *consumer, |
| 237 | + int flags); |
238 | 238 |
|
239 | 239 | int gpiod_line_request_falling_edge_events_flags(struct gpiod_line *line,
|
240 |
| - const char *consumer, |
241 |
| - int flags); |
| 240 | + const char *consumer, |
| 241 | + int flags); |
242 | 242 |
|
243 | 243 | int gpiod_line_request_both_edges_events_flags(struct gpiod_line *line,
|
244 |
| - const char *consumer, |
245 |
| - int flags); |
| 244 | + const char *consumer, |
| 245 | + int flags); |
246 | 246 |
|
247 | 247 | void gpiod_line_release(struct gpiod_line *line);
|
248 | 248 |
|
|
255 | 255 | int gpiod_line_set_value(struct gpiod_line *line, int value);
|
256 | 256 |
|
257 | 257 | int gpiod_line_event_wait(struct gpiod_line *line,
|
258 |
| - const struct timespec *timeout); |
| 258 | + const struct timespec *timeout); |
259 | 259 |
|
260 | 260 | int gpiod_line_event_read(struct gpiod_line *line,
|
261 |
| - struct gpiod_line_event *event); |
| 261 | + struct gpiod_line_event *event); |
262 | 262 |
|
263 | 263 | int gpiod_line_event_get_fd(struct gpiod_line *line);
|
264 | 264 |
|
|
0 commit comments