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_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 receive(&mut self, ch: u32) { 482 if !self.loopback_enabled() { 483 self.put_fifo(ch) 484 } 485 } 486 487 pub fn event(&mut self, event: QEMUChrEvent) { 488 if event == QEMUChrEvent::CHR_EVENT_BREAK && !self.loopback_enabled() { 489 self.put_fifo(registers::Data::BREAK.into()); 490 } 491 } 492 493 #[inline] 494 pub fn fifo_enabled(&self) -> bool { 495 self.line_control.fifos_enabled() == registers::Mode::FIFO 496 } 497 498 #[inline] 499 pub fn loopback_enabled(&self) -> bool { 500 self.control.enable_loopback() 501 } 502 503 #[inline] 504 pub fn fifo_depth(&self) -> u32 { 505 // Note: FIFO depth is expected to be power-of-2 506 if self.fifo_enabled() { 507 return PL011_FIFO_DEPTH; 508 } 509 1 510 } 511 512 pub fn put_fifo(&mut self, value: u32) { 513 let depth = self.fifo_depth(); 514 assert!(depth > 0); 515 let slot = (self.read_pos + self.read_count) & (depth - 1); 516 self.read_fifo[slot] = registers::Data::from(value); 517 self.read_count += 1; 518 self.flags.set_receive_fifo_empty(false); 519 if self.read_count == depth { 520 self.flags.set_receive_fifo_full(true); 521 } 522 523 if self.read_count == self.read_trigger { 524 self.int_level |= registers::INT_RX; 525 self.update(); 526 } 527 } 528 529 pub fn update(&self) { 530 let flags = self.int_level & self.int_enabled; 531 for (irq, i) in self.interrupts.iter().zip(IRQMASK) { 532 irq.set(flags & i != 0); 533 } 534 } 535 536 pub fn post_load(&mut self, _version_id: u32) -> Result<(), ()> { 537 /* Sanity-check input state */ 538 if self.read_pos >= self.read_fifo.len() || self.read_count > self.read_fifo.len() { 539 return Err(()); 540 } 541 542 if !self.fifo_enabled() && self.read_count > 0 && self.read_pos > 0 { 543 // Older versions of PL011 didn't ensure that the single 544 // character in the FIFO in FIFO-disabled mode is in 545 // element 0 of the array; convert to follow the current 546 // code's assumptions. 547 self.read_fifo[0] = self.read_fifo[self.read_pos]; 548 self.read_pos = 0; 549 } 550 551 self.ibrd &= IBRD_MASK; 552 self.fbrd &= FBRD_MASK; 553 554 Ok(()) 555 } 556 557 pub fn read(&mut self, offset: hwaddr, _size: u32) -> ControlFlow<u64, u64> { 558 match RegisterOffset::try_from(offset) { 559 Err(v) if (0x3f8..0x400).contains(&(v >> 2)) => { 560 let device_id = self.get_class().device_id; 561 ControlFlow::Break(u64::from(device_id[(offset - 0xfe0) >> 2])) 562 } 563 Err(_) => { 564 // qemu_log_mask(LOG_GUEST_ERROR, "pl011_read: Bad offset 0x%x\n", (int)offset); 565 ControlFlow::Break(0) 566 } 567 Ok(field) => { 568 let result = self.regs_read(field); 569 match result { 570 ControlFlow::Break(value) => ControlFlow::Break(value.into()), 571 ControlFlow::Continue(value) => ControlFlow::Continue(value.into()), 572 } 573 } 574 } 575 } 576 577 pub fn write(&mut self, offset: hwaddr, value: u64) { 578 if let Ok(field) = RegisterOffset::try_from(offset) { 579 // qemu_chr_fe_write_all() calls into the can_receive 580 // callback, so handle writes before entering PL011Registers. 581 if field == RegisterOffset::DR { 582 // ??? Check if transmitter is enabled. 583 let ch: u8 = value as u8; 584 // SAFETY: char_backend is a valid CharBackend instance after it's been 585 // initialized in realize(). 586 // XXX this blocks entire thread. Rewrite to use 587 // qemu_chr_fe_write and background I/O callbacks 588 unsafe { 589 qemu_chr_fe_write_all(&mut self.char_backend, &ch, 1); 590 } 591 } 592 593 self.regs_write(field, value as u32); 594 } else { 595 eprintln!("write bad offset {offset} value {value}"); 596 } 597 } 598 } 599 600 /// Which bits in the interrupt status matter for each outbound IRQ line ? 601 const IRQMASK: [u32; 6] = [ 602 /* combined IRQ */ 603 Interrupt::E 604 | Interrupt::MS 605 | Interrupt::RT as u32 606 | Interrupt::TX as u32 607 | Interrupt::RX as u32, 608 Interrupt::RX as u32, 609 Interrupt::TX as u32, 610 Interrupt::RT as u32, 611 Interrupt::MS, 612 Interrupt::E, 613 ]; 614 615 /// # Safety 616 /// 617 /// We expect the FFI user of this function to pass a valid pointer, that has 618 /// the same size as [`PL011State`]. We also expect the device is 619 /// readable/writeable from one thread at any time. 620 pub unsafe extern "C" fn pl011_can_receive(opaque: *mut c_void) -> c_int { 621 let state = NonNull::new(opaque).unwrap().cast::<PL011State>(); 622 unsafe { state.as_ref().can_receive().into() } 623 } 624 625 /// # Safety 626 /// 627 /// We expect the FFI user of this function to pass a valid pointer, that has 628 /// the same size as [`PL011State`]. We also expect the device is 629 /// readable/writeable from one thread at any time. 630 /// 631 /// The buffer and size arguments must also be valid. 632 pub unsafe extern "C" fn pl011_receive(opaque: *mut c_void, buf: *const u8, size: c_int) { 633 let mut state = NonNull::new(opaque).unwrap().cast::<PL011State>(); 634 unsafe { 635 if size > 0 { 636 debug_assert!(!buf.is_null()); 637 state.as_mut().receive(u32::from(buf.read_volatile())); 638 } 639 } 640 } 641 642 /// # Safety 643 /// 644 /// We expect the FFI user of this function to pass a valid pointer, that has 645 /// the same size as [`PL011State`]. We also expect the device is 646 /// readable/writeable from one thread at any time. 647 pub unsafe extern "C" fn pl011_event(opaque: *mut c_void, event: QEMUChrEvent) { 648 let mut state = NonNull::new(opaque).unwrap().cast::<PL011State>(); 649 unsafe { state.as_mut().event(event) } 650 } 651 652 /// # Safety 653 /// 654 /// We expect the FFI user of this function to pass a valid pointer for `chr`. 655 #[no_mangle] 656 pub unsafe extern "C" fn pl011_create( 657 addr: u64, 658 irq: qemu_irq, 659 chr: *mut Chardev, 660 ) -> *mut DeviceState { 661 unsafe { 662 let dev: *mut DeviceState = qdev_new(PL011State::TYPE_NAME.as_ptr()); 663 let sysbus: *mut SysBusDevice = dev.cast::<SysBusDevice>(); 664 665 qdev_prop_set_chr(dev, c_str!("chardev").as_ptr(), chr); 666 sysbus_realize_and_unref(sysbus, addr_of_mut!(error_fatal)); 667 sysbus_mmio_map(sysbus, 0, addr); 668 sysbus_connect_irq(sysbus, 0, irq); 669 dev 670 } 671 } 672 673 #[repr(C)] 674 #[derive(Debug, qemu_api_macros::Object)] 675 /// PL011 Luminary device model. 676 pub struct PL011Luminary { 677 parent_obj: ParentField<PL011State>, 678 } 679 680 impl ClassInitImpl<PL011Class> for PL011Luminary { 681 fn class_init(klass: &mut PL011Class) { 682 klass.device_id = DeviceId::LUMINARY; 683 <Self as ClassInitImpl<SysBusDeviceClass>>::class_init(&mut klass.parent_class); 684 } 685 } 686 687 qom_isa!(PL011Luminary : PL011State, SysBusDevice, DeviceState, Object); 688 689 unsafe impl ObjectType for PL011Luminary { 690 type Class = <PL011State as ObjectType>::Class; 691 const TYPE_NAME: &'static CStr = crate::TYPE_PL011_LUMINARY; 692 } 693 694 impl ObjectImpl for PL011Luminary { 695 type ParentType = PL011State; 696 } 697 698 impl DeviceImpl for PL011Luminary {} 699