mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-18 08:52:45 +00:00
add register interpretation for reset reason
This commit is contained in:
parent
85fc3d70f9
commit
b78a5619b0
1 changed files with 25 additions and 0 deletions
|
|
@ -1,6 +1,31 @@
|
||||||
|
use bitbybit::bitfield;
|
||||||
|
|
||||||
pub const FREQ_OSC_MHZ: u32 = 48;
|
pub const FREQ_OSC_MHZ: u32 = 48;
|
||||||
const FD_MAX: u32 = 256;
|
const FD_MAX: u32 = 256;
|
||||||
|
|
||||||
|
#[bitfield(u32)]
|
||||||
|
#[derive(PartialEq, Eq, Debug)]
|
||||||
|
pub struct ResetReason {
|
||||||
|
#[bit(8, r)]
|
||||||
|
chip_reset: bool,
|
||||||
|
#[bit(7, r)]
|
||||||
|
voltage_detetor_reset: bool,
|
||||||
|
#[bit(6, r)]
|
||||||
|
security_reset: bool,
|
||||||
|
#[bit(5, r)]
|
||||||
|
sw_chip_reset: bool,
|
||||||
|
#[bit(4, r)]
|
||||||
|
xrst_pad: bool,
|
||||||
|
#[bit(3, r)]
|
||||||
|
sys_reset: bool,
|
||||||
|
#[bit(2, r)]
|
||||||
|
cms_reset: bool,
|
||||||
|
#[bit(1, r)]
|
||||||
|
wdt_reset: bool,
|
||||||
|
#[bit(0, r)]
|
||||||
|
sw_core_reset: bool,
|
||||||
|
}
|
||||||
|
|
||||||
/// This takes in the FD input frequency (the frequency to be divided) in MHz
|
/// This takes in the FD input frequency (the frequency to be divided) in MHz
|
||||||
/// and the fd value, and returns the resulting divided frequency.
|
/// and the fd value, and returns the resulting divided frequency.
|
||||||
pub fn divide_by_fd(fd: u32, in_freq_hz: u32) -> u32 {
|
pub fn divide_by_fd(fd: u32, in_freq_hz: u32) -> u32 {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue