-
Notifications
You must be signed in to change notification settings - Fork 165
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
riscv
: register: exports macros for custom CSRs
#203
riscv
: register: exports macros for custom CSRs
#203
Conversation
4aa288e
to
1564199
Compare
@@ -1,3 +1,9 @@ | |||
/// `RV64`: Convenience macro to wrap the `csrrs` assembly instruction for reading a CSR register. | |||
/// | |||
/// This macro should generally not be called directly. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if this is actually correct, as some of the existing register
definitions directly call this macro.
Open to wording suggestions about correct usage here, and other similar locations.
Exports macros from the `riscv::register::macros` module for external users. This allows external users to define custom CSR accessor functions. This is useful for platforms and SoCs with custom CSR registers not defined in the `riscv` crate. Resolves: rust-embedded#187
1564199
to
d72d7a3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@@ -1,3 +1,9 @@ | |||
/// `RV64`: Convenience macro to wrap the `csrrs` assembly instruction for reading a CSR register. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This macro is for both RV32 and RV64. (Other non-*_rv32
macros are the same.)
For example:
riscv/riscv/src/register/mstatus.rs
Lines 274 to 277 in a9d3e33
read_csr_as!(Mstatus, 0x300); | |
write_csr!(0x300); | |
set!(0x300); | |
clear!(0x300); |
Exports macros from the
riscv::register::macros
module for external users.This allows external users to define custom CSR accessor functions.
This is useful for platforms and SoCs with custom CSR registers not defined in the
riscv
crate.Resolves: #187