Skip to content
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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

deepaksirone
Copy link

No description provided.

@emk emk self-assigned this Sep 18, 2016
Copy link
Owner

@emk emk left a 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) {
Copy link
Owner

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);
Copy link
Owner

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.

@emk emk assigned deepaksirone and unassigned emk Sep 18, 2016
@mkroening mkroening mentioned this pull request Sep 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants