Skip to content

Commit

Permalink
fix(d1): make Plic::mask actually do that (#348)
Browse files Browse the repository at this point in the history
PR #312 (commit df41dec) inadvertently
broke the `Plic` method to mask an interrupt by copy-pasting the code
from `Plic::unmask`.

Previously, `Plic::unmask` would write `MIE[offset]| irq_en` to
`MIE[offset]`, setting the `IRQ_EN` bit for that interrupt; while
`Plic::mask` would write `MIE[offset] & !irq_en` to `MIE[offset]`,
unsetting the `IRQ_EN` bit. But now they both *set* the `IRQ_EN` bit, so
masking an interrupt actually unmasks it. Whoopsie. This seems to have
occurred because I'm a LOSER FUCKING IDIOT.

This commit puts it back the way it was supposed to be. Sorry.

Fixes #347
  • Loading branch information
hawkw authored Dec 27, 2024
1 parent 6536ed7 commit 5f4bc9e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion platforms/allwinner-d1/d1-core/src/plic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ impl Plic {
/// Disable an interrupt
pub fn mask(&self, interrupt: Interrupt) {
let (mie, irq_en) = self.index_mie(interrupt);
mie.modify(|r, w| unsafe { w.bits(r.bits() | irq_en) });
mie.modify(|r, w| unsafe { w.bits(r.bits() & !irq_en) });
}

/// Globally set priority for one interrupt
Expand Down

0 comments on commit 5f4bc9e

Please sign in to comment.