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