1 // Copyright 2024, Linaro Limited 2 // Author(s): Manos Pitsidianakis <manos.pitsidianakis@linaro.org> 3 // SPDX-License-Identifier: GPL-2.0-or-later 4 5 use core::ptr::{addr_of, addr_of_mut, NonNull}; 6 use std::{ 7 ffi::CStr, 8 ops::ControlFlow, 9 os::raw::{c_int, c_uint, c_void}, 10 }; 11 12 use qemu_api::{ 13 bindings::{ 14 error_fatal, hwaddr, memory_region_init_io, qdev_init_clock_in, qdev_new, 15 qdev_prop_set_chr, qemu_chr_fe_ioctl, qemu_chr_fe_set_handlers, qemu_chr_fe_write_all, 16 qemu_irq, sysbus_connect_irq, sysbus_mmio_map, sysbus_realize_and_unref, CharBackend, 17 Chardev, Clock, ClockEvent, MemoryRegion, QEMUChrEvent, CHR_IOCTL_SERIAL_SET_BREAK, 18 }, 19 c_str, impl_vmstate_forward, 20 irq::InterruptSource, 21 prelude::*, 22 qdev::{DeviceImpl, DeviceState, Property}, 23 qom::{ClassInitImpl, ObjectImpl, ParentField}, 24 sysbus::{SysBusDevice, SysBusDeviceClass}, 25 vmstate::VMStateDescription, 26 }; 27 28 use crate::{ 29 device_class, 30 memory_ops::PL011_OPS, 31 registers::{self, Interrupt}, 32 RegisterOffset, 33 }; 34 35 /// Integer Baud Rate Divider, `UARTIBRD` 36 const IBRD_MASK: u32 = 0xffff; 37 38 /// Fractional Baud Rate Divider, `UARTFBRD` 39 const FBRD_MASK: u32 = 0x3f; 40 41 /// QEMU sourced constant. 42 pub const PL011_FIFO_DEPTH: u32 = 16; 43 44 #[derive(Clone, Copy)] 45 struct DeviceId(&'static [u8; 8]); 46 47 impl std::ops::Index<hwaddr> for DeviceId { 48 type Output = u8; 49 50 fn index(&self, idx: hwaddr) -> &Self::Output { 51 &self.0[idx as usize] 52 } 53 } 54 55 impl DeviceId { 56 const ARM: Self = Self(&[0x11, 0x10, 0x14, 0x00, 0x0d, 0xf0, 0x05, 0xb1]); 57 const LUMINARY: Self = Self(&[0x11, 0x00, 0x18, 0x01, 0x0d, 0xf0, 0x05, 0xb1]); 58 } 59 60 // FIFOs use 32-bit indices instead of usize, for compatibility with 61 // the migration stream produced by the C version of this device. 62 #[repr(transparent)] 63 #[derive(Debug, Default)] 64 pub struct Fifo([registers::Data; PL011_FIFO_DEPTH as usize]); 65 impl_vmstate_forward!(Fifo); 66 67 impl Fifo { 68 const fn len(&self) -> u32 { 69 self.0.len() as u32 70 } 71 } 72 73 impl std::ops::IndexMut<u32> for Fifo { 74 fn index_mut(&mut self, idx: u32) -> &mut Self::Output { 75 &mut self.0[idx as usize] 76 } 77 } 78 79 impl std::ops::Index<u32> for Fifo { 80 type Output = registers::Data; 81 82 fn index(&self, idx: u32) -> &Self::Output { 83 &self.0[idx as usize] 84 } 85 } 86 87 #[repr(C)] 88 #[derive(Debug, qemu_api_macros::Object, qemu_api_macros::offsets)] 89 /// PL011 Device Model in QEMU 90 pub struct PL011State { 91 pub parent_obj: ParentField<SysBusDevice>, 92 pub iomem: MemoryRegion, 93 #[doc(alias = "fr")] 94 pub flags: registers::Flags, 95 #[doc(alias = "lcr")] 96 pub line_control: registers::LineControl, 97 #[doc(alias = "rsr")] 98 pub receive_status_error_clear: registers::ReceiveStatusErrorClear, 99 #[doc(alias = "cr")] 100 pub control: registers::Control, 101 pub dmacr: u32, 102 pub int_enabled: u32, 103 pub int_level: u32, 104 pub read_fifo: Fifo, 105 pub ilpr: u32, 106 pub ibrd: u32, 107 pub fbrd: u32, 108 pub ifl: u32, 109 pub read_pos: u32, 110 pub read_count: u32, 111 pub read_trigger: u32, 112 #[doc(alias = "chr")] 113 pub char_backend: CharBackend, 114 /// QEMU interrupts 115 /// 116 /// ```text 117 /// * sysbus MMIO region 0: device registers 118 /// * sysbus IRQ 0: `UARTINTR` (combined interrupt line) 119 /// * sysbus IRQ 1: `UARTRXINTR` (receive FIFO interrupt line) 120 /// * sysbus IRQ 2: `UARTTXINTR` (transmit FIFO interrupt line) 121 /// * sysbus IRQ 3: `UARTRTINTR` (receive timeout interrupt line) 122 /// * sysbus IRQ 4: `UARTMSINTR` (momem status interrupt line) 123 /// * sysbus IRQ 5: `UARTEINTR` (error interrupt line) 124 /// ``` 125 #[doc(alias = "irq")] 126 pub interrupts: [InterruptSource; IRQMASK.len()], 127 #[doc(alias = "clk")] 128 pub clock: NonNull<Clock>, 129 #[doc(alias = "migrate_clk")] 130 pub migrate_clock: bool, 131 } 132 133 qom_isa!(PL011State : SysBusDevice, DeviceState, Object); 134 135 #[repr(C)] 136 pub struct PL011Class { 137 parent_class: <SysBusDevice as ObjectType>::Class, 138 /// The byte string that identifies the device. 139 device_id: DeviceId, 140 } 141 142 unsafe impl ObjectType for PL011State { 143 type Class = PL011Class; 144 const TYPE_NAME: &'static CStr = crate::TYPE_PL011; 145 } 146 147 impl ClassInitImpl<PL011Class> for PL011State { 148 fn class_init(klass: &mut PL011Class) { 149 klass.device_id = DeviceId::ARM; 150 <Self as ClassInitImpl<SysBusDeviceClass>>::class_init(&mut klass.parent_class); 151 } 152 } 153 154 impl ObjectImpl for PL011State { 155 type ParentType = SysBusDevice; 156 157 const INSTANCE_INIT: Option<unsafe fn(&mut Self)> = Some(Self::init); 158 const INSTANCE_POST_INIT: Option<fn(&Self)> = Some(Self::post_init); 159 } 160 161 impl DeviceImpl for PL011State { 162 fn properties() -> &'static [Property] { 163 &device_class::PL011_PROPERTIES 164 } 165 fn vmsd() -> Option<&'static VMStateDescription> { 166 Some(&device_class::VMSTATE_PL011) 167 } 168 const REALIZE: Option<fn(&Self)> = Some(Self::realize); 169 const RESET: Option<fn(&mut Self)> = Some(Self::reset); 170 } 171 172 impl PL011State { 173 /// Initializes a pre-allocated, unitialized instance of `PL011State`. 174 /// 175 /// # Safety 176 /// 177 /// `self` must point to a correctly sized and aligned location for the 178 /// `PL011State` type. It must not be called more than once on the same 179 /// location/instance. All its fields are expected to hold unitialized 180 /// values with the sole exception of `parent_obj`. 181 unsafe fn init(&mut self) { 182 const CLK_NAME: &CStr = c_str!("clk"); 183 184 // SAFETY: 185 // 186 // self and self.iomem are guaranteed to be valid at this point since callers 187 // must make sure the `self` reference is valid. 188 unsafe { 189 memory_region_init_io( 190 addr_of_mut!(self.iomem), 191 addr_of_mut!(*self).cast::<Object>(), 192 &PL011_OPS, 193 addr_of_mut!(*self).cast::<c_void>(), 194 Self::TYPE_NAME.as_ptr(), 195 0x1000, 196 ); 197 } 198 199 // SAFETY: 200 // 201 // self.clock is not initialized at this point; but since `NonNull<_>` is Copy, 202 // we can overwrite the undefined value without side effects. This is 203 // safe since all PL011State instances are created by QOM code which 204 // calls this function to initialize the fields; therefore no code is 205 // able to access an invalid self.clock value. 206 unsafe { 207 let dev: &mut DeviceState = self.upcast_mut(); 208 self.clock = NonNull::new(qdev_init_clock_in( 209 dev, 210 CLK_NAME.as_ptr(), 211 None, /* pl011_clock_update */ 212 addr_of_mut!(*self).cast::<c_void>(), 213 ClockEvent::ClockUpdate.0, 214 )) 215 .unwrap(); 216 } 217 } 218 219 fn post_init(&self) { 220 self.init_mmio(&self.iomem); 221 for irq in self.interrupts.iter() { 222 self.init_irq(irq); 223 } 224 } 225 226 fn regs_read(&mut self, offset: RegisterOffset) -> ControlFlow<u32, u32> { 227 use RegisterOffset::*; 228 229 ControlFlow::Break(match offset { 230 DR => { 231 self.flags.set_receive_fifo_full(false); 232 let c = self.read_fifo[self.read_pos]; 233 if self.read_count > 0 { 234 self.read_count -= 1; 235 self.read_pos = (self.read_pos + 1) & (self.fifo_depth() - 1); 236 } 237 if self.read_count == 0 { 238 self.flags.set_receive_fifo_empty(true); 239 } 240 if self.read_count + 1 == self.read_trigger { 241 self.int_level &= !registers::INT_RX; 242 } 243 // Update error bits. 244 self.receive_status_error_clear.set_from_data(c); 245 self.update(); 246 // Must call qemu_chr_fe_accept_input, so return Continue: 247 return ControlFlow::Continue(u32::from(c)); 248 } 249 RSR => u32::from(self.receive_status_error_clear), 250 FR => u32::from(self.flags), 251 FBRD => self.fbrd, 252 ILPR => self.ilpr, 253 IBRD => self.ibrd, 254 LCR_H => u32::from(self.line_control), 255 CR => u32::from(self.control), 256 FLS => self.ifl, 257 IMSC => self.int_enabled, 258 RIS => self.int_level, 259 MIS => self.int_level & self.int_enabled, 260 ICR => { 261 // "The UARTICR Register is the interrupt clear register and is write-only" 262 // Source: ARM DDI 0183G 3.3.13 Interrupt Clear Register, UARTICR 263 0 264 } 265 DMACR => self.dmacr, 266 }) 267 } 268 269 fn regs_write(&mut self, offset: RegisterOffset, value: u32) { 270 // eprintln!("write offset {offset} value {value}"); 271 use RegisterOffset::*; 272 match offset { 273 DR => { 274 self.loopback_tx(value); 275 self.int_level |= registers::INT_TX; 276 self.update(); 277 } 278 RSR => { 279 self.receive_status_error_clear = 0.into(); 280 } 281 FR => { 282 // flag writes are ignored 283 } 284 ILPR => { 285 self.ilpr = value; 286 } 287 IBRD => { 288 self.ibrd = value; 289 } 290 FBRD => { 291 self.fbrd = value; 292 } 293 LCR_H => { 294 let new_val: registers::LineControl = value.into(); 295 // Reset the FIFO state on FIFO enable or disable 296 if self.line_control.fifos_enabled() != new_val.fifos_enabled() { 297 self.reset_rx_fifo(); 298 self.reset_tx_fifo(); 299 } 300 if self.line_control.send_break() ^ new_val.send_break() { 301 let mut break_enable: c_int = new_val.send_break().into(); 302 // SAFETY: self.char_backend is a valid CharBackend instance after it's been 303 // initialized in realize(). 304 unsafe { 305 qemu_chr_fe_ioctl( 306 addr_of_mut!(self.char_backend), 307 CHR_IOCTL_SERIAL_SET_BREAK as i32, 308 addr_of_mut!(break_enable).cast::<c_void>(), 309 ); 310 } 311 self.loopback_break(break_enable > 0); 312 } 313 self.line_control = new_val; 314 self.set_read_trigger(); 315 } 316 CR => { 317 // ??? Need to implement the enable bit. 318 self.control = value.into(); 319 self.loopback_mdmctrl(); 320 } 321 FLS => { 322 self.ifl = value; 323 self.set_read_trigger(); 324 } 325 IMSC => { 326 self.int_enabled = value; 327 self.update(); 328 } 329 RIS => {} 330 MIS => {} 331 ICR => { 332 self.int_level &= !value; 333 self.update(); 334 } 335 DMACR => { 336 self.dmacr = value; 337 if value & 3 > 0 { 338 // qemu_log_mask(LOG_UNIMP, "pl011: DMA not implemented\n"); 339 eprintln!("pl011: DMA not implemented"); 340 } 341 } 342 } 343 } 344 345 #[inline] 346 fn loopback_tx(&mut self, value: u32) { 347 if !self.loopback_enabled() { 348 return; 349 } 350 351 // Caveat: 352 // 353 // In real hardware, TX loopback happens at the serial-bit level 354 // and then reassembled by the RX logics back into bytes and placed 355 // into the RX fifo. That is, loopback happens after TX fifo. 356 // 357 // Because the real hardware TX fifo is time-drained at the frame 358 // rate governed by the configured serial format, some loopback 359 // bytes in TX fifo may still be able to get into the RX fifo 360 // that could be full at times while being drained at software 361 // pace. 362 // 363 // In such scenario, the RX draining pace is the major factor 364 // deciding which loopback bytes get into the RX fifo, unless 365 // hardware flow-control is enabled. 366 // 367 // For simplicity, the above described is not emulated. 368 self.put_fifo(value); 369 } 370 371 fn loopback_mdmctrl(&mut self) { 372 if !self.loopback_enabled() { 373 return; 374 } 375 376 /* 377 * Loopback software-driven modem control outputs to modem status inputs: 378 * FR.RI <= CR.Out2 379 * FR.DCD <= CR.Out1 380 * FR.CTS <= CR.RTS 381 * FR.DSR <= CR.DTR 382 * 383 * The loopback happens immediately even if this call is triggered 384 * by setting only CR.LBE. 385 * 386 * CTS/RTS updates due to enabled hardware flow controls are not 387 * dealt with here. 388 */ 389 390 self.flags.set_ring_indicator(self.control.out_2()); 391 self.flags.set_data_carrier_detect(self.control.out_1()); 392 self.flags.set_clear_to_send(self.control.request_to_send()); 393 self.flags 394 .set_data_set_ready(self.control.data_transmit_ready()); 395 396 // Change interrupts based on updated FR 397 let mut il = self.int_level; 398 399 il &= !Interrupt::MS; 400 401 if self.flags.data_set_ready() { 402 il |= Interrupt::DSR as u32; 403 } 404 if self.flags.data_carrier_detect() { 405 il |= Interrupt::DCD as u32; 406 } 407 if self.flags.clear_to_send() { 408 il |= Interrupt::CTS as u32; 409 } 410 if self.flags.ring_indicator() { 411 il |= Interrupt::RI as u32; 412 } 413 self.int_level = il; 414 self.update(); 415 } 416 417 fn loopback_break(&mut self, enable: bool) { 418 if enable { 419 self.loopback_tx(registers::Data::BREAK.into()); 420 } 421 } 422 423 fn set_read_trigger(&mut self) { 424 self.read_trigger = 1; 425 } 426 427 pub fn realize(&self) { 428 // SAFETY: self.char_backend has the correct size and alignment for a 429 // CharBackend object, and its callbacks are of the correct types. 430 unsafe { 431 qemu_chr_fe_set_handlers( 432 addr_of!(self.char_backend) as *mut CharBackend, 433 Some(pl011_can_receive), 434 Some(pl011_receive), 435 Some(pl011_event), 436 None, 437 addr_of!(*self).cast::<c_void>() as *mut c_void, 438 core::ptr::null_mut(), 439 true, 440 ); 441 } 442 } 443 444 pub fn reset(&mut self) { 445 self.line_control.reset(); 446 self.receive_status_error_clear.reset(); 447 self.dmacr = 0; 448 self.int_enabled = 0; 449 self.int_level = 0; 450 self.ilpr = 0; 451 self.ibrd = 0; 452 self.fbrd = 0; 453 self.read_trigger = 1; 454 self.ifl = 0x12; 455 self.control.reset(); 456 self.flags.reset(); 457 self.reset_rx_fifo(); 458 self.reset_tx_fifo(); 459 } 460 461 pub fn reset_rx_fifo(&mut self) { 462 self.read_count = 0; 463 self.read_pos = 0; 464 465 // Reset FIFO flags 466 self.flags.set_receive_fifo_full(false); 467 self.flags.set_receive_fifo_empty(true); 468 } 469 470 pub fn reset_tx_fifo(&mut self) { 471 // Reset FIFO flags 472 self.flags.set_transmit_fifo_full(false); 473 self.flags.set_transmit_fifo_empty(true); 474 } 475 476 pub fn can_receive(&self) -> bool { 477 // trace_pl011_can_receive(s->lcr, s->read_count, r); 478 self.read_count < self.fifo_depth() 479 } 480 481 pub fn event(&mut self, event: QEMUChrEvent) { 482 if event == QEMUChrEvent::CHR_EVENT_BREAK && !self.loopback_enabled() { 483 self.put_fifo(registers::Data::BREAK.into()); 484 } 485 } 486 487 #[inline] 488 pub fn fifo_enabled(&self) -> bool { 489 self.line_control.fifos_enabled() == registers::Mode::FIFO 490 } 491 492 #[inline] 493 pub fn loopback_enabled(&self) -> bool { 494 self.control.enable_loopback() 495 } 496 497 #[inline] 498 pub fn fifo_depth(&self) -> u32 { 499 // Note: FIFO depth is expected to be power-of-2 500 if self.fifo_enabled() { 501 return PL011_FIFO_DEPTH; 502 } 503 1 504 } 505 506 pub fn put_fifo(&mut self, value: c_uint) { 507 let depth = self.fifo_depth(); 508 assert!(depth > 0); 509 let slot = (self.read_pos + self.read_count) & (depth - 1); 510 self.read_fifo[slot] = registers::Data::from(value); 511 self.read_count += 1; 512 self.flags.set_receive_fifo_empty(false); 513 if self.read_count == depth { 514 self.flags.set_receive_fifo_full(true); 515 } 516 517 if self.read_count == self.read_trigger { 518 self.int_level |= registers::INT_RX; 519 self.update(); 520 } 521 } 522 523 pub fn update(&self) { 524 let flags = self.int_level & self.int_enabled; 525 for (irq, i) in self.interrupts.iter().zip(IRQMASK) { 526 irq.set(flags & i != 0); 527 } 528 } 529 530 pub fn post_load(&mut self, _version_id: u32) -> Result<(), ()> { 531 /* Sanity-check input state */ 532 if self.read_pos >= self.read_fifo.len() || self.read_count > self.read_fifo.len() { 533 return Err(()); 534 } 535 536 if !self.fifo_enabled() && self.read_count > 0 && self.read_pos > 0 { 537 // Older versions of PL011 didn't ensure that the single 538 // character in the FIFO in FIFO-disabled mode is in 539 // element 0 of the array; convert to follow the current 540 // code's assumptions. 541 self.read_fifo[0] = self.read_fifo[self.read_pos]; 542 self.read_pos = 0; 543 } 544 545 self.ibrd &= IBRD_MASK; 546 self.fbrd &= FBRD_MASK; 547 548 Ok(()) 549 } 550 551 pub fn read(&mut self, offset: hwaddr, _size: u32) -> ControlFlow<u64, u64> { 552 match RegisterOffset::try_from(offset) { 553 Err(v) if (0x3f8..0x400).contains(&(v >> 2)) => { 554 let device_id = self.get_class().device_id; 555 ControlFlow::Break(u64::from(device_id[(offset - 0xfe0) >> 2])) 556 } 557 Err(_) => { 558 // qemu_log_mask(LOG_GUEST_ERROR, "pl011_read: Bad offset 0x%x\n", (int)offset); 559 ControlFlow::Break(0) 560 } 561 Ok(field) => { 562 let result = self.regs_read(field); 563 match result { 564 ControlFlow::Break(value) => ControlFlow::Break(value.into()), 565 ControlFlow::Continue(value) => ControlFlow::Continue(value.into()), 566 } 567 } 568 } 569 } 570 571 pub fn write(&mut self, offset: hwaddr, value: u64) { 572 if let Ok(field) = RegisterOffset::try_from(offset) { 573 // qemu_chr_fe_write_all() calls into the can_receive 574 // callback, so handle writes before entering PL011Registers. 575 if field == RegisterOffset::DR { 576 // ??? Check if transmitter is enabled. 577 let ch: u8 = value as u8; 578 // SAFETY: char_backend is a valid CharBackend instance after it's been 579 // initialized in realize(). 580 // XXX this blocks entire thread. Rewrite to use 581 // qemu_chr_fe_write and background I/O callbacks 582 unsafe { 583 qemu_chr_fe_write_all(&mut self.char_backend, &ch, 1); 584 } 585 } 586 587 self.regs_write(field, value as u32); 588 } else { 589 eprintln!("write bad offset {offset} value {value}"); 590 } 591 } 592 } 593 594 /// Which bits in the interrupt status matter for each outbound IRQ line ? 595 const IRQMASK: [u32; 6] = [ 596 /* combined IRQ */ 597 Interrupt::E 598 | Interrupt::MS 599 | Interrupt::RT as u32 600 | Interrupt::TX as u32 601 | Interrupt::RX as u32, 602 Interrupt::RX as u32, 603 Interrupt::TX as u32, 604 Interrupt::RT as u32, 605 Interrupt::MS, 606 Interrupt::E, 607 ]; 608 609 /// # Safety 610 /// 611 /// We expect the FFI user of this function to pass a valid pointer, that has 612 /// the same size as [`PL011State`]. We also expect the device is 613 /// readable/writeable from one thread at any time. 614 pub unsafe extern "C" fn pl011_can_receive(opaque: *mut c_void) -> c_int { 615 let state = NonNull::new(opaque).unwrap().cast::<PL011State>(); 616 unsafe { state.as_ref().can_receive().into() } 617 } 618 619 /// # Safety 620 /// 621 /// We expect the FFI user of this function to pass a valid pointer, that has 622 /// the same size as [`PL011State`]. We also expect the device is 623 /// readable/writeable from one thread at any time. 624 /// 625 /// The buffer and size arguments must also be valid. 626 pub unsafe extern "C" fn pl011_receive(opaque: *mut c_void, buf: *const u8, size: c_int) { 627 let mut state = NonNull::new(opaque).unwrap().cast::<PL011State>(); 628 unsafe { 629 if state.as_ref().loopback_enabled() { 630 return; 631 } 632 if size > 0 { 633 debug_assert!(!buf.is_null()); 634 state.as_mut().put_fifo(c_uint::from(buf.read_volatile())) 635 } 636 } 637 } 638 639 /// # Safety 640 /// 641 /// We expect the FFI user of this function to pass a valid pointer, that has 642 /// the same size as [`PL011State`]. We also expect the device is 643 /// readable/writeable from one thread at any time. 644 pub unsafe extern "C" fn pl011_event(opaque: *mut c_void, event: QEMUChrEvent) { 645 let mut state = NonNull::new(opaque).unwrap().cast::<PL011State>(); 646 unsafe { state.as_mut().event(event) } 647 } 648 649 /// # Safety 650 /// 651 /// We expect the FFI user of this function to pass a valid pointer for `chr`. 652 #[no_mangle] 653 pub unsafe extern "C" fn pl011_create( 654 addr: u64, 655 irq: qemu_irq, 656 chr: *mut Chardev, 657 ) -> *mut DeviceState { 658 unsafe { 659 let dev: *mut DeviceState = qdev_new(PL011State::TYPE_NAME.as_ptr()); 660 let sysbus: *mut SysBusDevice = dev.cast::<SysBusDevice>(); 661 662 qdev_prop_set_chr(dev, c_str!("chardev").as_ptr(), chr); 663 sysbus_realize_and_unref(sysbus, addr_of_mut!(error_fatal)); 664 sysbus_mmio_map(sysbus, 0, addr); 665 sysbus_connect_irq(sysbus, 0, irq); 666 dev 667 } 668 } 669 670 #[repr(C)] 671 #[derive(Debug, qemu_api_macros::Object)] 672 /// PL011 Luminary device model. 673 pub struct PL011Luminary { 674 parent_obj: ParentField<PL011State>, 675 } 676 677 impl ClassInitImpl<PL011Class> for PL011Luminary { 678 fn class_init(klass: &mut PL011Class) { 679 klass.device_id = DeviceId::LUMINARY; 680 <Self as ClassInitImpl<SysBusDeviceClass>>::class_init(&mut klass.parent_class); 681 } 682 } 683 684 qom_isa!(PL011Luminary : PL011State, SysBusDevice, DeviceState, Object); 685 686 unsafe impl ObjectType for PL011Luminary { 687 type Class = <PL011State as ObjectType>::Class; 688 const TYPE_NAME: &'static CStr = crate::TYPE_PL011_LUMINARY; 689 } 690 691 impl ObjectImpl for PL011Luminary { 692 type ParentType = PL011State; 693 } 694 695 impl DeviceImpl for PL011Luminary {} 696