- Notifications
You must be signed in to change notification settings - Fork8
rust-osdev/pic8259
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Abstractions for 8259 and 8259A Programmable Interrupt Controllers (PICs).
This project is a fork of thepic8259_simple
crate created by@emk.
Things we may not handle very well yet include:
- Dealing with spurious interrupts.
- Non-standard configurations.
This code is based on theOSDev Wiki PIC notes, but it's not acomplete implementation of everything they discuss. Also note that if youwant to do more sophisticated interrupt handling, especially onmultiprocessor systems, you'll probably want to read about the newerAPIC andIOAPIC interfaces.
This is a very basic interface to the 8259 and 8259A interrupt controllers,which are used on single processor systems to pass hardware interrupts tothe CPU.
To use this crate, add it to yourCargo.toml
file, along with anappropriate kernel-space mutex implementation such asspin
:
[dependencies]pic8259 ="0.10.0"spin ="0.9.0"
You can then declare a global, lockableChainedPics
object as follows:
use pic8259::ChainedPics;use spin::Mutex;// Map PIC interrupts to 0x20 through 0x2f.staticPICS:Mutex<ChainedPics> =Mutex::new(unsafe{ChainedPics::new(0x20,0x28)});
To perform runtime PIC intialization, callinitialize
before enablinginterrupts:
PICS.lock().initialize();
When you've finished handling an interrupt, run:
PICS.lock().notify_end_of_interrupt(interrupt_id);
It's safe to callnotify_end_of_interrupt
after every interrupt; thenotify_end_of_interrupt
function will try to figure out what it needs todo.
All public PIC interfaces areunsafe
, because it's really easy to triggerundefined behavior by misconfiguring the PIC or using it incorrectly.
nightly
- Uses features that are only usable on nightly Rust. Enabled by default.stable
- Enable this feature flag to build this crate on stable Rust. You have to adddefault-features = false, features = ["stable"]
to yourCargo.toml
.
Licensed under theApache License, Version 2.0 or theMIT license, at your option.
About
Resources
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors8
Uh oh!
There was an error while loading.Please reload this page.