Quellcode durchsuchen

modified macro for documentation

Román Cárdenas vor 1 Jahr
Ursprung
Commit
6d720363c6
3 geänderte Dateien mit 11 neuen und 5 gelöschten Zeilen
  1. 1 1
      src/aclint.rs
  2. 9 3
      src/macros.rs
  3. 1 1
      src/plic.rs

+ 1 - 1
src/aclint.rs

@@ -133,7 +133,7 @@ pub(crate) mod test {
         // Call CLINT macro with a base address and a list of mtimecmps for easing access to per-HART mtimecmp regs.
         crate::clint_codegen!(
             base 0x0200_0000,
-            mtimecmps [mtimecmp0=HartId::H0, mtimecmp1=HartId::H1, mtimecmp2=HartId::H2],
+            mtimecmps [mtimecmp0=(HartId::H0,"`H0`"), mtimecmp1=(HartId::H1,"`H1`"), mtimecmp2=(HartId::H2,"`H2`")],
         );
 
         let mswi = CLINT::mswi();

+ 9 - 3
src/macros.rs

@@ -47,7 +47,7 @@
 ///
 /// clint_codegen!(
 ///     base 0x0200_0000,
-///     mtimecmps [mtimecmp0 = HartId::H0, mtimecmp1 = HartId::H1, mtimecmp2 = HartId::H2], // do not forget the ending comma!
+///     mtimecmps [mtimecmp0 = (HartId::H0, "`H0`"), mtimecmp1 = (HartId::H1, "`H1`"), mtimecmp2 = (HartId::H2, "`H2`")], // do not forget the ending comma!
 /// );
 ///
 /// let mswi = CLINT::mswi(); // MSWI peripheral
@@ -87,9 +87,12 @@ macro_rules! clint_codegen {
         }
         $crate::clint_codegen!($($tail)*);
     };
-    (mtimecmps [$($fn:ident = $hart:expr),+], $($tail:tt)*) => {
+    (mtimecmps [$($fn:ident = ($hart:expr , $shart:expr)),+], $($tail:tt)*) => {
         impl CLINT {
             $(
+                #[doc = "Returns the `mtimecmp` peripheral HART "]
+                #[doc = $shart]
+                #[doc = "."]
                 #[inline]
                 pub fn $fn() -> $crate::aclint::mtimer::MTIMECMP {
                     Self::mtimer().mtimecmp($hart)
@@ -152,9 +155,12 @@ macro_rules! plic_codegen {
         }
         $crate::plic_codegen!($($tail)*);
     };
-    (ctxs [$($fn:ident = $ctx:expr),+], $($tail:tt)*) => {
+    (ctxs [$($fn:ident = ($ctx:expr , $sctx:expr)),+], $($tail:tt)*) => {
         impl PLIC {
             $(
+                #[doc = "Returns a PLIC context proxy for context "]
+                #[doc = $sctx]
+                #[doc = "."]
                 #[inline]
                 pub fn $fn() -> $crate::plic::CTX<Self> {
                     Self::ctx($ctx)

+ 1 - 1
src/plic.rs

@@ -371,7 +371,7 @@ pub(crate) mod test {
     fn check_plic() {
         crate::plic_codegen!(
             base 0x0C00_0000,
-            ctxs [ctx0 = Context::C0, ctx1 = Context::C1, ctx2 = Context::C2],
+            ctxs [ctx0 = (Context::C0, "`C0`"), ctx1 = (Context::C1, "`C1`"), ctx2 = (Context::C2, "`C2`")],
         );
 
         let priorities = PLIC::priorities();