Skip to content

Commit 4ee7fb7

Browse files
authored
chore: split method definitions of Port PM Status and Control (#110)
To remove duplicated docs.
1 parent 02253b7 commit 4ee7fb7

File tree

1 file changed

+4
-41
lines changed

1 file changed

+4
-41
lines changed

src/registers/operational.rs

Lines changed: 4 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -428,158 +428,121 @@ impl_debug_from_methods! {
428428
#[repr(transparent)]
429429
#[derive(Copy, Clone)]
430430
pub struct PortPowerManagementStatusAndControlRegister(u32);
431+
/// **These methods are only valid for USB3.**
431432
impl PortPowerManagementStatusAndControlRegister {
432433
/// Returns the value of the U1 Timeout field.
433-
///
434-
/// **This field is USB3 only.**
435434
#[must_use]
436435
pub fn u1_timeout(self) -> u8 {
437436
self.0.get_bits(0..=7).try_into().unwrap()
438437
}
439438

440439
/// Sets the value of the U1 Timeout field.
441-
///
442-
/// **This field is USB3 only.**
443440
pub fn set_u1_timeout(&mut self, timeout: u8) {
444441
self.0.set_bits(0..=7, timeout.into());
445442
}
446443

447444
/// Returns the value of the U2 Timeout field.
448-
///
449-
/// **This field is USB3 only.**
450445
#[must_use]
451446
pub fn u2_timeout(self) -> u8 {
452447
self.0.get_bits(8..=15).try_into().unwrap()
453448
}
454449

455450
/// Sets the value of the U2 Timeout field.
456-
///
457-
/// **This field is USB3 only.**
458451
pub fn set_u2_timeout(&mut self, timeout: u8) {
459452
self.0.set_bits(8..=15, timeout.into());
460453
}
461454

462455
/// Returns the value of the Force Link PM Accept bit.
463-
///
464-
/// **This field is USB3 only.**
465456
#[must_use]
466457
pub fn force_link_pm_accept(self) -> bool {
467458
self.0.get_bit(16)
468459
}
469460

470461
/// Sets the value of the Force Link PM Accept bit.
471-
///
472-
/// **This field is USB3 only.**
473462
pub fn set_force_link_pm_accept(&mut self) {
474463
self.0.set_bit(16, true);
475464
}
476465

477466
/// Clears the Force Link PM Accept bit.
478-
///
479-
/// **This field is USB3 only.**
480467
pub fn clear_force_link_pm_accept(&mut self) {
481468
self.0.set_bit(16, false);
482469
}
483-
470+
}
471+
/// **These methods are only valid for USB2.**
472+
impl PortPowerManagementStatusAndControlRegister {
484473
/// Returns the value of the L1 Status field.
485474
///
486475
/// This field returns [`None`] if the value means `Reserved`.
487-
///
488-
/// **This field is USB2 only.**
489476
#[must_use]
490477
pub fn l1_status(self) -> Option<L1Status> {
491478
let s = self.0.get_bits(0..=2);
492479
FromPrimitive::from_u32(s)
493480
}
494481

495482
/// Returns the value of the Remote Wake Enable field.
496-
///
497-
/// **This field is USB2 only.**
498483
#[must_use]
499484
pub fn remote_wake_enable(self) -> bool {
500485
self.0.get_bit(3)
501486
}
502487

503488
/// Sets the value of the Remote Wake Enable field.
504-
///
505-
/// **This field is USB2 only.**
506489
pub fn set_remote_wake_enable(&mut self) {
507490
self.0.set_bit(3, true);
508491
}
509492

510493
/// Clears the Remote Wake Enable bit.
511-
///
512-
/// **This field is USB2 only.**
513494
pub fn clear_remote_wake_enable(&mut self) {
514495
self.0.set_bit(3, false);
515496
}
516497

517498
/// Returns the value of the Best Effort Service Latency field.
518-
///
519-
/// **This field is USB2 only.**
520499
#[must_use]
521500
pub fn best_effort_service_latency(self) -> u8 {
522501
self.0.get_bits(4..=7).try_into().unwrap()
523502
}
524503

525504
/// Sets the value of the Best Effort Service Latency field.
526-
///
527-
/// **This field is USB2 only.**
528505
pub fn set_best_effort_service_latency(&mut self, l: u8) {
529506
self.0.set_bits(4..=7, l.into());
530507
}
531508

532509
/// Returns the value of the L1 Device Slot field.
533-
///
534-
/// **This field is USB2 only.**
535510
#[must_use]
536511
pub fn l1_device_slot(self) -> u8 {
537512
self.0.get_bits(8..=15).try_into().unwrap()
538513
}
539514

540515
/// Sets the value of the L1 Device Slot field.
541-
///
542-
/// **This field is USB2 only.**
543516
pub fn set_l1_device_slot(&mut self, slot: u8) {
544517
self.0.set_bits(8..=15, slot.into());
545518
}
546519

547520
/// Returns the value of the Hardware LPM Enable field.
548-
///
549-
/// **This field is USB2 only.**
550521
#[must_use]
551522
pub fn hardware_lpm_enable(self) -> bool {
552523
self.0.get_bit(16)
553524
}
554525

555526
/// Sets the value of the Hardware LPM Enable field.
556-
///
557-
/// **This field is USB2 only.**
558527
pub fn set_hardware_lpm_enable(&mut self) {
559528
self.0.set_bit(16, true);
560529
}
561530

562531
/// Clears the Hardware LPM Enable bit.
563-
///
564-
/// **This field is USB2 only.**
565532
pub fn clear_hardware_lpm_enable(&mut self) {
566533
self.0.set_bit(16, false);
567534
}
568535

569536
/// Returns the value of the Port Test Control field.
570537
///
571538
/// This field returns [`None`] if the value means `Reserved`.
572-
///
573-
/// **This field is USB2 only.**
574539
#[must_use]
575540
pub fn port_test_control(self) -> Option<TestMode> {
576541
let t = self.0.get_bits(28..=31);
577542
FromPrimitive::from_u32(t)
578543
}
579544

580545
/// Sets the value of the Port Test Control field.
581-
///
582-
/// **This field is USB2 only.**
583546
pub fn set_port_test_control(&mut self, m: TestMode) {
584547
self.0.set_bits(28..=31, m as _);
585548
}

0 commit comments

Comments
 (0)