Skip to content

Commit 1d34104

Browse files
committed
Update and fix documentation comments
1 parent ccb80e2 commit 1d34104

File tree

1 file changed

+15
-16
lines changed

1 file changed

+15
-16
lines changed

src/register/pmpcfgx.rs

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ pub enum Range {
2323
NAPOT = 0b11,
2424
}
2525

26-
/// RV64 Pmpcfg holds the entire register (8 Pmp configurations)
26+
/// Pmp struct holds a readable configuration of a single pmp
2727
#[derive(Clone, Copy, Debug)]
2828
pub struct Pmp {
2929
/// raw bits
@@ -37,13 +37,12 @@ pub struct Pmp {
3737
}
3838

3939
pub struct Pmpcsr {
40-
/// Holds the raw contents of the PMP CSR
40+
/// Holds the raw contents of the PMP CSR Register
4141
pub bits: usize,
4242
}
4343

4444
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
4746
#[inline]
4847
pub fn into_config(&self, index: usize) -> Pmp {
4948
#[cfg(riscv32)]
@@ -87,7 +86,7 @@ pub mod pmpcfg0 {
8786
read_csr_as!(Pmpcsr, 0x3A0, __read_pmpcfg0);
8887
write_csr_as_usize!(0x3A0, __write_pmpcfg0);
8988

90-
/// set the configuration for the defined index in pmpcfg3
89+
/// sets a configuration for the defined index in pmpcfg0
9190
pub unsafe fn set_pmp(index: usize, range: Range, permission: Permission, locked: bool) {
9291
#[cfg(riscv32)]
9392
assert!(index < 4);
@@ -101,8 +100,8 @@ pub mod pmpcfg0 {
101100
_write(value)
102101
}
103102

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
106105
pub unsafe fn clear_pmp(index: usize) {
107106
#[cfg(riscv32)]
108107
assert!(index < 4);
@@ -126,7 +125,7 @@ pub mod pmpcfg1 {
126125
read_csr_as!(Pmpcsr, 0x3A1, __read_pmpcfg1);
127126
write_csr_as_usize_rv32!(0x3A1, __write_pmpcfg1);
128127

129-
/// set the configuration for the defined index in pmpcfg3
128+
/// sets a configuration for the defined index in pmpcfg1
130129
pub unsafe fn set_pmp(index: usize, range: Range, permission: Permission, locked: bool) {
131130
assert!(index < 4);
132131

@@ -136,8 +135,8 @@ pub mod pmpcfg1 {
136135
_write(value)
137136
}
138137

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
141140
pub unsafe fn clear_pmp(index: usize) {
142141
assert!(index < 4);
143142

@@ -156,7 +155,7 @@ pub mod pmpcfg2 {
156155
read_csr_as!(Pmpcsr, 0x3A2, __read_pmpcfg2);
157156
write_csr_as_usize!(0x3A2, __write_pmpcfg2);
158157

159-
/// set the configuration for the defined index in pmpcfg3
158+
/// sets a configuration for the defined index in pmpcfg2
160159
pub unsafe fn set_pmp(index: usize, range: Range, permission: Permission, locked: bool) {
161160
#[cfg(riscv32)]
162161
assert!(index < 4);
@@ -170,8 +169,8 @@ pub mod pmpcfg2 {
170169
_write(value)
171170
}
172171

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
175174
pub unsafe fn clear_pmp(index: usize) {
176175
#[cfg(riscv32)]
177176
assert!(index < 4);
@@ -195,7 +194,7 @@ pub mod pmpcfg3 {
195194
read_csr_as!(Pmpcsr, 0x3A3, __read_pmpcfg3);
196195
write_csr_as_usize_rv32!(0x3A3, __write_pmpcfg3);
197196

198-
/// set the configuration for the defined index in pmpcfg3
197+
/// sets a configuration for the defined index in pmpcfg3
199198
pub unsafe fn set_pmp(index: usize, range: Range, permission: Permission, locked: bool) {
200199
assert!(index < 4);
201200

@@ -204,8 +203,8 @@ pub mod pmpcfg3 {
204203
value.set_bits(8 * index..=8 * index + 7, byte);
205204
_write(value)
206205
}
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
209208
pub unsafe fn clear_pmp(index: usize) {
210209
#[cfg(riscv32)]
211210
assert!(index < 4);

0 commit comments

Comments
 (0)