1#[doc = "Register `IC_ENABLE_STATUS` reader"]
2pub type R = crate::R<IC_ENABLE_STATUS_SPEC>;
3#[doc = "Field `IC_EN` reader - ic_en Status. This bit always reflects the value driven on the output port ic_en. - When read as 1, DW_apb_i2c is deemed to be in an enabled state. - When read as 0, DW_apb_i2c is deemed completely inactive. Note: The CPU can safely read this bit anytime. When this bit is read as 0, the CPU can safely read SLV_RX_DATA_LOST (bit 2) and SLV_DISABLED_WHILE_BUSY (bit 1).
45 Reset value: 0x0"]
6pub type IC_EN_R = crate::BitReader<IC_EN_A>;
7#[doc = "ic_en Status. This bit always reflects the value driven on the output port ic_en. - When read as 1, DW_apb_i2c is deemed to be in an enabled state. - When read as 0, DW_apb_i2c is deemed completely inactive. Note: The CPU can safely read this bit anytime. When this bit is read as 0, the CPU can safely read SLV_RX_DATA_LOST (bit 2) and SLV_DISABLED_WHILE_BUSY (bit 1).
89 Reset value: 0x0
1011Value on reset: 0"]
12#[derive(Clone, Copy, Debug, PartialEq, Eq)]
13pub enum IC_EN_A {
14#[doc = "0: I2C disabled"]
15DISABLED = 0,
16#[doc = "1: I2C enabled"]
17ENABLED = 1,
18}
19impl From<IC_EN_A> for bool {
20#[inline(always)]
21fn from(variant: IC_EN_A) -> Self {
22 variant as u8 != 0
23}
24}
25impl IC_EN_R {
26#[doc = "Get enumerated values variant"]
27 #[inline(always)]
28pub const fn variant(&self) -> IC_EN_A {
29match self.bits {
30false => IC_EN_A::DISABLED,
31true => IC_EN_A::ENABLED,
32 }
33 }
34#[doc = "I2C disabled"]
35 #[inline(always)]
36pub fn is_disabled(&self) -> bool {
37*self == IC_EN_A::DISABLED
38 }
39#[doc = "I2C enabled"]
40 #[inline(always)]
41pub fn is_enabled(&self) -> bool {
42*self == IC_EN_A::ENABLED
43 }
44}
45#[doc = "Field `SLV_DISABLED_WHILE_BUSY` reader - Slave Disabled While Busy (Transmit, Receive). This bit indicates if a potential or active Slave operation has been aborted due to the setting bit 0 of the IC_ENABLE register from 1 to 0. This bit is set when the CPU writes a 0 to the IC_ENABLE register while:
4647 (a) DW_apb_i2c is receiving the address byte of the Slave-Transmitter operation from a remote master;
4849 OR,
5051 (b) address and data bytes of the Slave-Receiver operation from a remote master.
5253 When read as 1, DW_apb_i2c is deemed to have forced a NACK during any part of an I2C transfer, irrespective of whether the I2C address matches the slave address set in DW_apb_i2c (IC_SAR register) OR if the transfer is completed before IC_ENABLE is set to 0 but has not taken effect.
5455 Note: If the remote I2C master terminates the transfer with a STOP condition before the DW_apb_i2c has a chance to NACK a transfer, and IC_ENABLE\\[0\\]
56has been set to 0, then this bit will also be set to 1.
5758 When read as 0, DW_apb_i2c is deemed to have been disabled when there is master activity, or when the I2C bus is idle.
5960 Note: The CPU can safely read this bit when IC_EN (bit 0) is read as 0.
6162 Reset value: 0x0"]
63pub type SLV_DISABLED_WHILE_BUSY_R = crate::BitReader<SLV_DISABLED_WHILE_BUSY_A>;
64#[doc = "Slave Disabled While Busy (Transmit, Receive). This bit indicates if a potential or active Slave operation has been aborted due to the setting bit 0 of the IC_ENABLE register from 1 to 0. This bit is set when the CPU writes a 0 to the IC_ENABLE register while:
6566 (a) DW_apb_i2c is receiving the address byte of the Slave-Transmitter operation from a remote master;
6768 OR,
6970 (b) address and data bytes of the Slave-Receiver operation from a remote master.
7172 When read as 1, DW_apb_i2c is deemed to have forced a NACK during any part of an I2C transfer, irrespective of whether the I2C address matches the slave address set in DW_apb_i2c (IC_SAR register) OR if the transfer is completed before IC_ENABLE is set to 0 but has not taken effect.
7374 Note: If the remote I2C master terminates the transfer with a STOP condition before the DW_apb_i2c has a chance to NACK a transfer, and IC_ENABLE\\[0\\]
75has been set to 0, then this bit will also be set to 1.
7677 When read as 0, DW_apb_i2c is deemed to have been disabled when there is master activity, or when the I2C bus is idle.
7879 Note: The CPU can safely read this bit when IC_EN (bit 0) is read as 0.
8081 Reset value: 0x0
8283Value on reset: 0"]
84#[derive(Clone, Copy, Debug, PartialEq, Eq)]
85pub enum SLV_DISABLED_WHILE_BUSY_A {
86#[doc = "0: Slave is disabled when it is idle"]
87INACTIVE = 0,
88#[doc = "1: Slave is disabled when it is active"]
89ACTIVE = 1,
90}
91impl From<SLV_DISABLED_WHILE_BUSY_A> for bool {
92#[inline(always)]
93fn from(variant: SLV_DISABLED_WHILE_BUSY_A) -> Self {
94 variant as u8 != 0
95}
96}
97impl SLV_DISABLED_WHILE_BUSY_R {
98#[doc = "Get enumerated values variant"]
99 #[inline(always)]
100pub const fn variant(&self) -> SLV_DISABLED_WHILE_BUSY_A {
101match self.bits {
102false => SLV_DISABLED_WHILE_BUSY_A::INACTIVE,
103true => SLV_DISABLED_WHILE_BUSY_A::ACTIVE,
104 }
105 }
106#[doc = "Slave is disabled when it is idle"]
107 #[inline(always)]
108pub fn is_inactive(&self) -> bool {
109*self == SLV_DISABLED_WHILE_BUSY_A::INACTIVE
110 }
111#[doc = "Slave is disabled when it is active"]
112 #[inline(always)]
113pub fn is_active(&self) -> bool {
114*self == SLV_DISABLED_WHILE_BUSY_A::ACTIVE
115 }
116}
117#[doc = "Field `SLV_RX_DATA_LOST` reader - Slave Received Data Lost. This bit indicates if a Slave-Receiver operation has been aborted with at least one data byte received from an I2C transfer due to the setting bit 0 of IC_ENABLE from 1 to 0. When read as 1, DW_apb_i2c is deemed to have been actively engaged in an aborted I2C transfer (with matching address) and the data phase of the I2C transfer has been entered, even though a data byte has been responded with a NACK.
118119 Note: If the remote I2C master terminates the transfer with a STOP condition before the DW_apb_i2c has a chance to NACK a transfer, and IC_ENABLE\\[0\\]
120has been set to 0, then this bit is also set to 1.
121122 When read as 0, DW_apb_i2c is deemed to have been disabled without being actively involved in the data phase of a Slave-Receiver transfer.
123124 Note: The CPU can safely read this bit when IC_EN (bit 0) is read as 0.
125126 Reset value: 0x0"]
127pub type SLV_RX_DATA_LOST_R = crate::BitReader<SLV_RX_DATA_LOST_A>;
128#[doc = "Slave Received Data Lost. This bit indicates if a Slave-Receiver operation has been aborted with at least one data byte received from an I2C transfer due to the setting bit 0 of IC_ENABLE from 1 to 0. When read as 1, DW_apb_i2c is deemed to have been actively engaged in an aborted I2C transfer (with matching address) and the data phase of the I2C transfer has been entered, even though a data byte has been responded with a NACK.
129130 Note: If the remote I2C master terminates the transfer with a STOP condition before the DW_apb_i2c has a chance to NACK a transfer, and IC_ENABLE\\[0\\]
131has been set to 0, then this bit is also set to 1.
132133 When read as 0, DW_apb_i2c is deemed to have been disabled without being actively involved in the data phase of a Slave-Receiver transfer.
134135 Note: The CPU can safely read this bit when IC_EN (bit 0) is read as 0.
136137 Reset value: 0x0
138139Value on reset: 0"]
140#[derive(Clone, Copy, Debug, PartialEq, Eq)]
141pub enum SLV_RX_DATA_LOST_A {
142#[doc = "0: Slave RX Data is not lost"]
143INACTIVE = 0,
144#[doc = "1: Slave RX Data is lost"]
145ACTIVE = 1,
146}
147impl From<SLV_RX_DATA_LOST_A> for bool {
148#[inline(always)]
149fn from(variant: SLV_RX_DATA_LOST_A) -> Self {
150 variant as u8 != 0
151}
152}
153impl SLV_RX_DATA_LOST_R {
154#[doc = "Get enumerated values variant"]
155 #[inline(always)]
156pub const fn variant(&self) -> SLV_RX_DATA_LOST_A {
157match self.bits {
158false => SLV_RX_DATA_LOST_A::INACTIVE,
159true => SLV_RX_DATA_LOST_A::ACTIVE,
160 }
161 }
162#[doc = "Slave RX Data is not lost"]
163 #[inline(always)]
164pub fn is_inactive(&self) -> bool {
165*self == SLV_RX_DATA_LOST_A::INACTIVE
166 }
167#[doc = "Slave RX Data is lost"]
168 #[inline(always)]
169pub fn is_active(&self) -> bool {
170*self == SLV_RX_DATA_LOST_A::ACTIVE
171 }
172}
173impl R {
174#[doc = "Bit 0 - ic_en Status. This bit always reflects the value driven on the output port ic_en. - When read as 1, DW_apb_i2c is deemed to be in an enabled state. - When read as 0, DW_apb_i2c is deemed completely inactive. Note: The CPU can safely read this bit anytime. When this bit is read as 0, the CPU can safely read SLV_RX_DATA_LOST (bit 2) and SLV_DISABLED_WHILE_BUSY (bit 1).
175176 Reset value: 0x0"]
177 #[inline(always)]
178pub fn ic_en(&self) -> IC_EN_R {
179 IC_EN_R::new((self.bits & 1) != 0)
180 }
181#[doc = "Bit 1 - Slave Disabled While Busy (Transmit, Receive). This bit indicates if a potential or active Slave operation has been aborted due to the setting bit 0 of the IC_ENABLE register from 1 to 0. This bit is set when the CPU writes a 0 to the IC_ENABLE register while:
182183 (a) DW_apb_i2c is receiving the address byte of the Slave-Transmitter operation from a remote master;
184185 OR,
186187 (b) address and data bytes of the Slave-Receiver operation from a remote master.
188189 When read as 1, DW_apb_i2c is deemed to have forced a NACK during any part of an I2C transfer, irrespective of whether the I2C address matches the slave address set in DW_apb_i2c (IC_SAR register) OR if the transfer is completed before IC_ENABLE is set to 0 but has not taken effect.
190191 Note: If the remote I2C master terminates the transfer with a STOP condition before the DW_apb_i2c has a chance to NACK a transfer, and IC_ENABLE\\[0\\]
192has been set to 0, then this bit will also be set to 1.
193194 When read as 0, DW_apb_i2c is deemed to have been disabled when there is master activity, or when the I2C bus is idle.
195196 Note: The CPU can safely read this bit when IC_EN (bit 0) is read as 0.
197198 Reset value: 0x0"]
199 #[inline(always)]
200pub fn slv_disabled_while_busy(&self) -> SLV_DISABLED_WHILE_BUSY_R {
201 SLV_DISABLED_WHILE_BUSY_R::new(((self.bits >> 1) & 1) != 0)
202 }
203#[doc = "Bit 2 - Slave Received Data Lost. This bit indicates if a Slave-Receiver operation has been aborted with at least one data byte received from an I2C transfer due to the setting bit 0 of IC_ENABLE from 1 to 0. When read as 1, DW_apb_i2c is deemed to have been actively engaged in an aborted I2C transfer (with matching address) and the data phase of the I2C transfer has been entered, even though a data byte has been responded with a NACK.
204205 Note: If the remote I2C master terminates the transfer with a STOP condition before the DW_apb_i2c has a chance to NACK a transfer, and IC_ENABLE\\[0\\]
206has been set to 0, then this bit is also set to 1.
207208 When read as 0, DW_apb_i2c is deemed to have been disabled without being actively involved in the data phase of a Slave-Receiver transfer.
209210 Note: The CPU can safely read this bit when IC_EN (bit 0) is read as 0.
211212 Reset value: 0x0"]
213 #[inline(always)]
214pub fn slv_rx_data_lost(&self) -> SLV_RX_DATA_LOST_R {
215 SLV_RX_DATA_LOST_R::new(((self.bits >> 2) & 1) != 0)
216 }
217}
218#[doc = "I2C Enable Status Register
219220 The register is used to report the DW_apb_i2c hardware status when the IC_ENABLE\\[0\\]
221register is set from 1 to 0; that is, when DW_apb_i2c is disabled.
222223 If IC_ENABLE\\[0\\]
224has been set to 1, bits 2:1 are forced to 0, and bit 0 is forced to 1.
225226 If IC_ENABLE\\[0\\]
227has been set to 0, bits 2:1 is only be valid as soon as bit 0 is read as '0'.
228229 Note: When IC_ENABLE\\[0\\]
230has been set to 0, a delay occurs for bit 0 to be read as 0 because disabling the DW_apb_i2c depends on I2C bus activities.
231232You can [`read`](crate::generic::Reg::read) this register and get [`ic_enable_status::R`](R). See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
233pub struct IC_ENABLE_STATUS_SPEC;
234impl crate::RegisterSpec for IC_ENABLE_STATUS_SPEC {
235type Ux = u32;
236}
237#[doc = "`read()` method returns [`ic_enable_status::R`](R) reader structure"]
238impl crate::Readable for IC_ENABLE_STATUS_SPEC {}
239#[doc = "`reset()` method sets IC_ENABLE_STATUS to value 0"]
240impl crate::Resettable for IC_ENABLE_STATUS_SPEC {
241const RESET_VALUE: u32 = 0;
242}