Skip to content

Commit 4ad7421

Browse files
Speed up timer test
1 parent c62eba9 commit 4ad7421

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
cntfrq = 62.500 MHz
22
Using physical timer ************************
3-
Print five, one per second...
3+
Print five, every 100ms...
44
i = 0
55
i = 1
66
i = 2
77
i = 3
88
i = 4
9-
Waiting for 125000000 physical ticks to count up...
9+
Waiting for 31250000 physical ticks to count up...
1010
Matched! physical
11-
Waiting for 125000000 physical ticks to count down...
11+
Waiting for 31250000 physical ticks to count down...
1212
physical countdown hit zero!
1313
Using virtual timer ************************
14-
Print five, one per second...
14+
Print five, every 100ms...
1515
i = 0
1616
i = 1
1717
i = 2
1818
i = 3
1919
i = 4
20-
Waiting for 125000000 virtual ticks to count up...
20+
Waiting for 31250000 virtual ticks to count up...
2121
Matched! virtual
22-
Waiting for 125000000 virtual ticks to count down...
22+
Waiting for 31250000 virtual ticks to count down...
2323
virtual countdown hit zero!

examples/mps3-an536/src/bin/generic_timer.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ fn main() {
2323
let cntfrq = cortex_ar::register::Cntfrq::read().0;
2424
println!("cntfrq = {:.03} MHz", cntfrq as f32 / 1_000_000.0);
2525

26-
let delay_ticks = cntfrq * 2;
26+
let delay_ticks = cntfrq / 2;
2727

2828
let mut pgt = unsafe { El1PhysicalTimer::new() };
2929
let mut vgt = unsafe { El1VirtualTimer::new() };
@@ -34,10 +34,10 @@ fn main() {
3434
for (timer, name) in [(pgt_ref, "physical"), (vgt_ref, "virtual")] {
3535
println!("Using {} timer ************************", name);
3636

37-
println!("Print five, one per second...");
37+
println!("Print five, every 100ms...");
3838
for i in 0..5 {
3939
println!("i = {}", i);
40-
timer.delay_ms(1000);
40+
timer.delay_ms(100);
4141
}
4242

4343
let now = timer.counter();

0 commit comments

Comments
 (0)