ChainedPics

Struct ChainedPics 

Source
pub struct ChainedPics { /* private fields */ }
Expand description

The two 8259 PICs, chained together.

Implementations§

Source§

impl ChainedPics

Source

pub const unsafe fn new(master_offset: u8, slave_offset: u8) -> Self

Create an interface for the two 8259 PICs, specifying the desired interrupt offsets for both.

§Safety

It is important to pass the correct offsets. The default PIC configuration, which sends interrupt vector numbers in the range of 0 to 15, is not usable in protected mode since the numbers in that range are occupied by CPU exceptions in protected mode. If you return to real mode from protected mode (for whatever reason), you must restore the PICs to their default configurations.

Source

pub unsafe fn initialize(&mut self)

Initialize both of the PICs. You can read more about the initialization process by checking out the following links:

§Safety

Please read the Safety section of ChainedPics::new.

Source

pub unsafe fn read_master_interrupt_mask(&mut self) -> u8

Read the interrupt mask of the master PIC.

Source

pub unsafe fn read_slave_interrupt_mask(&mut self) -> u8

Read the interrupt mask of the slave PIC.

Source

pub unsafe fn read_interrupt_masks(&mut self) -> [u8; 2]

Read the interrupt masks of both PICs.

Source

pub unsafe fn write_master_interrupt_mask(&mut self, mask: u8)

Write to the interrupt mask of the master PIC.

Source

pub unsafe fn write_slave_interrupt_mask(&mut self, mask: u8)

Write to the interrupt mask of the slave PIC.

Source

pub unsafe fn write_interrupt_masks(&mut self, master_mask: u8, slave_mask: u8)

Write to the interrupt masks of both PICs.

Source

pub unsafe fn unmask(&mut self)

Convenience function for unmasking both PICs.

Source

pub unsafe fn disable(&mut self)

Convenience function for disabling both PICs by masking all interrupts.

Source

pub fn handles_interrupt(&self, irq_id: u8) -> bool

Check if the master or slave PIC handles the IRQ specified by the given ID.

Source

pub unsafe fn notify_end_of_interrupt(&mut self, irq_id: u8)

Figure out which, if any, PIC in the chain needs to know about this interrupt. If the IRQ originated from the master PIC, we only need to send the EOI command to the master PIC. Otherwise, the EOI command needs to be sent to both PICs in the chain.

§Safety

It is important to pass the correct interrupt vector number. If the incorrect interrupt vector number is passed, it can lead to deleting an unsent interrupt or a hanging system.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.