1#![doc = "DPLL subsystem\\."]
2#![allow(clippy::all)]
3#![allow(unused_imports)]
4#![allow(unused_assignments)]
5#![allow(non_snake_case)]
6#![allow(unused_variables)]
7#![allow(irrefutable_let_patterns)]
8#![allow(unreachable_code)]
9#![allow(unreachable_patterns)]
10use crate::builtin::{BuiltinBitfield32, BuiltinNfgenmsg, Nlmsghdr, PushDummy};
11use crate::{
12 consts,
13 traits::{NetlinkRequest, Protocol},
14 utils::*,
15};
16pub const PROTONAME: &str = "dpll";
17pub const PROTONAME_CSTR: &CStr = c"dpll";
18#[doc = "working modes a dpll can support, differentiates if and how dpll selects\none of its inputs to syntonize with it, valid values for DPLL\\_A\\_MODE\nattribute\n"]
19#[doc = "Enum - defines an integer enumeration, with values for each entry incrementing by 1, (e.g. 0, 1, 2, 3)"]
20#[derive(Debug, Clone, Copy)]
21pub enum Mode {
22 #[doc = "input can be only selected by sending a request to dpll"]
23 Manual = 1,
24 #[doc = "highest prio input pin auto selected by dpll"]
25 Automatic = 2,
26}
27impl Mode {
28 pub fn from_value(value: u64) -> Option<Self> {
29 Some(match value {
30 1 => Self::Manual,
31 2 => Self::Automatic,
32 _ => return None,
33 })
34 }
35}
36#[doc = "provides information of dpll device lock status, valid values for\nDPLL\\_A\\_LOCK\\_STATUS attribute\n"]
37#[doc = "Enum - defines an integer enumeration, with values for each entry incrementing by 1, (e.g. 0, 1, 2, 3)"]
38#[derive(Debug, Clone, Copy)]
39pub enum LockStatus {
40 #[doc = "dpll was not yet locked to any valid input (or forced by setting\nDPLL\\_A\\_MODE to DPLL\\_MODE\\_DETACHED)\n"]
41 Unlocked = 1,
42 #[doc = "dpll is locked to a valid signal, but no holdover available\n"]
43 Locked = 2,
44 #[doc = "dpll is locked and holdover acquired\n"]
45 LockedHoAcq = 3,
46 #[doc = "dpll is in holdover state \\- lost a valid lock or was forced\nby disconnecting all the pins (latter possible only\nwhen dpll lock\\-state was already DPLL\\_LOCK\\_STATUS\\_LOCKED\\_HO\\_ACQ,\nif dpll lock\\-state was not DPLL\\_LOCK\\_STATUS\\_LOCKED\\_HO\\_ACQ, the\ndpll's lock\\-state shall remain DPLL\\_LOCK\\_STATUS\\_UNLOCKED)\n"]
47 Holdover = 4,
48}
49impl LockStatus {
50 pub fn from_value(value: u64) -> Option<Self> {
51 Some(match value {
52 1 => Self::Unlocked,
53 2 => Self::Locked,
54 3 => Self::LockedHoAcq,
55 4 => Self::Holdover,
56 _ => return None,
57 })
58 }
59}
60#[doc = "if previous status change was done due to a failure, this provides\ninformation of dpll device lock status error\\.\nValid values for DPLL\\_A\\_LOCK\\_STATUS\\_ERROR attribute\n"]
61#[doc = "Enum - defines an integer enumeration, with values for each entry incrementing by 1, (e.g. 0, 1, 2, 3)"]
62#[derive(Debug, Clone, Copy)]
63pub enum LockStatusError {
64 #[doc = "dpll device lock status was changed without any error\n"]
65 None = 1,
66 #[doc = "dpll device lock status was changed due to undefined error\\.\nDriver fills this value up in case it is not able\nto obtain suitable exact error type\\.\n"]
67 Undefined = 2,
68 #[doc = "dpll device lock status was changed because of associated\nmedia got down\\.\nThis may happen for example if dpll device was previously\nlocked on an input pin of type PIN\\_TYPE\\_SYNCE\\_ETH\\_PORT\\.\n"]
69 MediaDown = 3,
70 #[doc = "the FFO (Fractional Frequency Offset) between the RX and TX\nsymbol rate on the media got too high\\.\nThis may happen for example if dpll device was previously\nlocked on an input pin of type PIN\\_TYPE\\_SYNCE\\_ETH\\_PORT\\.\n"]
71 FractionalFrequencyOffsetTooHigh = 4,
72}
73impl LockStatusError {
74 pub fn from_value(value: u64) -> Option<Self> {
75 Some(match value {
76 1 => Self::None,
77 2 => Self::Undefined,
78 3 => Self::MediaDown,
79 4 => Self::FractionalFrequencyOffsetTooHigh,
80 _ => return None,
81 })
82 }
83}
84#[doc = "level of quality of a clock device\\. This mainly applies when\nthe dpll lock\\-status is DPLL\\_LOCK\\_STATUS\\_HOLDOVER\\.\nThe current list is defined according to the table 11\\-7 contained\nin ITU\\-T G\\.8264/Y\\.1364 document\\. One may extend this list freely\nby other ITU\\-T defined clock qualities, or different ones defined\nby another standardization body (for those, please use\ndifferent prefix)\\.\n"]
85#[doc = "Enum - defines an integer enumeration, with values for each entry incrementing by 1, (e.g. 0, 1, 2, 3)"]
86#[derive(Debug, Clone, Copy)]
87pub enum ClockQualityLevel {
88 ItuOpt1Prc = 1,
89 ItuOpt1SsuA = 2,
90 ItuOpt1SsuB = 3,
91 ItuOpt1Eec1 = 4,
92 ItuOpt1Prtc = 5,
93 ItuOpt1Eprtc = 6,
94 ItuOpt1Eeec = 7,
95 ItuOpt1Eprc = 8,
96}
97impl ClockQualityLevel {
98 pub fn from_value(value: u64) -> Option<Self> {
99 Some(match value {
100 1 => Self::ItuOpt1Prc,
101 2 => Self::ItuOpt1SsuA,
102 3 => Self::ItuOpt1SsuB,
103 4 => Self::ItuOpt1Eec1,
104 5 => Self::ItuOpt1Prtc,
105 6 => Self::ItuOpt1Eprtc,
106 7 => Self::ItuOpt1Eeec,
107 8 => Self::ItuOpt1Eprc,
108 _ => return None,
109 })
110 }
111}
112#[doc = "temperature divider allowing userspace to calculate the\ntemperature as float with three digit decimal precision\\.\nValue of (DPLL\\_A\\_TEMP / DPLL\\_TEMP\\_DIVIDER) is integer part of\ntemperature value\\.\nValue of (DPLL\\_A\\_TEMP % DPLL\\_TEMP\\_DIVIDER) is fractional part of\ntemperature value\\.\n"]
113pub const TEMP_DIVIDER: u64 = 1000u64;
114#[doc = "type of dpll, valid values for DPLL\\_A\\_TYPE attribute"]
115#[doc = "Enum - defines an integer enumeration, with values for each entry incrementing by 1, (e.g. 0, 1, 2, 3)"]
116#[derive(Debug, Clone, Copy)]
117pub enum Type {
118 #[doc = "dpll produces Pulse\\-Per\\-Second signal"]
119 Pps = 1,
120 #[doc = "dpll drives the Ethernet Equipment Clock"]
121 Eec = 2,
122}
123impl Type {
124 pub fn from_value(value: u64) -> Option<Self> {
125 Some(match value {
126 1 => Self::Pps,
127 2 => Self::Eec,
128 _ => return None,
129 })
130 }
131}
132#[doc = "defines possible types of a pin, valid values for DPLL\\_A\\_PIN\\_TYPE\nattribute\n"]
133#[doc = "Enum - defines an integer enumeration, with values for each entry incrementing by 1, (e.g. 0, 1, 2, 3)"]
134#[derive(Debug, Clone, Copy)]
135pub enum PinType {
136 #[doc = "aggregates another layer of selectable pins"]
137 Mux = 1,
138 #[doc = "external input"]
139 Ext = 2,
140 #[doc = "ethernet port PHY's recovered clock"]
141 SynceEthPort = 3,
142 #[doc = "device internal oscillator"]
143 IntOscillator = 4,
144 #[doc = "GNSS recovered clock"]
145 Gnss = 5,
146}
147impl PinType {
148 pub fn from_value(value: u64) -> Option<Self> {
149 Some(match value {
150 1 => Self::Mux,
151 2 => Self::Ext,
152 3 => Self::SynceEthPort,
153 4 => Self::IntOscillator,
154 5 => Self::Gnss,
155 _ => return None,
156 })
157 }
158}
159#[doc = "defines possible direction of a pin, valid values for\nDPLL\\_A\\_PIN\\_DIRECTION attribute\n"]
160#[doc = "Enum - defines an integer enumeration, with values for each entry incrementing by 1, (e.g. 0, 1, 2, 3)"]
161#[derive(Debug, Clone, Copy)]
162pub enum PinDirection {
163 #[doc = "pin used as a input of a signal"]
164 Input = 1,
165 #[doc = "pin used to output the signal"]
166 Output = 2,
167}
168impl PinDirection {
169 pub fn from_value(value: u64) -> Option<Self> {
170 Some(match value {
171 1 => Self::Input,
172 2 => Self::Output,
173 _ => return None,
174 })
175 }
176}
177pub const PIN_FREQUENCY_1_HZ: u64 = 1u64;
178pub const PIN_FREQUENCY_10_KHZ: u64 = 10000u64;
179pub const PIN_FREQUENCY_77_5_KHZ: u64 = 77500u64;
180pub const PIN_FREQUENCY_10_MHZ: u64 = 10000000u64;
181#[doc = "defines possible states of a pin, valid values for\nDPLL\\_A\\_PIN\\_STATE attribute\n"]
182#[doc = "Enum - defines an integer enumeration, with values for each entry incrementing by 1, (e.g. 0, 1, 2, 3)"]
183#[derive(Debug, Clone, Copy)]
184pub enum PinState {
185 #[doc = "pin connected, active input of phase locked loop"]
186 Connected = 1,
187 #[doc = "pin disconnected, not considered as a valid input"]
188 Disconnected = 2,
189 #[doc = "pin enabled for automatic input selection"]
190 Selectable = 3,
191}
192impl PinState {
193 pub fn from_value(value: u64) -> Option<Self> {
194 Some(match value {
195 1 => Self::Connected,
196 2 => Self::Disconnected,
197 3 => Self::Selectable,
198 _ => return None,
199 })
200 }
201}
202#[doc = "defines possible capabilities of a pin, valid flags on\nDPLL\\_A\\_PIN\\_CAPABILITIES attribute\n"]
203#[doc = "Flags - defines an integer enumeration, with values for each entry occupying a bit, starting from bit 0, (e.g. 1, 2, 4, 8)"]
204#[derive(Debug, Clone, Copy)]
205pub enum PinCapabilities {
206 #[doc = "pin direction can be changed"]
207 DirectionCanChange = 1 << 0,
208 #[doc = "pin priority can be changed"]
209 PriorityCanChange = 1 << 1,
210 #[doc = "pin state can be changed"]
211 StateCanChange = 1 << 2,
212}
213impl PinCapabilities {
214 pub fn from_value(value: u64) -> Option<Self> {
215 Some(match value {
216 n if n == 1 << 0 => Self::DirectionCanChange,
217 n if n == 1 << 1 => Self::PriorityCanChange,
218 n if n == 1 << 2 => Self::StateCanChange,
219 _ => return None,
220 })
221 }
222}
223#[doc = "phase offset divider allows userspace to calculate a value of\nmeasured signal phase difference between a pin and dpll device\nas a fractional value with three digit decimal precision\\.\nValue of (DPLL\\_A\\_PHASE\\_OFFSET / DPLL\\_PHASE\\_OFFSET\\_DIVIDER) is an\ninteger part of a measured phase offset value\\.\nValue of (DPLL\\_A\\_PHASE\\_OFFSET % DPLL\\_PHASE\\_OFFSET\\_DIVIDER) is a\nfractional part of a measured phase offset value\\.\n"]
224pub const PHASE_OFFSET_DIVIDER: u64 = 1000u64;
225#[doc = "Allow control (enable/disable) and status checking over features\\.\n"]
226#[doc = "Enum - defines an integer enumeration, with values for each entry incrementing by 1, (e.g. 0, 1, 2, 3)"]
227#[derive(Debug, Clone, Copy)]
228pub enum FeatureState {
229 #[doc = "feature shall be disabled\n"]
230 Disable = 0,
231 #[doc = "feature shall be enabled\n"]
232 Enable = 1,
233}
234impl FeatureState {
235 pub fn from_value(value: u64) -> Option<Self> {
236 Some(match value {
237 0 => Self::Disable,
238 1 => Self::Enable,
239 _ => return None,
240 })
241 }
242}
243#[derive(Clone)]
244pub enum Dpll<'a> {
245 Id(u32),
246 ModuleName(&'a CStr),
247 Pad(&'a [u8]),
248 ClockId(u64),
249 #[doc = "Associated type: [`Mode`] (enum)"]
250 Mode(u32),
251 #[doc = "Associated type: [`Mode`] (enum)\nAttribute may repeat multiple times (treat it as array)"]
252 ModeSupported(u32),
253 #[doc = "Associated type: [`LockStatus`] (enum)"]
254 LockStatus(u32),
255 Temp(i32),
256 #[doc = "Associated type: [`Type`] (enum)"]
257 Type(u32),
258 #[doc = "Associated type: [`LockStatusError`] (enum)"]
259 LockStatusError(u32),
260 #[doc = "Level of quality of a clock device\\. This mainly applies when\nthe dpll lock\\-status is DPLL\\_LOCK\\_STATUS\\_HOLDOVER\\. This could\nbe put to message multiple times to indicate possible parallel\nquality levels (e\\.g\\. one specified by ITU option 1 and another\none specified by option 2)\\.\n\nAssociated type: [`ClockQualityLevel`] (enum)\nAttribute may repeat multiple times (treat it as array)"]
261 ClockQualityLevel(u32),
262 #[doc = "Receive or request state of phase offset monitor feature\\. If enabled, dpll device shall monitor and notify all currently available inputs for changes of their phase offset against the dpll device\\.\nAssociated type: [`FeatureState`] (enum)"]
263 PhaseOffsetMonitor(u32),
264 #[doc = "Averaging factor applied to calculation of reported phase offset\\."]
265 PhaseOffsetAvgFactor(u32),
266}
267impl<'a> IterableDpll<'a> {
268 pub fn get_id(&self) -> Result<u32, ErrorContext> {
269 let mut iter = self.clone();
270 iter.pos = 0;
271 for attr in iter {
272 if let Dpll::Id(val) = attr? {
273 return Ok(val);
274 }
275 }
276 Err(ErrorContext::new_missing(
277 "Dpll",
278 "Id",
279 self.orig_loc,
280 self.buf.as_ptr() as usize,
281 ))
282 }
283 pub fn get_module_name(&self) -> Result<&'a CStr, ErrorContext> {
284 let mut iter = self.clone();
285 iter.pos = 0;
286 for attr in iter {
287 if let Dpll::ModuleName(val) = attr? {
288 return Ok(val);
289 }
290 }
291 Err(ErrorContext::new_missing(
292 "Dpll",
293 "ModuleName",
294 self.orig_loc,
295 self.buf.as_ptr() as usize,
296 ))
297 }
298 pub fn get_pad(&self) -> Result<&'a [u8], ErrorContext> {
299 let mut iter = self.clone();
300 iter.pos = 0;
301 for attr in iter {
302 if let Dpll::Pad(val) = attr? {
303 return Ok(val);
304 }
305 }
306 Err(ErrorContext::new_missing(
307 "Dpll",
308 "Pad",
309 self.orig_loc,
310 self.buf.as_ptr() as usize,
311 ))
312 }
313 pub fn get_clock_id(&self) -> Result<u64, ErrorContext> {
314 let mut iter = self.clone();
315 iter.pos = 0;
316 for attr in iter {
317 if let Dpll::ClockId(val) = attr? {
318 return Ok(val);
319 }
320 }
321 Err(ErrorContext::new_missing(
322 "Dpll",
323 "ClockId",
324 self.orig_loc,
325 self.buf.as_ptr() as usize,
326 ))
327 }
328 #[doc = "Associated type: [`Mode`] (enum)"]
329 pub fn get_mode(&self) -> Result<u32, ErrorContext> {
330 let mut iter = self.clone();
331 iter.pos = 0;
332 for attr in iter {
333 if let Dpll::Mode(val) = attr? {
334 return Ok(val);
335 }
336 }
337 Err(ErrorContext::new_missing(
338 "Dpll",
339 "Mode",
340 self.orig_loc,
341 self.buf.as_ptr() as usize,
342 ))
343 }
344 #[doc = "Associated type: [`Mode`] (enum)\nAttribute may repeat multiple times (treat it as array)"]
345 pub fn get_mode_supported(&self) -> MultiAttrIterable<Self, Dpll<'a>, u32> {
346 MultiAttrIterable::new(self.clone(), |variant| {
347 if let Dpll::ModeSupported(val) = variant {
348 Some(val)
349 } else {
350 None
351 }
352 })
353 }
354 #[doc = "Associated type: [`LockStatus`] (enum)"]
355 pub fn get_lock_status(&self) -> Result<u32, ErrorContext> {
356 let mut iter = self.clone();
357 iter.pos = 0;
358 for attr in iter {
359 if let Dpll::LockStatus(val) = attr? {
360 return Ok(val);
361 }
362 }
363 Err(ErrorContext::new_missing(
364 "Dpll",
365 "LockStatus",
366 self.orig_loc,
367 self.buf.as_ptr() as usize,
368 ))
369 }
370 pub fn get_temp(&self) -> Result<i32, ErrorContext> {
371 let mut iter = self.clone();
372 iter.pos = 0;
373 for attr in iter {
374 if let Dpll::Temp(val) = attr? {
375 return Ok(val);
376 }
377 }
378 Err(ErrorContext::new_missing(
379 "Dpll",
380 "Temp",
381 self.orig_loc,
382 self.buf.as_ptr() as usize,
383 ))
384 }
385 #[doc = "Associated type: [`Type`] (enum)"]
386 pub fn get_type(&self) -> Result<u32, ErrorContext> {
387 let mut iter = self.clone();
388 iter.pos = 0;
389 for attr in iter {
390 if let Dpll::Type(val) = attr? {
391 return Ok(val);
392 }
393 }
394 Err(ErrorContext::new_missing(
395 "Dpll",
396 "Type",
397 self.orig_loc,
398 self.buf.as_ptr() as usize,
399 ))
400 }
401 #[doc = "Associated type: [`LockStatusError`] (enum)"]
402 pub fn get_lock_status_error(&self) -> Result<u32, ErrorContext> {
403 let mut iter = self.clone();
404 iter.pos = 0;
405 for attr in iter {
406 if let Dpll::LockStatusError(val) = attr? {
407 return Ok(val);
408 }
409 }
410 Err(ErrorContext::new_missing(
411 "Dpll",
412 "LockStatusError",
413 self.orig_loc,
414 self.buf.as_ptr() as usize,
415 ))
416 }
417 #[doc = "Level of quality of a clock device\\. This mainly applies when\nthe dpll lock\\-status is DPLL\\_LOCK\\_STATUS\\_HOLDOVER\\. This could\nbe put to message multiple times to indicate possible parallel\nquality levels (e\\.g\\. one specified by ITU option 1 and another\none specified by option 2)\\.\n\nAssociated type: [`ClockQualityLevel`] (enum)\nAttribute may repeat multiple times (treat it as array)"]
418 pub fn get_clock_quality_level(&self) -> MultiAttrIterable<Self, Dpll<'a>, u32> {
419 MultiAttrIterable::new(self.clone(), |variant| {
420 if let Dpll::ClockQualityLevel(val) = variant {
421 Some(val)
422 } else {
423 None
424 }
425 })
426 }
427 #[doc = "Receive or request state of phase offset monitor feature\\. If enabled, dpll device shall monitor and notify all currently available inputs for changes of their phase offset against the dpll device\\.\nAssociated type: [`FeatureState`] (enum)"]
428 pub fn get_phase_offset_monitor(&self) -> Result<u32, ErrorContext> {
429 let mut iter = self.clone();
430 iter.pos = 0;
431 for attr in iter {
432 if let Dpll::PhaseOffsetMonitor(val) = attr? {
433 return Ok(val);
434 }
435 }
436 Err(ErrorContext::new_missing(
437 "Dpll",
438 "PhaseOffsetMonitor",
439 self.orig_loc,
440 self.buf.as_ptr() as usize,
441 ))
442 }
443 #[doc = "Averaging factor applied to calculation of reported phase offset\\."]
444 pub fn get_phase_offset_avg_factor(&self) -> Result<u32, ErrorContext> {
445 let mut iter = self.clone();
446 iter.pos = 0;
447 for attr in iter {
448 if let Dpll::PhaseOffsetAvgFactor(val) = attr? {
449 return Ok(val);
450 }
451 }
452 Err(ErrorContext::new_missing(
453 "Dpll",
454 "PhaseOffsetAvgFactor",
455 self.orig_loc,
456 self.buf.as_ptr() as usize,
457 ))
458 }
459}
460impl Dpll<'_> {
461 pub fn new<'a>(buf: &'a [u8]) -> IterableDpll<'a> {
462 IterableDpll::with_loc(buf, buf.as_ptr() as usize)
463 }
464 fn attr_from_type(r#type: u16) -> Option<&'static str> {
465 let res = match r#type {
466 1u16 => "Id",
467 2u16 => "ModuleName",
468 3u16 => "Pad",
469 4u16 => "ClockId",
470 5u16 => "Mode",
471 6u16 => "ModeSupported",
472 7u16 => "LockStatus",
473 8u16 => "Temp",
474 9u16 => "Type",
475 10u16 => "LockStatusError",
476 11u16 => "ClockQualityLevel",
477 12u16 => "PhaseOffsetMonitor",
478 13u16 => "PhaseOffsetAvgFactor",
479 _ => return None,
480 };
481 Some(res)
482 }
483}
484#[derive(Clone, Copy, Default)]
485pub struct IterableDpll<'a> {
486 buf: &'a [u8],
487 pos: usize,
488 orig_loc: usize,
489}
490impl<'a> IterableDpll<'a> {
491 fn with_loc(buf: &'a [u8], orig_loc: usize) -> Self {
492 Self {
493 buf,
494 pos: 0,
495 orig_loc,
496 }
497 }
498 pub fn get_buf(&self) -> &'a [u8] {
499 self.buf
500 }
501}
502impl<'a> Iterator for IterableDpll<'a> {
503 type Item = Result<Dpll<'a>, ErrorContext>;
504 fn next(&mut self) -> Option<Self::Item> {
505 let pos = self.pos;
506 let mut r#type;
507 loop {
508 r#type = None;
509 if self.buf.len() == self.pos {
510 return None;
511 }
512 let Some((header, next)) = chop_header(self.buf, &mut self.pos) else {
513 break;
514 };
515 r#type = Some(header.r#type);
516 let res = match header.r#type {
517 1u16 => Dpll::Id({
518 let res = parse_u32(next);
519 let Some(val) = res else { break };
520 val
521 }),
522 2u16 => Dpll::ModuleName({
523 let res = CStr::from_bytes_with_nul(next).ok();
524 let Some(val) = res else { break };
525 val
526 }),
527 3u16 => Dpll::Pad({
528 let res = Some(next);
529 let Some(val) = res else { break };
530 val
531 }),
532 4u16 => Dpll::ClockId({
533 let res = parse_u64(next);
534 let Some(val) = res else { break };
535 val
536 }),
537 5u16 => Dpll::Mode({
538 let res = parse_u32(next);
539 let Some(val) = res else { break };
540 val
541 }),
542 6u16 => Dpll::ModeSupported({
543 let res = parse_u32(next);
544 let Some(val) = res else { break };
545 val
546 }),
547 7u16 => Dpll::LockStatus({
548 let res = parse_u32(next);
549 let Some(val) = res else { break };
550 val
551 }),
552 8u16 => Dpll::Temp({
553 let res = parse_i32(next);
554 let Some(val) = res else { break };
555 val
556 }),
557 9u16 => Dpll::Type({
558 let res = parse_u32(next);
559 let Some(val) = res else { break };
560 val
561 }),
562 10u16 => Dpll::LockStatusError({
563 let res = parse_u32(next);
564 let Some(val) = res else { break };
565 val
566 }),
567 11u16 => Dpll::ClockQualityLevel({
568 let res = parse_u32(next);
569 let Some(val) = res else { break };
570 val
571 }),
572 12u16 => Dpll::PhaseOffsetMonitor({
573 let res = parse_u32(next);
574 let Some(val) = res else { break };
575 val
576 }),
577 13u16 => Dpll::PhaseOffsetAvgFactor({
578 let res = parse_u32(next);
579 let Some(val) = res else { break };
580 val
581 }),
582 n if cfg!(any(test, feature = "deny-unknown-attrs")) => break,
583 n => continue,
584 };
585 return Some(Ok(res));
586 }
587 Some(Err(ErrorContext::new(
588 "Dpll",
589 r#type.and_then(|t| Dpll::attr_from_type(t)),
590 self.orig_loc,
591 self.buf.as_ptr().wrapping_add(pos) as usize,
592 )))
593 }
594}
595impl<'a> std::fmt::Debug for IterableDpll<'_> {
596 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
597 let mut fmt = f.debug_struct("Dpll");
598 for attr in self.clone() {
599 let attr = match attr {
600 Ok(a) => a,
601 Err(err) => {
602 fmt.finish()?;
603 f.write_str("Err(")?;
604 err.fmt(f)?;
605 return f.write_str(")");
606 }
607 };
608 match attr {
609 Dpll::Id(val) => fmt.field("Id", &val),
610 Dpll::ModuleName(val) => fmt.field("ModuleName", &val),
611 Dpll::Pad(val) => fmt.field("Pad", &val),
612 Dpll::ClockId(val) => fmt.field("ClockId", &val),
613 Dpll::Mode(val) => fmt.field("Mode", &FormatEnum(val.into(), Mode::from_value)),
614 Dpll::ModeSupported(val) => {
615 fmt.field("ModeSupported", &FormatEnum(val.into(), Mode::from_value))
616 }
617 Dpll::LockStatus(val) => fmt.field(
618 "LockStatus",
619 &FormatEnum(val.into(), LockStatus::from_value),
620 ),
621 Dpll::Temp(val) => fmt.field("Temp", &val),
622 Dpll::Type(val) => fmt.field("Type", &FormatEnum(val.into(), Type::from_value)),
623 Dpll::LockStatusError(val) => fmt.field(
624 "LockStatusError",
625 &FormatEnum(val.into(), LockStatusError::from_value),
626 ),
627 Dpll::ClockQualityLevel(val) => fmt.field(
628 "ClockQualityLevel",
629 &FormatEnum(val.into(), ClockQualityLevel::from_value),
630 ),
631 Dpll::PhaseOffsetMonitor(val) => fmt.field(
632 "PhaseOffsetMonitor",
633 &FormatEnum(val.into(), FeatureState::from_value),
634 ),
635 Dpll::PhaseOffsetAvgFactor(val) => fmt.field("PhaseOffsetAvgFactor", &val),
636 };
637 }
638 fmt.finish()
639 }
640}
641impl IterableDpll<'_> {
642 pub fn lookup_attr(
643 &self,
644 offset: usize,
645 missing_type: Option<u16>,
646 ) -> (Vec<(&'static str, usize)>, Option<&'static str>) {
647 let mut stack = Vec::new();
648 let cur = ErrorContext::calc_offset(self.orig_loc, self.buf.as_ptr() as usize);
649 if missing_type.is_some() && cur == offset {
650 stack.push(("Dpll", offset));
651 return (stack, missing_type.and_then(|t| Dpll::attr_from_type(t)));
652 }
653 if cur > offset || cur + self.buf.len() < offset {
654 return (stack, None);
655 }
656 let mut attrs = self.clone();
657 let mut last_off = cur + attrs.pos;
658 while let Some(attr) = attrs.next() {
659 let Ok(attr) = attr else { break };
660 match attr {
661 Dpll::Id(val) => {
662 if last_off == offset {
663 stack.push(("Id", last_off));
664 break;
665 }
666 }
667 Dpll::ModuleName(val) => {
668 if last_off == offset {
669 stack.push(("ModuleName", last_off));
670 break;
671 }
672 }
673 Dpll::Pad(val) => {
674 if last_off == offset {
675 stack.push(("Pad", last_off));
676 break;
677 }
678 }
679 Dpll::ClockId(val) => {
680 if last_off == offset {
681 stack.push(("ClockId", last_off));
682 break;
683 }
684 }
685 Dpll::Mode(val) => {
686 if last_off == offset {
687 stack.push(("Mode", last_off));
688 break;
689 }
690 }
691 Dpll::ModeSupported(val) => {
692 if last_off == offset {
693 stack.push(("ModeSupported", last_off));
694 break;
695 }
696 }
697 Dpll::LockStatus(val) => {
698 if last_off == offset {
699 stack.push(("LockStatus", last_off));
700 break;
701 }
702 }
703 Dpll::Temp(val) => {
704 if last_off == offset {
705 stack.push(("Temp", last_off));
706 break;
707 }
708 }
709 Dpll::Type(val) => {
710 if last_off == offset {
711 stack.push(("Type", last_off));
712 break;
713 }
714 }
715 Dpll::LockStatusError(val) => {
716 if last_off == offset {
717 stack.push(("LockStatusError", last_off));
718 break;
719 }
720 }
721 Dpll::ClockQualityLevel(val) => {
722 if last_off == offset {
723 stack.push(("ClockQualityLevel", last_off));
724 break;
725 }
726 }
727 Dpll::PhaseOffsetMonitor(val) => {
728 if last_off == offset {
729 stack.push(("PhaseOffsetMonitor", last_off));
730 break;
731 }
732 }
733 Dpll::PhaseOffsetAvgFactor(val) => {
734 if last_off == offset {
735 stack.push(("PhaseOffsetAvgFactor", last_off));
736 break;
737 }
738 }
739 _ => {}
740 };
741 last_off = cur + attrs.pos;
742 }
743 if !stack.is_empty() {
744 stack.push(("Dpll", cur));
745 }
746 (stack, None)
747 }
748}
749#[derive(Clone)]
750pub enum Pin<'a> {
751 Id(u32),
752 ParentId(u32),
753 ModuleName(&'a CStr),
754 Pad(&'a [u8]),
755 ClockId(u64),
756 BoardLabel(&'a CStr),
757 PanelLabel(&'a CStr),
758 PackageLabel(&'a CStr),
759 #[doc = "Associated type: [`PinType`] (enum)"]
760 Type(u32),
761 #[doc = "Associated type: [`PinDirection`] (enum)"]
762 Direction(u32),
763 Frequency(u64),
764 #[doc = "Attribute may repeat multiple times (treat it as array)"]
765 FrequencySupported(IterableFrequencyRange<'a>),
766 FrequencyMin(u64),
767 FrequencyMax(u64),
768 Prio(u32),
769 #[doc = "Associated type: [`PinState`] (enum)"]
770 State(u32),
771 #[doc = "Associated type: [`PinCapabilities`] (enum)"]
772 Capabilities(u32),
773 #[doc = "Attribute may repeat multiple times (treat it as array)"]
774 ParentDevice(IterablePinParentDevice<'a>),
775 #[doc = "Attribute may repeat multiple times (treat it as array)"]
776 ParentPin(IterablePinParentPin<'a>),
777 PhaseAdjustMin(i32),
778 PhaseAdjustMax(i32),
779 PhaseAdjust(i32),
780 PhaseOffset(i64),
781 #[doc = "The FFO (Fractional Frequency Offset) between the RX and TX\nsymbol rate on the media associated with the pin:\n(rx\\_frequency\\-tx\\_frequency)/rx\\_frequency\nValue is in PPM (parts per million)\\.\nThis may be implemented for example for pin of type\nPIN\\_TYPE\\_SYNCE\\_ETH\\_PORT\\.\n"]
782 FractionalFrequencyOffset(i32),
783 #[doc = "Frequency of Embedded SYNC signal\\. If provided, the pin is configured\nwith a SYNC signal embedded into its base clock frequency\\.\n"]
784 EsyncFrequency(u64),
785 #[doc = "If provided a pin is capable of embedding a SYNC signal (within given\nrange) into its base frequency signal\\.\n\nAttribute may repeat multiple times (treat it as array)"]
786 EsyncFrequencySupported(IterableFrequencyRange<'a>),
787 #[doc = "A ratio of high to low state of a SYNC signal pulse embedded\ninto base clock frequency\\. Value is in percents\\.\n"]
788 EsyncPulse(u32),
789 #[doc = "Capable pin provides list of pins that can be bound to create a\nreference\\-sync pin pair\\.\n\nAttribute may repeat multiple times (treat it as array)"]
790 ReferenceSync(IterableReferenceSync<'a>),
791 #[doc = "Granularity of phase adjustment, in picoseconds\\. The value of\nphase adjustment must be a multiple of this granularity\\.\n"]
792 PhaseAdjustGran(u32),
793 #[doc = "The FFO (Fractional Frequency Offset) of the pin with respect to\nthe nominal frequency\\.\nValue = (frequency\\_measured \\- frequency\\_nominal) / frequency\\_nominal\nValue is in PPT (parts per trillion, 10^\\-12)\\.\nNote: This attribute provides higher resolution than the standard\nfractional\\-frequency\\-offset (which is in PPM)\\.\n"]
794 FractionalFrequencyOffsetPpt(i32),
795}
796impl<'a> IterablePin<'a> {
797 pub fn get_id(&self) -> Result<u32, ErrorContext> {
798 let mut iter = self.clone();
799 iter.pos = 0;
800 for attr in iter {
801 if let Pin::Id(val) = attr? {
802 return Ok(val);
803 }
804 }
805 Err(ErrorContext::new_missing(
806 "Pin",
807 "Id",
808 self.orig_loc,
809 self.buf.as_ptr() as usize,
810 ))
811 }
812 pub fn get_parent_id(&self) -> Result<u32, ErrorContext> {
813 let mut iter = self.clone();
814 iter.pos = 0;
815 for attr in iter {
816 if let Pin::ParentId(val) = attr? {
817 return Ok(val);
818 }
819 }
820 Err(ErrorContext::new_missing(
821 "Pin",
822 "ParentId",
823 self.orig_loc,
824 self.buf.as_ptr() as usize,
825 ))
826 }
827 pub fn get_module_name(&self) -> Result<&'a CStr, ErrorContext> {
828 let mut iter = self.clone();
829 iter.pos = 0;
830 for attr in iter {
831 if let Pin::ModuleName(val) = attr? {
832 return Ok(val);
833 }
834 }
835 Err(ErrorContext::new_missing(
836 "Pin",
837 "ModuleName",
838 self.orig_loc,
839 self.buf.as_ptr() as usize,
840 ))
841 }
842 pub fn get_pad(&self) -> Result<&'a [u8], ErrorContext> {
843 let mut iter = self.clone();
844 iter.pos = 0;
845 for attr in iter {
846 if let Pin::Pad(val) = attr? {
847 return Ok(val);
848 }
849 }
850 Err(ErrorContext::new_missing(
851 "Pin",
852 "Pad",
853 self.orig_loc,
854 self.buf.as_ptr() as usize,
855 ))
856 }
857 pub fn get_clock_id(&self) -> Result<u64, ErrorContext> {
858 let mut iter = self.clone();
859 iter.pos = 0;
860 for attr in iter {
861 if let Pin::ClockId(val) = attr? {
862 return Ok(val);
863 }
864 }
865 Err(ErrorContext::new_missing(
866 "Pin",
867 "ClockId",
868 self.orig_loc,
869 self.buf.as_ptr() as usize,
870 ))
871 }
872 pub fn get_board_label(&self) -> Result<&'a CStr, ErrorContext> {
873 let mut iter = self.clone();
874 iter.pos = 0;
875 for attr in iter {
876 if let Pin::BoardLabel(val) = attr? {
877 return Ok(val);
878 }
879 }
880 Err(ErrorContext::new_missing(
881 "Pin",
882 "BoardLabel",
883 self.orig_loc,
884 self.buf.as_ptr() as usize,
885 ))
886 }
887 pub fn get_panel_label(&self) -> Result<&'a CStr, ErrorContext> {
888 let mut iter = self.clone();
889 iter.pos = 0;
890 for attr in iter {
891 if let Pin::PanelLabel(val) = attr? {
892 return Ok(val);
893 }
894 }
895 Err(ErrorContext::new_missing(
896 "Pin",
897 "PanelLabel",
898 self.orig_loc,
899 self.buf.as_ptr() as usize,
900 ))
901 }
902 pub fn get_package_label(&self) -> Result<&'a CStr, ErrorContext> {
903 let mut iter = self.clone();
904 iter.pos = 0;
905 for attr in iter {
906 if let Pin::PackageLabel(val) = attr? {
907 return Ok(val);
908 }
909 }
910 Err(ErrorContext::new_missing(
911 "Pin",
912 "PackageLabel",
913 self.orig_loc,
914 self.buf.as_ptr() as usize,
915 ))
916 }
917 #[doc = "Associated type: [`PinType`] (enum)"]
918 pub fn get_type(&self) -> Result<u32, ErrorContext> {
919 let mut iter = self.clone();
920 iter.pos = 0;
921 for attr in iter {
922 if let Pin::Type(val) = attr? {
923 return Ok(val);
924 }
925 }
926 Err(ErrorContext::new_missing(
927 "Pin",
928 "Type",
929 self.orig_loc,
930 self.buf.as_ptr() as usize,
931 ))
932 }
933 #[doc = "Associated type: [`PinDirection`] (enum)"]
934 pub fn get_direction(&self) -> Result<u32, ErrorContext> {
935 let mut iter = self.clone();
936 iter.pos = 0;
937 for attr in iter {
938 if let Pin::Direction(val) = attr? {
939 return Ok(val);
940 }
941 }
942 Err(ErrorContext::new_missing(
943 "Pin",
944 "Direction",
945 self.orig_loc,
946 self.buf.as_ptr() as usize,
947 ))
948 }
949 pub fn get_frequency(&self) -> Result<u64, ErrorContext> {
950 let mut iter = self.clone();
951 iter.pos = 0;
952 for attr in iter {
953 if let Pin::Frequency(val) = attr? {
954 return Ok(val);
955 }
956 }
957 Err(ErrorContext::new_missing(
958 "Pin",
959 "Frequency",
960 self.orig_loc,
961 self.buf.as_ptr() as usize,
962 ))
963 }
964 #[doc = "Attribute may repeat multiple times (treat it as array)"]
965 pub fn get_frequency_supported(
966 &self,
967 ) -> MultiAttrIterable<Self, Pin<'a>, IterableFrequencyRange<'a>> {
968 MultiAttrIterable::new(self.clone(), |variant| {
969 if let Pin::FrequencySupported(val) = variant {
970 Some(val)
971 } else {
972 None
973 }
974 })
975 }
976 pub fn get_frequency_min(&self) -> Result<u64, ErrorContext> {
977 let mut iter = self.clone();
978 iter.pos = 0;
979 for attr in iter {
980 if let Pin::FrequencyMin(val) = attr? {
981 return Ok(val);
982 }
983 }
984 Err(ErrorContext::new_missing(
985 "Pin",
986 "FrequencyMin",
987 self.orig_loc,
988 self.buf.as_ptr() as usize,
989 ))
990 }
991 pub fn get_frequency_max(&self) -> Result<u64, ErrorContext> {
992 let mut iter = self.clone();
993 iter.pos = 0;
994 for attr in iter {
995 if let Pin::FrequencyMax(val) = attr? {
996 return Ok(val);
997 }
998 }
999 Err(ErrorContext::new_missing(
1000 "Pin",
1001 "FrequencyMax",
1002 self.orig_loc,
1003 self.buf.as_ptr() as usize,
1004 ))
1005 }
1006 pub fn get_prio(&self) -> Result<u32, ErrorContext> {
1007 let mut iter = self.clone();
1008 iter.pos = 0;
1009 for attr in iter {
1010 if let Pin::Prio(val) = attr? {
1011 return Ok(val);
1012 }
1013 }
1014 Err(ErrorContext::new_missing(
1015 "Pin",
1016 "Prio",
1017 self.orig_loc,
1018 self.buf.as_ptr() as usize,
1019 ))
1020 }
1021 #[doc = "Associated type: [`PinState`] (enum)"]
1022 pub fn get_state(&self) -> Result<u32, ErrorContext> {
1023 let mut iter = self.clone();
1024 iter.pos = 0;
1025 for attr in iter {
1026 if let Pin::State(val) = attr? {
1027 return Ok(val);
1028 }
1029 }
1030 Err(ErrorContext::new_missing(
1031 "Pin",
1032 "State",
1033 self.orig_loc,
1034 self.buf.as_ptr() as usize,
1035 ))
1036 }
1037 #[doc = "Associated type: [`PinCapabilities`] (enum)"]
1038 pub fn get_capabilities(&self) -> Result<u32, ErrorContext> {
1039 let mut iter = self.clone();
1040 iter.pos = 0;
1041 for attr in iter {
1042 if let Pin::Capabilities(val) = attr? {
1043 return Ok(val);
1044 }
1045 }
1046 Err(ErrorContext::new_missing(
1047 "Pin",
1048 "Capabilities",
1049 self.orig_loc,
1050 self.buf.as_ptr() as usize,
1051 ))
1052 }
1053 #[doc = "Attribute may repeat multiple times (treat it as array)"]
1054 pub fn get_parent_device(
1055 &self,
1056 ) -> MultiAttrIterable<Self, Pin<'a>, IterablePinParentDevice<'a>> {
1057 MultiAttrIterable::new(self.clone(), |variant| {
1058 if let Pin::ParentDevice(val) = variant {
1059 Some(val)
1060 } else {
1061 None
1062 }
1063 })
1064 }
1065 #[doc = "Attribute may repeat multiple times (treat it as array)"]
1066 pub fn get_parent_pin(&self) -> MultiAttrIterable<Self, Pin<'a>, IterablePinParentPin<'a>> {
1067 MultiAttrIterable::new(self.clone(), |variant| {
1068 if let Pin::ParentPin(val) = variant {
1069 Some(val)
1070 } else {
1071 None
1072 }
1073 })
1074 }
1075 pub fn get_phase_adjust_min(&self) -> Result<i32, ErrorContext> {
1076 let mut iter = self.clone();
1077 iter.pos = 0;
1078 for attr in iter {
1079 if let Pin::PhaseAdjustMin(val) = attr? {
1080 return Ok(val);
1081 }
1082 }
1083 Err(ErrorContext::new_missing(
1084 "Pin",
1085 "PhaseAdjustMin",
1086 self.orig_loc,
1087 self.buf.as_ptr() as usize,
1088 ))
1089 }
1090 pub fn get_phase_adjust_max(&self) -> Result<i32, ErrorContext> {
1091 let mut iter = self.clone();
1092 iter.pos = 0;
1093 for attr in iter {
1094 if let Pin::PhaseAdjustMax(val) = attr? {
1095 return Ok(val);
1096 }
1097 }
1098 Err(ErrorContext::new_missing(
1099 "Pin",
1100 "PhaseAdjustMax",
1101 self.orig_loc,
1102 self.buf.as_ptr() as usize,
1103 ))
1104 }
1105 pub fn get_phase_adjust(&self) -> Result<i32, ErrorContext> {
1106 let mut iter = self.clone();
1107 iter.pos = 0;
1108 for attr in iter {
1109 if let Pin::PhaseAdjust(val) = attr? {
1110 return Ok(val);
1111 }
1112 }
1113 Err(ErrorContext::new_missing(
1114 "Pin",
1115 "PhaseAdjust",
1116 self.orig_loc,
1117 self.buf.as_ptr() as usize,
1118 ))
1119 }
1120 pub fn get_phase_offset(&self) -> Result<i64, ErrorContext> {
1121 let mut iter = self.clone();
1122 iter.pos = 0;
1123 for attr in iter {
1124 if let Pin::PhaseOffset(val) = attr? {
1125 return Ok(val);
1126 }
1127 }
1128 Err(ErrorContext::new_missing(
1129 "Pin",
1130 "PhaseOffset",
1131 self.orig_loc,
1132 self.buf.as_ptr() as usize,
1133 ))
1134 }
1135 #[doc = "The FFO (Fractional Frequency Offset) between the RX and TX\nsymbol rate on the media associated with the pin:\n(rx\\_frequency\\-tx\\_frequency)/rx\\_frequency\nValue is in PPM (parts per million)\\.\nThis may be implemented for example for pin of type\nPIN\\_TYPE\\_SYNCE\\_ETH\\_PORT\\.\n"]
1136 pub fn get_fractional_frequency_offset(&self) -> Result<i32, ErrorContext> {
1137 let mut iter = self.clone();
1138 iter.pos = 0;
1139 for attr in iter {
1140 if let Pin::FractionalFrequencyOffset(val) = attr? {
1141 return Ok(val);
1142 }
1143 }
1144 Err(ErrorContext::new_missing(
1145 "Pin",
1146 "FractionalFrequencyOffset",
1147 self.orig_loc,
1148 self.buf.as_ptr() as usize,
1149 ))
1150 }
1151 #[doc = "Frequency of Embedded SYNC signal\\. If provided, the pin is configured\nwith a SYNC signal embedded into its base clock frequency\\.\n"]
1152 pub fn get_esync_frequency(&self) -> Result<u64, ErrorContext> {
1153 let mut iter = self.clone();
1154 iter.pos = 0;
1155 for attr in iter {
1156 if let Pin::EsyncFrequency(val) = attr? {
1157 return Ok(val);
1158 }
1159 }
1160 Err(ErrorContext::new_missing(
1161 "Pin",
1162 "EsyncFrequency",
1163 self.orig_loc,
1164 self.buf.as_ptr() as usize,
1165 ))
1166 }
1167 #[doc = "If provided a pin is capable of embedding a SYNC signal (within given\nrange) into its base frequency signal\\.\n\nAttribute may repeat multiple times (treat it as array)"]
1168 pub fn get_esync_frequency_supported(
1169 &self,
1170 ) -> MultiAttrIterable<Self, Pin<'a>, IterableFrequencyRange<'a>> {
1171 MultiAttrIterable::new(self.clone(), |variant| {
1172 if let Pin::EsyncFrequencySupported(val) = variant {
1173 Some(val)
1174 } else {
1175 None
1176 }
1177 })
1178 }
1179 #[doc = "A ratio of high to low state of a SYNC signal pulse embedded\ninto base clock frequency\\. Value is in percents\\.\n"]
1180 pub fn get_esync_pulse(&self) -> Result<u32, ErrorContext> {
1181 let mut iter = self.clone();
1182 iter.pos = 0;
1183 for attr in iter {
1184 if let Pin::EsyncPulse(val) = attr? {
1185 return Ok(val);
1186 }
1187 }
1188 Err(ErrorContext::new_missing(
1189 "Pin",
1190 "EsyncPulse",
1191 self.orig_loc,
1192 self.buf.as_ptr() as usize,
1193 ))
1194 }
1195 #[doc = "Capable pin provides list of pins that can be bound to create a\nreference\\-sync pin pair\\.\n\nAttribute may repeat multiple times (treat it as array)"]
1196 pub fn get_reference_sync(
1197 &self,
1198 ) -> MultiAttrIterable<Self, Pin<'a>, IterableReferenceSync<'a>> {
1199 MultiAttrIterable::new(self.clone(), |variant| {
1200 if let Pin::ReferenceSync(val) = variant {
1201 Some(val)
1202 } else {
1203 None
1204 }
1205 })
1206 }
1207 #[doc = "Granularity of phase adjustment, in picoseconds\\. The value of\nphase adjustment must be a multiple of this granularity\\.\n"]
1208 pub fn get_phase_adjust_gran(&self) -> Result<u32, ErrorContext> {
1209 let mut iter = self.clone();
1210 iter.pos = 0;
1211 for attr in iter {
1212 if let Pin::PhaseAdjustGran(val) = attr? {
1213 return Ok(val);
1214 }
1215 }
1216 Err(ErrorContext::new_missing(
1217 "Pin",
1218 "PhaseAdjustGran",
1219 self.orig_loc,
1220 self.buf.as_ptr() as usize,
1221 ))
1222 }
1223 #[doc = "The FFO (Fractional Frequency Offset) of the pin with respect to\nthe nominal frequency\\.\nValue = (frequency\\_measured \\- frequency\\_nominal) / frequency\\_nominal\nValue is in PPT (parts per trillion, 10^\\-12)\\.\nNote: This attribute provides higher resolution than the standard\nfractional\\-frequency\\-offset (which is in PPM)\\.\n"]
1224 pub fn get_fractional_frequency_offset_ppt(&self) -> Result<i32, ErrorContext> {
1225 let mut iter = self.clone();
1226 iter.pos = 0;
1227 for attr in iter {
1228 if let Pin::FractionalFrequencyOffsetPpt(val) = attr? {
1229 return Ok(val);
1230 }
1231 }
1232 Err(ErrorContext::new_missing(
1233 "Pin",
1234 "FractionalFrequencyOffsetPpt",
1235 self.orig_loc,
1236 self.buf.as_ptr() as usize,
1237 ))
1238 }
1239}
1240impl Pin<'_> {
1241 pub fn new<'a>(buf: &'a [u8]) -> IterablePin<'a> {
1242 IterablePin::with_loc(buf, buf.as_ptr() as usize)
1243 }
1244 fn attr_from_type(r#type: u16) -> Option<&'static str> {
1245 let res = match r#type {
1246 1u16 => "Id",
1247 2u16 => "ParentId",
1248 3u16 => "ModuleName",
1249 4u16 => "Pad",
1250 5u16 => "ClockId",
1251 6u16 => "BoardLabel",
1252 7u16 => "PanelLabel",
1253 8u16 => "PackageLabel",
1254 9u16 => "Type",
1255 10u16 => "Direction",
1256 11u16 => "Frequency",
1257 12u16 => "FrequencySupported",
1258 13u16 => "FrequencyMin",
1259 14u16 => "FrequencyMax",
1260 15u16 => "Prio",
1261 16u16 => "State",
1262 17u16 => "Capabilities",
1263 18u16 => "ParentDevice",
1264 19u16 => "ParentPin",
1265 20u16 => "PhaseAdjustMin",
1266 21u16 => "PhaseAdjustMax",
1267 22u16 => "PhaseAdjust",
1268 23u16 => "PhaseOffset",
1269 24u16 => "FractionalFrequencyOffset",
1270 25u16 => "EsyncFrequency",
1271 26u16 => "EsyncFrequencySupported",
1272 27u16 => "EsyncPulse",
1273 28u16 => "ReferenceSync",
1274 29u16 => "PhaseAdjustGran",
1275 30u16 => "FractionalFrequencyOffsetPpt",
1276 _ => return None,
1277 };
1278 Some(res)
1279 }
1280}
1281#[derive(Clone, Copy, Default)]
1282pub struct IterablePin<'a> {
1283 buf: &'a [u8],
1284 pos: usize,
1285 orig_loc: usize,
1286}
1287impl<'a> IterablePin<'a> {
1288 fn with_loc(buf: &'a [u8], orig_loc: usize) -> Self {
1289 Self {
1290 buf,
1291 pos: 0,
1292 orig_loc,
1293 }
1294 }
1295 pub fn get_buf(&self) -> &'a [u8] {
1296 self.buf
1297 }
1298}
1299impl<'a> Iterator for IterablePin<'a> {
1300 type Item = Result<Pin<'a>, ErrorContext>;
1301 fn next(&mut self) -> Option<Self::Item> {
1302 let pos = self.pos;
1303 let mut r#type;
1304 loop {
1305 r#type = None;
1306 if self.buf.len() == self.pos {
1307 return None;
1308 }
1309 let Some((header, next)) = chop_header(self.buf, &mut self.pos) else {
1310 break;
1311 };
1312 r#type = Some(header.r#type);
1313 let res = match header.r#type {
1314 1u16 => Pin::Id({
1315 let res = parse_u32(next);
1316 let Some(val) = res else { break };
1317 val
1318 }),
1319 2u16 => Pin::ParentId({
1320 let res = parse_u32(next);
1321 let Some(val) = res else { break };
1322 val
1323 }),
1324 3u16 => Pin::ModuleName({
1325 let res = CStr::from_bytes_with_nul(next).ok();
1326 let Some(val) = res else { break };
1327 val
1328 }),
1329 4u16 => Pin::Pad({
1330 let res = Some(next);
1331 let Some(val) = res else { break };
1332 val
1333 }),
1334 5u16 => Pin::ClockId({
1335 let res = parse_u64(next);
1336 let Some(val) = res else { break };
1337 val
1338 }),
1339 6u16 => Pin::BoardLabel({
1340 let res = CStr::from_bytes_with_nul(next).ok();
1341 let Some(val) = res else { break };
1342 val
1343 }),
1344 7u16 => Pin::PanelLabel({
1345 let res = CStr::from_bytes_with_nul(next).ok();
1346 let Some(val) = res else { break };
1347 val
1348 }),
1349 8u16 => Pin::PackageLabel({
1350 let res = CStr::from_bytes_with_nul(next).ok();
1351 let Some(val) = res else { break };
1352 val
1353 }),
1354 9u16 => Pin::Type({
1355 let res = parse_u32(next);
1356 let Some(val) = res else { break };
1357 val
1358 }),
1359 10u16 => Pin::Direction({
1360 let res = parse_u32(next);
1361 let Some(val) = res else { break };
1362 val
1363 }),
1364 11u16 => Pin::Frequency({
1365 let res = parse_u64(next);
1366 let Some(val) = res else { break };
1367 val
1368 }),
1369 12u16 => Pin::FrequencySupported({
1370 let res = Some(IterableFrequencyRange::with_loc(next, self.orig_loc));
1371 let Some(val) = res else { break };
1372 val
1373 }),
1374 13u16 => Pin::FrequencyMin({
1375 let res = parse_u64(next);
1376 let Some(val) = res else { break };
1377 val
1378 }),
1379 14u16 => Pin::FrequencyMax({
1380 let res = parse_u64(next);
1381 let Some(val) = res else { break };
1382 val
1383 }),
1384 15u16 => Pin::Prio({
1385 let res = parse_u32(next);
1386 let Some(val) = res else { break };
1387 val
1388 }),
1389 16u16 => Pin::State({
1390 let res = parse_u32(next);
1391 let Some(val) = res else { break };
1392 val
1393 }),
1394 17u16 => Pin::Capabilities({
1395 let res = parse_u32(next);
1396 let Some(val) = res else { break };
1397 val
1398 }),
1399 18u16 => Pin::ParentDevice({
1400 let res = Some(IterablePinParentDevice::with_loc(next, self.orig_loc));
1401 let Some(val) = res else { break };
1402 val
1403 }),
1404 19u16 => Pin::ParentPin({
1405 let res = Some(IterablePinParentPin::with_loc(next, self.orig_loc));
1406 let Some(val) = res else { break };
1407 val
1408 }),
1409 20u16 => Pin::PhaseAdjustMin({
1410 let res = parse_i32(next);
1411 let Some(val) = res else { break };
1412 val
1413 }),
1414 21u16 => Pin::PhaseAdjustMax({
1415 let res = parse_i32(next);
1416 let Some(val) = res else { break };
1417 val
1418 }),
1419 22u16 => Pin::PhaseAdjust({
1420 let res = parse_i32(next);
1421 let Some(val) = res else { break };
1422 val
1423 }),
1424 23u16 => Pin::PhaseOffset({
1425 let res = parse_i64(next);
1426 let Some(val) = res else { break };
1427 val
1428 }),
1429 24u16 => Pin::FractionalFrequencyOffset({
1430 let res = parse_i32(next);
1431 let Some(val) = res else { break };
1432 val
1433 }),
1434 25u16 => Pin::EsyncFrequency({
1435 let res = parse_u64(next);
1436 let Some(val) = res else { break };
1437 val
1438 }),
1439 26u16 => Pin::EsyncFrequencySupported({
1440 let res = Some(IterableFrequencyRange::with_loc(next, self.orig_loc));
1441 let Some(val) = res else { break };
1442 val
1443 }),
1444 27u16 => Pin::EsyncPulse({
1445 let res = parse_u32(next);
1446 let Some(val) = res else { break };
1447 val
1448 }),
1449 28u16 => Pin::ReferenceSync({
1450 let res = Some(IterableReferenceSync::with_loc(next, self.orig_loc));
1451 let Some(val) = res else { break };
1452 val
1453 }),
1454 29u16 => Pin::PhaseAdjustGran({
1455 let res = parse_u32(next);
1456 let Some(val) = res else { break };
1457 val
1458 }),
1459 30u16 => Pin::FractionalFrequencyOffsetPpt({
1460 let res = parse_i32(next);
1461 let Some(val) = res else { break };
1462 val
1463 }),
1464 n if cfg!(any(test, feature = "deny-unknown-attrs")) => break,
1465 n => continue,
1466 };
1467 return Some(Ok(res));
1468 }
1469 Some(Err(ErrorContext::new(
1470 "Pin",
1471 r#type.and_then(|t| Pin::attr_from_type(t)),
1472 self.orig_loc,
1473 self.buf.as_ptr().wrapping_add(pos) as usize,
1474 )))
1475 }
1476}
1477impl<'a> std::fmt::Debug for IterablePin<'_> {
1478 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1479 let mut fmt = f.debug_struct("Pin");
1480 for attr in self.clone() {
1481 let attr = match attr {
1482 Ok(a) => a,
1483 Err(err) => {
1484 fmt.finish()?;
1485 f.write_str("Err(")?;
1486 err.fmt(f)?;
1487 return f.write_str(")");
1488 }
1489 };
1490 match attr {
1491 Pin::Id(val) => fmt.field("Id", &val),
1492 Pin::ParentId(val) => fmt.field("ParentId", &val),
1493 Pin::ModuleName(val) => fmt.field("ModuleName", &val),
1494 Pin::Pad(val) => fmt.field("Pad", &val),
1495 Pin::ClockId(val) => fmt.field("ClockId", &val),
1496 Pin::BoardLabel(val) => fmt.field("BoardLabel", &val),
1497 Pin::PanelLabel(val) => fmt.field("PanelLabel", &val),
1498 Pin::PackageLabel(val) => fmt.field("PackageLabel", &val),
1499 Pin::Type(val) => fmt.field("Type", &FormatEnum(val.into(), PinType::from_value)),
1500 Pin::Direction(val) => fmt.field(
1501 "Direction",
1502 &FormatEnum(val.into(), PinDirection::from_value),
1503 ),
1504 Pin::Frequency(val) => fmt.field("Frequency", &val),
1505 Pin::FrequencySupported(val) => fmt.field("FrequencySupported", &val),
1506 Pin::FrequencyMin(val) => fmt.field("FrequencyMin", &val),
1507 Pin::FrequencyMax(val) => fmt.field("FrequencyMax", &val),
1508 Pin::Prio(val) => fmt.field("Prio", &val),
1509 Pin::State(val) => {
1510 fmt.field("State", &FormatEnum(val.into(), PinState::from_value))
1511 }
1512 Pin::Capabilities(val) => fmt.field(
1513 "Capabilities",
1514 &FormatFlags(val.into(), PinCapabilities::from_value),
1515 ),
1516 Pin::ParentDevice(val) => fmt.field("ParentDevice", &val),
1517 Pin::ParentPin(val) => fmt.field("ParentPin", &val),
1518 Pin::PhaseAdjustMin(val) => fmt.field("PhaseAdjustMin", &val),
1519 Pin::PhaseAdjustMax(val) => fmt.field("PhaseAdjustMax", &val),
1520 Pin::PhaseAdjust(val) => fmt.field("PhaseAdjust", &val),
1521 Pin::PhaseOffset(val) => fmt.field("PhaseOffset", &val),
1522 Pin::FractionalFrequencyOffset(val) => fmt.field("FractionalFrequencyOffset", &val),
1523 Pin::EsyncFrequency(val) => fmt.field("EsyncFrequency", &val),
1524 Pin::EsyncFrequencySupported(val) => fmt.field("EsyncFrequencySupported", &val),
1525 Pin::EsyncPulse(val) => fmt.field("EsyncPulse", &val),
1526 Pin::ReferenceSync(val) => fmt.field("ReferenceSync", &val),
1527 Pin::PhaseAdjustGran(val) => fmt.field("PhaseAdjustGran", &val),
1528 Pin::FractionalFrequencyOffsetPpt(val) => {
1529 fmt.field("FractionalFrequencyOffsetPpt", &val)
1530 }
1531 };
1532 }
1533 fmt.finish()
1534 }
1535}
1536impl IterablePin<'_> {
1537 pub fn lookup_attr(
1538 &self,
1539 offset: usize,
1540 missing_type: Option<u16>,
1541 ) -> (Vec<(&'static str, usize)>, Option<&'static str>) {
1542 let mut stack = Vec::new();
1543 let cur = ErrorContext::calc_offset(self.orig_loc, self.buf.as_ptr() as usize);
1544 if missing_type.is_some() && cur == offset {
1545 stack.push(("Pin", offset));
1546 return (stack, missing_type.and_then(|t| Pin::attr_from_type(t)));
1547 }
1548 if cur > offset || cur + self.buf.len() < offset {
1549 return (stack, None);
1550 }
1551 let mut attrs = self.clone();
1552 let mut last_off = cur + attrs.pos;
1553 let mut missing = None;
1554 while let Some(attr) = attrs.next() {
1555 let Ok(attr) = attr else { break };
1556 match attr {
1557 Pin::Id(val) => {
1558 if last_off == offset {
1559 stack.push(("Id", last_off));
1560 break;
1561 }
1562 }
1563 Pin::ParentId(val) => {
1564 if last_off == offset {
1565 stack.push(("ParentId", last_off));
1566 break;
1567 }
1568 }
1569 Pin::ModuleName(val) => {
1570 if last_off == offset {
1571 stack.push(("ModuleName", last_off));
1572 break;
1573 }
1574 }
1575 Pin::Pad(val) => {
1576 if last_off == offset {
1577 stack.push(("Pad", last_off));
1578 break;
1579 }
1580 }
1581 Pin::ClockId(val) => {
1582 if last_off == offset {
1583 stack.push(("ClockId", last_off));
1584 break;
1585 }
1586 }
1587 Pin::BoardLabel(val) => {
1588 if last_off == offset {
1589 stack.push(("BoardLabel", last_off));
1590 break;
1591 }
1592 }
1593 Pin::PanelLabel(val) => {
1594 if last_off == offset {
1595 stack.push(("PanelLabel", last_off));
1596 break;
1597 }
1598 }
1599 Pin::PackageLabel(val) => {
1600 if last_off == offset {
1601 stack.push(("PackageLabel", last_off));
1602 break;
1603 }
1604 }
1605 Pin::Type(val) => {
1606 if last_off == offset {
1607 stack.push(("Type", last_off));
1608 break;
1609 }
1610 }
1611 Pin::Direction(val) => {
1612 if last_off == offset {
1613 stack.push(("Direction", last_off));
1614 break;
1615 }
1616 }
1617 Pin::Frequency(val) => {
1618 if last_off == offset {
1619 stack.push(("Frequency", last_off));
1620 break;
1621 }
1622 }
1623 Pin::FrequencySupported(val) => {
1624 (stack, missing) = val.lookup_attr(offset, missing_type);
1625 if !stack.is_empty() {
1626 break;
1627 }
1628 }
1629 Pin::FrequencyMin(val) => {
1630 if last_off == offset {
1631 stack.push(("FrequencyMin", last_off));
1632 break;
1633 }
1634 }
1635 Pin::FrequencyMax(val) => {
1636 if last_off == offset {
1637 stack.push(("FrequencyMax", last_off));
1638 break;
1639 }
1640 }
1641 Pin::Prio(val) => {
1642 if last_off == offset {
1643 stack.push(("Prio", last_off));
1644 break;
1645 }
1646 }
1647 Pin::State(val) => {
1648 if last_off == offset {
1649 stack.push(("State", last_off));
1650 break;
1651 }
1652 }
1653 Pin::Capabilities(val) => {
1654 if last_off == offset {
1655 stack.push(("Capabilities", last_off));
1656 break;
1657 }
1658 }
1659 Pin::ParentDevice(val) => {
1660 (stack, missing) = val.lookup_attr(offset, missing_type);
1661 if !stack.is_empty() {
1662 break;
1663 }
1664 }
1665 Pin::ParentPin(val) => {
1666 (stack, missing) = val.lookup_attr(offset, missing_type);
1667 if !stack.is_empty() {
1668 break;
1669 }
1670 }
1671 Pin::PhaseAdjustMin(val) => {
1672 if last_off == offset {
1673 stack.push(("PhaseAdjustMin", last_off));
1674 break;
1675 }
1676 }
1677 Pin::PhaseAdjustMax(val) => {
1678 if last_off == offset {
1679 stack.push(("PhaseAdjustMax", last_off));
1680 break;
1681 }
1682 }
1683 Pin::PhaseAdjust(val) => {
1684 if last_off == offset {
1685 stack.push(("PhaseAdjust", last_off));
1686 break;
1687 }
1688 }
1689 Pin::PhaseOffset(val) => {
1690 if last_off == offset {
1691 stack.push(("PhaseOffset", last_off));
1692 break;
1693 }
1694 }
1695 Pin::FractionalFrequencyOffset(val) => {
1696 if last_off == offset {
1697 stack.push(("FractionalFrequencyOffset", last_off));
1698 break;
1699 }
1700 }
1701 Pin::EsyncFrequency(val) => {
1702 if last_off == offset {
1703 stack.push(("EsyncFrequency", last_off));
1704 break;
1705 }
1706 }
1707 Pin::EsyncFrequencySupported(val) => {
1708 (stack, missing) = val.lookup_attr(offset, missing_type);
1709 if !stack.is_empty() {
1710 break;
1711 }
1712 }
1713 Pin::EsyncPulse(val) => {
1714 if last_off == offset {
1715 stack.push(("EsyncPulse", last_off));
1716 break;
1717 }
1718 }
1719 Pin::ReferenceSync(val) => {
1720 (stack, missing) = val.lookup_attr(offset, missing_type);
1721 if !stack.is_empty() {
1722 break;
1723 }
1724 }
1725 Pin::PhaseAdjustGran(val) => {
1726 if last_off == offset {
1727 stack.push(("PhaseAdjustGran", last_off));
1728 break;
1729 }
1730 }
1731 Pin::FractionalFrequencyOffsetPpt(val) => {
1732 if last_off == offset {
1733 stack.push(("FractionalFrequencyOffsetPpt", last_off));
1734 break;
1735 }
1736 }
1737 _ => {}
1738 };
1739 last_off = cur + attrs.pos;
1740 }
1741 if !stack.is_empty() {
1742 stack.push(("Pin", cur));
1743 }
1744 (stack, missing)
1745 }
1746}
1747#[derive(Clone)]
1748pub enum PinParentDevice {
1749 ParentId(u32),
1750 #[doc = "Associated type: [`PinDirection`] (enum)"]
1751 Direction(u32),
1752 Prio(u32),
1753 #[doc = "Associated type: [`PinState`] (enum)"]
1754 State(u32),
1755 PhaseOffset(i64),
1756}
1757impl<'a> IterablePinParentDevice<'a> {
1758 pub fn get_parent_id(&self) -> Result<u32, ErrorContext> {
1759 let mut iter = self.clone();
1760 iter.pos = 0;
1761 for attr in iter {
1762 if let PinParentDevice::ParentId(val) = attr? {
1763 return Ok(val);
1764 }
1765 }
1766 Err(ErrorContext::new_missing(
1767 "PinParentDevice",
1768 "ParentId",
1769 self.orig_loc,
1770 self.buf.as_ptr() as usize,
1771 ))
1772 }
1773 #[doc = "Associated type: [`PinDirection`] (enum)"]
1774 pub fn get_direction(&self) -> Result<u32, ErrorContext> {
1775 let mut iter = self.clone();
1776 iter.pos = 0;
1777 for attr in iter {
1778 if let PinParentDevice::Direction(val) = attr? {
1779 return Ok(val);
1780 }
1781 }
1782 Err(ErrorContext::new_missing(
1783 "PinParentDevice",
1784 "Direction",
1785 self.orig_loc,
1786 self.buf.as_ptr() as usize,
1787 ))
1788 }
1789 pub fn get_prio(&self) -> Result<u32, ErrorContext> {
1790 let mut iter = self.clone();
1791 iter.pos = 0;
1792 for attr in iter {
1793 if let PinParentDevice::Prio(val) = attr? {
1794 return Ok(val);
1795 }
1796 }
1797 Err(ErrorContext::new_missing(
1798 "PinParentDevice",
1799 "Prio",
1800 self.orig_loc,
1801 self.buf.as_ptr() as usize,
1802 ))
1803 }
1804 #[doc = "Associated type: [`PinState`] (enum)"]
1805 pub fn get_state(&self) -> Result<u32, ErrorContext> {
1806 let mut iter = self.clone();
1807 iter.pos = 0;
1808 for attr in iter {
1809 if let PinParentDevice::State(val) = attr? {
1810 return Ok(val);
1811 }
1812 }
1813 Err(ErrorContext::new_missing(
1814 "PinParentDevice",
1815 "State",
1816 self.orig_loc,
1817 self.buf.as_ptr() as usize,
1818 ))
1819 }
1820 pub fn get_phase_offset(&self) -> Result<i64, ErrorContext> {
1821 let mut iter = self.clone();
1822 iter.pos = 0;
1823 for attr in iter {
1824 if let PinParentDevice::PhaseOffset(val) = attr? {
1825 return Ok(val);
1826 }
1827 }
1828 Err(ErrorContext::new_missing(
1829 "PinParentDevice",
1830 "PhaseOffset",
1831 self.orig_loc,
1832 self.buf.as_ptr() as usize,
1833 ))
1834 }
1835}
1836impl PinParentDevice {
1837 pub fn new<'a>(buf: &'a [u8]) -> IterablePinParentDevice<'a> {
1838 IterablePinParentDevice::with_loc(buf, buf.as_ptr() as usize)
1839 }
1840 fn attr_from_type(r#type: u16) -> Option<&'static str> {
1841 Pin::attr_from_type(r#type)
1842 }
1843}
1844#[derive(Clone, Copy, Default)]
1845pub struct IterablePinParentDevice<'a> {
1846 buf: &'a [u8],
1847 pos: usize,
1848 orig_loc: usize,
1849}
1850impl<'a> IterablePinParentDevice<'a> {
1851 fn with_loc(buf: &'a [u8], orig_loc: usize) -> Self {
1852 Self {
1853 buf,
1854 pos: 0,
1855 orig_loc,
1856 }
1857 }
1858 pub fn get_buf(&self) -> &'a [u8] {
1859 self.buf
1860 }
1861}
1862impl<'a> Iterator for IterablePinParentDevice<'a> {
1863 type Item = Result<PinParentDevice, ErrorContext>;
1864 fn next(&mut self) -> Option<Self::Item> {
1865 let pos = self.pos;
1866 let mut r#type;
1867 loop {
1868 r#type = None;
1869 if self.buf.len() == self.pos {
1870 return None;
1871 }
1872 let Some((header, next)) = chop_header(self.buf, &mut self.pos) else {
1873 break;
1874 };
1875 r#type = Some(header.r#type);
1876 let res = match header.r#type {
1877 2u16 => PinParentDevice::ParentId({
1878 let res = parse_u32(next);
1879 let Some(val) = res else { break };
1880 val
1881 }),
1882 10u16 => PinParentDevice::Direction({
1883 let res = parse_u32(next);
1884 let Some(val) = res else { break };
1885 val
1886 }),
1887 15u16 => PinParentDevice::Prio({
1888 let res = parse_u32(next);
1889 let Some(val) = res else { break };
1890 val
1891 }),
1892 16u16 => PinParentDevice::State({
1893 let res = parse_u32(next);
1894 let Some(val) = res else { break };
1895 val
1896 }),
1897 23u16 => PinParentDevice::PhaseOffset({
1898 let res = parse_i64(next);
1899 let Some(val) = res else { break };
1900 val
1901 }),
1902 n if cfg!(any(test, feature = "deny-unknown-attrs")) => break,
1903 n => continue,
1904 };
1905 return Some(Ok(res));
1906 }
1907 Some(Err(ErrorContext::new(
1908 "PinParentDevice",
1909 r#type.and_then(|t| PinParentDevice::attr_from_type(t)),
1910 self.orig_loc,
1911 self.buf.as_ptr().wrapping_add(pos) as usize,
1912 )))
1913 }
1914}
1915impl std::fmt::Debug for IterablePinParentDevice<'_> {
1916 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1917 let mut fmt = f.debug_struct("PinParentDevice");
1918 for attr in self.clone() {
1919 let attr = match attr {
1920 Ok(a) => a,
1921 Err(err) => {
1922 fmt.finish()?;
1923 f.write_str("Err(")?;
1924 err.fmt(f)?;
1925 return f.write_str(")");
1926 }
1927 };
1928 match attr {
1929 PinParentDevice::ParentId(val) => fmt.field("ParentId", &val),
1930 PinParentDevice::Direction(val) => fmt.field(
1931 "Direction",
1932 &FormatEnum(val.into(), PinDirection::from_value),
1933 ),
1934 PinParentDevice::Prio(val) => fmt.field("Prio", &val),
1935 PinParentDevice::State(val) => {
1936 fmt.field("State", &FormatEnum(val.into(), PinState::from_value))
1937 }
1938 PinParentDevice::PhaseOffset(val) => fmt.field("PhaseOffset", &val),
1939 };
1940 }
1941 fmt.finish()
1942 }
1943}
1944impl IterablePinParentDevice<'_> {
1945 pub fn lookup_attr(
1946 &self,
1947 offset: usize,
1948 missing_type: Option<u16>,
1949 ) -> (Vec<(&'static str, usize)>, Option<&'static str>) {
1950 let mut stack = Vec::new();
1951 let cur = ErrorContext::calc_offset(self.orig_loc, self.buf.as_ptr() as usize);
1952 if missing_type.is_some() && cur == offset {
1953 stack.push(("PinParentDevice", offset));
1954 return (
1955 stack,
1956 missing_type.and_then(|t| PinParentDevice::attr_from_type(t)),
1957 );
1958 }
1959 if cur > offset || cur + self.buf.len() < offset {
1960 return (stack, None);
1961 }
1962 let mut attrs = self.clone();
1963 let mut last_off = cur + attrs.pos;
1964 while let Some(attr) = attrs.next() {
1965 let Ok(attr) = attr else { break };
1966 match attr {
1967 PinParentDevice::ParentId(val) => {
1968 if last_off == offset {
1969 stack.push(("ParentId", last_off));
1970 break;
1971 }
1972 }
1973 PinParentDevice::Direction(val) => {
1974 if last_off == offset {
1975 stack.push(("Direction", last_off));
1976 break;
1977 }
1978 }
1979 PinParentDevice::Prio(val) => {
1980 if last_off == offset {
1981 stack.push(("Prio", last_off));
1982 break;
1983 }
1984 }
1985 PinParentDevice::State(val) => {
1986 if last_off == offset {
1987 stack.push(("State", last_off));
1988 break;
1989 }
1990 }
1991 PinParentDevice::PhaseOffset(val) => {
1992 if last_off == offset {
1993 stack.push(("PhaseOffset", last_off));
1994 break;
1995 }
1996 }
1997 _ => {}
1998 };
1999 last_off = cur + attrs.pos;
2000 }
2001 if !stack.is_empty() {
2002 stack.push(("PinParentDevice", cur));
2003 }
2004 (stack, None)
2005 }
2006}
2007#[derive(Clone)]
2008pub enum PinParentPin {
2009 ParentId(u32),
2010 #[doc = "Associated type: [`PinState`] (enum)"]
2011 State(u32),
2012}
2013impl<'a> IterablePinParentPin<'a> {
2014 pub fn get_parent_id(&self) -> Result<u32, ErrorContext> {
2015 let mut iter = self.clone();
2016 iter.pos = 0;
2017 for attr in iter {
2018 if let PinParentPin::ParentId(val) = attr? {
2019 return Ok(val);
2020 }
2021 }
2022 Err(ErrorContext::new_missing(
2023 "PinParentPin",
2024 "ParentId",
2025 self.orig_loc,
2026 self.buf.as_ptr() as usize,
2027 ))
2028 }
2029 #[doc = "Associated type: [`PinState`] (enum)"]
2030 pub fn get_state(&self) -> Result<u32, ErrorContext> {
2031 let mut iter = self.clone();
2032 iter.pos = 0;
2033 for attr in iter {
2034 if let PinParentPin::State(val) = attr? {
2035 return Ok(val);
2036 }
2037 }
2038 Err(ErrorContext::new_missing(
2039 "PinParentPin",
2040 "State",
2041 self.orig_loc,
2042 self.buf.as_ptr() as usize,
2043 ))
2044 }
2045}
2046impl PinParentPin {
2047 pub fn new<'a>(buf: &'a [u8]) -> IterablePinParentPin<'a> {
2048 IterablePinParentPin::with_loc(buf, buf.as_ptr() as usize)
2049 }
2050 fn attr_from_type(r#type: u16) -> Option<&'static str> {
2051 Pin::attr_from_type(r#type)
2052 }
2053}
2054#[derive(Clone, Copy, Default)]
2055pub struct IterablePinParentPin<'a> {
2056 buf: &'a [u8],
2057 pos: usize,
2058 orig_loc: usize,
2059}
2060impl<'a> IterablePinParentPin<'a> {
2061 fn with_loc(buf: &'a [u8], orig_loc: usize) -> Self {
2062 Self {
2063 buf,
2064 pos: 0,
2065 orig_loc,
2066 }
2067 }
2068 pub fn get_buf(&self) -> &'a [u8] {
2069 self.buf
2070 }
2071}
2072impl<'a> Iterator for IterablePinParentPin<'a> {
2073 type Item = Result<PinParentPin, ErrorContext>;
2074 fn next(&mut self) -> Option<Self::Item> {
2075 let pos = self.pos;
2076 let mut r#type;
2077 loop {
2078 r#type = None;
2079 if self.buf.len() == self.pos {
2080 return None;
2081 }
2082 let Some((header, next)) = chop_header(self.buf, &mut self.pos) else {
2083 break;
2084 };
2085 r#type = Some(header.r#type);
2086 let res = match header.r#type {
2087 2u16 => PinParentPin::ParentId({
2088 let res = parse_u32(next);
2089 let Some(val) = res else { break };
2090 val
2091 }),
2092 16u16 => PinParentPin::State({
2093 let res = parse_u32(next);
2094 let Some(val) = res else { break };
2095 val
2096 }),
2097 n if cfg!(any(test, feature = "deny-unknown-attrs")) => break,
2098 n => continue,
2099 };
2100 return Some(Ok(res));
2101 }
2102 Some(Err(ErrorContext::new(
2103 "PinParentPin",
2104 r#type.and_then(|t| PinParentPin::attr_from_type(t)),
2105 self.orig_loc,
2106 self.buf.as_ptr().wrapping_add(pos) as usize,
2107 )))
2108 }
2109}
2110impl std::fmt::Debug for IterablePinParentPin<'_> {
2111 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
2112 let mut fmt = f.debug_struct("PinParentPin");
2113 for attr in self.clone() {
2114 let attr = match attr {
2115 Ok(a) => a,
2116 Err(err) => {
2117 fmt.finish()?;
2118 f.write_str("Err(")?;
2119 err.fmt(f)?;
2120 return f.write_str(")");
2121 }
2122 };
2123 match attr {
2124 PinParentPin::ParentId(val) => fmt.field("ParentId", &val),
2125 PinParentPin::State(val) => {
2126 fmt.field("State", &FormatEnum(val.into(), PinState::from_value))
2127 }
2128 };
2129 }
2130 fmt.finish()
2131 }
2132}
2133impl IterablePinParentPin<'_> {
2134 pub fn lookup_attr(
2135 &self,
2136 offset: usize,
2137 missing_type: Option<u16>,
2138 ) -> (Vec<(&'static str, usize)>, Option<&'static str>) {
2139 let mut stack = Vec::new();
2140 let cur = ErrorContext::calc_offset(self.orig_loc, self.buf.as_ptr() as usize);
2141 if missing_type.is_some() && cur == offset {
2142 stack.push(("PinParentPin", offset));
2143 return (
2144 stack,
2145 missing_type.and_then(|t| PinParentPin::attr_from_type(t)),
2146 );
2147 }
2148 if cur > offset || cur + self.buf.len() < offset {
2149 return (stack, None);
2150 }
2151 let mut attrs = self.clone();
2152 let mut last_off = cur + attrs.pos;
2153 while let Some(attr) = attrs.next() {
2154 let Ok(attr) = attr else { break };
2155 match attr {
2156 PinParentPin::ParentId(val) => {
2157 if last_off == offset {
2158 stack.push(("ParentId", last_off));
2159 break;
2160 }
2161 }
2162 PinParentPin::State(val) => {
2163 if last_off == offset {
2164 stack.push(("State", last_off));
2165 break;
2166 }
2167 }
2168 _ => {}
2169 };
2170 last_off = cur + attrs.pos;
2171 }
2172 if !stack.is_empty() {
2173 stack.push(("PinParentPin", cur));
2174 }
2175 (stack, None)
2176 }
2177}
2178#[derive(Clone)]
2179pub enum FrequencyRange {
2180 FrequencyMin(u64),
2181 FrequencyMax(u64),
2182}
2183impl<'a> IterableFrequencyRange<'a> {
2184 pub fn get_frequency_min(&self) -> Result<u64, ErrorContext> {
2185 let mut iter = self.clone();
2186 iter.pos = 0;
2187 for attr in iter {
2188 if let FrequencyRange::FrequencyMin(val) = attr? {
2189 return Ok(val);
2190 }
2191 }
2192 Err(ErrorContext::new_missing(
2193 "FrequencyRange",
2194 "FrequencyMin",
2195 self.orig_loc,
2196 self.buf.as_ptr() as usize,
2197 ))
2198 }
2199 pub fn get_frequency_max(&self) -> Result<u64, ErrorContext> {
2200 let mut iter = self.clone();
2201 iter.pos = 0;
2202 for attr in iter {
2203 if let FrequencyRange::FrequencyMax(val) = attr? {
2204 return Ok(val);
2205 }
2206 }
2207 Err(ErrorContext::new_missing(
2208 "FrequencyRange",
2209 "FrequencyMax",
2210 self.orig_loc,
2211 self.buf.as_ptr() as usize,
2212 ))
2213 }
2214}
2215impl FrequencyRange {
2216 pub fn new<'a>(buf: &'a [u8]) -> IterableFrequencyRange<'a> {
2217 IterableFrequencyRange::with_loc(buf, buf.as_ptr() as usize)
2218 }
2219 fn attr_from_type(r#type: u16) -> Option<&'static str> {
2220 Pin::attr_from_type(r#type)
2221 }
2222}
2223#[derive(Clone, Copy, Default)]
2224pub struct IterableFrequencyRange<'a> {
2225 buf: &'a [u8],
2226 pos: usize,
2227 orig_loc: usize,
2228}
2229impl<'a> IterableFrequencyRange<'a> {
2230 fn with_loc(buf: &'a [u8], orig_loc: usize) -> Self {
2231 Self {
2232 buf,
2233 pos: 0,
2234 orig_loc,
2235 }
2236 }
2237 pub fn get_buf(&self) -> &'a [u8] {
2238 self.buf
2239 }
2240}
2241impl<'a> Iterator for IterableFrequencyRange<'a> {
2242 type Item = Result<FrequencyRange, ErrorContext>;
2243 fn next(&mut self) -> Option<Self::Item> {
2244 let pos = self.pos;
2245 let mut r#type;
2246 loop {
2247 r#type = None;
2248 if self.buf.len() == self.pos {
2249 return None;
2250 }
2251 let Some((header, next)) = chop_header(self.buf, &mut self.pos) else {
2252 break;
2253 };
2254 r#type = Some(header.r#type);
2255 let res = match header.r#type {
2256 13u16 => FrequencyRange::FrequencyMin({
2257 let res = parse_u64(next);
2258 let Some(val) = res else { break };
2259 val
2260 }),
2261 14u16 => FrequencyRange::FrequencyMax({
2262 let res = parse_u64(next);
2263 let Some(val) = res else { break };
2264 val
2265 }),
2266 n if cfg!(any(test, feature = "deny-unknown-attrs")) => break,
2267 n => continue,
2268 };
2269 return Some(Ok(res));
2270 }
2271 Some(Err(ErrorContext::new(
2272 "FrequencyRange",
2273 r#type.and_then(|t| FrequencyRange::attr_from_type(t)),
2274 self.orig_loc,
2275 self.buf.as_ptr().wrapping_add(pos) as usize,
2276 )))
2277 }
2278}
2279impl std::fmt::Debug for IterableFrequencyRange<'_> {
2280 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
2281 let mut fmt = f.debug_struct("FrequencyRange");
2282 for attr in self.clone() {
2283 let attr = match attr {
2284 Ok(a) => a,
2285 Err(err) => {
2286 fmt.finish()?;
2287 f.write_str("Err(")?;
2288 err.fmt(f)?;
2289 return f.write_str(")");
2290 }
2291 };
2292 match attr {
2293 FrequencyRange::FrequencyMin(val) => fmt.field("FrequencyMin", &val),
2294 FrequencyRange::FrequencyMax(val) => fmt.field("FrequencyMax", &val),
2295 };
2296 }
2297 fmt.finish()
2298 }
2299}
2300impl IterableFrequencyRange<'_> {
2301 pub fn lookup_attr(
2302 &self,
2303 offset: usize,
2304 missing_type: Option<u16>,
2305 ) -> (Vec<(&'static str, usize)>, Option<&'static str>) {
2306 let mut stack = Vec::new();
2307 let cur = ErrorContext::calc_offset(self.orig_loc, self.buf.as_ptr() as usize);
2308 if missing_type.is_some() && cur == offset {
2309 stack.push(("FrequencyRange", offset));
2310 return (
2311 stack,
2312 missing_type.and_then(|t| FrequencyRange::attr_from_type(t)),
2313 );
2314 }
2315 if cur > offset || cur + self.buf.len() < offset {
2316 return (stack, None);
2317 }
2318 let mut attrs = self.clone();
2319 let mut last_off = cur + attrs.pos;
2320 while let Some(attr) = attrs.next() {
2321 let Ok(attr) = attr else { break };
2322 match attr {
2323 FrequencyRange::FrequencyMin(val) => {
2324 if last_off == offset {
2325 stack.push(("FrequencyMin", last_off));
2326 break;
2327 }
2328 }
2329 FrequencyRange::FrequencyMax(val) => {
2330 if last_off == offset {
2331 stack.push(("FrequencyMax", last_off));
2332 break;
2333 }
2334 }
2335 _ => {}
2336 };
2337 last_off = cur + attrs.pos;
2338 }
2339 if !stack.is_empty() {
2340 stack.push(("FrequencyRange", cur));
2341 }
2342 (stack, None)
2343 }
2344}
2345#[derive(Clone)]
2346pub enum ReferenceSync {
2347 Id(u32),
2348 #[doc = "Associated type: [`PinState`] (enum)"]
2349 State(u32),
2350}
2351impl<'a> IterableReferenceSync<'a> {
2352 pub fn get_id(&self) -> Result<u32, ErrorContext> {
2353 let mut iter = self.clone();
2354 iter.pos = 0;
2355 for attr in iter {
2356 if let ReferenceSync::Id(val) = attr? {
2357 return Ok(val);
2358 }
2359 }
2360 Err(ErrorContext::new_missing(
2361 "ReferenceSync",
2362 "Id",
2363 self.orig_loc,
2364 self.buf.as_ptr() as usize,
2365 ))
2366 }
2367 #[doc = "Associated type: [`PinState`] (enum)"]
2368 pub fn get_state(&self) -> Result<u32, ErrorContext> {
2369 let mut iter = self.clone();
2370 iter.pos = 0;
2371 for attr in iter {
2372 if let ReferenceSync::State(val) = attr? {
2373 return Ok(val);
2374 }
2375 }
2376 Err(ErrorContext::new_missing(
2377 "ReferenceSync",
2378 "State",
2379 self.orig_loc,
2380 self.buf.as_ptr() as usize,
2381 ))
2382 }
2383}
2384impl ReferenceSync {
2385 pub fn new<'a>(buf: &'a [u8]) -> IterableReferenceSync<'a> {
2386 IterableReferenceSync::with_loc(buf, buf.as_ptr() as usize)
2387 }
2388 fn attr_from_type(r#type: u16) -> Option<&'static str> {
2389 Pin::attr_from_type(r#type)
2390 }
2391}
2392#[derive(Clone, Copy, Default)]
2393pub struct IterableReferenceSync<'a> {
2394 buf: &'a [u8],
2395 pos: usize,
2396 orig_loc: usize,
2397}
2398impl<'a> IterableReferenceSync<'a> {
2399 fn with_loc(buf: &'a [u8], orig_loc: usize) -> Self {
2400 Self {
2401 buf,
2402 pos: 0,
2403 orig_loc,
2404 }
2405 }
2406 pub fn get_buf(&self) -> &'a [u8] {
2407 self.buf
2408 }
2409}
2410impl<'a> Iterator for IterableReferenceSync<'a> {
2411 type Item = Result<ReferenceSync, ErrorContext>;
2412 fn next(&mut self) -> Option<Self::Item> {
2413 let pos = self.pos;
2414 let mut r#type;
2415 loop {
2416 r#type = None;
2417 if self.buf.len() == self.pos {
2418 return None;
2419 }
2420 let Some((header, next)) = chop_header(self.buf, &mut self.pos) else {
2421 break;
2422 };
2423 r#type = Some(header.r#type);
2424 let res = match header.r#type {
2425 1u16 => ReferenceSync::Id({
2426 let res = parse_u32(next);
2427 let Some(val) = res else { break };
2428 val
2429 }),
2430 16u16 => ReferenceSync::State({
2431 let res = parse_u32(next);
2432 let Some(val) = res else { break };
2433 val
2434 }),
2435 n if cfg!(any(test, feature = "deny-unknown-attrs")) => break,
2436 n => continue,
2437 };
2438 return Some(Ok(res));
2439 }
2440 Some(Err(ErrorContext::new(
2441 "ReferenceSync",
2442 r#type.and_then(|t| ReferenceSync::attr_from_type(t)),
2443 self.orig_loc,
2444 self.buf.as_ptr().wrapping_add(pos) as usize,
2445 )))
2446 }
2447}
2448impl std::fmt::Debug for IterableReferenceSync<'_> {
2449 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
2450 let mut fmt = f.debug_struct("ReferenceSync");
2451 for attr in self.clone() {
2452 let attr = match attr {
2453 Ok(a) => a,
2454 Err(err) => {
2455 fmt.finish()?;
2456 f.write_str("Err(")?;
2457 err.fmt(f)?;
2458 return f.write_str(")");
2459 }
2460 };
2461 match attr {
2462 ReferenceSync::Id(val) => fmt.field("Id", &val),
2463 ReferenceSync::State(val) => {
2464 fmt.field("State", &FormatEnum(val.into(), PinState::from_value))
2465 }
2466 };
2467 }
2468 fmt.finish()
2469 }
2470}
2471impl IterableReferenceSync<'_> {
2472 pub fn lookup_attr(
2473 &self,
2474 offset: usize,
2475 missing_type: Option<u16>,
2476 ) -> (Vec<(&'static str, usize)>, Option<&'static str>) {
2477 let mut stack = Vec::new();
2478 let cur = ErrorContext::calc_offset(self.orig_loc, self.buf.as_ptr() as usize);
2479 if missing_type.is_some() && cur == offset {
2480 stack.push(("ReferenceSync", offset));
2481 return (
2482 stack,
2483 missing_type.and_then(|t| ReferenceSync::attr_from_type(t)),
2484 );
2485 }
2486 if cur > offset || cur + self.buf.len() < offset {
2487 return (stack, None);
2488 }
2489 let mut attrs = self.clone();
2490 let mut last_off = cur + attrs.pos;
2491 while let Some(attr) = attrs.next() {
2492 let Ok(attr) = attr else { break };
2493 match attr {
2494 ReferenceSync::Id(val) => {
2495 if last_off == offset {
2496 stack.push(("Id", last_off));
2497 break;
2498 }
2499 }
2500 ReferenceSync::State(val) => {
2501 if last_off == offset {
2502 stack.push(("State", last_off));
2503 break;
2504 }
2505 }
2506 _ => {}
2507 };
2508 last_off = cur + attrs.pos;
2509 }
2510 if !stack.is_empty() {
2511 stack.push(("ReferenceSync", cur));
2512 }
2513 (stack, None)
2514 }
2515}
2516pub struct PushDpll<Prev: Rec> {
2517 pub(crate) prev: Option<Prev>,
2518 pub(crate) header_offset: Option<usize>,
2519}
2520impl<Prev: Rec> Rec for PushDpll<Prev> {
2521 fn as_rec_mut(&mut self) -> &mut Vec<u8> {
2522 self.prev.as_mut().unwrap().as_rec_mut()
2523 }
2524 fn as_rec(&self) -> &Vec<u8> {
2525 self.prev.as_ref().unwrap().as_rec()
2526 }
2527}
2528impl<Prev: Rec> PushDpll<Prev> {
2529 pub fn new(prev: Prev) -> Self {
2530 Self {
2531 prev: Some(prev),
2532 header_offset: None,
2533 }
2534 }
2535 pub fn end_nested(mut self) -> Prev {
2536 let mut prev = self.prev.take().unwrap();
2537 if let Some(header_offset) = &self.header_offset {
2538 finalize_nested_header(prev.as_rec_mut(), *header_offset);
2539 }
2540 prev
2541 }
2542 pub fn push_id(mut self, value: u32) -> Self {
2543 push_header(self.as_rec_mut(), 1u16, 4 as u16);
2544 self.as_rec_mut().extend(value.to_ne_bytes());
2545 self
2546 }
2547 pub fn push_module_name(mut self, value: &CStr) -> Self {
2548 push_header(
2549 self.as_rec_mut(),
2550 2u16,
2551 value.to_bytes_with_nul().len() as u16,
2552 );
2553 self.as_rec_mut().extend(value.to_bytes_with_nul());
2554 self
2555 }
2556 pub fn push_module_name_bytes(mut self, value: &[u8]) -> Self {
2557 push_header(self.as_rec_mut(), 2u16, (value.len() + 1) as u16);
2558 self.as_rec_mut().extend(value);
2559 self.as_rec_mut().push(0);
2560 self
2561 }
2562 pub fn push_pad(mut self, value: &[u8]) -> Self {
2563 push_header(self.as_rec_mut(), 3u16, value.len() as u16);
2564 self.as_rec_mut().extend(value);
2565 self
2566 }
2567 pub fn push_clock_id(mut self, value: u64) -> Self {
2568 push_header(self.as_rec_mut(), 4u16, 8 as u16);
2569 self.as_rec_mut().extend(value.to_ne_bytes());
2570 self
2571 }
2572 #[doc = "Associated type: [`Mode`] (enum)"]
2573 pub fn push_mode(mut self, value: u32) -> Self {
2574 push_header(self.as_rec_mut(), 5u16, 4 as u16);
2575 self.as_rec_mut().extend(value.to_ne_bytes());
2576 self
2577 }
2578 #[doc = "Associated type: [`Mode`] (enum)\nAttribute may repeat multiple times (treat it as array)"]
2579 pub fn push_mode_supported(mut self, value: u32) -> Self {
2580 push_header(self.as_rec_mut(), 6u16, 4 as u16);
2581 self.as_rec_mut().extend(value.to_ne_bytes());
2582 self
2583 }
2584 #[doc = "Associated type: [`LockStatus`] (enum)"]
2585 pub fn push_lock_status(mut self, value: u32) -> Self {
2586 push_header(self.as_rec_mut(), 7u16, 4 as u16);
2587 self.as_rec_mut().extend(value.to_ne_bytes());
2588 self
2589 }
2590 pub fn push_temp(mut self, value: i32) -> Self {
2591 push_header(self.as_rec_mut(), 8u16, 4 as u16);
2592 self.as_rec_mut().extend(value.to_ne_bytes());
2593 self
2594 }
2595 #[doc = "Associated type: [`Type`] (enum)"]
2596 pub fn push_type(mut self, value: u32) -> Self {
2597 push_header(self.as_rec_mut(), 9u16, 4 as u16);
2598 self.as_rec_mut().extend(value.to_ne_bytes());
2599 self
2600 }
2601 #[doc = "Associated type: [`LockStatusError`] (enum)"]
2602 pub fn push_lock_status_error(mut self, value: u32) -> Self {
2603 push_header(self.as_rec_mut(), 10u16, 4 as u16);
2604 self.as_rec_mut().extend(value.to_ne_bytes());
2605 self
2606 }
2607 #[doc = "Level of quality of a clock device\\. This mainly applies when\nthe dpll lock\\-status is DPLL\\_LOCK\\_STATUS\\_HOLDOVER\\. This could\nbe put to message multiple times to indicate possible parallel\nquality levels (e\\.g\\. one specified by ITU option 1 and another\none specified by option 2)\\.\n\nAssociated type: [`ClockQualityLevel`] (enum)\nAttribute may repeat multiple times (treat it as array)"]
2608 pub fn push_clock_quality_level(mut self, value: u32) -> Self {
2609 push_header(self.as_rec_mut(), 11u16, 4 as u16);
2610 self.as_rec_mut().extend(value.to_ne_bytes());
2611 self
2612 }
2613 #[doc = "Receive or request state of phase offset monitor feature\\. If enabled, dpll device shall monitor and notify all currently available inputs for changes of their phase offset against the dpll device\\.\nAssociated type: [`FeatureState`] (enum)"]
2614 pub fn push_phase_offset_monitor(mut self, value: u32) -> Self {
2615 push_header(self.as_rec_mut(), 12u16, 4 as u16);
2616 self.as_rec_mut().extend(value.to_ne_bytes());
2617 self
2618 }
2619 #[doc = "Averaging factor applied to calculation of reported phase offset\\."]
2620 pub fn push_phase_offset_avg_factor(mut self, value: u32) -> Self {
2621 push_header(self.as_rec_mut(), 13u16, 4 as u16);
2622 self.as_rec_mut().extend(value.to_ne_bytes());
2623 self
2624 }
2625}
2626impl<Prev: Rec> Drop for PushDpll<Prev> {
2627 fn drop(&mut self) {
2628 if let Some(prev) = &mut self.prev {
2629 if let Some(header_offset) = &self.header_offset {
2630 finalize_nested_header(prev.as_rec_mut(), *header_offset);
2631 }
2632 }
2633 }
2634}
2635pub struct PushPin<Prev: Rec> {
2636 pub(crate) prev: Option<Prev>,
2637 pub(crate) header_offset: Option<usize>,
2638}
2639impl<Prev: Rec> Rec for PushPin<Prev> {
2640 fn as_rec_mut(&mut self) -> &mut Vec<u8> {
2641 self.prev.as_mut().unwrap().as_rec_mut()
2642 }
2643 fn as_rec(&self) -> &Vec<u8> {
2644 self.prev.as_ref().unwrap().as_rec()
2645 }
2646}
2647impl<Prev: Rec> PushPin<Prev> {
2648 pub fn new(prev: Prev) -> Self {
2649 Self {
2650 prev: Some(prev),
2651 header_offset: None,
2652 }
2653 }
2654 pub fn end_nested(mut self) -> Prev {
2655 let mut prev = self.prev.take().unwrap();
2656 if let Some(header_offset) = &self.header_offset {
2657 finalize_nested_header(prev.as_rec_mut(), *header_offset);
2658 }
2659 prev
2660 }
2661 pub fn push_id(mut self, value: u32) -> Self {
2662 push_header(self.as_rec_mut(), 1u16, 4 as u16);
2663 self.as_rec_mut().extend(value.to_ne_bytes());
2664 self
2665 }
2666 pub fn push_parent_id(mut self, value: u32) -> Self {
2667 push_header(self.as_rec_mut(), 2u16, 4 as u16);
2668 self.as_rec_mut().extend(value.to_ne_bytes());
2669 self
2670 }
2671 pub fn push_module_name(mut self, value: &CStr) -> Self {
2672 push_header(
2673 self.as_rec_mut(),
2674 3u16,
2675 value.to_bytes_with_nul().len() as u16,
2676 );
2677 self.as_rec_mut().extend(value.to_bytes_with_nul());
2678 self
2679 }
2680 pub fn push_module_name_bytes(mut self, value: &[u8]) -> Self {
2681 push_header(self.as_rec_mut(), 3u16, (value.len() + 1) as u16);
2682 self.as_rec_mut().extend(value);
2683 self.as_rec_mut().push(0);
2684 self
2685 }
2686 pub fn push_pad(mut self, value: &[u8]) -> Self {
2687 push_header(self.as_rec_mut(), 4u16, value.len() as u16);
2688 self.as_rec_mut().extend(value);
2689 self
2690 }
2691 pub fn push_clock_id(mut self, value: u64) -> Self {
2692 push_header(self.as_rec_mut(), 5u16, 8 as u16);
2693 self.as_rec_mut().extend(value.to_ne_bytes());
2694 self
2695 }
2696 pub fn push_board_label(mut self, value: &CStr) -> Self {
2697 push_header(
2698 self.as_rec_mut(),
2699 6u16,
2700 value.to_bytes_with_nul().len() as u16,
2701 );
2702 self.as_rec_mut().extend(value.to_bytes_with_nul());
2703 self
2704 }
2705 pub fn push_board_label_bytes(mut self, value: &[u8]) -> Self {
2706 push_header(self.as_rec_mut(), 6u16, (value.len() + 1) as u16);
2707 self.as_rec_mut().extend(value);
2708 self.as_rec_mut().push(0);
2709 self
2710 }
2711 pub fn push_panel_label(mut self, value: &CStr) -> Self {
2712 push_header(
2713 self.as_rec_mut(),
2714 7u16,
2715 value.to_bytes_with_nul().len() as u16,
2716 );
2717 self.as_rec_mut().extend(value.to_bytes_with_nul());
2718 self
2719 }
2720 pub fn push_panel_label_bytes(mut self, value: &[u8]) -> Self {
2721 push_header(self.as_rec_mut(), 7u16, (value.len() + 1) as u16);
2722 self.as_rec_mut().extend(value);
2723 self.as_rec_mut().push(0);
2724 self
2725 }
2726 pub fn push_package_label(mut self, value: &CStr) -> Self {
2727 push_header(
2728 self.as_rec_mut(),
2729 8u16,
2730 value.to_bytes_with_nul().len() as u16,
2731 );
2732 self.as_rec_mut().extend(value.to_bytes_with_nul());
2733 self
2734 }
2735 pub fn push_package_label_bytes(mut self, value: &[u8]) -> Self {
2736 push_header(self.as_rec_mut(), 8u16, (value.len() + 1) as u16);
2737 self.as_rec_mut().extend(value);
2738 self.as_rec_mut().push(0);
2739 self
2740 }
2741 #[doc = "Associated type: [`PinType`] (enum)"]
2742 pub fn push_type(mut self, value: u32) -> Self {
2743 push_header(self.as_rec_mut(), 9u16, 4 as u16);
2744 self.as_rec_mut().extend(value.to_ne_bytes());
2745 self
2746 }
2747 #[doc = "Associated type: [`PinDirection`] (enum)"]
2748 pub fn push_direction(mut self, value: u32) -> Self {
2749 push_header(self.as_rec_mut(), 10u16, 4 as u16);
2750 self.as_rec_mut().extend(value.to_ne_bytes());
2751 self
2752 }
2753 pub fn push_frequency(mut self, value: u64) -> Self {
2754 push_header(self.as_rec_mut(), 11u16, 8 as u16);
2755 self.as_rec_mut().extend(value.to_ne_bytes());
2756 self
2757 }
2758 #[doc = "Attribute may repeat multiple times (treat it as array)"]
2759 pub fn nested_frequency_supported(mut self) -> PushFrequencyRange<Self> {
2760 let header_offset = push_nested_header(self.as_rec_mut(), 12u16);
2761 PushFrequencyRange {
2762 prev: Some(self),
2763 header_offset: Some(header_offset),
2764 }
2765 }
2766 pub fn push_frequency_min(mut self, value: u64) -> Self {
2767 push_header(self.as_rec_mut(), 13u16, 8 as u16);
2768 self.as_rec_mut().extend(value.to_ne_bytes());
2769 self
2770 }
2771 pub fn push_frequency_max(mut self, value: u64) -> Self {
2772 push_header(self.as_rec_mut(), 14u16, 8 as u16);
2773 self.as_rec_mut().extend(value.to_ne_bytes());
2774 self
2775 }
2776 pub fn push_prio(mut self, value: u32) -> Self {
2777 push_header(self.as_rec_mut(), 15u16, 4 as u16);
2778 self.as_rec_mut().extend(value.to_ne_bytes());
2779 self
2780 }
2781 #[doc = "Associated type: [`PinState`] (enum)"]
2782 pub fn push_state(mut self, value: u32) -> Self {
2783 push_header(self.as_rec_mut(), 16u16, 4 as u16);
2784 self.as_rec_mut().extend(value.to_ne_bytes());
2785 self
2786 }
2787 #[doc = "Associated type: [`PinCapabilities`] (enum)"]
2788 pub fn push_capabilities(mut self, value: u32) -> Self {
2789 push_header(self.as_rec_mut(), 17u16, 4 as u16);
2790 self.as_rec_mut().extend(value.to_ne_bytes());
2791 self
2792 }
2793 #[doc = "Attribute may repeat multiple times (treat it as array)"]
2794 pub fn nested_parent_device(mut self) -> PushPinParentDevice<Self> {
2795 let header_offset = push_nested_header(self.as_rec_mut(), 18u16);
2796 PushPinParentDevice {
2797 prev: Some(self),
2798 header_offset: Some(header_offset),
2799 }
2800 }
2801 #[doc = "Attribute may repeat multiple times (treat it as array)"]
2802 pub fn nested_parent_pin(mut self) -> PushPinParentPin<Self> {
2803 let header_offset = push_nested_header(self.as_rec_mut(), 19u16);
2804 PushPinParentPin {
2805 prev: Some(self),
2806 header_offset: Some(header_offset),
2807 }
2808 }
2809 pub fn push_phase_adjust_min(mut self, value: i32) -> Self {
2810 push_header(self.as_rec_mut(), 20u16, 4 as u16);
2811 self.as_rec_mut().extend(value.to_ne_bytes());
2812 self
2813 }
2814 pub fn push_phase_adjust_max(mut self, value: i32) -> Self {
2815 push_header(self.as_rec_mut(), 21u16, 4 as u16);
2816 self.as_rec_mut().extend(value.to_ne_bytes());
2817 self
2818 }
2819 pub fn push_phase_adjust(mut self, value: i32) -> Self {
2820 push_header(self.as_rec_mut(), 22u16, 4 as u16);
2821 self.as_rec_mut().extend(value.to_ne_bytes());
2822 self
2823 }
2824 pub fn push_phase_offset(mut self, value: i64) -> Self {
2825 push_header(self.as_rec_mut(), 23u16, 8 as u16);
2826 self.as_rec_mut().extend(value.to_ne_bytes());
2827 self
2828 }
2829 #[doc = "The FFO (Fractional Frequency Offset) between the RX and TX\nsymbol rate on the media associated with the pin:\n(rx\\_frequency\\-tx\\_frequency)/rx\\_frequency\nValue is in PPM (parts per million)\\.\nThis may be implemented for example for pin of type\nPIN\\_TYPE\\_SYNCE\\_ETH\\_PORT\\.\n"]
2830 pub fn push_fractional_frequency_offset(mut self, value: i32) -> Self {
2831 push_header(self.as_rec_mut(), 24u16, 4 as u16);
2832 self.as_rec_mut().extend(value.to_ne_bytes());
2833 self
2834 }
2835 #[doc = "Frequency of Embedded SYNC signal\\. If provided, the pin is configured\nwith a SYNC signal embedded into its base clock frequency\\.\n"]
2836 pub fn push_esync_frequency(mut self, value: u64) -> Self {
2837 push_header(self.as_rec_mut(), 25u16, 8 as u16);
2838 self.as_rec_mut().extend(value.to_ne_bytes());
2839 self
2840 }
2841 #[doc = "If provided a pin is capable of embedding a SYNC signal (within given\nrange) into its base frequency signal\\.\n\nAttribute may repeat multiple times (treat it as array)"]
2842 pub fn nested_esync_frequency_supported(mut self) -> PushFrequencyRange<Self> {
2843 let header_offset = push_nested_header(self.as_rec_mut(), 26u16);
2844 PushFrequencyRange {
2845 prev: Some(self),
2846 header_offset: Some(header_offset),
2847 }
2848 }
2849 #[doc = "A ratio of high to low state of a SYNC signal pulse embedded\ninto base clock frequency\\. Value is in percents\\.\n"]
2850 pub fn push_esync_pulse(mut self, value: u32) -> Self {
2851 push_header(self.as_rec_mut(), 27u16, 4 as u16);
2852 self.as_rec_mut().extend(value.to_ne_bytes());
2853 self
2854 }
2855 #[doc = "Capable pin provides list of pins that can be bound to create a\nreference\\-sync pin pair\\.\n\nAttribute may repeat multiple times (treat it as array)"]
2856 pub fn nested_reference_sync(mut self) -> PushReferenceSync<Self> {
2857 let header_offset = push_nested_header(self.as_rec_mut(), 28u16);
2858 PushReferenceSync {
2859 prev: Some(self),
2860 header_offset: Some(header_offset),
2861 }
2862 }
2863 #[doc = "Granularity of phase adjustment, in picoseconds\\. The value of\nphase adjustment must be a multiple of this granularity\\.\n"]
2864 pub fn push_phase_adjust_gran(mut self, value: u32) -> Self {
2865 push_header(self.as_rec_mut(), 29u16, 4 as u16);
2866 self.as_rec_mut().extend(value.to_ne_bytes());
2867 self
2868 }
2869 #[doc = "The FFO (Fractional Frequency Offset) of the pin with respect to\nthe nominal frequency\\.\nValue = (frequency\\_measured \\- frequency\\_nominal) / frequency\\_nominal\nValue is in PPT (parts per trillion, 10^\\-12)\\.\nNote: This attribute provides higher resolution than the standard\nfractional\\-frequency\\-offset (which is in PPM)\\.\n"]
2870 pub fn push_fractional_frequency_offset_ppt(mut self, value: i32) -> Self {
2871 push_header(self.as_rec_mut(), 30u16, 4 as u16);
2872 self.as_rec_mut().extend(value.to_ne_bytes());
2873 self
2874 }
2875}
2876impl<Prev: Rec> Drop for PushPin<Prev> {
2877 fn drop(&mut self) {
2878 if let Some(prev) = &mut self.prev {
2879 if let Some(header_offset) = &self.header_offset {
2880 finalize_nested_header(prev.as_rec_mut(), *header_offset);
2881 }
2882 }
2883 }
2884}
2885pub struct PushPinParentDevice<Prev: Rec> {
2886 pub(crate) prev: Option<Prev>,
2887 pub(crate) header_offset: Option<usize>,
2888}
2889impl<Prev: Rec> Rec for PushPinParentDevice<Prev> {
2890 fn as_rec_mut(&mut self) -> &mut Vec<u8> {
2891 self.prev.as_mut().unwrap().as_rec_mut()
2892 }
2893 fn as_rec(&self) -> &Vec<u8> {
2894 self.prev.as_ref().unwrap().as_rec()
2895 }
2896}
2897impl<Prev: Rec> PushPinParentDevice<Prev> {
2898 pub fn new(prev: Prev) -> Self {
2899 Self {
2900 prev: Some(prev),
2901 header_offset: None,
2902 }
2903 }
2904 pub fn end_nested(mut self) -> Prev {
2905 let mut prev = self.prev.take().unwrap();
2906 if let Some(header_offset) = &self.header_offset {
2907 finalize_nested_header(prev.as_rec_mut(), *header_offset);
2908 }
2909 prev
2910 }
2911 pub fn push_parent_id(mut self, value: u32) -> Self {
2912 push_header(self.as_rec_mut(), 2u16, 4 as u16);
2913 self.as_rec_mut().extend(value.to_ne_bytes());
2914 self
2915 }
2916 #[doc = "Associated type: [`PinDirection`] (enum)"]
2917 pub fn push_direction(mut self, value: u32) -> Self {
2918 push_header(self.as_rec_mut(), 10u16, 4 as u16);
2919 self.as_rec_mut().extend(value.to_ne_bytes());
2920 self
2921 }
2922 pub fn push_prio(mut self, value: u32) -> Self {
2923 push_header(self.as_rec_mut(), 15u16, 4 as u16);
2924 self.as_rec_mut().extend(value.to_ne_bytes());
2925 self
2926 }
2927 #[doc = "Associated type: [`PinState`] (enum)"]
2928 pub fn push_state(mut self, value: u32) -> Self {
2929 push_header(self.as_rec_mut(), 16u16, 4 as u16);
2930 self.as_rec_mut().extend(value.to_ne_bytes());
2931 self
2932 }
2933 pub fn push_phase_offset(mut self, value: i64) -> Self {
2934 push_header(self.as_rec_mut(), 23u16, 8 as u16);
2935 self.as_rec_mut().extend(value.to_ne_bytes());
2936 self
2937 }
2938}
2939impl<Prev: Rec> Drop for PushPinParentDevice<Prev> {
2940 fn drop(&mut self) {
2941 if let Some(prev) = &mut self.prev {
2942 if let Some(header_offset) = &self.header_offset {
2943 finalize_nested_header(prev.as_rec_mut(), *header_offset);
2944 }
2945 }
2946 }
2947}
2948pub struct PushPinParentPin<Prev: Rec> {
2949 pub(crate) prev: Option<Prev>,
2950 pub(crate) header_offset: Option<usize>,
2951}
2952impl<Prev: Rec> Rec for PushPinParentPin<Prev> {
2953 fn as_rec_mut(&mut self) -> &mut Vec<u8> {
2954 self.prev.as_mut().unwrap().as_rec_mut()
2955 }
2956 fn as_rec(&self) -> &Vec<u8> {
2957 self.prev.as_ref().unwrap().as_rec()
2958 }
2959}
2960impl<Prev: Rec> PushPinParentPin<Prev> {
2961 pub fn new(prev: Prev) -> Self {
2962 Self {
2963 prev: Some(prev),
2964 header_offset: None,
2965 }
2966 }
2967 pub fn end_nested(mut self) -> Prev {
2968 let mut prev = self.prev.take().unwrap();
2969 if let Some(header_offset) = &self.header_offset {
2970 finalize_nested_header(prev.as_rec_mut(), *header_offset);
2971 }
2972 prev
2973 }
2974 pub fn push_parent_id(mut self, value: u32) -> Self {
2975 push_header(self.as_rec_mut(), 2u16, 4 as u16);
2976 self.as_rec_mut().extend(value.to_ne_bytes());
2977 self
2978 }
2979 #[doc = "Associated type: [`PinState`] (enum)"]
2980 pub fn push_state(mut self, value: u32) -> Self {
2981 push_header(self.as_rec_mut(), 16u16, 4 as u16);
2982 self.as_rec_mut().extend(value.to_ne_bytes());
2983 self
2984 }
2985}
2986impl<Prev: Rec> Drop for PushPinParentPin<Prev> {
2987 fn drop(&mut self) {
2988 if let Some(prev) = &mut self.prev {
2989 if let Some(header_offset) = &self.header_offset {
2990 finalize_nested_header(prev.as_rec_mut(), *header_offset);
2991 }
2992 }
2993 }
2994}
2995pub struct PushFrequencyRange<Prev: Rec> {
2996 pub(crate) prev: Option<Prev>,
2997 pub(crate) header_offset: Option<usize>,
2998}
2999impl<Prev: Rec> Rec for PushFrequencyRange<Prev> {
3000 fn as_rec_mut(&mut self) -> &mut Vec<u8> {
3001 self.prev.as_mut().unwrap().as_rec_mut()
3002 }
3003 fn as_rec(&self) -> &Vec<u8> {
3004 self.prev.as_ref().unwrap().as_rec()
3005 }
3006}
3007impl<Prev: Rec> PushFrequencyRange<Prev> {
3008 pub fn new(prev: Prev) -> Self {
3009 Self {
3010 prev: Some(prev),
3011 header_offset: None,
3012 }
3013 }
3014 pub fn end_nested(mut self) -> Prev {
3015 let mut prev = self.prev.take().unwrap();
3016 if let Some(header_offset) = &self.header_offset {
3017 finalize_nested_header(prev.as_rec_mut(), *header_offset);
3018 }
3019 prev
3020 }
3021 pub fn push_frequency_min(mut self, value: u64) -> Self {
3022 push_header(self.as_rec_mut(), 13u16, 8 as u16);
3023 self.as_rec_mut().extend(value.to_ne_bytes());
3024 self
3025 }
3026 pub fn push_frequency_max(mut self, value: u64) -> Self {
3027 push_header(self.as_rec_mut(), 14u16, 8 as u16);
3028 self.as_rec_mut().extend(value.to_ne_bytes());
3029 self
3030 }
3031}
3032impl<Prev: Rec> Drop for PushFrequencyRange<Prev> {
3033 fn drop(&mut self) {
3034 if let Some(prev) = &mut self.prev {
3035 if let Some(header_offset) = &self.header_offset {
3036 finalize_nested_header(prev.as_rec_mut(), *header_offset);
3037 }
3038 }
3039 }
3040}
3041pub struct PushReferenceSync<Prev: Rec> {
3042 pub(crate) prev: Option<Prev>,
3043 pub(crate) header_offset: Option<usize>,
3044}
3045impl<Prev: Rec> Rec for PushReferenceSync<Prev> {
3046 fn as_rec_mut(&mut self) -> &mut Vec<u8> {
3047 self.prev.as_mut().unwrap().as_rec_mut()
3048 }
3049 fn as_rec(&self) -> &Vec<u8> {
3050 self.prev.as_ref().unwrap().as_rec()
3051 }
3052}
3053impl<Prev: Rec> PushReferenceSync<Prev> {
3054 pub fn new(prev: Prev) -> Self {
3055 Self {
3056 prev: Some(prev),
3057 header_offset: None,
3058 }
3059 }
3060 pub fn end_nested(mut self) -> Prev {
3061 let mut prev = self.prev.take().unwrap();
3062 if let Some(header_offset) = &self.header_offset {
3063 finalize_nested_header(prev.as_rec_mut(), *header_offset);
3064 }
3065 prev
3066 }
3067 pub fn push_id(mut self, value: u32) -> Self {
3068 push_header(self.as_rec_mut(), 1u16, 4 as u16);
3069 self.as_rec_mut().extend(value.to_ne_bytes());
3070 self
3071 }
3072 #[doc = "Associated type: [`PinState`] (enum)"]
3073 pub fn push_state(mut self, value: u32) -> Self {
3074 push_header(self.as_rec_mut(), 16u16, 4 as u16);
3075 self.as_rec_mut().extend(value.to_ne_bytes());
3076 self
3077 }
3078}
3079impl<Prev: Rec> Drop for PushReferenceSync<Prev> {
3080 fn drop(&mut self) {
3081 if let Some(prev) = &mut self.prev {
3082 if let Some(header_offset) = &self.header_offset {
3083 finalize_nested_header(prev.as_rec_mut(), *header_offset);
3084 }
3085 }
3086 }
3087}
3088#[doc = "Notify attributes:\n- [`.get_id()`](IterableDpll::get_id)\n- [`.get_module_name()`](IterableDpll::get_module_name)\n- [`.get_mode()`](IterableDpll::get_mode)\n- [`.get_mode_supported()`](IterableDpll::get_mode_supported)\n- [`.get_lock_status()`](IterableDpll::get_lock_status)\n- [`.get_lock_status_error()`](IterableDpll::get_lock_status_error)\n- [`.get_temp()`](IterableDpll::get_temp)\n- [`.get_clock_id()`](IterableDpll::get_clock_id)\n- [`.get_type()`](IterableDpll::get_type)\n- [`.get_phase_offset_monitor()`](IterableDpll::get_phase_offset_monitor)\n- [`.get_phase_offset_avg_factor()`](IterableDpll::get_phase_offset_avg_factor)\n"]
3089#[derive(Debug)]
3090pub struct OpDeviceCreateNotif;
3091impl OpDeviceCreateNotif {
3092 pub const CMD: u8 = 4u8;
3093 pub fn decode_notif<'a>(buf: &'a [u8]) -> IterableDpll<'a> {
3094 let (_header, attrs) = buf.split_at(buf.len().min(BuiltinNfgenmsg::len()));
3095 IterableDpll::with_loc(attrs, buf.as_ptr() as usize)
3096 }
3097}
3098#[doc = "Notify attributes:\n- [`.get_id()`](IterableDpll::get_id)\n- [`.get_module_name()`](IterableDpll::get_module_name)\n- [`.get_mode()`](IterableDpll::get_mode)\n- [`.get_mode_supported()`](IterableDpll::get_mode_supported)\n- [`.get_lock_status()`](IterableDpll::get_lock_status)\n- [`.get_lock_status_error()`](IterableDpll::get_lock_status_error)\n- [`.get_temp()`](IterableDpll::get_temp)\n- [`.get_clock_id()`](IterableDpll::get_clock_id)\n- [`.get_type()`](IterableDpll::get_type)\n- [`.get_phase_offset_monitor()`](IterableDpll::get_phase_offset_monitor)\n- [`.get_phase_offset_avg_factor()`](IterableDpll::get_phase_offset_avg_factor)\n"]
3099#[derive(Debug)]
3100pub struct OpDeviceDeleteNotif;
3101impl OpDeviceDeleteNotif {
3102 pub const CMD: u8 = 5u8;
3103 pub fn decode_notif<'a>(buf: &'a [u8]) -> IterableDpll<'a> {
3104 let (_header, attrs) = buf.split_at(buf.len().min(BuiltinNfgenmsg::len()));
3105 IterableDpll::with_loc(attrs, buf.as_ptr() as usize)
3106 }
3107}
3108#[doc = "Notify attributes:\n- [`.get_id()`](IterableDpll::get_id)\n- [`.get_module_name()`](IterableDpll::get_module_name)\n- [`.get_mode()`](IterableDpll::get_mode)\n- [`.get_mode_supported()`](IterableDpll::get_mode_supported)\n- [`.get_lock_status()`](IterableDpll::get_lock_status)\n- [`.get_lock_status_error()`](IterableDpll::get_lock_status_error)\n- [`.get_temp()`](IterableDpll::get_temp)\n- [`.get_clock_id()`](IterableDpll::get_clock_id)\n- [`.get_type()`](IterableDpll::get_type)\n- [`.get_phase_offset_monitor()`](IterableDpll::get_phase_offset_monitor)\n- [`.get_phase_offset_avg_factor()`](IterableDpll::get_phase_offset_avg_factor)\n"]
3109#[derive(Debug)]
3110pub struct OpDeviceChangeNotif;
3111impl OpDeviceChangeNotif {
3112 pub const CMD: u8 = 6u8;
3113 pub fn decode_notif<'a>(buf: &'a [u8]) -> IterableDpll<'a> {
3114 let (_header, attrs) = buf.split_at(buf.len().min(BuiltinNfgenmsg::len()));
3115 IterableDpll::with_loc(attrs, buf.as_ptr() as usize)
3116 }
3117}
3118#[doc = "Notify attributes:\n- [`.get_id()`](IterablePin::get_id)\n- [`.get_module_name()`](IterablePin::get_module_name)\n- [`.get_clock_id()`](IterablePin::get_clock_id)\n- [`.get_board_label()`](IterablePin::get_board_label)\n- [`.get_panel_label()`](IterablePin::get_panel_label)\n- [`.get_package_label()`](IterablePin::get_package_label)\n- [`.get_type()`](IterablePin::get_type)\n- [`.get_frequency()`](IterablePin::get_frequency)\n- [`.get_frequency_supported()`](IterablePin::get_frequency_supported)\n- [`.get_capabilities()`](IterablePin::get_capabilities)\n- [`.get_parent_device()`](IterablePin::get_parent_device)\n- [`.get_parent_pin()`](IterablePin::get_parent_pin)\n- [`.get_phase_adjust_gran()`](IterablePin::get_phase_adjust_gran)\n- [`.get_phase_adjust_min()`](IterablePin::get_phase_adjust_min)\n- [`.get_phase_adjust_max()`](IterablePin::get_phase_adjust_max)\n- [`.get_phase_adjust()`](IterablePin::get_phase_adjust)\n- [`.get_fractional_frequency_offset()`](IterablePin::get_fractional_frequency_offset)\n- [`.get_fractional_frequency_offset_ppt()`](IterablePin::get_fractional_frequency_offset_ppt)\n- [`.get_esync_frequency()`](IterablePin::get_esync_frequency)\n- [`.get_esync_frequency_supported()`](IterablePin::get_esync_frequency_supported)\n- [`.get_esync_pulse()`](IterablePin::get_esync_pulse)\n- [`.get_reference_sync()`](IterablePin::get_reference_sync)\n"]
3119#[derive(Debug)]
3120pub struct OpPinCreateNotif;
3121impl OpPinCreateNotif {
3122 pub const CMD: u8 = 10u8;
3123 pub fn decode_notif<'a>(buf: &'a [u8]) -> IterablePin<'a> {
3124 let (_header, attrs) = buf.split_at(buf.len().min(BuiltinNfgenmsg::len()));
3125 IterablePin::with_loc(attrs, buf.as_ptr() as usize)
3126 }
3127}
3128#[doc = "Notify attributes:\n- [`.get_id()`](IterablePin::get_id)\n- [`.get_module_name()`](IterablePin::get_module_name)\n- [`.get_clock_id()`](IterablePin::get_clock_id)\n- [`.get_board_label()`](IterablePin::get_board_label)\n- [`.get_panel_label()`](IterablePin::get_panel_label)\n- [`.get_package_label()`](IterablePin::get_package_label)\n- [`.get_type()`](IterablePin::get_type)\n- [`.get_frequency()`](IterablePin::get_frequency)\n- [`.get_frequency_supported()`](IterablePin::get_frequency_supported)\n- [`.get_capabilities()`](IterablePin::get_capabilities)\n- [`.get_parent_device()`](IterablePin::get_parent_device)\n- [`.get_parent_pin()`](IterablePin::get_parent_pin)\n- [`.get_phase_adjust_gran()`](IterablePin::get_phase_adjust_gran)\n- [`.get_phase_adjust_min()`](IterablePin::get_phase_adjust_min)\n- [`.get_phase_adjust_max()`](IterablePin::get_phase_adjust_max)\n- [`.get_phase_adjust()`](IterablePin::get_phase_adjust)\n- [`.get_fractional_frequency_offset()`](IterablePin::get_fractional_frequency_offset)\n- [`.get_fractional_frequency_offset_ppt()`](IterablePin::get_fractional_frequency_offset_ppt)\n- [`.get_esync_frequency()`](IterablePin::get_esync_frequency)\n- [`.get_esync_frequency_supported()`](IterablePin::get_esync_frequency_supported)\n- [`.get_esync_pulse()`](IterablePin::get_esync_pulse)\n- [`.get_reference_sync()`](IterablePin::get_reference_sync)\n"]
3129#[derive(Debug)]
3130pub struct OpPinDeleteNotif;
3131impl OpPinDeleteNotif {
3132 pub const CMD: u8 = 11u8;
3133 pub fn decode_notif<'a>(buf: &'a [u8]) -> IterablePin<'a> {
3134 let (_header, attrs) = buf.split_at(buf.len().min(BuiltinNfgenmsg::len()));
3135 IterablePin::with_loc(attrs, buf.as_ptr() as usize)
3136 }
3137}
3138#[doc = "Notify attributes:\n- [`.get_id()`](IterablePin::get_id)\n- [`.get_module_name()`](IterablePin::get_module_name)\n- [`.get_clock_id()`](IterablePin::get_clock_id)\n- [`.get_board_label()`](IterablePin::get_board_label)\n- [`.get_panel_label()`](IterablePin::get_panel_label)\n- [`.get_package_label()`](IterablePin::get_package_label)\n- [`.get_type()`](IterablePin::get_type)\n- [`.get_frequency()`](IterablePin::get_frequency)\n- [`.get_frequency_supported()`](IterablePin::get_frequency_supported)\n- [`.get_capabilities()`](IterablePin::get_capabilities)\n- [`.get_parent_device()`](IterablePin::get_parent_device)\n- [`.get_parent_pin()`](IterablePin::get_parent_pin)\n- [`.get_phase_adjust_gran()`](IterablePin::get_phase_adjust_gran)\n- [`.get_phase_adjust_min()`](IterablePin::get_phase_adjust_min)\n- [`.get_phase_adjust_max()`](IterablePin::get_phase_adjust_max)\n- [`.get_phase_adjust()`](IterablePin::get_phase_adjust)\n- [`.get_fractional_frequency_offset()`](IterablePin::get_fractional_frequency_offset)\n- [`.get_fractional_frequency_offset_ppt()`](IterablePin::get_fractional_frequency_offset_ppt)\n- [`.get_esync_frequency()`](IterablePin::get_esync_frequency)\n- [`.get_esync_frequency_supported()`](IterablePin::get_esync_frequency_supported)\n- [`.get_esync_pulse()`](IterablePin::get_esync_pulse)\n- [`.get_reference_sync()`](IterablePin::get_reference_sync)\n"]
3139#[derive(Debug)]
3140pub struct OpPinChangeNotif;
3141impl OpPinChangeNotif {
3142 pub const CMD: u8 = 12u8;
3143 pub fn decode_notif<'a>(buf: &'a [u8]) -> IterablePin<'a> {
3144 let (_header, attrs) = buf.split_at(buf.len().min(BuiltinNfgenmsg::len()));
3145 IterablePin::with_loc(attrs, buf.as_ptr() as usize)
3146 }
3147}
3148pub struct NotifGroup;
3149impl NotifGroup {
3150 #[doc = "Notifications:\n- [`OpDeviceCreateNotif`]\n- [`OpDeviceDeleteNotif`]\n- [`OpDeviceChangeNotif`]\n- [`OpPinCreateNotif`]\n- [`OpPinDeleteNotif`]\n- [`OpPinChangeNotif`]\n"]
3151 pub const MONITOR: &str = "monitor";
3152 #[doc = "Notifications:\n- [`OpDeviceCreateNotif`]\n- [`OpDeviceDeleteNotif`]\n- [`OpDeviceChangeNotif`]\n- [`OpPinCreateNotif`]\n- [`OpPinDeleteNotif`]\n- [`OpPinChangeNotif`]\n"]
3153 pub const MONITOR_CSTR: &CStr = c"monitor";
3154}
3155#[doc = "Get id of dpll device that matches given attributes\n\nFlags: admin-perm\nRequest attributes:\n- [.push_module_name()](PushDpll::push_module_name)\n- [.push_clock_id()](PushDpll::push_clock_id)\n- [.push_type()](PushDpll::push_type)\n\nReply attributes:\n- [.get_id()](IterableDpll::get_id)\n"]
3156#[derive(Debug)]
3157pub struct OpDeviceIdGetDo<'r> {
3158 request: Request<'r>,
3159}
3160impl<'r> OpDeviceIdGetDo<'r> {
3161 pub fn new(mut request: Request<'r>) -> Self {
3162 Self::write_header(request.buf_mut());
3163 Self { request: request }
3164 }
3165 pub fn encode_request<'buf>(buf: &'buf mut Vec<u8>) -> PushDpll<&'buf mut Vec<u8>> {
3166 Self::write_header(buf);
3167 PushDpll::new(buf)
3168 }
3169 pub fn encode(&mut self) -> PushDpll<&mut Vec<u8>> {
3170 PushDpll::new(self.request.buf_mut())
3171 }
3172 pub fn into_encoder(self) -> PushDpll<RequestBuf<'r>> {
3173 PushDpll::new(self.request.buf)
3174 }
3175 pub fn decode_request<'a>(buf: &'a [u8]) -> IterableDpll<'a> {
3176 let (_header, attrs) = buf.split_at(buf.len().min(BuiltinNfgenmsg::len()));
3177 IterableDpll::with_loc(attrs, buf.as_ptr() as usize)
3178 }
3179 fn write_header<Prev: Rec>(prev: &mut Prev) {
3180 let mut header = BuiltinNfgenmsg::new();
3181 header.cmd = 1u8;
3182 header.version = 1u8;
3183 prev.as_rec_mut().extend(header.as_slice());
3184 }
3185}
3186impl NetlinkRequest for OpDeviceIdGetDo<'_> {
3187 fn protocol(&self) -> Protocol {
3188 Protocol::Generic("dpll".as_bytes())
3189 }
3190 fn flags(&self) -> u16 {
3191 self.request.flags
3192 }
3193 fn payload(&self) -> &[u8] {
3194 self.request.buf()
3195 }
3196 type ReplyType<'buf> = IterableDpll<'buf>;
3197 fn decode_reply<'buf>(buf: &'buf [u8]) -> Self::ReplyType<'buf> {
3198 Self::decode_request(buf)
3199 }
3200 fn lookup(
3201 buf: &[u8],
3202 offset: usize,
3203 missing_type: Option<u16>,
3204 ) -> (Vec<(&'static str, usize)>, Option<&'static str>) {
3205 Self::decode_request(buf).lookup_attr(offset, missing_type)
3206 }
3207}
3208#[doc = "Get list of DPLL devices (dump) or attributes of a single dpll device\n\nFlags: admin-perm\n\nReply attributes:\n- [.get_id()](IterableDpll::get_id)\n- [.get_module_name()](IterableDpll::get_module_name)\n- [.get_clock_id()](IterableDpll::get_clock_id)\n- [.get_mode()](IterableDpll::get_mode)\n- [.get_mode_supported()](IterableDpll::get_mode_supported)\n- [.get_lock_status()](IterableDpll::get_lock_status)\n- [.get_temp()](IterableDpll::get_temp)\n- [.get_type()](IterableDpll::get_type)\n- [.get_lock_status_error()](IterableDpll::get_lock_status_error)\n- [.get_phase_offset_monitor()](IterableDpll::get_phase_offset_monitor)\n- [.get_phase_offset_avg_factor()](IterableDpll::get_phase_offset_avg_factor)\n"]
3209#[derive(Debug)]
3210pub struct OpDeviceGetDump<'r> {
3211 request: Request<'r>,
3212}
3213impl<'r> OpDeviceGetDump<'r> {
3214 pub fn new(mut request: Request<'r>) -> Self {
3215 Self::write_header(request.buf_mut());
3216 Self {
3217 request: request.set_dump(),
3218 }
3219 }
3220 pub fn encode_request<'buf>(buf: &'buf mut Vec<u8>) -> PushDpll<&'buf mut Vec<u8>> {
3221 Self::write_header(buf);
3222 PushDpll::new(buf)
3223 }
3224 pub fn encode(&mut self) -> PushDpll<&mut Vec<u8>> {
3225 PushDpll::new(self.request.buf_mut())
3226 }
3227 pub fn into_encoder(self) -> PushDpll<RequestBuf<'r>> {
3228 PushDpll::new(self.request.buf)
3229 }
3230 pub fn decode_request<'a>(buf: &'a [u8]) -> IterableDpll<'a> {
3231 let (_header, attrs) = buf.split_at(buf.len().min(BuiltinNfgenmsg::len()));
3232 IterableDpll::with_loc(attrs, buf.as_ptr() as usize)
3233 }
3234 fn write_header<Prev: Rec>(prev: &mut Prev) {
3235 let mut header = BuiltinNfgenmsg::new();
3236 header.cmd = 2u8;
3237 header.version = 1u8;
3238 prev.as_rec_mut().extend(header.as_slice());
3239 }
3240}
3241impl NetlinkRequest for OpDeviceGetDump<'_> {
3242 fn protocol(&self) -> Protocol {
3243 Protocol::Generic("dpll".as_bytes())
3244 }
3245 fn flags(&self) -> u16 {
3246 self.request.flags
3247 }
3248 fn payload(&self) -> &[u8] {
3249 self.request.buf()
3250 }
3251 type ReplyType<'buf> = IterableDpll<'buf>;
3252 fn decode_reply<'buf>(buf: &'buf [u8]) -> Self::ReplyType<'buf> {
3253 Self::decode_request(buf)
3254 }
3255 fn lookup(
3256 buf: &[u8],
3257 offset: usize,
3258 missing_type: Option<u16>,
3259 ) -> (Vec<(&'static str, usize)>, Option<&'static str>) {
3260 Self::decode_request(buf).lookup_attr(offset, missing_type)
3261 }
3262}
3263#[doc = "Get list of DPLL devices (dump) or attributes of a single dpll device\n\nFlags: admin-perm\nRequest attributes:\n- [.push_id()](PushDpll::push_id)\n\nReply attributes:\n- [.get_id()](IterableDpll::get_id)\n- [.get_module_name()](IterableDpll::get_module_name)\n- [.get_clock_id()](IterableDpll::get_clock_id)\n- [.get_mode()](IterableDpll::get_mode)\n- [.get_mode_supported()](IterableDpll::get_mode_supported)\n- [.get_lock_status()](IterableDpll::get_lock_status)\n- [.get_temp()](IterableDpll::get_temp)\n- [.get_type()](IterableDpll::get_type)\n- [.get_lock_status_error()](IterableDpll::get_lock_status_error)\n- [.get_phase_offset_monitor()](IterableDpll::get_phase_offset_monitor)\n- [.get_phase_offset_avg_factor()](IterableDpll::get_phase_offset_avg_factor)\n"]
3264#[derive(Debug)]
3265pub struct OpDeviceGetDo<'r> {
3266 request: Request<'r>,
3267}
3268impl<'r> OpDeviceGetDo<'r> {
3269 pub fn new(mut request: Request<'r>) -> Self {
3270 Self::write_header(request.buf_mut());
3271 Self { request: request }
3272 }
3273 pub fn encode_request<'buf>(buf: &'buf mut Vec<u8>) -> PushDpll<&'buf mut Vec<u8>> {
3274 Self::write_header(buf);
3275 PushDpll::new(buf)
3276 }
3277 pub fn encode(&mut self) -> PushDpll<&mut Vec<u8>> {
3278 PushDpll::new(self.request.buf_mut())
3279 }
3280 pub fn into_encoder(self) -> PushDpll<RequestBuf<'r>> {
3281 PushDpll::new(self.request.buf)
3282 }
3283 pub fn decode_request<'a>(buf: &'a [u8]) -> IterableDpll<'a> {
3284 let (_header, attrs) = buf.split_at(buf.len().min(BuiltinNfgenmsg::len()));
3285 IterableDpll::with_loc(attrs, buf.as_ptr() as usize)
3286 }
3287 fn write_header<Prev: Rec>(prev: &mut Prev) {
3288 let mut header = BuiltinNfgenmsg::new();
3289 header.cmd = 2u8;
3290 header.version = 1u8;
3291 prev.as_rec_mut().extend(header.as_slice());
3292 }
3293}
3294impl NetlinkRequest for OpDeviceGetDo<'_> {
3295 fn protocol(&self) -> Protocol {
3296 Protocol::Generic("dpll".as_bytes())
3297 }
3298 fn flags(&self) -> u16 {
3299 self.request.flags
3300 }
3301 fn payload(&self) -> &[u8] {
3302 self.request.buf()
3303 }
3304 type ReplyType<'buf> = IterableDpll<'buf>;
3305 fn decode_reply<'buf>(buf: &'buf [u8]) -> Self::ReplyType<'buf> {
3306 Self::decode_request(buf)
3307 }
3308 fn lookup(
3309 buf: &[u8],
3310 offset: usize,
3311 missing_type: Option<u16>,
3312 ) -> (Vec<(&'static str, usize)>, Option<&'static str>) {
3313 Self::decode_request(buf).lookup_attr(offset, missing_type)
3314 }
3315}
3316#[doc = "Set attributes for a DPLL device\nFlags: admin-perm\nRequest attributes:\n- [.push_id()](PushDpll::push_id)\n- [.push_mode()](PushDpll::push_mode)\n- [.push_phase_offset_monitor()](PushDpll::push_phase_offset_monitor)\n- [.push_phase_offset_avg_factor()](PushDpll::push_phase_offset_avg_factor)\n"]
3317#[derive(Debug)]
3318pub struct OpDeviceSetDo<'r> {
3319 request: Request<'r>,
3320}
3321impl<'r> OpDeviceSetDo<'r> {
3322 pub fn new(mut request: Request<'r>) -> Self {
3323 Self::write_header(request.buf_mut());
3324 Self { request: request }
3325 }
3326 pub fn encode_request<'buf>(buf: &'buf mut Vec<u8>) -> PushDpll<&'buf mut Vec<u8>> {
3327 Self::write_header(buf);
3328 PushDpll::new(buf)
3329 }
3330 pub fn encode(&mut self) -> PushDpll<&mut Vec<u8>> {
3331 PushDpll::new(self.request.buf_mut())
3332 }
3333 pub fn into_encoder(self) -> PushDpll<RequestBuf<'r>> {
3334 PushDpll::new(self.request.buf)
3335 }
3336 pub fn decode_request<'a>(buf: &'a [u8]) -> IterableDpll<'a> {
3337 let (_header, attrs) = buf.split_at(buf.len().min(BuiltinNfgenmsg::len()));
3338 IterableDpll::with_loc(attrs, buf.as_ptr() as usize)
3339 }
3340 fn write_header<Prev: Rec>(prev: &mut Prev) {
3341 let mut header = BuiltinNfgenmsg::new();
3342 header.cmd = 3u8;
3343 header.version = 1u8;
3344 prev.as_rec_mut().extend(header.as_slice());
3345 }
3346}
3347impl NetlinkRequest for OpDeviceSetDo<'_> {
3348 fn protocol(&self) -> Protocol {
3349 Protocol::Generic("dpll".as_bytes())
3350 }
3351 fn flags(&self) -> u16 {
3352 self.request.flags
3353 }
3354 fn payload(&self) -> &[u8] {
3355 self.request.buf()
3356 }
3357 type ReplyType<'buf> = IterableDpll<'buf>;
3358 fn decode_reply<'buf>(buf: &'buf [u8]) -> Self::ReplyType<'buf> {
3359 Self::decode_request(buf)
3360 }
3361 fn lookup(
3362 buf: &[u8],
3363 offset: usize,
3364 missing_type: Option<u16>,
3365 ) -> (Vec<(&'static str, usize)>, Option<&'static str>) {
3366 Self::decode_request(buf).lookup_attr(offset, missing_type)
3367 }
3368}
3369#[doc = "Get id of a pin that matches given attributes\n\nFlags: admin-perm\nRequest attributes:\n- [.push_module_name()](PushPin::push_module_name)\n- [.push_clock_id()](PushPin::push_clock_id)\n- [.push_board_label()](PushPin::push_board_label)\n- [.push_panel_label()](PushPin::push_panel_label)\n- [.push_package_label()](PushPin::push_package_label)\n- [.push_type()](PushPin::push_type)\n\nReply attributes:\n- [.get_id()](IterablePin::get_id)\n"]
3370#[derive(Debug)]
3371pub struct OpPinIdGetDo<'r> {
3372 request: Request<'r>,
3373}
3374impl<'r> OpPinIdGetDo<'r> {
3375 pub fn new(mut request: Request<'r>) -> Self {
3376 Self::write_header(request.buf_mut());
3377 Self { request: request }
3378 }
3379 pub fn encode_request<'buf>(buf: &'buf mut Vec<u8>) -> PushPin<&'buf mut Vec<u8>> {
3380 Self::write_header(buf);
3381 PushPin::new(buf)
3382 }
3383 pub fn encode(&mut self) -> PushPin<&mut Vec<u8>> {
3384 PushPin::new(self.request.buf_mut())
3385 }
3386 pub fn into_encoder(self) -> PushPin<RequestBuf<'r>> {
3387 PushPin::new(self.request.buf)
3388 }
3389 pub fn decode_request<'a>(buf: &'a [u8]) -> IterablePin<'a> {
3390 let (_header, attrs) = buf.split_at(buf.len().min(BuiltinNfgenmsg::len()));
3391 IterablePin::with_loc(attrs, buf.as_ptr() as usize)
3392 }
3393 fn write_header<Prev: Rec>(prev: &mut Prev) {
3394 let mut header = BuiltinNfgenmsg::new();
3395 header.cmd = 7u8;
3396 header.version = 1u8;
3397 prev.as_rec_mut().extend(header.as_slice());
3398 }
3399}
3400impl NetlinkRequest for OpPinIdGetDo<'_> {
3401 fn protocol(&self) -> Protocol {
3402 Protocol::Generic("dpll".as_bytes())
3403 }
3404 fn flags(&self) -> u16 {
3405 self.request.flags
3406 }
3407 fn payload(&self) -> &[u8] {
3408 self.request.buf()
3409 }
3410 type ReplyType<'buf> = IterablePin<'buf>;
3411 fn decode_reply<'buf>(buf: &'buf [u8]) -> Self::ReplyType<'buf> {
3412 Self::decode_request(buf)
3413 }
3414 fn lookup(
3415 buf: &[u8],
3416 offset: usize,
3417 missing_type: Option<u16>,
3418 ) -> (Vec<(&'static str, usize)>, Option<&'static str>) {
3419 Self::decode_request(buf).lookup_attr(offset, missing_type)
3420 }
3421}
3422#[doc = "Get list of pins and its attributes\\.\n\n\\- dump request without any attributes given \\- list all the pins in the\n system\n\\- dump request with target dpll \\- list all the pins registered with\n a given dpll device\n\\- do request with target dpll and target pin \\- single pin attributes\n\nFlags: admin-perm\nRequest attributes:\n- [.push_id()](PushPin::push_id)\n\nReply attributes:\n- [.get_id()](IterablePin::get_id)\n- [.get_module_name()](IterablePin::get_module_name)\n- [.get_clock_id()](IterablePin::get_clock_id)\n- [.get_board_label()](IterablePin::get_board_label)\n- [.get_panel_label()](IterablePin::get_panel_label)\n- [.get_package_label()](IterablePin::get_package_label)\n- [.get_type()](IterablePin::get_type)\n- [.get_frequency()](IterablePin::get_frequency)\n- [.get_frequency_supported()](IterablePin::get_frequency_supported)\n- [.get_capabilities()](IterablePin::get_capabilities)\n- [.get_parent_device()](IterablePin::get_parent_device)\n- [.get_parent_pin()](IterablePin::get_parent_pin)\n- [.get_phase_adjust_min()](IterablePin::get_phase_adjust_min)\n- [.get_phase_adjust_max()](IterablePin::get_phase_adjust_max)\n- [.get_phase_adjust()](IterablePin::get_phase_adjust)\n- [.get_fractional_frequency_offset()](IterablePin::get_fractional_frequency_offset)\n- [.get_esync_frequency()](IterablePin::get_esync_frequency)\n- [.get_esync_frequency_supported()](IterablePin::get_esync_frequency_supported)\n- [.get_esync_pulse()](IterablePin::get_esync_pulse)\n- [.get_reference_sync()](IterablePin::get_reference_sync)\n- [.get_phase_adjust_gran()](IterablePin::get_phase_adjust_gran)\n- [.get_fractional_frequency_offset_ppt()](IterablePin::get_fractional_frequency_offset_ppt)\n"]
3423#[derive(Debug)]
3424pub struct OpPinGetDump<'r> {
3425 request: Request<'r>,
3426}
3427impl<'r> OpPinGetDump<'r> {
3428 pub fn new(mut request: Request<'r>) -> Self {
3429 Self::write_header(request.buf_mut());
3430 Self {
3431 request: request.set_dump(),
3432 }
3433 }
3434 pub fn encode_request<'buf>(buf: &'buf mut Vec<u8>) -> PushPin<&'buf mut Vec<u8>> {
3435 Self::write_header(buf);
3436 PushPin::new(buf)
3437 }
3438 pub fn encode(&mut self) -> PushPin<&mut Vec<u8>> {
3439 PushPin::new(self.request.buf_mut())
3440 }
3441 pub fn into_encoder(self) -> PushPin<RequestBuf<'r>> {
3442 PushPin::new(self.request.buf)
3443 }
3444 pub fn decode_request<'a>(buf: &'a [u8]) -> IterablePin<'a> {
3445 let (_header, attrs) = buf.split_at(buf.len().min(BuiltinNfgenmsg::len()));
3446 IterablePin::with_loc(attrs, buf.as_ptr() as usize)
3447 }
3448 fn write_header<Prev: Rec>(prev: &mut Prev) {
3449 let mut header = BuiltinNfgenmsg::new();
3450 header.cmd = 8u8;
3451 header.version = 1u8;
3452 prev.as_rec_mut().extend(header.as_slice());
3453 }
3454}
3455impl NetlinkRequest for OpPinGetDump<'_> {
3456 fn protocol(&self) -> Protocol {
3457 Protocol::Generic("dpll".as_bytes())
3458 }
3459 fn flags(&self) -> u16 {
3460 self.request.flags
3461 }
3462 fn payload(&self) -> &[u8] {
3463 self.request.buf()
3464 }
3465 type ReplyType<'buf> = IterablePin<'buf>;
3466 fn decode_reply<'buf>(buf: &'buf [u8]) -> Self::ReplyType<'buf> {
3467 Self::decode_request(buf)
3468 }
3469 fn lookup(
3470 buf: &[u8],
3471 offset: usize,
3472 missing_type: Option<u16>,
3473 ) -> (Vec<(&'static str, usize)>, Option<&'static str>) {
3474 Self::decode_request(buf).lookup_attr(offset, missing_type)
3475 }
3476}
3477#[doc = "Get list of pins and its attributes\\.\n\n\\- dump request without any attributes given \\- list all the pins in the\n system\n\\- dump request with target dpll \\- list all the pins registered with\n a given dpll device\n\\- do request with target dpll and target pin \\- single pin attributes\n\nFlags: admin-perm\nRequest attributes:\n- [.push_id()](PushPin::push_id)\n\nReply attributes:\n- [.get_id()](IterablePin::get_id)\n- [.get_module_name()](IterablePin::get_module_name)\n- [.get_clock_id()](IterablePin::get_clock_id)\n- [.get_board_label()](IterablePin::get_board_label)\n- [.get_panel_label()](IterablePin::get_panel_label)\n- [.get_package_label()](IterablePin::get_package_label)\n- [.get_type()](IterablePin::get_type)\n- [.get_frequency()](IterablePin::get_frequency)\n- [.get_frequency_supported()](IterablePin::get_frequency_supported)\n- [.get_capabilities()](IterablePin::get_capabilities)\n- [.get_parent_device()](IterablePin::get_parent_device)\n- [.get_parent_pin()](IterablePin::get_parent_pin)\n- [.get_phase_adjust_min()](IterablePin::get_phase_adjust_min)\n- [.get_phase_adjust_max()](IterablePin::get_phase_adjust_max)\n- [.get_phase_adjust()](IterablePin::get_phase_adjust)\n- [.get_fractional_frequency_offset()](IterablePin::get_fractional_frequency_offset)\n- [.get_esync_frequency()](IterablePin::get_esync_frequency)\n- [.get_esync_frequency_supported()](IterablePin::get_esync_frequency_supported)\n- [.get_esync_pulse()](IterablePin::get_esync_pulse)\n- [.get_reference_sync()](IterablePin::get_reference_sync)\n- [.get_phase_adjust_gran()](IterablePin::get_phase_adjust_gran)\n- [.get_fractional_frequency_offset_ppt()](IterablePin::get_fractional_frequency_offset_ppt)\n"]
3478#[derive(Debug)]
3479pub struct OpPinGetDo<'r> {
3480 request: Request<'r>,
3481}
3482impl<'r> OpPinGetDo<'r> {
3483 pub fn new(mut request: Request<'r>) -> Self {
3484 Self::write_header(request.buf_mut());
3485 Self { request: request }
3486 }
3487 pub fn encode_request<'buf>(buf: &'buf mut Vec<u8>) -> PushPin<&'buf mut Vec<u8>> {
3488 Self::write_header(buf);
3489 PushPin::new(buf)
3490 }
3491 pub fn encode(&mut self) -> PushPin<&mut Vec<u8>> {
3492 PushPin::new(self.request.buf_mut())
3493 }
3494 pub fn into_encoder(self) -> PushPin<RequestBuf<'r>> {
3495 PushPin::new(self.request.buf)
3496 }
3497 pub fn decode_request<'a>(buf: &'a [u8]) -> IterablePin<'a> {
3498 let (_header, attrs) = buf.split_at(buf.len().min(BuiltinNfgenmsg::len()));
3499 IterablePin::with_loc(attrs, buf.as_ptr() as usize)
3500 }
3501 fn write_header<Prev: Rec>(prev: &mut Prev) {
3502 let mut header = BuiltinNfgenmsg::new();
3503 header.cmd = 8u8;
3504 header.version = 1u8;
3505 prev.as_rec_mut().extend(header.as_slice());
3506 }
3507}
3508impl NetlinkRequest for OpPinGetDo<'_> {
3509 fn protocol(&self) -> Protocol {
3510 Protocol::Generic("dpll".as_bytes())
3511 }
3512 fn flags(&self) -> u16 {
3513 self.request.flags
3514 }
3515 fn payload(&self) -> &[u8] {
3516 self.request.buf()
3517 }
3518 type ReplyType<'buf> = IterablePin<'buf>;
3519 fn decode_reply<'buf>(buf: &'buf [u8]) -> Self::ReplyType<'buf> {
3520 Self::decode_request(buf)
3521 }
3522 fn lookup(
3523 buf: &[u8],
3524 offset: usize,
3525 missing_type: Option<u16>,
3526 ) -> (Vec<(&'static str, usize)>, Option<&'static str>) {
3527 Self::decode_request(buf).lookup_attr(offset, missing_type)
3528 }
3529}
3530#[doc = "Set attributes of a target pin\nFlags: admin-perm\nRequest attributes:\n- [.push_id()](PushPin::push_id)\n- [.push_direction()](PushPin::push_direction)\n- [.push_frequency()](PushPin::push_frequency)\n- [.push_prio()](PushPin::push_prio)\n- [.push_state()](PushPin::push_state)\n- [.nested_parent_device()](PushPin::nested_parent_device)\n- [.nested_parent_pin()](PushPin::nested_parent_pin)\n- [.push_phase_adjust()](PushPin::push_phase_adjust)\n- [.push_esync_frequency()](PushPin::push_esync_frequency)\n- [.nested_reference_sync()](PushPin::nested_reference_sync)\n"]
3531#[derive(Debug)]
3532pub struct OpPinSetDo<'r> {
3533 request: Request<'r>,
3534}
3535impl<'r> OpPinSetDo<'r> {
3536 pub fn new(mut request: Request<'r>) -> Self {
3537 Self::write_header(request.buf_mut());
3538 Self { request: request }
3539 }
3540 pub fn encode_request<'buf>(buf: &'buf mut Vec<u8>) -> PushPin<&'buf mut Vec<u8>> {
3541 Self::write_header(buf);
3542 PushPin::new(buf)
3543 }
3544 pub fn encode(&mut self) -> PushPin<&mut Vec<u8>> {
3545 PushPin::new(self.request.buf_mut())
3546 }
3547 pub fn into_encoder(self) -> PushPin<RequestBuf<'r>> {
3548 PushPin::new(self.request.buf)
3549 }
3550 pub fn decode_request<'a>(buf: &'a [u8]) -> IterablePin<'a> {
3551 let (_header, attrs) = buf.split_at(buf.len().min(BuiltinNfgenmsg::len()));
3552 IterablePin::with_loc(attrs, buf.as_ptr() as usize)
3553 }
3554 fn write_header<Prev: Rec>(prev: &mut Prev) {
3555 let mut header = BuiltinNfgenmsg::new();
3556 header.cmd = 9u8;
3557 header.version = 1u8;
3558 prev.as_rec_mut().extend(header.as_slice());
3559 }
3560}
3561impl NetlinkRequest for OpPinSetDo<'_> {
3562 fn protocol(&self) -> Protocol {
3563 Protocol::Generic("dpll".as_bytes())
3564 }
3565 fn flags(&self) -> u16 {
3566 self.request.flags
3567 }
3568 fn payload(&self) -> &[u8] {
3569 self.request.buf()
3570 }
3571 type ReplyType<'buf> = IterablePin<'buf>;
3572 fn decode_reply<'buf>(buf: &'buf [u8]) -> Self::ReplyType<'buf> {
3573 Self::decode_request(buf)
3574 }
3575 fn lookup(
3576 buf: &[u8],
3577 offset: usize,
3578 missing_type: Option<u16>,
3579 ) -> (Vec<(&'static str, usize)>, Option<&'static str>) {
3580 Self::decode_request(buf).lookup_attr(offset, missing_type)
3581 }
3582}
3583use crate::traits::LookupFn;
3584use crate::utils::RequestBuf;
3585#[derive(Debug)]
3586pub struct Request<'buf> {
3587 buf: RequestBuf<'buf>,
3588 flags: u16,
3589 writeback: Option<&'buf mut Option<RequestInfo>>,
3590}
3591#[allow(unused)]
3592#[derive(Debug, Clone)]
3593pub struct RequestInfo {
3594 protocol: Protocol,
3595 flags: u16,
3596 name: &'static str,
3597 lookup: LookupFn,
3598}
3599impl Request<'static> {
3600 pub fn new() -> Self {
3601 Self::new_from_buf(Vec::new())
3602 }
3603 pub fn new_from_buf(buf: Vec<u8>) -> Self {
3604 Self {
3605 flags: 0,
3606 buf: RequestBuf::Own(buf),
3607 writeback: None,
3608 }
3609 }
3610 pub fn into_buf(self) -> Vec<u8> {
3611 match self.buf {
3612 RequestBuf::Own(buf) => buf,
3613 _ => unreachable!(),
3614 }
3615 }
3616}
3617impl<'buf> Request<'buf> {
3618 pub fn new_with_buf(buf: &'buf mut Vec<u8>) -> Self {
3619 buf.clear();
3620 Self::new_extend(buf)
3621 }
3622 pub fn new_extend(buf: &'buf mut Vec<u8>) -> Self {
3623 Self {
3624 flags: 0,
3625 buf: RequestBuf::Ref(buf),
3626 writeback: None,
3627 }
3628 }
3629 fn do_writeback(&mut self, protocol: Protocol, name: &'static str, lookup: LookupFn) {
3630 let Some(writeback) = &mut self.writeback else {
3631 return;
3632 };
3633 **writeback = Some(RequestInfo {
3634 protocol,
3635 flags: self.flags,
3636 name,
3637 lookup,
3638 })
3639 }
3640 pub fn buf(&self) -> &Vec<u8> {
3641 self.buf.buf()
3642 }
3643 pub fn buf_mut(&mut self) -> &mut Vec<u8> {
3644 self.buf.buf_mut()
3645 }
3646 #[doc = "Set `NLM_F_CREATE` flag"]
3647 pub fn set_create(mut self) -> Self {
3648 self.flags |= consts::NLM_F_CREATE as u16;
3649 self
3650 }
3651 #[doc = "Set `NLM_F_EXCL` flag"]
3652 pub fn set_excl(mut self) -> Self {
3653 self.flags |= consts::NLM_F_EXCL as u16;
3654 self
3655 }
3656 #[doc = "Set `NLM_F_REPLACE` flag"]
3657 pub fn set_replace(mut self) -> Self {
3658 self.flags |= consts::NLM_F_REPLACE as u16;
3659 self
3660 }
3661 #[doc = "Set `NLM_F_CREATE` and `NLM_F_REPLACE` flag"]
3662 pub fn set_change(self) -> Self {
3663 self.set_create().set_replace()
3664 }
3665 #[doc = "Set `NLM_F_APPEND` flag"]
3666 pub fn set_append(mut self) -> Self {
3667 self.flags |= consts::NLM_F_APPEND as u16;
3668 self
3669 }
3670 #[doc = "Set `self.flags |= flags`"]
3671 pub fn set_flags(mut self, flags: u16) -> Self {
3672 self.flags |= flags;
3673 self
3674 }
3675 #[doc = "Set `self.flags ^= self.flags & flags`"]
3676 pub fn unset_flags(mut self, flags: u16) -> Self {
3677 self.flags ^= self.flags & flags;
3678 self
3679 }
3680 #[doc = "Set `NLM_F_DUMP` flag"]
3681 fn set_dump(mut self) -> Self {
3682 self.flags |= consts::NLM_F_DUMP as u16;
3683 self
3684 }
3685 #[doc = "Get id of dpll device that matches given attributes\n\nFlags: admin-perm\nRequest attributes:\n- [.push_module_name()](PushDpll::push_module_name)\n- [.push_clock_id()](PushDpll::push_clock_id)\n- [.push_type()](PushDpll::push_type)\n\nReply attributes:\n- [.get_id()](IterableDpll::get_id)\n"]
3686 pub fn op_device_id_get_do(self) -> OpDeviceIdGetDo<'buf> {
3687 let mut res = OpDeviceIdGetDo::new(self);
3688 res.request.do_writeback(
3689 res.protocol(),
3690 "op-device-id-get-do",
3691 OpDeviceIdGetDo::lookup,
3692 );
3693 res
3694 }
3695 #[doc = "Get list of DPLL devices (dump) or attributes of a single dpll device\n\nFlags: admin-perm\n\nReply attributes:\n- [.get_id()](IterableDpll::get_id)\n- [.get_module_name()](IterableDpll::get_module_name)\n- [.get_clock_id()](IterableDpll::get_clock_id)\n- [.get_mode()](IterableDpll::get_mode)\n- [.get_mode_supported()](IterableDpll::get_mode_supported)\n- [.get_lock_status()](IterableDpll::get_lock_status)\n- [.get_temp()](IterableDpll::get_temp)\n- [.get_type()](IterableDpll::get_type)\n- [.get_lock_status_error()](IterableDpll::get_lock_status_error)\n- [.get_phase_offset_monitor()](IterableDpll::get_phase_offset_monitor)\n- [.get_phase_offset_avg_factor()](IterableDpll::get_phase_offset_avg_factor)\n"]
3696 pub fn op_device_get_dump(self) -> OpDeviceGetDump<'buf> {
3697 let mut res = OpDeviceGetDump::new(self);
3698 res.request.do_writeback(
3699 res.protocol(),
3700 "op-device-get-dump",
3701 OpDeviceGetDump::lookup,
3702 );
3703 res
3704 }
3705 #[doc = "Get list of DPLL devices (dump) or attributes of a single dpll device\n\nFlags: admin-perm\nRequest attributes:\n- [.push_id()](PushDpll::push_id)\n\nReply attributes:\n- [.get_id()](IterableDpll::get_id)\n- [.get_module_name()](IterableDpll::get_module_name)\n- [.get_clock_id()](IterableDpll::get_clock_id)\n- [.get_mode()](IterableDpll::get_mode)\n- [.get_mode_supported()](IterableDpll::get_mode_supported)\n- [.get_lock_status()](IterableDpll::get_lock_status)\n- [.get_temp()](IterableDpll::get_temp)\n- [.get_type()](IterableDpll::get_type)\n- [.get_lock_status_error()](IterableDpll::get_lock_status_error)\n- [.get_phase_offset_monitor()](IterableDpll::get_phase_offset_monitor)\n- [.get_phase_offset_avg_factor()](IterableDpll::get_phase_offset_avg_factor)\n"]
3706 pub fn op_device_get_do(self) -> OpDeviceGetDo<'buf> {
3707 let mut res = OpDeviceGetDo::new(self);
3708 res.request
3709 .do_writeback(res.protocol(), "op-device-get-do", OpDeviceGetDo::lookup);
3710 res
3711 }
3712 #[doc = "Set attributes for a DPLL device\nFlags: admin-perm\nRequest attributes:\n- [.push_id()](PushDpll::push_id)\n- [.push_mode()](PushDpll::push_mode)\n- [.push_phase_offset_monitor()](PushDpll::push_phase_offset_monitor)\n- [.push_phase_offset_avg_factor()](PushDpll::push_phase_offset_avg_factor)\n"]
3713 pub fn op_device_set_do(self) -> OpDeviceSetDo<'buf> {
3714 let mut res = OpDeviceSetDo::new(self);
3715 res.request
3716 .do_writeback(res.protocol(), "op-device-set-do", OpDeviceSetDo::lookup);
3717 res
3718 }
3719 #[doc = "Get id of a pin that matches given attributes\n\nFlags: admin-perm\nRequest attributes:\n- [.push_module_name()](PushPin::push_module_name)\n- [.push_clock_id()](PushPin::push_clock_id)\n- [.push_board_label()](PushPin::push_board_label)\n- [.push_panel_label()](PushPin::push_panel_label)\n- [.push_package_label()](PushPin::push_package_label)\n- [.push_type()](PushPin::push_type)\n\nReply attributes:\n- [.get_id()](IterablePin::get_id)\n"]
3720 pub fn op_pin_id_get_do(self) -> OpPinIdGetDo<'buf> {
3721 let mut res = OpPinIdGetDo::new(self);
3722 res.request
3723 .do_writeback(res.protocol(), "op-pin-id-get-do", OpPinIdGetDo::lookup);
3724 res
3725 }
3726 #[doc = "Get list of pins and its attributes\\.\n\n\\- dump request without any attributes given \\- list all the pins in the\n system\n\\- dump request with target dpll \\- list all the pins registered with\n a given dpll device\n\\- do request with target dpll and target pin \\- single pin attributes\n\nFlags: admin-perm\nRequest attributes:\n- [.push_id()](PushPin::push_id)\n\nReply attributes:\n- [.get_id()](IterablePin::get_id)\n- [.get_module_name()](IterablePin::get_module_name)\n- [.get_clock_id()](IterablePin::get_clock_id)\n- [.get_board_label()](IterablePin::get_board_label)\n- [.get_panel_label()](IterablePin::get_panel_label)\n- [.get_package_label()](IterablePin::get_package_label)\n- [.get_type()](IterablePin::get_type)\n- [.get_frequency()](IterablePin::get_frequency)\n- [.get_frequency_supported()](IterablePin::get_frequency_supported)\n- [.get_capabilities()](IterablePin::get_capabilities)\n- [.get_parent_device()](IterablePin::get_parent_device)\n- [.get_parent_pin()](IterablePin::get_parent_pin)\n- [.get_phase_adjust_min()](IterablePin::get_phase_adjust_min)\n- [.get_phase_adjust_max()](IterablePin::get_phase_adjust_max)\n- [.get_phase_adjust()](IterablePin::get_phase_adjust)\n- [.get_fractional_frequency_offset()](IterablePin::get_fractional_frequency_offset)\n- [.get_esync_frequency()](IterablePin::get_esync_frequency)\n- [.get_esync_frequency_supported()](IterablePin::get_esync_frequency_supported)\n- [.get_esync_pulse()](IterablePin::get_esync_pulse)\n- [.get_reference_sync()](IterablePin::get_reference_sync)\n- [.get_phase_adjust_gran()](IterablePin::get_phase_adjust_gran)\n- [.get_fractional_frequency_offset_ppt()](IterablePin::get_fractional_frequency_offset_ppt)\n"]
3727 pub fn op_pin_get_dump(self) -> OpPinGetDump<'buf> {
3728 let mut res = OpPinGetDump::new(self);
3729 res.request
3730 .do_writeback(res.protocol(), "op-pin-get-dump", OpPinGetDump::lookup);
3731 res
3732 }
3733 #[doc = "Get list of pins and its attributes\\.\n\n\\- dump request without any attributes given \\- list all the pins in the\n system\n\\- dump request with target dpll \\- list all the pins registered with\n a given dpll device\n\\- do request with target dpll and target pin \\- single pin attributes\n\nFlags: admin-perm\nRequest attributes:\n- [.push_id()](PushPin::push_id)\n\nReply attributes:\n- [.get_id()](IterablePin::get_id)\n- [.get_module_name()](IterablePin::get_module_name)\n- [.get_clock_id()](IterablePin::get_clock_id)\n- [.get_board_label()](IterablePin::get_board_label)\n- [.get_panel_label()](IterablePin::get_panel_label)\n- [.get_package_label()](IterablePin::get_package_label)\n- [.get_type()](IterablePin::get_type)\n- [.get_frequency()](IterablePin::get_frequency)\n- [.get_frequency_supported()](IterablePin::get_frequency_supported)\n- [.get_capabilities()](IterablePin::get_capabilities)\n- [.get_parent_device()](IterablePin::get_parent_device)\n- [.get_parent_pin()](IterablePin::get_parent_pin)\n- [.get_phase_adjust_min()](IterablePin::get_phase_adjust_min)\n- [.get_phase_adjust_max()](IterablePin::get_phase_adjust_max)\n- [.get_phase_adjust()](IterablePin::get_phase_adjust)\n- [.get_fractional_frequency_offset()](IterablePin::get_fractional_frequency_offset)\n- [.get_esync_frequency()](IterablePin::get_esync_frequency)\n- [.get_esync_frequency_supported()](IterablePin::get_esync_frequency_supported)\n- [.get_esync_pulse()](IterablePin::get_esync_pulse)\n- [.get_reference_sync()](IterablePin::get_reference_sync)\n- [.get_phase_adjust_gran()](IterablePin::get_phase_adjust_gran)\n- [.get_fractional_frequency_offset_ppt()](IterablePin::get_fractional_frequency_offset_ppt)\n"]
3734 pub fn op_pin_get_do(self) -> OpPinGetDo<'buf> {
3735 let mut res = OpPinGetDo::new(self);
3736 res.request
3737 .do_writeback(res.protocol(), "op-pin-get-do", OpPinGetDo::lookup);
3738 res
3739 }
3740 #[doc = "Set attributes of a target pin\nFlags: admin-perm\nRequest attributes:\n- [.push_id()](PushPin::push_id)\n- [.push_direction()](PushPin::push_direction)\n- [.push_frequency()](PushPin::push_frequency)\n- [.push_prio()](PushPin::push_prio)\n- [.push_state()](PushPin::push_state)\n- [.nested_parent_device()](PushPin::nested_parent_device)\n- [.nested_parent_pin()](PushPin::nested_parent_pin)\n- [.push_phase_adjust()](PushPin::push_phase_adjust)\n- [.push_esync_frequency()](PushPin::push_esync_frequency)\n- [.nested_reference_sync()](PushPin::nested_reference_sync)\n"]
3741 pub fn op_pin_set_do(self) -> OpPinSetDo<'buf> {
3742 let mut res = OpPinSetDo::new(self);
3743 res.request
3744 .do_writeback(res.protocol(), "op-pin-set-do", OpPinSetDo::lookup);
3745 res
3746 }
3747}
3748#[cfg(test)]
3749mod generated_tests {
3750 use super::*;
3751 #[test]
3752 fn tests() {
3753 let _ = IterableDpll::get_clock_id;
3754 let _ = IterableDpll::get_id;
3755 let _ = IterableDpll::get_lock_status;
3756 let _ = IterableDpll::get_lock_status_error;
3757 let _ = IterableDpll::get_mode;
3758 let _ = IterableDpll::get_mode_supported;
3759 let _ = IterableDpll::get_module_name;
3760 let _ = IterableDpll::get_phase_offset_avg_factor;
3761 let _ = IterableDpll::get_phase_offset_monitor;
3762 let _ = IterableDpll::get_temp;
3763 let _ = IterableDpll::get_type;
3764 let _ = IterablePin::get_board_label;
3765 let _ = IterablePin::get_capabilities;
3766 let _ = IterablePin::get_clock_id;
3767 let _ = IterablePin::get_esync_frequency;
3768 let _ = IterablePin::get_esync_frequency_supported;
3769 let _ = IterablePin::get_esync_pulse;
3770 let _ = IterablePin::get_fractional_frequency_offset;
3771 let _ = IterablePin::get_fractional_frequency_offset_ppt;
3772 let _ = IterablePin::get_frequency;
3773 let _ = IterablePin::get_frequency_supported;
3774 let _ = IterablePin::get_id;
3775 let _ = IterablePin::get_module_name;
3776 let _ = IterablePin::get_package_label;
3777 let _ = IterablePin::get_panel_label;
3778 let _ = IterablePin::get_parent_device;
3779 let _ = IterablePin::get_parent_pin;
3780 let _ = IterablePin::get_phase_adjust;
3781 let _ = IterablePin::get_phase_adjust_gran;
3782 let _ = IterablePin::get_phase_adjust_max;
3783 let _ = IterablePin::get_phase_adjust_min;
3784 let _ = IterablePin::get_reference_sync;
3785 let _ = IterablePin::get_type;
3786 let _ = OpDeviceChangeNotif;
3787 let _ = OpDeviceCreateNotif;
3788 let _ = OpDeviceDeleteNotif;
3789 let _ = OpPinChangeNotif;
3790 let _ = OpPinCreateNotif;
3791 let _ = OpPinDeleteNotif;
3792 let _ = PushDpll::<&mut Vec<u8>>::push_clock_id;
3793 let _ = PushDpll::<&mut Vec<u8>>::push_id;
3794 let _ = PushDpll::<&mut Vec<u8>>::push_mode;
3795 let _ = PushDpll::<&mut Vec<u8>>::push_module_name;
3796 let _ = PushDpll::<&mut Vec<u8>>::push_phase_offset_avg_factor;
3797 let _ = PushDpll::<&mut Vec<u8>>::push_phase_offset_monitor;
3798 let _ = PushDpll::<&mut Vec<u8>>::push_type;
3799 let _ = PushPin::<&mut Vec<u8>>::nested_parent_device;
3800 let _ = PushPin::<&mut Vec<u8>>::nested_parent_pin;
3801 let _ = PushPin::<&mut Vec<u8>>::nested_reference_sync;
3802 let _ = PushPin::<&mut Vec<u8>>::push_board_label;
3803 let _ = PushPin::<&mut Vec<u8>>::push_clock_id;
3804 let _ = PushPin::<&mut Vec<u8>>::push_direction;
3805 let _ = PushPin::<&mut Vec<u8>>::push_esync_frequency;
3806 let _ = PushPin::<&mut Vec<u8>>::push_frequency;
3807 let _ = PushPin::<&mut Vec<u8>>::push_id;
3808 let _ = PushPin::<&mut Vec<u8>>::push_module_name;
3809 let _ = PushPin::<&mut Vec<u8>>::push_package_label;
3810 let _ = PushPin::<&mut Vec<u8>>::push_panel_label;
3811 let _ = PushPin::<&mut Vec<u8>>::push_phase_adjust;
3812 let _ = PushPin::<&mut Vec<u8>>::push_prio;
3813 let _ = PushPin::<&mut Vec<u8>>::push_state;
3814 let _ = PushPin::<&mut Vec<u8>>::push_type;
3815 }
3816}