1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
use bit_field::BitField;
use core::arch::asm;
#[derive(Clone, Copy, Debug)]
pub struct Mcer2 {
bits: usize,
}
impl Mcer2 {
#[inline]
pub fn err_index(&self) -> u16 {
self.bits.get_bits(0..=15) as u16
}
#[inline]
pub fn err_way(&self) -> u8 {
self.bits.get_bits(17..=20) as u8
}
#[inline]
pub fn oth_err(&self) -> bool {
self.bits.get_bit(30)
}
#[inline]
pub fn ecc_err(&self) -> bool {
self.bits.get_bit(31)
}
}
read_csr_as!(Mcer2, 0x7C4);
clear_csr! {
, 0x7C4, clear_ecc_err, 1 << 31
}