File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
platforms/allwinner-d1/d1-core/src Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -16,18 +16,23 @@ impl Timer0 {
16
16
17
17
let _ = self . get_and_clear_interrupt ( ) ;
18
18
19
+ // Start the timer counting down from 0xffff_ffff_ffff_ffff.
20
+
19
21
// TODO(eliza): if it's zero, handle that lol --- when the IRQ fires
20
22
// we need to increment some higher half counter and then reset the
21
23
// timer to u32::MAX?
22
- self . start_counter ( 0xFFFF_FFFF ) ;
24
+ self . start_counter ( u32 :: MAX ) ;
23
25
24
26
Clock :: new ( core:: time:: Duration :: from_nanos ( 333 ) , || {
25
27
let timer0 = unsafe {
26
28
// Safety: we are just reading the current value and will not be
27
29
// concurrently mutating the timer.
28
30
Self :: steal ( )
29
31
} ;
30
- 0xFFFF_FFFF - timer0. current_value ( ) as u64
32
+ // Since timer 0 is counting *down*, we have to subtract its current
33
+ // value from the intial value to get an increasing timestamp for
34
+ // Maitake.
35
+ ( u32:: MAX - timer0. current_value ( ) ) as u64
31
36
} )
32
37
. named ( "CLOCK_D1_TIMER0" )
33
38
}
You can’t perform that action at this time.
0 commit comments