Coverage for linuxpy/gpio/raw.py: 100%
94 statements
« prev ^ index » next coverage.py v7.6.1, created at 2024-10-19 05:29 +0200
« prev ^ index » next coverage.py v7.6.1, created at 2024-10-19 05:29 +0200
1#
2# This file is part of the linuxpy project
3#
4# Copyright (c) 2024 Tiago Coutinho
5# Distributed under the GPLv3 license. See LICENSE for more info.
7# This file has been generated by __main__
8# Date: 2024-09-14 07:38:13.225082
9# System: Linux
10# Release: 6.8.0-44-generic
11# Version: #44-Ubuntu SMP PREEMPT_DYNAMIC Tue Aug 13 13:35:26 UTC 2024
13import enum
15from linuxpy.ctypes import Struct, Union, cchar, cint, cuint, culonglong, u32
16from linuxpy.ioctl import IOR as _IOR, IOWR as _IOWR
18MAX_LINES = 64
19MAX_ATTRS = 10
22class LineFlag(enum.IntFlag):
23 USED = 1
24 ACTIVE_LOW = 2
25 INPUT = 4
26 OUTPUT = 8
27 EDGE_RISING = 16
28 EDGE_FALLING = 32
29 OPEN_DRAIN = 64
30 OPEN_SOURCE = 128
31 BIAS_PULL_UP = 256
32 BIAS_PULL_DOWN = 512
33 BIAS_DISABLED = 1024
34 EVENT_CLOCK_REALTIME = 2048
35 EVENT_CLOCK_HTE = 4096
38class LineAttrId(enum.IntEnum):
39 FLAGS = 1
40 OUTPUT_VALUES = 2
41 DEBOUNCE = 3
44class LineChangedType(enum.IntEnum):
45 REQUESTED = 1
46 RELEASED = 2
47 CONFIG = 3
50class LineEventId(enum.IntEnum):
51 RISING_EDGE = 1
52 FALLING_EDGE = 2
55class gpiochip_info(Struct):
56 pass
59gpiochip_info._fields_ = [("name", cchar * 32), ("label", cchar * 32), ("lines", cuint)]
62class gpio_v2_line_values(Struct):
63 pass
66gpio_v2_line_values._fields_ = [("bits", culonglong), ("mask", culonglong)]
69class gpio_v2_line_attribute(Struct):
70 class M1(Union):
71 pass
73 M1._fields_ = [("flags", culonglong), ("values", culonglong), ("debounce_period_us", cuint)]
75 _anonymous_ = ("m1",)
78gpio_v2_line_attribute._fields_ = [("id", cuint), ("padding", cuint), ("m1", gpio_v2_line_attribute.M1)]
81class gpio_v2_line_config_attribute(Struct):
82 pass
85gpio_v2_line_config_attribute._fields_ = [("attr", gpio_v2_line_attribute), ("mask", culonglong)]
88class gpio_v2_line_config(Struct):
89 pass
92gpio_v2_line_config._fields_ = [
93 ("flags", culonglong),
94 ("num_attrs", cuint),
95 ("padding", cuint * 5),
96 ("attrs", gpio_v2_line_config_attribute * 10),
97]
100class gpio_v2_line_request(Struct):
101 pass
104gpio_v2_line_request._fields_ = [
105 ("offsets", cuint * 64),
106 ("consumer", cchar * 32),
107 ("config", gpio_v2_line_config),
108 ("num_lines", cuint),
109 ("event_buffer_size", cuint),
110 ("padding", cuint * 5),
111 ("fd", cint),
112]
115class gpio_v2_line_info(Struct):
116 pass
119gpio_v2_line_info._fields_ = [
120 ("name", cchar * 32),
121 ("consumer", cchar * 32),
122 ("offset", cuint),
123 ("num_attrs", cuint),
124 ("flags", culonglong),
125 ("attrs", gpio_v2_line_attribute * 10),
126 ("padding", cuint * 4),
127]
130class gpio_v2_line_info_changed(Struct):
131 pass
134gpio_v2_line_info_changed._fields_ = [
135 ("info", gpio_v2_line_info),
136 ("timestamp_ns", culonglong),
137 ("event_type", cuint),
138 ("padding", cuint * 5),
139]
142class gpio_v2_line_event(Struct):
143 pass
146gpio_v2_line_event._fields_ = [
147 ("timestamp_ns", culonglong),
148 ("id", cuint),
149 ("offset", cuint),
150 ("seqno", cuint),
151 ("line_seqno", cuint),
152 ("padding", cuint * 6),
153]
156class gpioline_info(Struct):
157 pass
160gpioline_info._fields_ = [("line_offset", cuint), ("flags", cuint), ("name", cchar * 32), ("consumer", cchar * 32)]
163class gpioline_info_changed(Struct):
164 pass
167gpioline_info_changed._fields_ = [
168 ("info", gpioline_info),
169 ("timestamp", culonglong),
170 ("event_type", cuint),
171 ("padding", cuint * 5),
172]
175class gpiohandle_request(Struct):
176 pass
179gpiohandle_request._fields_ = [
180 ("lineoffsets", cuint * 64),
181 ("flags", cuint),
182 ("default_values", cchar * 64),
183 ("consumer_label", cchar * 32),
184 ("lines", cuint),
185 ("fd", cint),
186]
189class gpiohandle_config(Struct):
190 pass
193gpiohandle_config._fields_ = [("flags", cuint), ("default_values", cchar * 64), ("padding", cuint * 4)]
196class gpiohandle_data(Struct):
197 _pack_ = True
200gpiohandle_data._fields_ = [("values", cchar * 64)]
203class gpioevent_request(Struct):
204 pass
207gpioevent_request._fields_ = [
208 ("lineoffset", cuint),
209 ("handleflags", cuint),
210 ("eventflags", cuint),
211 ("consumer_label", cchar * 32),
212 ("fd", cint),
213]
216class gpioevent_data(Struct):
217 pass
220gpioevent_data._fields_ = [("timestamp", culonglong), ("id", cuint)]
223class IOC(enum.IntEnum):
224 CHIPINFO = _IOR(0xB4, 0x01, gpiochip_info)
225 LINEINFO_UNWATCH = _IOWR(0xB4, 0x0C, u32)
226 GET_LINEINFO = _IOWR(0xB4, 0x05, gpio_v2_line_info)
227 GET_LINEINFO_WATCH = _IOWR(0xB4, 0x06, gpio_v2_line_info)
228 GET_LINE = _IOWR(0xB4, 0x07, gpio_v2_line_request)
229 LINE_SET_CONFIG = _IOWR(0xB4, 0x0D, gpio_v2_line_config)
230 LINE_GET_VALUES = _IOWR(0xB4, 0x0E, gpio_v2_line_values)
231 LINE_SET_VALUES = _IOWR(0xB4, 0x0F, gpio_v2_line_values)
232 LINEINFO = _IOWR(0xB4, 0x02, gpioline_info)
233 LINEHANDLE = _IOWR(0xB4, 0x03, gpiohandle_request)
234 LINEEVENT = _IOWR(0xB4, 0x04, gpioevent_request)
235 LINEINFO_WATCH = _IOWR(0xB4, 0x0B, gpioline_info)