Skip to content

Commit d6a828e

Browse files
committed
Fix get_bits() typo and change _set to _clear in clear_lock
1 parent 02a0916 commit d6a828e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/register/pmpcfgx.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ pub mod pmpcfg0 {
5555

5656
#[inline]
5757
fn range(&self, byte: usize) -> Range {
58-
match byte.get_bits(3..5) {
58+
match byte.get_bits(4..6) {
5959
0 => Range::OFF,
6060
1 => Range::TOR,
6161
2 => Range::NA4,
@@ -66,7 +66,7 @@ pub mod pmpcfg0 {
6666

6767
#[inline]
6868
fn permission(&self, byte: usize) -> Permission {
69-
match byte.get_bits(3..5) {
69+
match byte.get_bits(0..4) {
7070
0 => Permission::NONE,
7171
1 => Permission::R,
7272
2 => Permission::W,
@@ -122,7 +122,7 @@ pub mod pmpcfg0 {
122122
#[inline]
123123
pub unsafe fn clear_lock(index: usize) {
124124
assert!(index < 8);
125-
_set(1 << (7 + (index * 8)));
125+
_clear(1 << (7 + (index * 8)));
126126
}
127127
}
128128

0 commit comments

Comments
 (0)