File tree 2 files changed +18
-27
lines changed
2 files changed +18
-27
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
28
28
- Use CSR helper macros to define ` mstatus ` register
29
29
- Use CSR helper macros to define ` mstatush ` register
30
30
- Use CSR helper macros to define ` mtvec ` register
31
+ - Use CSR helper macros to define ` mtvendorid ` register
31
32
32
33
## [ v0.12.1] - 2024-10-20
33
34
Original file line number Diff line number Diff line change 1
1
//! mvendorid register
2
2
3
- use core:: num:: NonZeroUsize ;
4
-
5
- /// mvendorid register
6
- #[ derive( Clone , Copy , Debug ) ]
7
- pub struct Mvendorid {
8
- bits : NonZeroUsize ,
3
+ read_only_csr ! {
4
+ /// `mvendorid` register
5
+ Mvendorid : 0xF11 ,
6
+ mask: 0xffff_ffff ,
7
+ sentinel: 0 ,
9
8
}
10
9
11
- impl Mvendorid {
12
- /// Returns the contents of the register as raw bits
13
- #[ inline]
14
- pub fn bits ( & self ) -> usize {
15
- self . bits . get ( )
16
- }
17
-
18
- /// Returns the JEDEC manufacturer ID
19
- #[ inline]
20
- pub fn jedec_manufacturer ( & self ) -> usize {
21
- self . bits ( ) >> 7
22
- }
10
+ read_only_csr_field ! {
11
+ Mvendorid ,
12
+ /// Represents the number of continuation bytes (`0x7f`) in the JEDEC manufacturer ID.
13
+ bank: [ 7 : 31 ] ,
23
14
}
24
15
25
- read_csr ! ( 0xF11 ) ;
26
-
27
- /// Reads the CSR
28
- #[ inline]
29
- pub fn read ( ) -> Option < Mvendorid > {
30
- let r = unsafe { _read ( ) } ;
31
- // When mvendorid is hardwired to zero it means that the mvendorid
32
- // csr isn't implemented.
33
- NonZeroUsize :: new ( r) . map ( |bits| Mvendorid { bits } )
16
+ read_only_csr_field ! {
17
+ Mvendorid ,
18
+ /// Represents the final offset field in the JEDEC manufacturer ID.
19
+ ///
20
+ /// # Note
21
+ ///
22
+ /// The encoded value returned by `offset` does not include the odd parity bit (`0x80`).
23
+ offset: [ 0 : 6 ] ,
34
24
}
You can’t perform that action at this time.
0 commit comments