mimxrt595s/spi0/
fifostat.rs

1#[doc = "Register `FIFOSTAT` reader"]
2pub struct R(crate::R<FIFOSTAT_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<FIFOSTAT_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<FIFOSTAT_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<FIFOSTAT_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `FIFOSTAT` writer"]
17pub struct W(crate::W<FIFOSTAT_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<FIFOSTAT_SPEC>;
20    #[inline(always)]
21    fn deref(&self) -> &Self::Target {
22        &self.0
23    }
24}
25impl core::ops::DerefMut for W {
26    #[inline(always)]
27    fn deref_mut(&mut self) -> &mut Self::Target {
28        &mut self.0
29    }
30}
31impl From<crate::W<FIFOSTAT_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<FIFOSTAT_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `TXERR` reader - TX FIFO Error"]
38pub type TXERR_R = crate::BitReader<TXERR_A>;
39#[doc = "TX FIFO Error\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41pub enum TXERR_A {
42    #[doc = "0: A transmit FIFO error has not occurred."]
43    NO_TXERR = 0,
44    #[doc = "1: A transmit FIFO error has occurred. This error could be an overflow caused by pushing data into a full FIFO, or by an underflow if the FIFO is empty when data is needed."]
45    TXERR = 1,
46}
47impl From<TXERR_A> for bool {
48    #[inline(always)]
49    fn from(variant: TXERR_A) -> Self {
50        variant as u8 != 0
51    }
52}
53impl TXERR_R {
54    #[doc = "Get enumerated values variant"]
55    #[inline(always)]
56    pub fn variant(&self) -> TXERR_A {
57        match self.bits {
58            false => TXERR_A::NO_TXERR,
59            true => TXERR_A::TXERR,
60        }
61    }
62    #[doc = "Checks if the value of the field is `NO_TXERR`"]
63    #[inline(always)]
64    pub fn is_no_txerr(&self) -> bool {
65        *self == TXERR_A::NO_TXERR
66    }
67    #[doc = "Checks if the value of the field is `TXERR`"]
68    #[inline(always)]
69    pub fn is_txerr(&self) -> bool {
70        *self == TXERR_A::TXERR
71    }
72}
73#[doc = "Field `TXERR` writer - TX FIFO Error"]
74pub type TXERR_W<'a, const O: u8> = crate::BitWriter<'a, u32, FIFOSTAT_SPEC, TXERR_A, O>;
75impl<'a, const O: u8> TXERR_W<'a, O> {
76    #[doc = "A transmit FIFO error has not occurred."]
77    #[inline(always)]
78    pub fn no_txerr(self) -> &'a mut W {
79        self.variant(TXERR_A::NO_TXERR)
80    }
81    #[doc = "A transmit FIFO error has occurred. This error could be an overflow caused by pushing data into a full FIFO, or by an underflow if the FIFO is empty when data is needed."]
82    #[inline(always)]
83    pub fn txerr(self) -> &'a mut W {
84        self.variant(TXERR_A::TXERR)
85    }
86}
87#[doc = "Field `RXERR` reader - RX FIFO Error"]
88pub type RXERR_R = crate::BitReader<RXERR_A>;
89#[doc = "RX FIFO Error\n\nValue on reset: 0"]
90#[derive(Clone, Copy, Debug, PartialEq, Eq)]
91pub enum RXERR_A {
92    #[doc = "0: A receive FIFO overflow has not occurred"]
93    NO_RXERR = 0,
94    #[doc = "1: A receive FIFO overflow has occurred, caused by software or DMA not emptying the FIFO fast enough"]
95    RXERR = 1,
96}
97impl From<RXERR_A> for bool {
98    #[inline(always)]
99    fn from(variant: RXERR_A) -> Self {
100        variant as u8 != 0
101    }
102}
103impl RXERR_R {
104    #[doc = "Get enumerated values variant"]
105    #[inline(always)]
106    pub fn variant(&self) -> RXERR_A {
107        match self.bits {
108            false => RXERR_A::NO_RXERR,
109            true => RXERR_A::RXERR,
110        }
111    }
112    #[doc = "Checks if the value of the field is `NO_RXERR`"]
113    #[inline(always)]
114    pub fn is_no_rxerr(&self) -> bool {
115        *self == RXERR_A::NO_RXERR
116    }
117    #[doc = "Checks if the value of the field is `RXERR`"]
118    #[inline(always)]
119    pub fn is_rxerr(&self) -> bool {
120        *self == RXERR_A::RXERR
121    }
122}
123#[doc = "Field `RXERR` writer - RX FIFO Error"]
124pub type RXERR_W<'a, const O: u8> = crate::BitWriter<'a, u32, FIFOSTAT_SPEC, RXERR_A, O>;
125impl<'a, const O: u8> RXERR_W<'a, O> {
126    #[doc = "A receive FIFO overflow has not occurred"]
127    #[inline(always)]
128    pub fn no_rxerr(self) -> &'a mut W {
129        self.variant(RXERR_A::NO_RXERR)
130    }
131    #[doc = "A receive FIFO overflow has occurred, caused by software or DMA not emptying the FIFO fast enough"]
132    #[inline(always)]
133    pub fn rxerr(self) -> &'a mut W {
134        self.variant(RXERR_A::RXERR)
135    }
136}
137#[doc = "Field `PERINT` reader - Peripheral Interrupt"]
138pub type PERINT_R = crate::BitReader<PERINT_A>;
139#[doc = "Peripheral Interrupt\n\nValue on reset: 0"]
140#[derive(Clone, Copy, Debug, PartialEq, Eq)]
141pub enum PERINT_A {
142    #[doc = "0: The peripheral function has not asserted an interrupt"]
143    NO_PERINT = 0,
144    #[doc = "1: Indicates that the peripheral function has asserted an interrupt. More information can be found by reading the peripheral's status register (STAT)."]
145    PERINT = 1,
146}
147impl From<PERINT_A> for bool {
148    #[inline(always)]
149    fn from(variant: PERINT_A) -> Self {
150        variant as u8 != 0
151    }
152}
153impl PERINT_R {
154    #[doc = "Get enumerated values variant"]
155    #[inline(always)]
156    pub fn variant(&self) -> PERINT_A {
157        match self.bits {
158            false => PERINT_A::NO_PERINT,
159            true => PERINT_A::PERINT,
160        }
161    }
162    #[doc = "Checks if the value of the field is `NO_PERINT`"]
163    #[inline(always)]
164    pub fn is_no_perint(&self) -> bool {
165        *self == PERINT_A::NO_PERINT
166    }
167    #[doc = "Checks if the value of the field is `PERINT`"]
168    #[inline(always)]
169    pub fn is_perint(&self) -> bool {
170        *self == PERINT_A::PERINT
171    }
172}
173#[doc = "Field `TXEMPTY` reader - Transmit FIFO Empty"]
174pub type TXEMPTY_R = crate::BitReader<TXEMPTY_A>;
175#[doc = "Transmit FIFO Empty\n\nValue on reset: 1"]
176#[derive(Clone, Copy, Debug, PartialEq, Eq)]
177pub enum TXEMPTY_A {
178    #[doc = "0: The transmit FIFO is not empty"]
179    TXFIFO_ISNOTEMPTY = 0,
180    #[doc = "1: The transmit FIFO is empty, although the peripheral may still be processing the last piece of data."]
181    TXFIFO_ISEMPTY = 1,
182}
183impl From<TXEMPTY_A> for bool {
184    #[inline(always)]
185    fn from(variant: TXEMPTY_A) -> Self {
186        variant as u8 != 0
187    }
188}
189impl TXEMPTY_R {
190    #[doc = "Get enumerated values variant"]
191    #[inline(always)]
192    pub fn variant(&self) -> TXEMPTY_A {
193        match self.bits {
194            false => TXEMPTY_A::TXFIFO_ISNOTEMPTY,
195            true => TXEMPTY_A::TXFIFO_ISEMPTY,
196        }
197    }
198    #[doc = "Checks if the value of the field is `TXFIFO_ISNOTEMPTY`"]
199    #[inline(always)]
200    pub fn is_txfifo_isnotempty(&self) -> bool {
201        *self == TXEMPTY_A::TXFIFO_ISNOTEMPTY
202    }
203    #[doc = "Checks if the value of the field is `TXFIFO_ISEMPTY`"]
204    #[inline(always)]
205    pub fn is_txfifo_isempty(&self) -> bool {
206        *self == TXEMPTY_A::TXFIFO_ISEMPTY
207    }
208}
209#[doc = "Field `TXNOTFULL` reader - Transmit FIFO is Not Full"]
210pub type TXNOTFULL_R = crate::BitReader<TXNOTFULL_A>;
211#[doc = "Transmit FIFO is Not Full\n\nValue on reset: 1"]
212#[derive(Clone, Copy, Debug, PartialEq, Eq)]
213pub enum TXNOTFULL_A {
214    #[doc = "0: The transmit FIFO is full and another write would cause it to overflow"]
215    TXFIFO_ISFULL = 0,
216    #[doc = "1: The transmit FIFO is not full, so more data can be written"]
217    TXFIFO_ISNOTFULL = 1,
218}
219impl From<TXNOTFULL_A> for bool {
220    #[inline(always)]
221    fn from(variant: TXNOTFULL_A) -> Self {
222        variant as u8 != 0
223    }
224}
225impl TXNOTFULL_R {
226    #[doc = "Get enumerated values variant"]
227    #[inline(always)]
228    pub fn variant(&self) -> TXNOTFULL_A {
229        match self.bits {
230            false => TXNOTFULL_A::TXFIFO_ISFULL,
231            true => TXNOTFULL_A::TXFIFO_ISNOTFULL,
232        }
233    }
234    #[doc = "Checks if the value of the field is `TXFIFO_ISFULL`"]
235    #[inline(always)]
236    pub fn is_txfifo_isfull(&self) -> bool {
237        *self == TXNOTFULL_A::TXFIFO_ISFULL
238    }
239    #[doc = "Checks if the value of the field is `TXFIFO_ISNOTFULL`"]
240    #[inline(always)]
241    pub fn is_txfifo_isnotfull(&self) -> bool {
242        *self == TXNOTFULL_A::TXFIFO_ISNOTFULL
243    }
244}
245#[doc = "Field `RXNOTEMPTY` reader - Receive FIFO is Not Empty"]
246pub type RXNOTEMPTY_R = crate::BitReader<RXNOTEMPTY_A>;
247#[doc = "Receive FIFO is Not Empty\n\nValue on reset: 0"]
248#[derive(Clone, Copy, Debug, PartialEq, Eq)]
249pub enum RXNOTEMPTY_A {
250    #[doc = "0: When 0, the receive FIFO is empty"]
251    RXFIFO_ISEMPTY = 0,
252    #[doc = "1: When 1, the receive FIFO is not empty, so data can be read"]
253    RXFIFO_ISNOTEMPTY = 1,
254}
255impl From<RXNOTEMPTY_A> for bool {
256    #[inline(always)]
257    fn from(variant: RXNOTEMPTY_A) -> Self {
258        variant as u8 != 0
259    }
260}
261impl RXNOTEMPTY_R {
262    #[doc = "Get enumerated values variant"]
263    #[inline(always)]
264    pub fn variant(&self) -> RXNOTEMPTY_A {
265        match self.bits {
266            false => RXNOTEMPTY_A::RXFIFO_ISEMPTY,
267            true => RXNOTEMPTY_A::RXFIFO_ISNOTEMPTY,
268        }
269    }
270    #[doc = "Checks if the value of the field is `RXFIFO_ISEMPTY`"]
271    #[inline(always)]
272    pub fn is_rxfifo_isempty(&self) -> bool {
273        *self == RXNOTEMPTY_A::RXFIFO_ISEMPTY
274    }
275    #[doc = "Checks if the value of the field is `RXFIFO_ISNOTEMPTY`"]
276    #[inline(always)]
277    pub fn is_rxfifo_isnotempty(&self) -> bool {
278        *self == RXNOTEMPTY_A::RXFIFO_ISNOTEMPTY
279    }
280}
281#[doc = "Field `RXFULL` reader - Receive FIFO is Full"]
282pub type RXFULL_R = crate::BitReader<RXFULL_A>;
283#[doc = "Receive FIFO is Full\n\nValue on reset: 0"]
284#[derive(Clone, Copy, Debug, PartialEq, Eq)]
285pub enum RXFULL_A {
286    #[doc = "0: The receive FIFO is not full"]
287    RXFIFO_ISNOTFULL = 0,
288    #[doc = "1: The receive FIFO is full. To prevent the peripheral from causing an overflow, data should be read out."]
289    RXFIFO_ISFULL = 1,
290}
291impl From<RXFULL_A> for bool {
292    #[inline(always)]
293    fn from(variant: RXFULL_A) -> Self {
294        variant as u8 != 0
295    }
296}
297impl RXFULL_R {
298    #[doc = "Get enumerated values variant"]
299    #[inline(always)]
300    pub fn variant(&self) -> RXFULL_A {
301        match self.bits {
302            false => RXFULL_A::RXFIFO_ISNOTFULL,
303            true => RXFULL_A::RXFIFO_ISFULL,
304        }
305    }
306    #[doc = "Checks if the value of the field is `RXFIFO_ISNOTFULL`"]
307    #[inline(always)]
308    pub fn is_rxfifo_isnotfull(&self) -> bool {
309        *self == RXFULL_A::RXFIFO_ISNOTFULL
310    }
311    #[doc = "Checks if the value of the field is `RXFIFO_ISFULL`"]
312    #[inline(always)]
313    pub fn is_rxfifo_isfull(&self) -> bool {
314        *self == RXFULL_A::RXFIFO_ISFULL
315    }
316}
317#[doc = "Field `TXLVL` reader - Transmit FIFO Current Level"]
318pub type TXLVL_R = crate::FieldReader<u8, u8>;
319#[doc = "Field `RXLVL` reader - Receive FIFO Current Level"]
320pub type RXLVL_R = crate::FieldReader<u8, u8>;
321impl R {
322    #[doc = "Bit 0 - TX FIFO Error"]
323    #[inline(always)]
324    pub fn txerr(&self) -> TXERR_R {
325        TXERR_R::new((self.bits & 1) != 0)
326    }
327    #[doc = "Bit 1 - RX FIFO Error"]
328    #[inline(always)]
329    pub fn rxerr(&self) -> RXERR_R {
330        RXERR_R::new(((self.bits >> 1) & 1) != 0)
331    }
332    #[doc = "Bit 3 - Peripheral Interrupt"]
333    #[inline(always)]
334    pub fn perint(&self) -> PERINT_R {
335        PERINT_R::new(((self.bits >> 3) & 1) != 0)
336    }
337    #[doc = "Bit 4 - Transmit FIFO Empty"]
338    #[inline(always)]
339    pub fn txempty(&self) -> TXEMPTY_R {
340        TXEMPTY_R::new(((self.bits >> 4) & 1) != 0)
341    }
342    #[doc = "Bit 5 - Transmit FIFO is Not Full"]
343    #[inline(always)]
344    pub fn txnotfull(&self) -> TXNOTFULL_R {
345        TXNOTFULL_R::new(((self.bits >> 5) & 1) != 0)
346    }
347    #[doc = "Bit 6 - Receive FIFO is Not Empty"]
348    #[inline(always)]
349    pub fn rxnotempty(&self) -> RXNOTEMPTY_R {
350        RXNOTEMPTY_R::new(((self.bits >> 6) & 1) != 0)
351    }
352    #[doc = "Bit 7 - Receive FIFO is Full"]
353    #[inline(always)]
354    pub fn rxfull(&self) -> RXFULL_R {
355        RXFULL_R::new(((self.bits >> 7) & 1) != 0)
356    }
357    #[doc = "Bits 8:12 - Transmit FIFO Current Level"]
358    #[inline(always)]
359    pub fn txlvl(&self) -> TXLVL_R {
360        TXLVL_R::new(((self.bits >> 8) & 0x1f) as u8)
361    }
362    #[doc = "Bits 16:20 - Receive FIFO Current Level"]
363    #[inline(always)]
364    pub fn rxlvl(&self) -> RXLVL_R {
365        RXLVL_R::new(((self.bits >> 16) & 0x1f) as u8)
366    }
367}
368impl W {
369    #[doc = "Bit 0 - TX FIFO Error"]
370    #[inline(always)]
371    #[must_use]
372    pub fn txerr(&mut self) -> TXERR_W<0> {
373        TXERR_W::new(self)
374    }
375    #[doc = "Bit 1 - RX FIFO Error"]
376    #[inline(always)]
377    #[must_use]
378    pub fn rxerr(&mut self) -> RXERR_W<1> {
379        RXERR_W::new(self)
380    }
381    #[doc = "Writes raw bits to the register."]
382    #[inline(always)]
383    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
384        self.0.bits(bits);
385        self
386    }
387}
388#[doc = "FIFO Status Register\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [fifostat](index.html) module"]
389pub struct FIFOSTAT_SPEC;
390impl crate::RegisterSpec for FIFOSTAT_SPEC {
391    type Ux = u32;
392}
393#[doc = "`read()` method returns [fifostat::R](R) reader structure"]
394impl crate::Readable for FIFOSTAT_SPEC {
395    type Reader = R;
396}
397#[doc = "`write(|w| ..)` method takes [fifostat::W](W) writer structure"]
398impl crate::Writable for FIFOSTAT_SPEC {
399    type Writer = W;
400    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
401    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
402}
403#[doc = "`reset()` method sets FIFOSTAT to value 0x30"]
404impl crate::Resettable for FIFOSTAT_SPEC {
405    const RESET_VALUE: Self::Ux = 0x30;
406}