-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add function to set master/slave mask #4
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the great patch! I'm sorry for the slow response; I haven't been working on toyos-rs for a while and I lost track of some pull requests.
If you're still interested in merging this one—and I can totally understand if you've forgotten about it after all this time—there are two minor improvements proposed below which might make the UI simpler. What do you think?
@@ -139,6 +139,14 @@ impl ChainedPics { | |||
pub fn handles_interrupt(&self, interrupt_id: u8) -> bool { | |||
self.pics.iter().any(|p| p.handles_interrupt(interrupt_id)) | |||
} | |||
|
|||
// Function to set interrupt mask for master or slave | |||
pub unsafe fn set_mask(&mut self, pic_no: usize, mask: u8) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function is a really nice addition! But it takes a pic_size
parameter, which means it should be declared on the Pic
object, not on the Pics
object.
pub unsafe fn set_mask(&mut self, pic_no: usize, mask: u8) { | ||
let mut wait_port: cpuio::Port<u8> = cpuio::Port::new(0x80); | ||
let mut wait = || { wait_port.write(0) }; | ||
self.pics[pic_no].data.write(mask); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here, when we set the mask, we overwrite it completely. Many PIC 8259 implementations provide some way to read the current mask, set specific bits, and then write it back. One way to do this would be to add a get_mask
function to Pic
as well.
No description provided.