@@ -32,22 +32,9 @@ pub use paste::paste;
3232///
3333/// /// HART IDs for the target CLINT peripheral
3434/// #[derive(Clone, Copy, Debug, Eq, PartialEq)]
35+ /// #[riscv::pac_enum(unsafe HartIdNumber)]
3536/// pub enum HartId { H0 = 0, H1 = 1, H2 = 2 }
3637///
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- ///
5138/// riscv_peripheral::clint_codegen!(
5239/// base 0x0200_0000,
5340/// mtime_freq 32_768,
@@ -158,30 +145,16 @@ macro_rules! clint_codegen {
158145/// let pendings = plic.pendings(); // Pendings registers
159146/// ```
160147///
161- ///
162148/// ## Base address and per-HART context proxies
163149///
164150/// ```
165151/// use riscv_pac::result::{Error, Result};
166152///
167153/// /// HART IDs for the target CLINT peripheral
168154/// #[derive(Clone, Copy, Debug, Eq, PartialEq)]
155+ /// #[riscv::pac_enum(unsafe HartIdNumber)]
169156/// pub enum HartId { H0 = 0, H1 = 1, H2 = 2 }
170157///
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- ///
185158/// riscv_peripheral::plic_codegen!(
186159/// base 0x0C00_0000,
187160/// harts [HartId::H0 => 0, HartId::H1 => 1, HartId::H2 => 2], // do not forget the ending comma!
@@ -242,7 +215,7 @@ macro_rules! plic_codegen {
242215 $crate:: macros:: paste! {
243216 impl PLIC {
244217 $(
245- #[ doc = "Returns a PLIC context proxy for context of HART " ]
218+ #[ doc = "Returns a PLIC context proxy for context of HART [` " ]
246219 #[ doc = stringify!( $hart) ]
247220 #[ doc = "`]." ]
248221 #[ inline]
0 commit comments