Skip to content

Commit

Permalink
riscv: re-export paste macro
Browse files Browse the repository at this point in the history
Re-exports the `paste` macro to allow using CSR helper macros in
external crates.

Authored-by: rmsyn <[email protected]>
Co-authored-by: romancardenas <[email protected]>
  • Loading branch information
rmsyn and romancardenas committed Sep 27, 2024
1 parent 2535b4c commit c9cab75
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
2 changes: 2 additions & 0 deletions riscv/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
#![no_std]
#![allow(clippy::missing_safety_doc)]

pub use paste::paste;

pub mod asm;
pub mod bits;
pub mod delay;
Expand Down
14 changes: 7 additions & 7 deletions riscv/src/register/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -756,7 +756,7 @@ macro_rules! read_write_csr_field {
$(#[$field_doc:meta])+
$field:ident: $bit:literal$(,)?
) => {
paste::paste! {
$crate::paste! {
$crate::read_only_csr_field!(
$ty,
$(#[$field_doc])+
Expand All @@ -775,7 +775,7 @@ macro_rules! read_write_csr_field {
$(#[$field_doc:meta])+
$field:ident: $bit_start:literal ..= $bit_end:literal$(,)?
) => {
paste::paste! {
$crate::paste! {
$crate::read_only_csr_field!(
$ty,
$(#[$field_doc])+
Expand All @@ -794,7 +794,7 @@ macro_rules! read_write_csr_field {
$(#[$field_doc:meta])+
$field:ident: [$bit_start:literal : $bit_end:literal]$(,)?
) => {
paste::paste! {
$crate::paste! {
$crate::read_only_csr_field!(
$ty,
$(#[$field_doc])+
Expand All @@ -814,7 +814,7 @@ macro_rules! read_write_csr_field {
$field:ident,
$field_ty:ident: [$field_start:literal : $field_end:literal],
) => {
paste::paste! {
$crate::paste! {
$crate::read_only_csr_field!(
$ty,
$(#[$field_doc])+
Expand Down Expand Up @@ -855,7 +855,7 @@ macro_rules! read_only_csr_field {
const _: () = assert!($bit_end < usize::BITS);
const _: () = assert!($bit_start < $bit_end);

paste::paste! {
$crate::paste! {
impl $ty {
$(#[$field_doc])+
#[inline]
Expand Down Expand Up @@ -903,7 +903,7 @@ macro_rules! read_only_csr_field {
const _: () = assert!($field_end < usize::BITS);
const _: () = assert!($field_start <= $field_end);

paste::paste! {
$crate::paste! {
impl $ty {
$(#[$field_doc])+
#[inline]
Expand Down Expand Up @@ -952,7 +952,7 @@ macro_rules! write_only_csr_field {
const _: () = assert!($bit_end < usize::BITS);
const _: () = assert!($bit_start < $bit_end);

paste::paste! {
$crate::paste! {
impl $ty {
$(#[$field_doc])+
#[doc = ""]
Expand Down

0 comments on commit c9cab75

Please sign in to comment.