@@ -32,22 +32,9 @@ pub use paste::paste;
32
32
///
33
33
/// /// HART IDs for the target CLINT peripheral
34
34
/// #[derive(Clone, Copy, Debug, Eq, PartialEq)]
35
+ /// #[riscv::pac_enum(unsafe HartIdNumber)]
35
36
/// pub enum HartId { H0 = 0, H1 = 1, H2 = 2 }
36
37
///
37
- /// // Implement `HartIdNumber` for `HartId`
38
- /// unsafe impl riscv_peripheral::aclint::HartIdNumber for HartId {
39
- /// const MAX_HART_ID_NUMBER: usize = Self::H2 as usize;
40
- /// fn number(self) -> usize { self as _ }
41
- /// fn from_number(number: usize) -> Result<Self> {
42
- /// match number {
43
- /// 0 => Ok(HartId::H0),
44
- /// 1 => Ok(HartId::H1),
45
- /// 2 => Ok(HartId::H2),
46
- /// _ => Err(Error::InvalidVariant(number)),
47
- /// }
48
- /// }
49
- /// }
50
- ///
51
38
/// riscv_peripheral::clint_codegen!(
52
39
/// base 0x0200_0000,
53
40
/// mtime_freq 32_768,
@@ -158,30 +145,16 @@ macro_rules! clint_codegen {
158
145
/// let pendings = plic.pendings(); // Pendings registers
159
146
/// ```
160
147
///
161
- ///
162
148
/// ## Base address and per-HART context proxies
163
149
///
164
150
/// ```
165
151
/// use riscv_pac::result::{Error, Result};
166
152
///
167
153
/// /// HART IDs for the target CLINT peripheral
168
154
/// #[derive(Clone, Copy, Debug, Eq, PartialEq)]
155
+ /// #[riscv::pac_enum(unsafe HartIdNumber)]
169
156
/// pub enum HartId { H0 = 0, H1 = 1, H2 = 2 }
170
157
///
171
- /// // Implement `HartIdNumber` for `HartId`
172
- /// unsafe impl riscv_peripheral::aclint::HartIdNumber for HartId {
173
- /// const MAX_HART_ID_NUMBER: usize = Self::H2 as usize;
174
- /// fn number(self) -> usize { self as _ }
175
- /// fn from_number(number: usize) -> Result<Self> {
176
- /// match number {
177
- /// 0 => Ok(HartId::H0),
178
- /// 1 => Ok(HartId::H1),
179
- /// 2 => Ok(HartId::H2),
180
- /// _ => Err(Error::InvalidVariant(number)),
181
- /// }
182
- /// }
183
- /// }
184
- ///
185
158
/// riscv_peripheral::plic_codegen!(
186
159
/// base 0x0C00_0000,
187
160
/// harts [HartId::H0 => 0, HartId::H1 => 1, HartId::H2 => 2], // do not forget the ending comma!
@@ -242,7 +215,7 @@ macro_rules! plic_codegen {
242
215
$crate:: macros:: paste! {
243
216
impl PLIC {
244
217
$(
245
- #[ doc = "Returns a PLIC context proxy for context of HART " ]
218
+ #[ doc = "Returns a PLIC context proxy for context of HART [` " ]
246
219
#[ doc = stringify!( $hart) ]
247
220
#[ doc = "`]." ]
248
221
#[ inline]
0 commit comments