pub struct Pc<'a, I1: InterruptService + 'a, I2: InterruptService + 'a, const PR: u16 = RELOAD_1KHZ> {
pub com1: &'a SerialPort<'a>,
pub com2: &'a SerialPort<'a>,
pub com3: &'a SerialPort<'a>,
pub com4: &'a SerialPort<'a>,
pub pit: &'a Pit<'a, PR>,
pub vga: &'a VgaText<'a>,
/* private fields */
}Expand description
Representation of a generic PC platform.
This struct serves as an implementation of Tock’s Chip trait for the x86 PC platform. The
behavior and set of peripherals available on PCs is very heavily standardized. As a result, this
chip definition should be broadly compatible with most PC hardware.
Parameter PR is the PIT reload value. See Pit for more information.
§Interrupt Handling
This chip automatically handles interrupts for legacy PC devices which are known to be present
on QEMU’s Q35 machine type. This includes the PIT timer and four serial ports. Other devices
which are conditionally present (e.g. Virtio devices specified on the QEMU command line) may be
handled via a board-specific implementation of InterruptService.
This chip uses the legacy 8259 PIC to manage interrupts. This is relatively simple compared with using the Local APIC or I/O APIC and avoids needing to interact with ACPI or MP tables.
Internally, this chip re-maps the PIC interrupt numbers to avoid conflicts with ISA-defined
exceptions. This remapping is fully encapsulated within the chip. N.B. Implementors of
InterruptService will be passed the physical interrupt line number, not the remapped
number used internally by the chip. This should match the interrupt line number reported by
documentation or read from the PCI configuration space.
Fields§
§com1: &'a SerialPort<'a>Legacy COM1 serial port
com2: &'a SerialPort<'a>Legacy COM2 serial port
com3: &'a SerialPort<'a>Legacy COM3 serial port
com4: &'a SerialPort<'a>Legacy COM4 serial port
pit: &'a Pit<'a, PR>Legacy PIT timer
vga: &'a VgaText<'a>Vga
Implementations§
Source§impl<I2: InterruptService, const PR: u16> Pc<'static, PcDefaultPeripherals<PR>, I2, PR>
impl<I2: InterruptService, const PR: u16> Pc<'static, PcDefaultPeripherals<PR>, I2, PR>
Sourcepub unsafe fn new(
default_peripherals: &'static PcDefaultPeripherals<PR>,
pd: &'static mut PD,
pt: &'static mut PT,
board_peripherals: &'static I2,
) -> Self
pub unsafe fn new( default_peripherals: &'static PcDefaultPeripherals<PR>, pd: &'static mut PD, pt: &'static mut PT, board_peripherals: &'static I2, ) -> Self
Construct Pc using a standard set of peripherals plus page tables.
§Safety
- Must be called only once for the lifetime of the kernel.
pdandptmust be identity-mapped and unique.