Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
NotificationsYou must be signed in to change notification settings

rust-osdev/pic8259

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

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:

  1. Dealing with spurious interrupts.
  2. 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.

Using

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.

Crate Feature Flags

  • 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.

Licensing

Licensed under theApache License, Version 2.0 or theMIT license, at your option.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors8

Languages


[8]ページ先頭

©2009-2025 Movatter.jp