d1_pac/usb1/ohci_root_hub_partition/
hc_rh_status.rs

1#[doc = "Register `hc_rh_status` reader"]
2pub type R = crate::R<HC_RH_STATUS_SPEC>;
3#[doc = "Register `hc_rh_status` writer"]
4pub type W = crate::W<HC_RH_STATUS_SPEC>;
5#[doc = "Field `r_local_power_status_w_clear_global_power` reader - (Read)LocalPowerStatus\n\nWhen read, this bit returns the LocalPowerStatus of the Root Hub. The Root Hub does not support the local power status feature; thus, this bit is always read as '0'.\n\n(Write)ClearGlobalPower\n\nWhen write, this bit is operated as the ClearGlobalPower. In global power mode ( PowerSwitchingMode =0), This bit is written to '1' to turn off power to all ports (clear PortPowerStatus ). In per-port power mode, it clears PortPowerStatus only on ports whose PortPowerControlMask bit is not set. Writing a '0' has no effect."]
6pub type R_LOCAL_POWER_STATUS_W_CLEAR_GLOBAL_POWER_R = crate::BitReader;
7#[doc = "Field `r_local_power_status_w_clear_global_power` writer - (Read)LocalPowerStatus\n\nWhen read, this bit returns the LocalPowerStatus of the Root Hub. The Root Hub does not support the local power status feature; thus, this bit is always read as '0'.\n\n(Write)ClearGlobalPower\n\nWhen write, this bit is operated as the ClearGlobalPower. In global power mode ( PowerSwitchingMode =0), This bit is written to '1' to turn off power to all ports (clear PortPowerStatus ). In per-port power mode, it clears PortPowerStatus only on ports whose PortPowerControlMask bit is not set. Writing a '0' has no effect."]
8pub type R_LOCAL_POWER_STATUS_W_CLEAR_GLOBAL_POWER_W<'a, REG> = crate::BitWriter<'a, REG>;
9#[doc = "Field `over_current_indicator` reader - This bit reports overcurrent conditions when the global reporting is implemented. When set, an overcurrent condition exists. When cleared, all power operations are normal. If per-port overcurrent protection is implemented this bit is always '0'"]
10pub type OVER_CURRENT_INDICATOR_R = crate::BitReader;
11#[doc = "Field `over_current_indicator` writer - This bit reports overcurrent conditions when the global reporting is implemented. When set, an overcurrent condition exists. When cleared, all power operations are normal. If per-port overcurrent protection is implemented this bit is always '0'"]
12pub type OVER_CURRENT_INDICATOR_W<'a, REG> = crate::BitWriter<'a, REG>;
13#[doc = "Field `r_device_remote_wakeup_enable_w_set_remote_wakeup_enable` reader - (read)DeviceRemoteWakeupEnable\n\nThis bit enables a ConnectStatusChange bit as a resume event, causing a USBSUSPEND to USBRESUME state transition and setting the ResumeDetected interrupt.\n\n0 ConnectStatusChange is not a remote wakeup event.\n\n1 ConnectStatusChange is a remote wakeup event.\n\n(write)SetRemoteWakeupEnable\n\nWriting a '1' sets DeviceRemoveWakeupEnable. Writing a '0' has no effect."]
14pub type R_DEVICE_REMOTE_WAKEUP_ENABLE_W_SET_REMOTE_WAKEUP_ENABLE_R = crate::BitReader;
15#[doc = "Field `r_device_remote_wakeup_enable_w_set_remote_wakeup_enable` writer - (read)DeviceRemoteWakeupEnable\n\nThis bit enables a ConnectStatusChange bit as a resume event, causing a USBSUSPEND to USBRESUME state transition and setting the ResumeDetected interrupt.\n\n0 ConnectStatusChange is not a remote wakeup event.\n\n1 ConnectStatusChange is a remote wakeup event.\n\n(write)SetRemoteWakeupEnable\n\nWriting a '1' sets DeviceRemoveWakeupEnable. Writing a '0' has no effect."]
16pub type R_DEVICE_REMOTE_WAKEUP_ENABLE_W_SET_REMOTE_WAKEUP_ENABLE_W<'a, REG> =
17    crate::BitWriter<'a, REG>;
18#[doc = "Field `r_local_power_status_w_set_global_power` reader - (read)LocalPowerStatusChange\n\nThe Root Hub does not support the local power status features, thus, this bit is always read as '0'.\n\n(write)SetGlobalPower\n\nIn global power mode ( PowerSwitchingMode =0), This bit is written to '1' to turn on power to all ports (clear PortPowerStatus ). In per-port power mode, it sets PortPowerStatus only on ports whose PortPowerControlMask bit is not set. Writing a '0' has no effect."]
19pub type R_LOCAL_POWER_STATUS_W_SET_GLOBAL_POWER_R = crate::BitReader;
20#[doc = "Field `r_local_power_status_w_set_global_power` writer - (read)LocalPowerStatusChange\n\nThe Root Hub does not support the local power status features, thus, this bit is always read as '0'.\n\n(write)SetGlobalPower\n\nIn global power mode ( PowerSwitchingMode =0), This bit is written to '1' to turn on power to all ports (clear PortPowerStatus ). In per-port power mode, it sets PortPowerStatus only on ports whose PortPowerControlMask bit is not set. Writing a '0' has no effect."]
21pub type R_LOCAL_POWER_STATUS_W_SET_GLOBAL_POWER_W<'a, REG> = crate::BitWriter<'a, REG>;
22#[doc = "Field `over_current_indicator_change` reader - This bit is set by hardware when a change has occurred to the OverCurrentIndicator field of this register. The HCD clears this bit by writing a '1'. Writing a '0' has no effect."]
23pub type OVER_CURRENT_INDICATOR_CHANGE_R = crate::BitReader;
24#[doc = "Field `over_current_indicator_change` writer - This bit is set by hardware when a change has occurred to the OverCurrentIndicator field of this register. The HCD clears this bit by writing a '1'. Writing a '0' has no effect."]
25pub type OVER_CURRENT_INDICATOR_CHANGE_W<'a, REG> = crate::BitWriter<'a, REG>;
26#[doc = "Field `clear_remote_eakeup_enable` reader - (write)ClearRemoteWakeupEnable\n\nWrite a '1' clears DeviceRemoteWakeupEnable. Writing a '0' has no effect."]
27pub type CLEAR_REMOTE_EAKEUP_ENABLE_R = crate::BitReader;
28#[doc = "Field `clear_remote_eakeup_enable` writer - (write)ClearRemoteWakeupEnable\n\nWrite a '1' clears DeviceRemoteWakeupEnable. Writing a '0' has no effect."]
29pub type CLEAR_REMOTE_EAKEUP_ENABLE_W<'a, REG> = crate::BitWriter<'a, REG>;
30impl R {
31    #[doc = "Bit 0 - (Read)LocalPowerStatus\n\nWhen read, this bit returns the LocalPowerStatus of the Root Hub. The Root Hub does not support the local power status feature; thus, this bit is always read as '0'.\n\n(Write)ClearGlobalPower\n\nWhen write, this bit is operated as the ClearGlobalPower. In global power mode ( PowerSwitchingMode =0), This bit is written to '1' to turn off power to all ports (clear PortPowerStatus ). In per-port power mode, it clears PortPowerStatus only on ports whose PortPowerControlMask bit is not set. Writing a '0' has no effect."]
32    #[inline(always)]
33    pub fn r_local_power_status_w_clear_global_power(
34        &self,
35    ) -> R_LOCAL_POWER_STATUS_W_CLEAR_GLOBAL_POWER_R {
36        R_LOCAL_POWER_STATUS_W_CLEAR_GLOBAL_POWER_R::new((self.bits & 1) != 0)
37    }
38    #[doc = "Bit 1 - This bit reports overcurrent conditions when the global reporting is implemented. When set, an overcurrent condition exists. When cleared, all power operations are normal. If per-port overcurrent protection is implemented this bit is always '0'"]
39    #[inline(always)]
40    pub fn over_current_indicator(&self) -> OVER_CURRENT_INDICATOR_R {
41        OVER_CURRENT_INDICATOR_R::new(((self.bits >> 1) & 1) != 0)
42    }
43    #[doc = "Bit 15 - (read)DeviceRemoteWakeupEnable\n\nThis bit enables a ConnectStatusChange bit as a resume event, causing a USBSUSPEND to USBRESUME state transition and setting the ResumeDetected interrupt.\n\n0 ConnectStatusChange is not a remote wakeup event.\n\n1 ConnectStatusChange is a remote wakeup event.\n\n(write)SetRemoteWakeupEnable\n\nWriting a '1' sets DeviceRemoveWakeupEnable. Writing a '0' has no effect."]
44    #[inline(always)]
45    pub fn r_device_remote_wakeup_enable_w_set_remote_wakeup_enable(
46        &self,
47    ) -> R_DEVICE_REMOTE_WAKEUP_ENABLE_W_SET_REMOTE_WAKEUP_ENABLE_R {
48        R_DEVICE_REMOTE_WAKEUP_ENABLE_W_SET_REMOTE_WAKEUP_ENABLE_R::new(
49            ((self.bits >> 15) & 1) != 0,
50        )
51    }
52    #[doc = "Bit 16 - (read)LocalPowerStatusChange\n\nThe Root Hub does not support the local power status features, thus, this bit is always read as '0'.\n\n(write)SetGlobalPower\n\nIn global power mode ( PowerSwitchingMode =0), This bit is written to '1' to turn on power to all ports (clear PortPowerStatus ). In per-port power mode, it sets PortPowerStatus only on ports whose PortPowerControlMask bit is not set. Writing a '0' has no effect."]
53    #[inline(always)]
54    pub fn r_local_power_status_w_set_global_power(
55        &self,
56    ) -> R_LOCAL_POWER_STATUS_W_SET_GLOBAL_POWER_R {
57        R_LOCAL_POWER_STATUS_W_SET_GLOBAL_POWER_R::new(((self.bits >> 16) & 1) != 0)
58    }
59    #[doc = "Bit 17 - This bit is set by hardware when a change has occurred to the OverCurrentIndicator field of this register. The HCD clears this bit by writing a '1'. Writing a '0' has no effect."]
60    #[inline(always)]
61    pub fn over_current_indicator_change(&self) -> OVER_CURRENT_INDICATOR_CHANGE_R {
62        OVER_CURRENT_INDICATOR_CHANGE_R::new(((self.bits >> 17) & 1) != 0)
63    }
64    #[doc = "Bit 31 - (write)ClearRemoteWakeupEnable\n\nWrite a '1' clears DeviceRemoteWakeupEnable. Writing a '0' has no effect."]
65    #[inline(always)]
66    pub fn clear_remote_eakeup_enable(&self) -> CLEAR_REMOTE_EAKEUP_ENABLE_R {
67        CLEAR_REMOTE_EAKEUP_ENABLE_R::new(((self.bits >> 31) & 1) != 0)
68    }
69}
70impl W {
71    #[doc = "Bit 0 - (Read)LocalPowerStatus\n\nWhen read, this bit returns the LocalPowerStatus of the Root Hub. The Root Hub does not support the local power status feature; thus, this bit is always read as '0'.\n\n(Write)ClearGlobalPower\n\nWhen write, this bit is operated as the ClearGlobalPower. In global power mode ( PowerSwitchingMode =0), This bit is written to '1' to turn off power to all ports (clear PortPowerStatus ). In per-port power mode, it clears PortPowerStatus only on ports whose PortPowerControlMask bit is not set. Writing a '0' has no effect."]
72    #[inline(always)]
73    #[must_use]
74    pub fn r_local_power_status_w_clear_global_power(
75        &mut self,
76    ) -> R_LOCAL_POWER_STATUS_W_CLEAR_GLOBAL_POWER_W<HC_RH_STATUS_SPEC> {
77        R_LOCAL_POWER_STATUS_W_CLEAR_GLOBAL_POWER_W::new(self, 0)
78    }
79    #[doc = "Bit 1 - This bit reports overcurrent conditions when the global reporting is implemented. When set, an overcurrent condition exists. When cleared, all power operations are normal. If per-port overcurrent protection is implemented this bit is always '0'"]
80    #[inline(always)]
81    #[must_use]
82    pub fn over_current_indicator(&mut self) -> OVER_CURRENT_INDICATOR_W<HC_RH_STATUS_SPEC> {
83        OVER_CURRENT_INDICATOR_W::new(self, 1)
84    }
85    #[doc = "Bit 15 - (read)DeviceRemoteWakeupEnable\n\nThis bit enables a ConnectStatusChange bit as a resume event, causing a USBSUSPEND to USBRESUME state transition and setting the ResumeDetected interrupt.\n\n0 ConnectStatusChange is not a remote wakeup event.\n\n1 ConnectStatusChange is a remote wakeup event.\n\n(write)SetRemoteWakeupEnable\n\nWriting a '1' sets DeviceRemoveWakeupEnable. Writing a '0' has no effect."]
86    #[inline(always)]
87    #[must_use]
88    pub fn r_device_remote_wakeup_enable_w_set_remote_wakeup_enable(
89        &mut self,
90    ) -> R_DEVICE_REMOTE_WAKEUP_ENABLE_W_SET_REMOTE_WAKEUP_ENABLE_W<HC_RH_STATUS_SPEC> {
91        R_DEVICE_REMOTE_WAKEUP_ENABLE_W_SET_REMOTE_WAKEUP_ENABLE_W::new(self, 15)
92    }
93    #[doc = "Bit 16 - (read)LocalPowerStatusChange\n\nThe Root Hub does not support the local power status features, thus, this bit is always read as '0'.\n\n(write)SetGlobalPower\n\nIn global power mode ( PowerSwitchingMode =0), This bit is written to '1' to turn on power to all ports (clear PortPowerStatus ). In per-port power mode, it sets PortPowerStatus only on ports whose PortPowerControlMask bit is not set. Writing a '0' has no effect."]
94    #[inline(always)]
95    #[must_use]
96    pub fn r_local_power_status_w_set_global_power(
97        &mut self,
98    ) -> R_LOCAL_POWER_STATUS_W_SET_GLOBAL_POWER_W<HC_RH_STATUS_SPEC> {
99        R_LOCAL_POWER_STATUS_W_SET_GLOBAL_POWER_W::new(self, 16)
100    }
101    #[doc = "Bit 17 - This bit is set by hardware when a change has occurred to the OverCurrentIndicator field of this register. The HCD clears this bit by writing a '1'. Writing a '0' has no effect."]
102    #[inline(always)]
103    #[must_use]
104    pub fn over_current_indicator_change(
105        &mut self,
106    ) -> OVER_CURRENT_INDICATOR_CHANGE_W<HC_RH_STATUS_SPEC> {
107        OVER_CURRENT_INDICATOR_CHANGE_W::new(self, 17)
108    }
109    #[doc = "Bit 31 - (write)ClearRemoteWakeupEnable\n\nWrite a '1' clears DeviceRemoteWakeupEnable. Writing a '0' has no effect."]
110    #[inline(always)]
111    #[must_use]
112    pub fn clear_remote_eakeup_enable(
113        &mut self,
114    ) -> CLEAR_REMOTE_EAKEUP_ENABLE_W<HC_RH_STATUS_SPEC> {
115        CLEAR_REMOTE_EAKEUP_ENABLE_W::new(self, 31)
116    }
117    #[doc = r" Writes raw bits to the register."]
118    #[doc = r""]
119    #[doc = r" # Safety"]
120    #[doc = r""]
121    #[doc = r" Passing incorrect value can cause undefined behaviour. See reference manual"]
122    #[inline(always)]
123    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
124        self.bits = bits;
125        self
126    }
127}
128#[doc = "OHCI Root Hub Status Register\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`hc_rh_status::R`](R).  You can [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero) this register using [`hc_rh_status::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
129pub struct HC_RH_STATUS_SPEC;
130impl crate::RegisterSpec for HC_RH_STATUS_SPEC {
131    type Ux = u32;
132}
133#[doc = "`read()` method returns [`hc_rh_status::R`](R) reader structure"]
134impl crate::Readable for HC_RH_STATUS_SPEC {}
135#[doc = "`write(|w| ..)` method takes [`hc_rh_status::W`](W) writer structure"]
136impl crate::Writable for HC_RH_STATUS_SPEC {
137    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
138    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
139}
140#[doc = "`reset()` method sets hc_rh_status to value 0"]
141impl crate::Resettable for HC_RH_STATUS_SPEC {
142    const RESET_VALUE: Self::Ux = 0;
143}