Skip to content

Commit

Permalink
Fix VTF for V2
Browse files Browse the repository at this point in the history
  • Loading branch information
Noxime committed Nov 19, 2024
1 parent 73a21d1 commit a84909a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/pfic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,11 @@ pub unsafe fn enable_vtf(channel: u8, irq: u8, address: u32) {
// [7:0]: Numbering of VTF interrupt 0
const PFIC_VTFIDR: *mut u32 = 0xE000E050 as *mut u32;

ptr::write_volatile(PFIC_VTFIDR, (irq as u32) << ((channel as u32) * 8));
let irq_bits = (irq as u32) << ((channel as u32) * 8);
let irq_mask = 0xFF << ((channel as u32) * 8);

let irq = ptr::read_volatile(PFIC_VTFIDR);
ptr::write_volatile(PFIC_VTFIDR, irq & !irq_mask | irq_bits);

ptr::write_volatile(
PFIC_VTFADDRR0.offset(channel as isize),
Expand Down

0 comments on commit a84909a

Please sign in to comment.