Skip to content

Commit 03779e5

Browse files
committed
Make all available NVIC registers accessible
According to the ARMv7-M Technical Reference Manual[1], there are 124 IPR registers available on ARMv7-M, and 16 of all others. I don't know where the original numbers came from, since on ARMv6-M, there are only 8 IPR registers available, and 1 of each of the others.[2] This commit removes some test cases that were checking the address of the last register. Since the last register has changed, those are no longer applicable. I decided to remove instead of update them, since they only really test the length of each register type, which is obvious enough from the code. [1]: https://silver.arm.com/download/ARM_and_AMBA_Architecture/AR580-DA-70000-r0p0-05rel0/DDI0403E_B_armv7m_arm.pdf [2]: https://silver.arm.com/download/ARM_and_AMBA_Architecture/AR585-DA-70000-r0p0-00rel0/DDI0419C_arm_architecture_v6m_reference_manual.pdf
1 parent 74cb12e commit 03779e5

File tree

2 files changed

+11
-17
lines changed

2 files changed

+11
-17
lines changed

src/peripheral/nvic.rs

+11-11
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,22 @@ use interrupt::Nr;
88
#[repr(C)]
99
pub struct RegisterBlock {
1010
/// Interrupt Set-Enable
11-
pub iser: [RW<u32>; 8],
12-
reserved0: [u32; 24],
11+
pub iser: [RW<u32>; 16],
12+
reserved0: [u32; 16],
1313
/// Interrupt Clear-Enable
14-
pub icer: [RW<u32>; 8],
15-
reserved1: [u32; 24],
14+
pub icer: [RW<u32>; 16],
15+
reserved1: [u32; 16],
1616
/// Interrupt Set-Pending
17-
pub ispr: [RW<u32>; 8],
18-
reserved2: [u32; 24],
17+
pub ispr: [RW<u32>; 16],
18+
reserved2: [u32; 16],
1919
/// Interrupt Clear-Pending
20-
pub icpr: [RW<u32>; 8],
21-
reserved3: [u32; 24],
20+
pub icpr: [RW<u32>; 16],
21+
reserved3: [u32; 16],
2222
/// Interrupt Active Bit
23-
pub iabr: [RO<u32>; 8],
24-
reserved4: [u32; 56],
23+
pub iabr: [RO<u32>; 16],
24+
reserved4: [u32; 48],
2525
/// Interrupt Priority
26-
pub ipr: [RW<u8>; 240],
26+
pub ipr: [RW<u8>; 496],
2727
}
2828

2929
impl RegisterBlock {

src/peripheral/test.rs

-6
Original file line numberDiff line numberDiff line change
@@ -104,17 +104,11 @@ fn nvic() {
104104
let nvic = unsafe { &*::peripheral::NVIC::ptr() };
105105

106106
assert_eq!(address(&nvic.iser), 0xE000E100);
107-
assert_eq!(address(&nvic.iser[7]), 0xE000E11C);
108107
assert_eq!(address(&nvic.icer), 0xE000E180);
109-
assert_eq!(address(&nvic.icer[7]), 0xE000E19C);
110108
assert_eq!(address(&nvic.ispr), 0xE000E200);
111-
assert_eq!(address(&nvic.ispr[7]), 0xE000E21C);
112109
assert_eq!(address(&nvic.icpr), 0xE000E280);
113-
assert_eq!(address(&nvic.icpr[7]), 0xE000E29C);
114110
assert_eq!(address(&nvic.iabr), 0xE000E300);
115-
assert_eq!(address(&nvic.iabr[7]), 0xE000E31C);
116111
assert_eq!(address(&nvic.ipr), 0xE000E400);
117-
assert_eq!(address(&nvic.ipr[239]), 0xE000E4eF);
118112
}
119113

120114
#[test]

0 commit comments

Comments
 (0)