File tree Expand file tree Collapse file tree 2 files changed +30
-24
lines changed Expand file tree Collapse file tree 2 files changed +30
-24
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
34
34
- Use CSR helper macros to define ` satp ` register
35
35
- Use CSR helper macros to define ` pmpcfgx ` field types
36
36
- Use CSR helper macros to define ` scause ` field types
37
+ - Use CSR helper macros to define ` sie ` register
37
38
38
39
## [ v0.12.1] - 2024-10-20
39
40
Original file line number Diff line number Diff line change 1
1
//! sie register
2
2
3
+ read_write_csr ! {
3
4
/// sie register
4
- #[ derive( Clone , Copy , Debug ) ]
5
- pub struct Sie {
6
- bits : usize ,
5
+ Sie : 0x104 ,
6
+ mask: 0x222 ,
7
7
}
8
8
9
- impl Sie {
10
- /// Returns the contents of the register as raw bits
11
- #[ inline]
12
- pub fn bits ( & self ) -> usize {
13
- self . bits
14
- }
15
-
9
+ read_write_csr_field ! {
10
+ Sie ,
16
11
/// Supervisor Software Interrupt Enable
17
- #[ inline]
18
- pub fn ssoft ( & self ) -> bool {
19
- self . bits & ( 1 << 1 ) != 0
20
- }
12
+ ssoft: 1 ,
13
+ }
21
14
15
+ read_write_csr_field ! {
16
+ Sie ,
22
17
/// Supervisor Timer Interrupt Enable
23
- #[ inline]
24
- pub fn stimer ( & self ) -> bool {
25
- self . bits & ( 1 << 5 ) != 0
26
- }
18
+ stimer: 5 ,
19
+ }
27
20
28
- /// Supervisor External Interrupt Enable
29
- #[ inline]
30
- pub fn sext ( & self ) -> bool {
31
- self . bits & ( 1 << 9 ) != 0
32
- }
21
+ read_write_csr_field ! {
22
+ Sie ,
23
+ /// Supervisor Timer Interrupt Enable
24
+ sext: 9 ,
33
25
}
34
26
35
- read_csr_as ! ( Sie , 0x104 ) ;
36
27
set ! ( 0x104 ) ;
37
28
clear ! ( 0x104 ) ;
38
29
@@ -45,3 +36,17 @@ set_clear_csr!(
45
36
set_clear_csr ! (
46
37
/// Supervisor External Interrupt Enable
47
38
, set_sext, clear_sext, 1 << 9 ) ;
39
+
40
+ #[ cfg( test) ]
41
+ mod tests {
42
+ use super :: * ;
43
+
44
+ #[ test]
45
+ fn test_sie ( ) {
46
+ let mut sie = Sie :: from_bits ( 0 ) ;
47
+
48
+ test_csr_field ! ( sie, ssoft) ;
49
+ test_csr_field ! ( sie, stimer) ;
50
+ test_csr_field ! ( sie, sext) ;
51
+ }
52
+ }
You can’t perform that action at this time.
0 commit comments