74 lines
1.5 KiB
Rust
74 lines
1.5 KiB
Rust
|
//! mip register
|
||
|
|
||
|
use bit_field::BitField;
|
||
|
|
||
|
/// mip register
|
||
|
#[derive(Clone, Copy, Debug)]
|
||
|
pub struct Mip {
|
||
|
bits: usize,
|
||
|
}
|
||
|
|
||
|
impl Mip {
|
||
|
/// Returns the contents of the register as raw bits
|
||
|
#[inline]
|
||
|
pub fn bits(&self) -> usize {
|
||
|
self.bits
|
||
|
}
|
||
|
|
||
|
/// User Software Interrupt Pending
|
||
|
#[inline]
|
||
|
pub fn usoft(&self) -> bool {
|
||
|
self.bits.get_bit(0)
|
||
|
}
|
||
|
|
||
|
/// Supervisor Software Interrupt Pending
|
||
|
#[inline]
|
||
|
pub fn ssoft(&self) -> bool {
|
||
|
self.bits.get_bit(1)
|
||
|
}
|
||
|
|
||
|
/// Machine Software Interrupt Pending
|
||
|
#[inline]
|
||
|
pub fn msoft(&self) -> bool {
|
||
|
self.bits.get_bit(3)
|
||
|
}
|
||
|
|
||
|
/// User Timer Interrupt Pending
|
||
|
#[inline]
|
||
|
pub fn utimer(&self) -> bool {
|
||
|
self.bits.get_bit(4)
|
||
|
}
|
||
|
|
||
|
/// Supervisor Timer Interrupt Pending
|
||
|
#[inline]
|
||
|
pub fn stimer(&self) -> bool {
|
||
|
self.bits.get_bit(5)
|
||
|
}
|
||
|
|
||
|
/// Machine Timer Interrupt Pending
|
||
|
#[inline]
|
||
|
pub fn mtimer(&self) -> bool {
|
||
|
self.bits.get_bit(7)
|
||
|
}
|
||
|
|
||
|
/// User External Interrupt Pending
|
||
|
#[inline]
|
||
|
pub fn uext(&self) -> bool {
|
||
|
self.bits.get_bit(8)
|
||
|
}
|
||
|
|
||
|
/// Supervisor External Interrupt Pending
|
||
|
#[inline]
|
||
|
pub fn sext(&self) -> bool {
|
||
|
self.bits.get_bit(9)
|
||
|
}
|
||
|
|
||
|
/// Machine External Interrupt Pending
|
||
|
#[inline]
|
||
|
pub fn mext(&self) -> bool {
|
||
|
self.bits.get_bit(11)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
read_csr_as!(Mip, 0x344, __read_mip);
|