File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -160,6 +160,34 @@ macro_rules! write_csr_rv32 {
160
160
} ;
161
161
}
162
162
163
+ /// `RV64`: Convenience macro to write a value with `bits` to a CSR
164
+ #[ macro_export]
165
+ macro_rules! write_csr_as {
166
+ ( $csr_type: ty, $csr_number: literal) => {
167
+ $crate:: write_csr!( $csr_number) ;
168
+
169
+ /// Writes the CSR
170
+ #[ inline]
171
+ pub fn write( value: $csr_type) {
172
+ unsafe { _write( value. bits) }
173
+ }
174
+ } ;
175
+ }
176
+
177
+ /// `RV32`: Convenience macro to write a value to a CSR register.
178
+ #[ macro_export]
179
+ macro_rules! write_csr_as_rv32 {
180
+ ( $csr_type: ty, $csr_number: literal) => {
181
+ $crate:: write_csr_rv32!( $csr_number) ;
182
+
183
+ /// Writes the CSR
184
+ #[ inline]
185
+ pub fn write( value: $csr_type) {
186
+ unsafe { _write( value. bits) }
187
+ }
188
+ } ;
189
+ }
190
+
163
191
/// `RV64`: Convenience macro to write a [`usize`] value to a CSR register.
164
192
#[ macro_export]
165
193
macro_rules! write_csr_as_usize {
You can’t perform that action at this time.
0 commit comments