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

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. 

6 

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 

12 

13import enum 

14 

15from linuxpy.ctypes import Struct, Union, cchar, cint, cuint, culonglong, u32 

16from linuxpy.ioctl import IOR as _IOR, IOWR as _IOWR 

17 

18MAX_LINES = 64 

19MAX_ATTRS = 10 

20 

21 

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 

36 

37 

38class LineAttrId(enum.IntEnum): 

39 FLAGS = 1 

40 OUTPUT_VALUES = 2 

41 DEBOUNCE = 3 

42 

43 

44class LineChangedType(enum.IntEnum): 

45 REQUESTED = 1 

46 RELEASED = 2 

47 CONFIG = 3 

48 

49 

50class LineEventId(enum.IntEnum): 

51 RISING_EDGE = 1 

52 FALLING_EDGE = 2 

53 

54 

55class gpiochip_info(Struct): 

56 pass 

57 

58 

59gpiochip_info._fields_ = [("name", cchar * 32), ("label", cchar * 32), ("lines", cuint)] 

60 

61 

62class gpio_v2_line_values(Struct): 

63 pass 

64 

65 

66gpio_v2_line_values._fields_ = [("bits", culonglong), ("mask", culonglong)] 

67 

68 

69class gpio_v2_line_attribute(Struct): 

70 class M1(Union): 

71 pass 

72 

73 M1._fields_ = [("flags", culonglong), ("values", culonglong), ("debounce_period_us", cuint)] 

74 

75 _anonymous_ = ("m1",) 

76 

77 

78gpio_v2_line_attribute._fields_ = [("id", cuint), ("padding", cuint), ("m1", gpio_v2_line_attribute.M1)] 

79 

80 

81class gpio_v2_line_config_attribute(Struct): 

82 pass 

83 

84 

85gpio_v2_line_config_attribute._fields_ = [("attr", gpio_v2_line_attribute), ("mask", culonglong)] 

86 

87 

88class gpio_v2_line_config(Struct): 

89 pass 

90 

91 

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] 

98 

99 

100class gpio_v2_line_request(Struct): 

101 pass 

102 

103 

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] 

113 

114 

115class gpio_v2_line_info(Struct): 

116 pass 

117 

118 

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] 

128 

129 

130class gpio_v2_line_info_changed(Struct): 

131 pass 

132 

133 

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] 

140 

141 

142class gpio_v2_line_event(Struct): 

143 pass 

144 

145 

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] 

154 

155 

156class gpioline_info(Struct): 

157 pass 

158 

159 

160gpioline_info._fields_ = [("line_offset", cuint), ("flags", cuint), ("name", cchar * 32), ("consumer", cchar * 32)] 

161 

162 

163class gpioline_info_changed(Struct): 

164 pass 

165 

166 

167gpioline_info_changed._fields_ = [ 

168 ("info", gpioline_info), 

169 ("timestamp", culonglong), 

170 ("event_type", cuint), 

171 ("padding", cuint * 5), 

172] 

173 

174 

175class gpiohandle_request(Struct): 

176 pass 

177 

178 

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] 

187 

188 

189class gpiohandle_config(Struct): 

190 pass 

191 

192 

193gpiohandle_config._fields_ = [("flags", cuint), ("default_values", cchar * 64), ("padding", cuint * 4)] 

194 

195 

196class gpiohandle_data(Struct): 

197 _pack_ = True 

198 

199 

200gpiohandle_data._fields_ = [("values", cchar * 64)] 

201 

202 

203class gpioevent_request(Struct): 

204 pass 

205 

206 

207gpioevent_request._fields_ = [ 

208 ("lineoffset", cuint), 

209 ("handleflags", cuint), 

210 ("eventflags", cuint), 

211 ("consumer_label", cchar * 32), 

212 ("fd", cint), 

213] 

214 

215 

216class gpioevent_data(Struct): 

217 pass 

218 

219 

220gpioevent_data._fields_ = [("timestamp", culonglong), ("id", cuint)] 

221 

222 

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)