@@ -23,7 +23,7 @@ pub enum Range {
23
23
NAPOT = 0b11 ,
24
24
}
25
25
26
- /// RV64 Pmpcfg holds the entire register (8 Pmp configurations)
26
+ /// Pmp struct holds a readable configuration of a single pmp
27
27
#[ derive( Clone , Copy , Debug ) ]
28
28
pub struct Pmp {
29
29
/// raw bits
@@ -37,13 +37,12 @@ pub struct Pmp {
37
37
}
38
38
39
39
pub struct Pmpcsr {
40
- /// Holds the raw contents of the PMP CSR
40
+ /// Holds the raw contents of the PMP CSR Register
41
41
pub bits : usize ,
42
42
}
43
43
44
44
impl Pmpcsr {
45
- /// Take the register contents and translate into configurations held in a Pmpcfg struct
46
- /// Takes `self` as a parameter and destroys the current Pmpcsr struct
45
+ /// Take the register contents and translates into a Pmp configuration struct
47
46
#[ inline]
48
47
pub fn into_config ( & self , index : usize ) -> Pmp {
49
48
#[ cfg( riscv32) ]
@@ -87,7 +86,7 @@ pub mod pmpcfg0 {
87
86
read_csr_as ! ( Pmpcsr , 0x3A0 , __read_pmpcfg0) ;
88
87
write_csr_as_usize ! ( 0x3A0 , __write_pmpcfg0) ;
89
88
90
- /// set the configuration for the defined index in pmpcfg3
89
+ /// sets a configuration for the defined index in pmpcfg0
91
90
pub unsafe fn set_pmp ( index : usize , range : Range , permission : Permission , locked : bool ) {
92
91
#[ cfg( riscv32) ]
93
92
assert ! ( index < 4 ) ;
@@ -101,8 +100,8 @@ pub mod pmpcfg0 {
101
100
_write ( value)
102
101
}
103
102
104
- /// clear the configuration for the defined index in pmpcfg0
105
- /// will not work when pmp is locked
103
+ /// clears the configuration for the defined index in pmpcfg0
104
+ /// cannot clear when pmp is locked
106
105
pub unsafe fn clear_pmp ( index : usize ) {
107
106
#[ cfg( riscv32) ]
108
107
assert ! ( index < 4 ) ;
@@ -126,7 +125,7 @@ pub mod pmpcfg1 {
126
125
read_csr_as ! ( Pmpcsr , 0x3A1 , __read_pmpcfg1) ;
127
126
write_csr_as_usize_rv32 ! ( 0x3A1 , __write_pmpcfg1) ;
128
127
129
- /// set the configuration for the defined index in pmpcfg3
128
+ /// sets a configuration for the defined index in pmpcfg1
130
129
pub unsafe fn set_pmp ( index : usize , range : Range , permission : Permission , locked : bool ) {
131
130
assert ! ( index < 4 ) ;
132
131
@@ -136,8 +135,8 @@ pub mod pmpcfg1 {
136
135
_write ( value)
137
136
}
138
137
139
- /// clear the configuration for the defined index in pmpcfg1
140
- /// will not work when pmp is locked
138
+ /// clears the configuration for the defined index in pmpcfg1
139
+ /// cannot clear when pmp is locked
141
140
pub unsafe fn clear_pmp ( index : usize ) {
142
141
assert ! ( index < 4 ) ;
143
142
@@ -156,7 +155,7 @@ pub mod pmpcfg2 {
156
155
read_csr_as ! ( Pmpcsr , 0x3A2 , __read_pmpcfg2) ;
157
156
write_csr_as_usize ! ( 0x3A2 , __write_pmpcfg2) ;
158
157
159
- /// set the configuration for the defined index in pmpcfg3
158
+ /// sets a configuration for the defined index in pmpcfg2
160
159
pub unsafe fn set_pmp ( index : usize , range : Range , permission : Permission , locked : bool ) {
161
160
#[ cfg( riscv32) ]
162
161
assert ! ( index < 4 ) ;
@@ -170,8 +169,8 @@ pub mod pmpcfg2 {
170
169
_write ( value)
171
170
}
172
171
173
- /// clear the configuration for the defined index in pmpcfg2
174
- /// will not work when pmp is locked
172
+ /// clears the configuration for the defined index in pmpcfg2
173
+ /// cannot clear when pmp is locked
175
174
pub unsafe fn clear_pmp ( index : usize ) {
176
175
#[ cfg( riscv32) ]
177
176
assert ! ( index < 4 ) ;
@@ -195,7 +194,7 @@ pub mod pmpcfg3 {
195
194
read_csr_as ! ( Pmpcsr , 0x3A3 , __read_pmpcfg3) ;
196
195
write_csr_as_usize_rv32 ! ( 0x3A3 , __write_pmpcfg3) ;
197
196
198
- /// set the configuration for the defined index in pmpcfg3
197
+ /// sets a configuration for the defined index in pmpcfg3
199
198
pub unsafe fn set_pmp ( index : usize , range : Range , permission : Permission , locked : bool ) {
200
199
assert ! ( index < 4 ) ;
201
200
@@ -204,8 +203,8 @@ pub mod pmpcfg3 {
204
203
value. set_bits ( 8 * index..=8 * index + 7 , byte) ;
205
204
_write ( value)
206
205
}
207
- /// clear the configuration for the defined index in pmpcfg3
208
- /// will not work when pmp is locked
206
+ /// clears the configuration for the defined index in pmpcfg3
207
+ /// cannot clear when pmp is locked
209
208
pub unsafe fn clear_pmp ( index : usize ) {
210
209
#[ cfg( riscv32) ]
211
210
assert ! ( index < 4 ) ;
0 commit comments