push mods for modnoise eval etc.

This commit is contained in:
bunnie 2020-12-18 04:35:39 +08:00
parent fdd474fa89
commit 957c065f41
2 changed files with 28 additions and 10 deletions

View file

@ -102,6 +102,7 @@ mod implementation {
(&mut xtt) as *mut XousTickTimer as *mut usize, (&mut xtt) as *mut XousTickTimer as *mut usize,
) )
.expect("couldn't claim irq"); .expect("couldn't claim irq");
xtt xtt
} }
@ -157,19 +158,23 @@ mod implementation {
pub fn reset_wdt(&mut self) { pub fn reset_wdt(&mut self) {
// disarm the WDT // disarm the WDT
// why do we write the registers three times? because: // why do we have this weird interlock dance?
// - the WDT is triggered on a "ring oscillator" that's entirely internal to the SoC // - the WDT is triggered on a "ring oscillator" that's entirely internal to the SoC
// (so you can't defeat the WDT by just pausing the external clock sourc) // (so you can't defeat the WDT by just pausing the external clock sourc)
// - the ring oscillator has a tolerance band of 65MHz +/- 50% // - the ring oscillator has a tolerance band of 65MHz +/- 50%
// - the CPU runs at 100MHz with a tight tolerance // - the CPU runs at 100MHz with a tight tolerance
// - presenting the data three times ensures the WDT will pick it up, // - thus we have to confirm the write of the watchdog data before moving to the next state
// even at the slowest end of tolerance if self.wdt.rf(utra::wdt::STATE_ENABLED) == 1 {
self.wdt.wfo(utra::wdt::WATCHDOG_RESET_CODE, 0x600d); if self.wdt.rf(utra::wdt::STATE_DISARMED) != 1 {
self.wdt.wfo(utra::wdt::WATCHDOG_RESET_CODE, 0x600d); while self.wdt.rf(utra::wdt::STATE_ARMED1) == 1 {
self.wdt.wfo(utra::wdt::WATCHDOG_RESET_CODE, 0x600d); self.wdt.wfo(utra::wdt::WATCHDOG_RESET_CODE, 0x600d);
self.wdt.wfo(utra::wdt::WATCHDOG_RESET_CODE, 0xc0de); }
self.wdt.wfo(utra::wdt::WATCHDOG_RESET_CODE, 0xc0de); self.wdt.wfo(utra::wdt::WATCHDOG_RESET_CODE, 0xc0de);
self.wdt.wfo(utra::wdt::WATCHDOG_RESET_CODE, 0xc0de); while self.wdt.rf(utra::wdt::STATE_ARMED2) == 1 {
self.wdt.wfo(utra::wdt::WATCHDOG_RESET_CODE, 0xc0de);
}
}
}
} }
} }
} }

View file

@ -107,7 +107,20 @@ mod implementation {
| self.server_csr.ms(utra::trng_server::CONTROL_RO_DIS, 1) // disable the RO to characterize only the AV | self.server_csr.ms(utra::trng_server::CONTROL_RO_DIS, 1) // disable the RO to characterize only the AV
); );
// delay in microseconds for avalanche poweron after powersave // delay in microseconds for avalanche poweron after powersave
self.server_csr.wfo(utra::trng_server::AV_CONFIG_POWERDELAY, 50_000); // self.server_csr.rmwf(utra::trng_server::AV_CONFIG_POWERDELAY, 50_000);
self.server_csr.wo(utra::trng_server::AV_CONFIG,
self.server_csr.ms(utra::trng_server::AV_CONFIG_POWERDELAY, 50_000)
| self.server_csr.ms(utra::trng_server::AV_CONFIG_SAMPLES, 20)
);
/* historical note -- for modular noise variants -- do not remove
self.xadc_csr.rmwf(utra::trng::MODNOISE_CTL_PERIOD, 495); // to set just the period
self.xadc_csr.wo(utra::trng::MODNOISE_CTL, // to set also the deadtime
self.xadc_csr.ms(utra::trng::MODNOISE_CTL_ENA, 1)
| self.xadc_csr.ms(utra::trng::MODNOISE_CTL_PERIOD, 64)
| self.xadc_csr.ms(utra::trng::MODNOISE_CTL_DEADTIME, 5)
);*/
} }
pub fn messible_send(&mut self, which: WhichMessible, value: u8) { pub fn messible_send(&mut self, which: WhichMessible, value: u8) {