stm32-metapac 18.0.0

Peripheral Access Crate (PAC) for all STM32 chips, including metadata.
Documentation
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
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
#![allow(clippy::missing_safety_doc)]
#![allow(clippy::identity_op)]
#![allow(clippy::unnecessary_cast)]
#![allow(clippy::erasing_op)]

#[doc = "Filter math accelerator"]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Fmac {
    ptr: *mut u8,
}
unsafe impl Send for Fmac {}
unsafe impl Sync for Fmac {}
impl Fmac {
    #[inline(always)]
    pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
        Self { ptr: ptr as _ }
    }
    #[inline(always)]
    pub const fn as_ptr(&self) -> *mut () {
        self.ptr as _
    }
    #[doc = "X1 buffer configuration register"]
    #[inline(always)]
    pub const fn x1bufcfg(self) -> crate::common::Reg<regs::X1bufcfg, crate::common::RW> {
        unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x0usize) as _) }
    }
    #[doc = "X2 buffer configuration register"]
    #[inline(always)]
    pub const fn x2bufcfg(self) -> crate::common::Reg<regs::X2bufcfg, crate::common::RW> {
        unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x04usize) as _) }
    }
    #[doc = "Y buffer configuration register"]
    #[inline(always)]
    pub const fn ybufcfg(self) -> crate::common::Reg<regs::Ybufcfg, crate::common::RW> {
        unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x08usize) as _) }
    }
    #[doc = "Parameter register"]
    #[inline(always)]
    pub const fn param(self) -> crate::common::Reg<regs::Param, crate::common::RW> {
        unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x0cusize) as _) }
    }
    #[doc = "Control register"]
    #[inline(always)]
    pub const fn cr(self) -> crate::common::Reg<regs::Cr, crate::common::RW> {
        unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x10usize) as _) }
    }
    #[doc = "Status register"]
    #[inline(always)]
    pub const fn sr(self) -> crate::common::Reg<regs::Sr, crate::common::R> {
        unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x14usize) as _) }
    }
    #[doc = "Write data register"]
    #[inline(always)]
    pub const fn wdata(self) -> crate::common::Reg<regs::Wdata, crate::common::W> {
        unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x18usize) as _) }
    }
    #[doc = "Read data register"]
    #[inline(always)]
    pub const fn rdata(self) -> crate::common::Reg<regs::Rdata, crate::common::R> {
        unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x1cusize) as _) }
    }
}
pub mod regs {
    #[doc = "Control register"]
    #[repr(transparent)]
    #[derive(Copy, Clone, Eq, PartialEq)]
    pub struct Cr(pub u32);
    impl Cr {
        #[doc = "Enable read interrupt"]
        #[inline(always)]
        pub const fn rien(&self) -> bool {
            let val = (self.0 >> 0usize) & 0x01;
            val != 0
        }
        #[doc = "Enable read interrupt"]
        #[inline(always)]
        pub fn set_rien(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
        }
        #[doc = "Enable write interrupt"]
        #[inline(always)]
        pub const fn wien(&self) -> bool {
            let val = (self.0 >> 1usize) & 0x01;
            val != 0
        }
        #[doc = "Enable write interrupt"]
        #[inline(always)]
        pub fn set_wien(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
        }
        #[doc = "Enable overflow error interrupts"]
        #[inline(always)]
        pub const fn ovflien(&self) -> bool {
            let val = (self.0 >> 2usize) & 0x01;
            val != 0
        }
        #[doc = "Enable overflow error interrupts"]
        #[inline(always)]
        pub fn set_ovflien(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
        }
        #[doc = "Enable underflow error interrupts"]
        #[inline(always)]
        pub const fn unflien(&self) -> bool {
            let val = (self.0 >> 3usize) & 0x01;
            val != 0
        }
        #[doc = "Enable underflow error interrupts"]
        #[inline(always)]
        pub fn set_unflien(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize);
        }
        #[doc = "Enable saturation error interrupts"]
        #[inline(always)]
        pub const fn satien(&self) -> bool {
            let val = (self.0 >> 4usize) & 0x01;
            val != 0
        }
        #[doc = "Enable saturation error interrupts"]
        #[inline(always)]
        pub fn set_satien(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize);
        }
        #[doc = "Enable DMA read channel requests"]
        #[inline(always)]
        pub const fn dmaren(&self) -> bool {
            let val = (self.0 >> 8usize) & 0x01;
            val != 0
        }
        #[doc = "Enable DMA read channel requests"]
        #[inline(always)]
        pub fn set_dmaren(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 8usize)) | (((val as u32) & 0x01) << 8usize);
        }
        #[doc = "Enable DMA write channel requests"]
        #[inline(always)]
        pub const fn dmawen(&self) -> bool {
            let val = (self.0 >> 9usize) & 0x01;
            val != 0
        }
        #[doc = "Enable DMA write channel requests"]
        #[inline(always)]
        pub fn set_dmawen(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 9usize)) | (((val as u32) & 0x01) << 9usize);
        }
        #[doc = "Enable clipping"]
        #[inline(always)]
        pub const fn clipen(&self) -> bool {
            let val = (self.0 >> 15usize) & 0x01;
            val != 0
        }
        #[doc = "Enable clipping"]
        #[inline(always)]
        pub fn set_clipen(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 15usize)) | (((val as u32) & 0x01) << 15usize);
        }
        #[doc = "Reset FMAC unit"]
        #[inline(always)]
        pub const fn reset(&self) -> bool {
            let val = (self.0 >> 16usize) & 0x01;
            val != 0
        }
        #[doc = "Reset FMAC unit"]
        #[inline(always)]
        pub fn set_reset(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 16usize)) | (((val as u32) & 0x01) << 16usize);
        }
    }
    impl Default for Cr {
        #[inline(always)]
        fn default() -> Cr {
            Cr(0)
        }
    }
    impl core::fmt::Debug for Cr {
        fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
            f.debug_struct("Cr")
                .field("rien", &self.rien())
                .field("wien", &self.wien())
                .field("ovflien", &self.ovflien())
                .field("unflien", &self.unflien())
                .field("satien", &self.satien())
                .field("dmaren", &self.dmaren())
                .field("dmawen", &self.dmawen())
                .field("clipen", &self.clipen())
                .field("reset", &self.reset())
                .finish()
        }
    }
    #[cfg(feature = "defmt")]
    impl defmt::Format for Cr {
        fn format(&self, f: defmt::Formatter) {
            defmt :: write ! (f , "Cr {{ rien: {=bool:?}, wien: {=bool:?}, ovflien: {=bool:?}, unflien: {=bool:?}, satien: {=bool:?}, dmaren: {=bool:?}, dmawen: {=bool:?}, clipen: {=bool:?}, reset: {=bool:?} }}" , self . rien () , self . wien () , self . ovflien () , self . unflien () , self . satien () , self . dmaren () , self . dmawen () , self . clipen () , self . reset ())
        }
    }
    #[doc = "Parameter register"]
    #[repr(transparent)]
    #[derive(Copy, Clone, Eq, PartialEq)]
    pub struct Param(pub u32);
    impl Param {
        #[doc = "Input parameter P"]
        #[inline(always)]
        pub const fn p(&self) -> u8 {
            let val = (self.0 >> 0usize) & 0xff;
            val as u8
        }
        #[doc = "Input parameter P"]
        #[inline(always)]
        pub fn set_p(&mut self, val: u8) {
            self.0 = (self.0 & !(0xff << 0usize)) | (((val as u32) & 0xff) << 0usize);
        }
        #[doc = "Input parameter Q"]
        #[inline(always)]
        pub const fn q(&self) -> u8 {
            let val = (self.0 >> 8usize) & 0xff;
            val as u8
        }
        #[doc = "Input parameter Q"]
        #[inline(always)]
        pub fn set_q(&mut self, val: u8) {
            self.0 = (self.0 & !(0xff << 8usize)) | (((val as u32) & 0xff) << 8usize);
        }
        #[doc = "Input parameter R"]
        #[inline(always)]
        pub const fn r(&self) -> u8 {
            let val = (self.0 >> 16usize) & 0xff;
            val as u8
        }
        #[doc = "Input parameter R"]
        #[inline(always)]
        pub fn set_r(&mut self, val: u8) {
            self.0 = (self.0 & !(0xff << 16usize)) | (((val as u32) & 0xff) << 16usize);
        }
        #[doc = "Function"]
        #[inline(always)]
        pub const fn func(&self) -> u8 {
            let val = (self.0 >> 24usize) & 0x7f;
            val as u8
        }
        #[doc = "Function"]
        #[inline(always)]
        pub fn set_func(&mut self, val: u8) {
            self.0 = (self.0 & !(0x7f << 24usize)) | (((val as u32) & 0x7f) << 24usize);
        }
        #[doc = "Enable execution"]
        #[inline(always)]
        pub const fn start(&self) -> bool {
            let val = (self.0 >> 31usize) & 0x01;
            val != 0
        }
        #[doc = "Enable execution"]
        #[inline(always)]
        pub fn set_start(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 31usize)) | (((val as u32) & 0x01) << 31usize);
        }
    }
    impl Default for Param {
        #[inline(always)]
        fn default() -> Param {
            Param(0)
        }
    }
    impl core::fmt::Debug for Param {
        fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
            f.debug_struct("Param")
                .field("p", &self.p())
                .field("q", &self.q())
                .field("r", &self.r())
                .field("func", &self.func())
                .field("start", &self.start())
                .finish()
        }
    }
    #[cfg(feature = "defmt")]
    impl defmt::Format for Param {
        fn format(&self, f: defmt::Formatter) {
            defmt::write!(
                f,
                "Param {{ p: {=u8:?}, q: {=u8:?}, r: {=u8:?}, func: {=u8:?}, start: {=bool:?} }}",
                self.p(),
                self.q(),
                self.r(),
                self.func(),
                self.start()
            )
        }
    }
    #[doc = "Read data register"]
    #[repr(transparent)]
    #[derive(Copy, Clone, Eq, PartialEq)]
    pub struct Rdata(pub u32);
    impl Rdata {
        #[doc = "Read data (contents of the Y output buffer at the address indicated by the READ pointer)"]
        #[inline(always)]
        pub const fn res(&self) -> u16 {
            let val = (self.0 >> 0usize) & 0xffff;
            val as u16
        }
        #[doc = "Read data (contents of the Y output buffer at the address indicated by the READ pointer)"]
        #[inline(always)]
        pub fn set_res(&mut self, val: u16) {
            self.0 = (self.0 & !(0xffff << 0usize)) | (((val as u32) & 0xffff) << 0usize);
        }
    }
    impl Default for Rdata {
        #[inline(always)]
        fn default() -> Rdata {
            Rdata(0)
        }
    }
    impl core::fmt::Debug for Rdata {
        fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
            f.debug_struct("Rdata").field("res", &self.res()).finish()
        }
    }
    #[cfg(feature = "defmt")]
    impl defmt::Format for Rdata {
        fn format(&self, f: defmt::Formatter) {
            defmt::write!(f, "Rdata {{ res: {=u16:?} }}", self.res())
        }
    }
    #[doc = "Status register"]
    #[repr(transparent)]
    #[derive(Copy, Clone, Eq, PartialEq)]
    pub struct Sr(pub u32);
    impl Sr {
        #[doc = "Y buffer empty flag"]
        #[inline(always)]
        pub const fn yempty(&self) -> bool {
            let val = (self.0 >> 0usize) & 0x01;
            val != 0
        }
        #[doc = "Y buffer empty flag"]
        #[inline(always)]
        pub fn set_yempty(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
        }
        #[doc = "X1 buffer full flag"]
        #[inline(always)]
        pub const fn x1full(&self) -> bool {
            let val = (self.0 >> 1usize) & 0x01;
            val != 0
        }
        #[doc = "X1 buffer full flag"]
        #[inline(always)]
        pub fn set_x1full(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
        }
        #[doc = "Overflow error flag"]
        #[inline(always)]
        pub const fn ovfl(&self) -> bool {
            let val = (self.0 >> 8usize) & 0x01;
            val != 0
        }
        #[doc = "Overflow error flag"]
        #[inline(always)]
        pub fn set_ovfl(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 8usize)) | (((val as u32) & 0x01) << 8usize);
        }
        #[doc = "Underflow error flag"]
        #[inline(always)]
        pub const fn unfl(&self) -> bool {
            let val = (self.0 >> 9usize) & 0x01;
            val != 0
        }
        #[doc = "Underflow error flag"]
        #[inline(always)]
        pub fn set_unfl(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 9usize)) | (((val as u32) & 0x01) << 9usize);
        }
        #[doc = "Saturation error flag"]
        #[inline(always)]
        pub const fn sat(&self) -> bool {
            let val = (self.0 >> 10usize) & 0x01;
            val != 0
        }
        #[doc = "Saturation error flag"]
        #[inline(always)]
        pub fn set_sat(&mut self, val: bool) {
            self.0 = (self.0 & !(0x01 << 10usize)) | (((val as u32) & 0x01) << 10usize);
        }
    }
    impl Default for Sr {
        #[inline(always)]
        fn default() -> Sr {
            Sr(0)
        }
    }
    impl core::fmt::Debug for Sr {
        fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
            f.debug_struct("Sr")
                .field("yempty", &self.yempty())
                .field("x1full", &self.x1full())
                .field("ovfl", &self.ovfl())
                .field("unfl", &self.unfl())
                .field("sat", &self.sat())
                .finish()
        }
    }
    #[cfg(feature = "defmt")]
    impl defmt::Format for Sr {
        fn format(&self, f: defmt::Formatter) {
            defmt::write!(
                f,
                "Sr {{ yempty: {=bool:?}, x1full: {=bool:?}, ovfl: {=bool:?}, unfl: {=bool:?}, sat: {=bool:?} }}",
                self.yempty(),
                self.x1full(),
                self.ovfl(),
                self.unfl(),
                self.sat()
            )
        }
    }
    #[doc = "Write data register"]
    #[repr(transparent)]
    #[derive(Copy, Clone, Eq, PartialEq)]
    pub struct Wdata(pub u32);
    impl Wdata {
        #[doc = "Write data (write data are transferred to the address indicated by the write pointer)"]
        #[inline(always)]
        pub const fn wdata(&self) -> u16 {
            let val = (self.0 >> 0usize) & 0xffff;
            val as u16
        }
        #[doc = "Write data (write data are transferred to the address indicated by the write pointer)"]
        #[inline(always)]
        pub fn set_wdata(&mut self, val: u16) {
            self.0 = (self.0 & !(0xffff << 0usize)) | (((val as u32) & 0xffff) << 0usize);
        }
    }
    impl Default for Wdata {
        #[inline(always)]
        fn default() -> Wdata {
            Wdata(0)
        }
    }
    impl core::fmt::Debug for Wdata {
        fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
            f.debug_struct("Wdata").field("wdata", &self.wdata()).finish()
        }
    }
    #[cfg(feature = "defmt")]
    impl defmt::Format for Wdata {
        fn format(&self, f: defmt::Formatter) {
            defmt::write!(f, "Wdata {{ wdata: {=u16:?} }}", self.wdata())
        }
    }
    #[doc = "X1 buffer configuration register"]
    #[repr(transparent)]
    #[derive(Copy, Clone, Eq, PartialEq)]
    pub struct X1bufcfg(pub u32);
    impl X1bufcfg {
        #[doc = "Base address of X1 buffer"]
        #[inline(always)]
        pub const fn x1_base(&self) -> u8 {
            let val = (self.0 >> 0usize) & 0xff;
            val as u8
        }
        #[doc = "Base address of X1 buffer"]
        #[inline(always)]
        pub fn set_x1_base(&mut self, val: u8) {
            self.0 = (self.0 & !(0xff << 0usize)) | (((val as u32) & 0xff) << 0usize);
        }
        #[doc = "Allocated size of X1 buffer in 16-bit words"]
        #[inline(always)]
        pub const fn x1_buf_size(&self) -> u8 {
            let val = (self.0 >> 8usize) & 0xff;
            val as u8
        }
        #[doc = "Allocated size of X1 buffer in 16-bit words"]
        #[inline(always)]
        pub fn set_x1_buf_size(&mut self, val: u8) {
            self.0 = (self.0 & !(0xff << 8usize)) | (((val as u32) & 0xff) << 8usize);
        }
        #[doc = "Watermark for buffer full flag"]
        #[inline(always)]
        pub const fn full_wm(&self) -> u8 {
            let val = (self.0 >> 24usize) & 0x03;
            val as u8
        }
        #[doc = "Watermark for buffer full flag"]
        #[inline(always)]
        pub fn set_full_wm(&mut self, val: u8) {
            self.0 = (self.0 & !(0x03 << 24usize)) | (((val as u32) & 0x03) << 24usize);
        }
    }
    impl Default for X1bufcfg {
        #[inline(always)]
        fn default() -> X1bufcfg {
            X1bufcfg(0)
        }
    }
    impl core::fmt::Debug for X1bufcfg {
        fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
            f.debug_struct("X1bufcfg")
                .field("x1_base", &self.x1_base())
                .field("x1_buf_size", &self.x1_buf_size())
                .field("full_wm", &self.full_wm())
                .finish()
        }
    }
    #[cfg(feature = "defmt")]
    impl defmt::Format for X1bufcfg {
        fn format(&self, f: defmt::Formatter) {
            defmt::write!(
                f,
                "X1bufcfg {{ x1_base: {=u8:?}, x1_buf_size: {=u8:?}, full_wm: {=u8:?} }}",
                self.x1_base(),
                self.x1_buf_size(),
                self.full_wm()
            )
        }
    }
    #[doc = "X2 buffer configuration register"]
    #[repr(transparent)]
    #[derive(Copy, Clone, Eq, PartialEq)]
    pub struct X2bufcfg(pub u32);
    impl X2bufcfg {
        #[doc = "Base address of X2 buffer"]
        #[inline(always)]
        pub const fn x2_base(&self) -> u8 {
            let val = (self.0 >> 0usize) & 0xff;
            val as u8
        }
        #[doc = "Base address of X2 buffer"]
        #[inline(always)]
        pub fn set_x2_base(&mut self, val: u8) {
            self.0 = (self.0 & !(0xff << 0usize)) | (((val as u32) & 0xff) << 0usize);
        }
        #[doc = "Size of X2 buffer in 16-bit words"]
        #[inline(always)]
        pub const fn x2_buf_size(&self) -> u8 {
            let val = (self.0 >> 8usize) & 0xff;
            val as u8
        }
        #[doc = "Size of X2 buffer in 16-bit words"]
        #[inline(always)]
        pub fn set_x2_buf_size(&mut self, val: u8) {
            self.0 = (self.0 & !(0xff << 8usize)) | (((val as u32) & 0xff) << 8usize);
        }
    }
    impl Default for X2bufcfg {
        #[inline(always)]
        fn default() -> X2bufcfg {
            X2bufcfg(0)
        }
    }
    impl core::fmt::Debug for X2bufcfg {
        fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
            f.debug_struct("X2bufcfg")
                .field("x2_base", &self.x2_base())
                .field("x2_buf_size", &self.x2_buf_size())
                .finish()
        }
    }
    #[cfg(feature = "defmt")]
    impl defmt::Format for X2bufcfg {
        fn format(&self, f: defmt::Formatter) {
            defmt::write!(
                f,
                "X2bufcfg {{ x2_base: {=u8:?}, x2_buf_size: {=u8:?} }}",
                self.x2_base(),
                self.x2_buf_size()
            )
        }
    }
    #[doc = "Y buffer configuration register"]
    #[repr(transparent)]
    #[derive(Copy, Clone, Eq, PartialEq)]
    pub struct Ybufcfg(pub u32);
    impl Ybufcfg {
        #[doc = "Base address of Y buffer"]
        #[inline(always)]
        pub const fn y_base(&self) -> u8 {
            let val = (self.0 >> 0usize) & 0xff;
            val as u8
        }
        #[doc = "Base address of Y buffer"]
        #[inline(always)]
        pub fn set_y_base(&mut self, val: u8) {
            self.0 = (self.0 & !(0xff << 0usize)) | (((val as u32) & 0xff) << 0usize);
        }
        #[doc = "Size of Y buffer in 16-bit words"]
        #[inline(always)]
        pub const fn y_buf_size(&self) -> u8 {
            let val = (self.0 >> 8usize) & 0xff;
            val as u8
        }
        #[doc = "Size of Y buffer in 16-bit words"]
        #[inline(always)]
        pub fn set_y_buf_size(&mut self, val: u8) {
            self.0 = (self.0 & !(0xff << 8usize)) | (((val as u32) & 0xff) << 8usize);
        }
        #[doc = "Watermark for buffer empty flag"]
        #[inline(always)]
        pub const fn empty_wm(&self) -> u8 {
            let val = (self.0 >> 24usize) & 0x03;
            val as u8
        }
        #[doc = "Watermark for buffer empty flag"]
        #[inline(always)]
        pub fn set_empty_wm(&mut self, val: u8) {
            self.0 = (self.0 & !(0x03 << 24usize)) | (((val as u32) & 0x03) << 24usize);
        }
    }
    impl Default for Ybufcfg {
        #[inline(always)]
        fn default() -> Ybufcfg {
            Ybufcfg(0)
        }
    }
    impl core::fmt::Debug for Ybufcfg {
        fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
            f.debug_struct("Ybufcfg")
                .field("y_base", &self.y_base())
                .field("y_buf_size", &self.y_buf_size())
                .field("empty_wm", &self.empty_wm())
                .finish()
        }
    }
    #[cfg(feature = "defmt")]
    impl defmt::Format for Ybufcfg {
        fn format(&self, f: defmt::Formatter) {
            defmt::write!(
                f,
                "Ybufcfg {{ y_base: {=u8:?}, y_buf_size: {=u8:?}, empty_wm: {=u8:?} }}",
                self.y_base(),
                self.y_buf_size(),
                self.empty_wm()
            )
        }
    }
}