| 1 | #![allow (clippy::missing_safety_doc)] |
| 2 | #![allow (clippy::identity_op)] |
| 3 | #![allow (clippy::unnecessary_cast)] |
| 4 | #![allow (clippy::erasing_op)] |
| 5 | |
| 6 | #[doc = "Filter math accelerator" ] |
| 7 | #[derive (Copy, Clone, Eq, PartialEq)] |
| 8 | pub struct Fmac { |
| 9 | ptr: *mut u8, |
| 10 | } |
| 11 | unsafe impl Send for Fmac {} |
| 12 | unsafe impl Sync for Fmac {} |
| 13 | impl Fmac { |
| 14 | #[inline (always)] |
| 15 | pub const unsafe fn from_ptr(ptr: *mut ()) -> Self { |
| 16 | Self { ptr: ptr as _ } |
| 17 | } |
| 18 | #[inline (always)] |
| 19 | pub const fn as_ptr(&self) -> *mut () { |
| 20 | self.ptr as _ |
| 21 | } |
| 22 | #[doc = "X1 buffer configuration register" ] |
| 23 | #[inline (always)] |
| 24 | pub const fn x1bufcfg(self) -> crate::common::Reg<regs::X1bufcfg, crate::common::RW> { |
| 25 | unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x0usize) as _) } |
| 26 | } |
| 27 | #[doc = "X2 buffer configuration register" ] |
| 28 | #[inline (always)] |
| 29 | pub const fn x2bufcfg(self) -> crate::common::Reg<regs::X2bufcfg, crate::common::RW> { |
| 30 | unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x04usize) as _) } |
| 31 | } |
| 32 | #[doc = "Y buffer configuration register" ] |
| 33 | #[inline (always)] |
| 34 | pub const fn ybufcfg(self) -> crate::common::Reg<regs::Ybufcfg, crate::common::RW> { |
| 35 | unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x08usize) as _) } |
| 36 | } |
| 37 | #[doc = "Parameter register" ] |
| 38 | #[inline (always)] |
| 39 | pub const fn param(self) -> crate::common::Reg<regs::Param, crate::common::RW> { |
| 40 | unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x0cusize) as _) } |
| 41 | } |
| 42 | #[doc = "Control register" ] |
| 43 | #[inline (always)] |
| 44 | pub const fn cr(self) -> crate::common::Reg<regs::Cr, crate::common::RW> { |
| 45 | unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x10usize) as _) } |
| 46 | } |
| 47 | #[doc = "Status register" ] |
| 48 | #[inline (always)] |
| 49 | pub const fn sr(self) -> crate::common::Reg<regs::Sr, crate::common::R> { |
| 50 | unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x14usize) as _) } |
| 51 | } |
| 52 | #[doc = "Write data register" ] |
| 53 | #[inline (always)] |
| 54 | pub const fn wdata(self) -> crate::common::Reg<regs::Wdata, crate::common::W> { |
| 55 | unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x18usize) as _) } |
| 56 | } |
| 57 | #[doc = "Read data register" ] |
| 58 | #[inline (always)] |
| 59 | pub const fn rdata(self) -> crate::common::Reg<regs::Rdata, crate::common::R> { |
| 60 | unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x1cusize) as _) } |
| 61 | } |
| 62 | } |
| 63 | pub mod regs { |
| 64 | #[doc = "Control register" ] |
| 65 | #[repr (transparent)] |
| 66 | #[derive (Copy, Clone, Eq, PartialEq)] |
| 67 | pub struct Cr(pub u32); |
| 68 | impl Cr { |
| 69 | #[doc = "Enable read interrupt" ] |
| 70 | #[inline (always)] |
| 71 | pub const fn rien(&self) -> bool { |
| 72 | let val = (self.0 >> 0usize) & 0x01; |
| 73 | val != 0 |
| 74 | } |
| 75 | #[doc = "Enable read interrupt" ] |
| 76 | #[inline (always)] |
| 77 | pub fn set_rien(&mut self, val: bool) { |
| 78 | self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize); |
| 79 | } |
| 80 | #[doc = "Enable write interrupt" ] |
| 81 | #[inline (always)] |
| 82 | pub const fn wien(&self) -> bool { |
| 83 | let val = (self.0 >> 1usize) & 0x01; |
| 84 | val != 0 |
| 85 | } |
| 86 | #[doc = "Enable write interrupt" ] |
| 87 | #[inline (always)] |
| 88 | pub fn set_wien(&mut self, val: bool) { |
| 89 | self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize); |
| 90 | } |
| 91 | #[doc = "Enable overflow error interrupts" ] |
| 92 | #[inline (always)] |
| 93 | pub const fn ovflien(&self) -> bool { |
| 94 | let val = (self.0 >> 2usize) & 0x01; |
| 95 | val != 0 |
| 96 | } |
| 97 | #[doc = "Enable overflow error interrupts" ] |
| 98 | #[inline (always)] |
| 99 | pub fn set_ovflien(&mut self, val: bool) { |
| 100 | self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize); |
| 101 | } |
| 102 | #[doc = "Enable underflow error interrupts" ] |
| 103 | #[inline (always)] |
| 104 | pub const fn unflien(&self) -> bool { |
| 105 | let val = (self.0 >> 3usize) & 0x01; |
| 106 | val != 0 |
| 107 | } |
| 108 | #[doc = "Enable underflow error interrupts" ] |
| 109 | #[inline (always)] |
| 110 | pub fn set_unflien(&mut self, val: bool) { |
| 111 | self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize); |
| 112 | } |
| 113 | #[doc = "Enable saturation error interrupts" ] |
| 114 | #[inline (always)] |
| 115 | pub const fn satien(&self) -> bool { |
| 116 | let val = (self.0 >> 4usize) & 0x01; |
| 117 | val != 0 |
| 118 | } |
| 119 | #[doc = "Enable saturation error interrupts" ] |
| 120 | #[inline (always)] |
| 121 | pub fn set_satien(&mut self, val: bool) { |
| 122 | self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize); |
| 123 | } |
| 124 | #[doc = "Enable DMA read channel requests" ] |
| 125 | #[inline (always)] |
| 126 | pub const fn dmaren(&self) -> bool { |
| 127 | let val = (self.0 >> 8usize) & 0x01; |
| 128 | val != 0 |
| 129 | } |
| 130 | #[doc = "Enable DMA read channel requests" ] |
| 131 | #[inline (always)] |
| 132 | pub fn set_dmaren(&mut self, val: bool) { |
| 133 | self.0 = (self.0 & !(0x01 << 8usize)) | (((val as u32) & 0x01) << 8usize); |
| 134 | } |
| 135 | #[doc = "Enable DMA write channel requests" ] |
| 136 | #[inline (always)] |
| 137 | pub const fn dmawen(&self) -> bool { |
| 138 | let val = (self.0 >> 9usize) & 0x01; |
| 139 | val != 0 |
| 140 | } |
| 141 | #[doc = "Enable DMA write channel requests" ] |
| 142 | #[inline (always)] |
| 143 | pub fn set_dmawen(&mut self, val: bool) { |
| 144 | self.0 = (self.0 & !(0x01 << 9usize)) | (((val as u32) & 0x01) << 9usize); |
| 145 | } |
| 146 | #[doc = "Enable clipping" ] |
| 147 | #[inline (always)] |
| 148 | pub const fn clipen(&self) -> bool { |
| 149 | let val = (self.0 >> 15usize) & 0x01; |
| 150 | val != 0 |
| 151 | } |
| 152 | #[doc = "Enable clipping" ] |
| 153 | #[inline (always)] |
| 154 | pub fn set_clipen(&mut self, val: bool) { |
| 155 | self.0 = (self.0 & !(0x01 << 15usize)) | (((val as u32) & 0x01) << 15usize); |
| 156 | } |
| 157 | #[doc = "Reset FMAC unit" ] |
| 158 | #[inline (always)] |
| 159 | pub const fn reset(&self) -> bool { |
| 160 | let val = (self.0 >> 16usize) & 0x01; |
| 161 | val != 0 |
| 162 | } |
| 163 | #[doc = "Reset FMAC unit" ] |
| 164 | #[inline (always)] |
| 165 | pub fn set_reset(&mut self, val: bool) { |
| 166 | self.0 = (self.0 & !(0x01 << 16usize)) | (((val as u32) & 0x01) << 16usize); |
| 167 | } |
| 168 | } |
| 169 | impl Default for Cr { |
| 170 | #[inline (always)] |
| 171 | fn default() -> Cr { |
| 172 | Cr(0) |
| 173 | } |
| 174 | } |
| 175 | impl core::fmt::Debug for Cr { |
| 176 | fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { |
| 177 | f.debug_struct("Cr" ) |
| 178 | .field("rien" , &self.rien()) |
| 179 | .field("wien" , &self.wien()) |
| 180 | .field("ovflien" , &self.ovflien()) |
| 181 | .field("unflien" , &self.unflien()) |
| 182 | .field("satien" , &self.satien()) |
| 183 | .field("dmaren" , &self.dmaren()) |
| 184 | .field("dmawen" , &self.dmawen()) |
| 185 | .field("clipen" , &self.clipen()) |
| 186 | .field("reset" , &self.reset()) |
| 187 | .finish() |
| 188 | } |
| 189 | } |
| 190 | #[cfg (feature = "defmt" )] |
| 191 | impl defmt::Format for Cr { |
| 192 | fn format(&self, f: defmt::Formatter) { |
| 193 | #[derive (defmt :: Format)] |
| 194 | struct Cr { |
| 195 | rien: bool, |
| 196 | wien: bool, |
| 197 | ovflien: bool, |
| 198 | unflien: bool, |
| 199 | satien: bool, |
| 200 | dmaren: bool, |
| 201 | dmawen: bool, |
| 202 | clipen: bool, |
| 203 | reset: bool, |
| 204 | } |
| 205 | let proxy = Cr { |
| 206 | rien: self.rien(), |
| 207 | wien: self.wien(), |
| 208 | ovflien: self.ovflien(), |
| 209 | unflien: self.unflien(), |
| 210 | satien: self.satien(), |
| 211 | dmaren: self.dmaren(), |
| 212 | dmawen: self.dmawen(), |
| 213 | clipen: self.clipen(), |
| 214 | reset: self.reset(), |
| 215 | }; |
| 216 | defmt::write!(f, "{}" , proxy) |
| 217 | } |
| 218 | } |
| 219 | #[doc = "Parameter register" ] |
| 220 | #[repr (transparent)] |
| 221 | #[derive (Copy, Clone, Eq, PartialEq)] |
| 222 | pub struct Param(pub u32); |
| 223 | impl Param { |
| 224 | #[doc = "Input parameter P" ] |
| 225 | #[inline (always)] |
| 226 | pub const fn p(&self) -> u8 { |
| 227 | let val = (self.0 >> 0usize) & 0xff; |
| 228 | val as u8 |
| 229 | } |
| 230 | #[doc = "Input parameter P" ] |
| 231 | #[inline (always)] |
| 232 | pub fn set_p(&mut self, val: u8) { |
| 233 | self.0 = (self.0 & !(0xff << 0usize)) | (((val as u32) & 0xff) << 0usize); |
| 234 | } |
| 235 | #[doc = "Input parameter Q" ] |
| 236 | #[inline (always)] |
| 237 | pub const fn q(&self) -> u8 { |
| 238 | let val = (self.0 >> 8usize) & 0xff; |
| 239 | val as u8 |
| 240 | } |
| 241 | #[doc = "Input parameter Q" ] |
| 242 | #[inline (always)] |
| 243 | pub fn set_q(&mut self, val: u8) { |
| 244 | self.0 = (self.0 & !(0xff << 8usize)) | (((val as u32) & 0xff) << 8usize); |
| 245 | } |
| 246 | #[doc = "Input parameter R" ] |
| 247 | #[inline (always)] |
| 248 | pub const fn r(&self) -> u8 { |
| 249 | let val = (self.0 >> 16usize) & 0xff; |
| 250 | val as u8 |
| 251 | } |
| 252 | #[doc = "Input parameter R" ] |
| 253 | #[inline (always)] |
| 254 | pub fn set_r(&mut self, val: u8) { |
| 255 | self.0 = (self.0 & !(0xff << 16usize)) | (((val as u32) & 0xff) << 16usize); |
| 256 | } |
| 257 | #[doc = "Function" ] |
| 258 | #[inline (always)] |
| 259 | pub const fn func(&self) -> u8 { |
| 260 | let val = (self.0 >> 24usize) & 0x7f; |
| 261 | val as u8 |
| 262 | } |
| 263 | #[doc = "Function" ] |
| 264 | #[inline (always)] |
| 265 | pub fn set_func(&mut self, val: u8) { |
| 266 | self.0 = (self.0 & !(0x7f << 24usize)) | (((val as u32) & 0x7f) << 24usize); |
| 267 | } |
| 268 | #[doc = "Enable execution" ] |
| 269 | #[inline (always)] |
| 270 | pub const fn start(&self) -> bool { |
| 271 | let val = (self.0 >> 31usize) & 0x01; |
| 272 | val != 0 |
| 273 | } |
| 274 | #[doc = "Enable execution" ] |
| 275 | #[inline (always)] |
| 276 | pub fn set_start(&mut self, val: bool) { |
| 277 | self.0 = (self.0 & !(0x01 << 31usize)) | (((val as u32) & 0x01) << 31usize); |
| 278 | } |
| 279 | } |
| 280 | impl Default for Param { |
| 281 | #[inline (always)] |
| 282 | fn default() -> Param { |
| 283 | Param(0) |
| 284 | } |
| 285 | } |
| 286 | impl core::fmt::Debug for Param { |
| 287 | fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { |
| 288 | f.debug_struct("Param" ) |
| 289 | .field("p" , &self.p()) |
| 290 | .field("q" , &self.q()) |
| 291 | .field("r" , &self.r()) |
| 292 | .field("func" , &self.func()) |
| 293 | .field("start" , &self.start()) |
| 294 | .finish() |
| 295 | } |
| 296 | } |
| 297 | #[cfg (feature = "defmt" )] |
| 298 | impl defmt::Format for Param { |
| 299 | fn format(&self, f: defmt::Formatter) { |
| 300 | #[derive (defmt :: Format)] |
| 301 | struct Param { |
| 302 | p: u8, |
| 303 | q: u8, |
| 304 | r: u8, |
| 305 | func: u8, |
| 306 | start: bool, |
| 307 | } |
| 308 | let proxy = Param { |
| 309 | p: self.p(), |
| 310 | q: self.q(), |
| 311 | r: self.r(), |
| 312 | func: self.func(), |
| 313 | start: self.start(), |
| 314 | }; |
| 315 | defmt::write!(f, "{}" , proxy) |
| 316 | } |
| 317 | } |
| 318 | #[doc = "Read data register" ] |
| 319 | #[repr (transparent)] |
| 320 | #[derive (Copy, Clone, Eq, PartialEq)] |
| 321 | pub struct Rdata(pub u32); |
| 322 | impl Rdata { |
| 323 | #[doc = "Read data (contents of the Y output buffer at the address indicated by the READ pointer)" ] |
| 324 | #[inline (always)] |
| 325 | pub const fn res(&self) -> u16 { |
| 326 | let val = (self.0 >> 0usize) & 0xffff; |
| 327 | val as u16 |
| 328 | } |
| 329 | #[doc = "Read data (contents of the Y output buffer at the address indicated by the READ pointer)" ] |
| 330 | #[inline (always)] |
| 331 | pub fn set_res(&mut self, val: u16) { |
| 332 | self.0 = (self.0 & !(0xffff << 0usize)) | (((val as u32) & 0xffff) << 0usize); |
| 333 | } |
| 334 | } |
| 335 | impl Default for Rdata { |
| 336 | #[inline (always)] |
| 337 | fn default() -> Rdata { |
| 338 | Rdata(0) |
| 339 | } |
| 340 | } |
| 341 | impl core::fmt::Debug for Rdata { |
| 342 | fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { |
| 343 | f.debug_struct("Rdata" ).field("res" , &self.res()).finish() |
| 344 | } |
| 345 | } |
| 346 | #[cfg (feature = "defmt" )] |
| 347 | impl defmt::Format for Rdata { |
| 348 | fn format(&self, f: defmt::Formatter) { |
| 349 | #[derive (defmt :: Format)] |
| 350 | struct Rdata { |
| 351 | res: u16, |
| 352 | } |
| 353 | let proxy = Rdata { res: self.res() }; |
| 354 | defmt::write!(f, "{}" , proxy) |
| 355 | } |
| 356 | } |
| 357 | #[doc = "Status register" ] |
| 358 | #[repr (transparent)] |
| 359 | #[derive (Copy, Clone, Eq, PartialEq)] |
| 360 | pub struct Sr(pub u32); |
| 361 | impl Sr { |
| 362 | #[doc = "Y buffer empty flag" ] |
| 363 | #[inline (always)] |
| 364 | pub const fn yempty(&self) -> bool { |
| 365 | let val = (self.0 >> 0usize) & 0x01; |
| 366 | val != 0 |
| 367 | } |
| 368 | #[doc = "Y buffer empty flag" ] |
| 369 | #[inline (always)] |
| 370 | pub fn set_yempty(&mut self, val: bool) { |
| 371 | self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize); |
| 372 | } |
| 373 | #[doc = "X1 buffer full flag" ] |
| 374 | #[inline (always)] |
| 375 | pub const fn x1full(&self) -> bool { |
| 376 | let val = (self.0 >> 1usize) & 0x01; |
| 377 | val != 0 |
| 378 | } |
| 379 | #[doc = "X1 buffer full flag" ] |
| 380 | #[inline (always)] |
| 381 | pub fn set_x1full(&mut self, val: bool) { |
| 382 | self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize); |
| 383 | } |
| 384 | #[doc = "Overflow error flag" ] |
| 385 | #[inline (always)] |
| 386 | pub const fn ovfl(&self) -> bool { |
| 387 | let val = (self.0 >> 8usize) & 0x01; |
| 388 | val != 0 |
| 389 | } |
| 390 | #[doc = "Overflow error flag" ] |
| 391 | #[inline (always)] |
| 392 | pub fn set_ovfl(&mut self, val: bool) { |
| 393 | self.0 = (self.0 & !(0x01 << 8usize)) | (((val as u32) & 0x01) << 8usize); |
| 394 | } |
| 395 | #[doc = "Underflow error flag" ] |
| 396 | #[inline (always)] |
| 397 | pub const fn unfl(&self) -> bool { |
| 398 | let val = (self.0 >> 9usize) & 0x01; |
| 399 | val != 0 |
| 400 | } |
| 401 | #[doc = "Underflow error flag" ] |
| 402 | #[inline (always)] |
| 403 | pub fn set_unfl(&mut self, val: bool) { |
| 404 | self.0 = (self.0 & !(0x01 << 9usize)) | (((val as u32) & 0x01) << 9usize); |
| 405 | } |
| 406 | #[doc = "Saturation error flag" ] |
| 407 | #[inline (always)] |
| 408 | pub const fn sat(&self) -> bool { |
| 409 | let val = (self.0 >> 10usize) & 0x01; |
| 410 | val != 0 |
| 411 | } |
| 412 | #[doc = "Saturation error flag" ] |
| 413 | #[inline (always)] |
| 414 | pub fn set_sat(&mut self, val: bool) { |
| 415 | self.0 = (self.0 & !(0x01 << 10usize)) | (((val as u32) & 0x01) << 10usize); |
| 416 | } |
| 417 | } |
| 418 | impl Default for Sr { |
| 419 | #[inline (always)] |
| 420 | fn default() -> Sr { |
| 421 | Sr(0) |
| 422 | } |
| 423 | } |
| 424 | impl core::fmt::Debug for Sr { |
| 425 | fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { |
| 426 | f.debug_struct("Sr" ) |
| 427 | .field("yempty" , &self.yempty()) |
| 428 | .field("x1full" , &self.x1full()) |
| 429 | .field("ovfl" , &self.ovfl()) |
| 430 | .field("unfl" , &self.unfl()) |
| 431 | .field("sat" , &self.sat()) |
| 432 | .finish() |
| 433 | } |
| 434 | } |
| 435 | #[cfg (feature = "defmt" )] |
| 436 | impl defmt::Format for Sr { |
| 437 | fn format(&self, f: defmt::Formatter) { |
| 438 | #[derive (defmt :: Format)] |
| 439 | struct Sr { |
| 440 | yempty: bool, |
| 441 | x1full: bool, |
| 442 | ovfl: bool, |
| 443 | unfl: bool, |
| 444 | sat: bool, |
| 445 | } |
| 446 | let proxy = Sr { |
| 447 | yempty: self.yempty(), |
| 448 | x1full: self.x1full(), |
| 449 | ovfl: self.ovfl(), |
| 450 | unfl: self.unfl(), |
| 451 | sat: self.sat(), |
| 452 | }; |
| 453 | defmt::write!(f, "{}" , proxy) |
| 454 | } |
| 455 | } |
| 456 | #[doc = "Write data register" ] |
| 457 | #[repr (transparent)] |
| 458 | #[derive (Copy, Clone, Eq, PartialEq)] |
| 459 | pub struct Wdata(pub u32); |
| 460 | impl Wdata { |
| 461 | #[doc = "Write data (write data are transferred to the address indicated by the write pointer)" ] |
| 462 | #[inline (always)] |
| 463 | pub const fn wdata(&self) -> u16 { |
| 464 | let val = (self.0 >> 0usize) & 0xffff; |
| 465 | val as u16 |
| 466 | } |
| 467 | #[doc = "Write data (write data are transferred to the address indicated by the write pointer)" ] |
| 468 | #[inline (always)] |
| 469 | pub fn set_wdata(&mut self, val: u16) { |
| 470 | self.0 = (self.0 & !(0xffff << 0usize)) | (((val as u32) & 0xffff) << 0usize); |
| 471 | } |
| 472 | } |
| 473 | impl Default for Wdata { |
| 474 | #[inline (always)] |
| 475 | fn default() -> Wdata { |
| 476 | Wdata(0) |
| 477 | } |
| 478 | } |
| 479 | impl core::fmt::Debug for Wdata { |
| 480 | fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { |
| 481 | f.debug_struct("Wdata" ).field("wdata" , &self.wdata()).finish() |
| 482 | } |
| 483 | } |
| 484 | #[cfg (feature = "defmt" )] |
| 485 | impl defmt::Format for Wdata { |
| 486 | fn format(&self, f: defmt::Formatter) { |
| 487 | #[derive (defmt :: Format)] |
| 488 | struct Wdata { |
| 489 | wdata: u16, |
| 490 | } |
| 491 | let proxy = Wdata { wdata: self.wdata() }; |
| 492 | defmt::write!(f, "{}" , proxy) |
| 493 | } |
| 494 | } |
| 495 | #[doc = "X1 buffer configuration register" ] |
| 496 | #[repr (transparent)] |
| 497 | #[derive (Copy, Clone, Eq, PartialEq)] |
| 498 | pub struct X1bufcfg(pub u32); |
| 499 | impl X1bufcfg { |
| 500 | #[doc = "Base address of X1 buffer" ] |
| 501 | #[inline (always)] |
| 502 | pub const fn x1_base(&self) -> u8 { |
| 503 | let val = (self.0 >> 0usize) & 0xff; |
| 504 | val as u8 |
| 505 | } |
| 506 | #[doc = "Base address of X1 buffer" ] |
| 507 | #[inline (always)] |
| 508 | pub fn set_x1_base(&mut self, val: u8) { |
| 509 | self.0 = (self.0 & !(0xff << 0usize)) | (((val as u32) & 0xff) << 0usize); |
| 510 | } |
| 511 | #[doc = "Allocated size of X1 buffer in 16-bit words" ] |
| 512 | #[inline (always)] |
| 513 | pub const fn x1_buf_size(&self) -> u8 { |
| 514 | let val = (self.0 >> 8usize) & 0xff; |
| 515 | val as u8 |
| 516 | } |
| 517 | #[doc = "Allocated size of X1 buffer in 16-bit words" ] |
| 518 | #[inline (always)] |
| 519 | pub fn set_x1_buf_size(&mut self, val: u8) { |
| 520 | self.0 = (self.0 & !(0xff << 8usize)) | (((val as u32) & 0xff) << 8usize); |
| 521 | } |
| 522 | #[doc = "Watermark for buffer full flag" ] |
| 523 | #[inline (always)] |
| 524 | pub const fn full_wm(&self) -> u8 { |
| 525 | let val = (self.0 >> 24usize) & 0x03; |
| 526 | val as u8 |
| 527 | } |
| 528 | #[doc = "Watermark for buffer full flag" ] |
| 529 | #[inline (always)] |
| 530 | pub fn set_full_wm(&mut self, val: u8) { |
| 531 | self.0 = (self.0 & !(0x03 << 24usize)) | (((val as u32) & 0x03) << 24usize); |
| 532 | } |
| 533 | } |
| 534 | impl Default for X1bufcfg { |
| 535 | #[inline (always)] |
| 536 | fn default() -> X1bufcfg { |
| 537 | X1bufcfg(0) |
| 538 | } |
| 539 | } |
| 540 | impl core::fmt::Debug for X1bufcfg { |
| 541 | fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { |
| 542 | f.debug_struct("X1bufcfg" ) |
| 543 | .field("x1_base" , &self.x1_base()) |
| 544 | .field("x1_buf_size" , &self.x1_buf_size()) |
| 545 | .field("full_wm" , &self.full_wm()) |
| 546 | .finish() |
| 547 | } |
| 548 | } |
| 549 | #[cfg (feature = "defmt" )] |
| 550 | impl defmt::Format for X1bufcfg { |
| 551 | fn format(&self, f: defmt::Formatter) { |
| 552 | #[derive (defmt :: Format)] |
| 553 | struct X1bufcfg { |
| 554 | x1_base: u8, |
| 555 | x1_buf_size: u8, |
| 556 | full_wm: u8, |
| 557 | } |
| 558 | let proxy = X1bufcfg { |
| 559 | x1_base: self.x1_base(), |
| 560 | x1_buf_size: self.x1_buf_size(), |
| 561 | full_wm: self.full_wm(), |
| 562 | }; |
| 563 | defmt::write!(f, "{}" , proxy) |
| 564 | } |
| 565 | } |
| 566 | #[doc = "X2 buffer configuration register" ] |
| 567 | #[repr (transparent)] |
| 568 | #[derive (Copy, Clone, Eq, PartialEq)] |
| 569 | pub struct X2bufcfg(pub u32); |
| 570 | impl X2bufcfg { |
| 571 | #[doc = "Base address of X2 buffer" ] |
| 572 | #[inline (always)] |
| 573 | pub const fn x2_base(&self) -> u8 { |
| 574 | let val = (self.0 >> 0usize) & 0xff; |
| 575 | val as u8 |
| 576 | } |
| 577 | #[doc = "Base address of X2 buffer" ] |
| 578 | #[inline (always)] |
| 579 | pub fn set_x2_base(&mut self, val: u8) { |
| 580 | self.0 = (self.0 & !(0xff << 0usize)) | (((val as u32) & 0xff) << 0usize); |
| 581 | } |
| 582 | #[doc = "Size of X2 buffer in 16-bit words" ] |
| 583 | #[inline (always)] |
| 584 | pub const fn x2_buf_size(&self) -> u8 { |
| 585 | let val = (self.0 >> 8usize) & 0xff; |
| 586 | val as u8 |
| 587 | } |
| 588 | #[doc = "Size of X2 buffer in 16-bit words" ] |
| 589 | #[inline (always)] |
| 590 | pub fn set_x2_buf_size(&mut self, val: u8) { |
| 591 | self.0 = (self.0 & !(0xff << 8usize)) | (((val as u32) & 0xff) << 8usize); |
| 592 | } |
| 593 | } |
| 594 | impl Default for X2bufcfg { |
| 595 | #[inline (always)] |
| 596 | fn default() -> X2bufcfg { |
| 597 | X2bufcfg(0) |
| 598 | } |
| 599 | } |
| 600 | impl core::fmt::Debug for X2bufcfg { |
| 601 | fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { |
| 602 | f.debug_struct("X2bufcfg" ) |
| 603 | .field("x2_base" , &self.x2_base()) |
| 604 | .field("x2_buf_size" , &self.x2_buf_size()) |
| 605 | .finish() |
| 606 | } |
| 607 | } |
| 608 | #[cfg (feature = "defmt" )] |
| 609 | impl defmt::Format for X2bufcfg { |
| 610 | fn format(&self, f: defmt::Formatter) { |
| 611 | #[derive (defmt :: Format)] |
| 612 | struct X2bufcfg { |
| 613 | x2_base: u8, |
| 614 | x2_buf_size: u8, |
| 615 | } |
| 616 | let proxy = X2bufcfg { |
| 617 | x2_base: self.x2_base(), |
| 618 | x2_buf_size: self.x2_buf_size(), |
| 619 | }; |
| 620 | defmt::write!(f, "{}" , proxy) |
| 621 | } |
| 622 | } |
| 623 | #[doc = "Y buffer configuration register" ] |
| 624 | #[repr (transparent)] |
| 625 | #[derive (Copy, Clone, Eq, PartialEq)] |
| 626 | pub struct Ybufcfg(pub u32); |
| 627 | impl Ybufcfg { |
| 628 | #[doc = "Base address of Y buffer" ] |
| 629 | #[inline (always)] |
| 630 | pub const fn y_base(&self) -> u8 { |
| 631 | let val = (self.0 >> 0usize) & 0xff; |
| 632 | val as u8 |
| 633 | } |
| 634 | #[doc = "Base address of Y buffer" ] |
| 635 | #[inline (always)] |
| 636 | pub fn set_y_base(&mut self, val: u8) { |
| 637 | self.0 = (self.0 & !(0xff << 0usize)) | (((val as u32) & 0xff) << 0usize); |
| 638 | } |
| 639 | #[doc = "Size of Y buffer in 16-bit words" ] |
| 640 | #[inline (always)] |
| 641 | pub const fn y_buf_size(&self) -> u8 { |
| 642 | let val = (self.0 >> 8usize) & 0xff; |
| 643 | val as u8 |
| 644 | } |
| 645 | #[doc = "Size of Y buffer in 16-bit words" ] |
| 646 | #[inline (always)] |
| 647 | pub fn set_y_buf_size(&mut self, val: u8) { |
| 648 | self.0 = (self.0 & !(0xff << 8usize)) | (((val as u32) & 0xff) << 8usize); |
| 649 | } |
| 650 | #[doc = "Watermark for buffer empty flag" ] |
| 651 | #[inline (always)] |
| 652 | pub const fn empty_wm(&self) -> u8 { |
| 653 | let val = (self.0 >> 24usize) & 0x03; |
| 654 | val as u8 |
| 655 | } |
| 656 | #[doc = "Watermark for buffer empty flag" ] |
| 657 | #[inline (always)] |
| 658 | pub fn set_empty_wm(&mut self, val: u8) { |
| 659 | self.0 = (self.0 & !(0x03 << 24usize)) | (((val as u32) & 0x03) << 24usize); |
| 660 | } |
| 661 | } |
| 662 | impl Default for Ybufcfg { |
| 663 | #[inline (always)] |
| 664 | fn default() -> Ybufcfg { |
| 665 | Ybufcfg(0) |
| 666 | } |
| 667 | } |
| 668 | impl core::fmt::Debug for Ybufcfg { |
| 669 | fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { |
| 670 | f.debug_struct("Ybufcfg" ) |
| 671 | .field("y_base" , &self.y_base()) |
| 672 | .field("y_buf_size" , &self.y_buf_size()) |
| 673 | .field("empty_wm" , &self.empty_wm()) |
| 674 | .finish() |
| 675 | } |
| 676 | } |
| 677 | #[cfg (feature = "defmt" )] |
| 678 | impl defmt::Format for Ybufcfg { |
| 679 | fn format(&self, f: defmt::Formatter) { |
| 680 | #[derive (defmt :: Format)] |
| 681 | struct Ybufcfg { |
| 682 | y_base: u8, |
| 683 | y_buf_size: u8, |
| 684 | empty_wm: u8, |
| 685 | } |
| 686 | let proxy = Ybufcfg { |
| 687 | y_base: self.y_base(), |
| 688 | y_buf_size: self.y_buf_size(), |
| 689 | empty_wm: self.empty_wm(), |
| 690 | }; |
| 691 | defmt::write!(f, "{}" , proxy) |
| 692 | } |
| 693 | } |
| 694 | } |
| 695 | |