diff options
| author | Jeff Epler <jepler@gmail.com> | 2019-11-18 08:22:41 -0600 |
|---|---|---|
| committer | Jeff Epler <jepler@gmail.com> | 2019-11-18 11:01:23 -0600 |
| commit | 7f744a2369a5036cadfa05575da1704f709c98bb (patch) | |
| tree | 62b0c1d21d75910076a6c4b8d11a0c55861267aa /ports/cxd56/common-hal | |
| parent | 45d1b290ee13ee4080e9718909c33053583314b8 (diff) | |
Supervisor: move most of systick to the supervisor
This code is shared by most parts, except where not all the #ifdefs
inside the tick function were present in all ports. This mostly would
have broken gamepad tick support on non-samd ports.
The "ms32" and "ms64" variants of the tick functions are introduced
because there is no 64-bit atomic read. Disabling interrupts avoids
a low probability bug where milliseconds could be off by ~49.5 days
once every ~49.5 days (2^32 ms).
Avoiding disabling interrupts when only the low 32 bits are needed is a minor
optimization.
Testing performed: on metro m4 express, USB still works and
time.monotonic_ns() still counts up
Diffstat (limited to 'ports/cxd56/common-hal')
| -rw-r--r-- | ports/cxd56/common-hal/time/__init__.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/ports/cxd56/common-hal/time/__init__.c b/ports/cxd56/common-hal/time/__init__.c index 8f7326b62..6f5eedd41 100644 --- a/ports/cxd56/common-hal/time/__init__.c +++ b/ports/cxd56/common-hal/time/__init__.c @@ -26,10 +26,10 @@ #include "py/mphal.h" -#include "tick.h" +#include "supervisor/shared/tick.h" uint64_t common_hal_time_monotonic(void) { - return ticks_ms; + return supervisor_ticks_ms64(); } void common_hal_time_delay_ms(uint32_t delay) { |
