fix system time counter

The CYCCNT module used to calculate the system
time counts every processor clock cycle =
400 MHz.
This commit is contained in:
Chris Ballance 2019-09-12 00:35:00 +01:00
parent 5dffe1c456
commit 1f1e588744

View File

@ -675,7 +675,7 @@ const APP: () = {
// unsafe { eth::enable_interrupt(DMA); } // unsafe { eth::enable_interrupt(DMA); }
let mut time = 0u32; let mut time = 0u32;
let mut next_ms = Instant::now(); let mut next_ms = Instant::now();
next_ms += 200_000.cycles(); next_ms += 400_000.cycles();
let mut server = Server::new(); let mut server = Server::new();
let mut iir_state: resources::iir_state = c.resources.iir_state; let mut iir_state: resources::iir_state = c.resources.iir_state;
let mut iir_ch: resources::iir_ch = c.resources.iir_ch; let mut iir_ch: resources::iir_ch = c.resources.iir_ch;
@ -683,7 +683,7 @@ const APP: () = {
// if ETHERNET_PENDING.swap(false, Ordering::Relaxed) { } // if ETHERNET_PENDING.swap(false, Ordering::Relaxed) { }
let tick = Instant::now() > next_ms; let tick = Instant::now() > next_ms;
if tick { if tick {
next_ms += 200_000.cycles(); next_ms += 400_000.cycles();
time += 1; time += 1;
} }
{ {