diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2017-03-24 23:01:08 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2017-03-26 22:45:58 -0400 |
commit | 60e488eb177a35084669cb85d81131ce95eac959 (patch) | |
tree | 2a0b406f4e0b6e54ef495140573daf6426ca6b0e /src/basecmd.c | |
parent | 14340ac4df4c58bab4b5fc4c9e4746e33958c081 (diff) | |
download | kutter-60e488eb177a35084669cb85d81131ce95eac959.tar.gz kutter-60e488eb177a35084669cb85d81131ce95eac959.tar.xz kutter-60e488eb177a35084669cb85d81131ce95eac959.zip |
timer: Allow board code to define its own timer_is_before implementation
Move sched_is_before() from sched.c to timer_is_before() in the board
specific timer code. This allows the board code to provide its own
definition.
Also, remove the sched_from_us() and sched_read_time() wrapper
functions and change the callers to directly invoke timer_from_us() /
timer_read_time().
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src/basecmd.c')
-rw-r--r-- | src/basecmd.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/basecmd.c b/src/basecmd.c index 8049e376..5a4dc853 100644 --- a/src/basecmd.c +++ b/src/basecmd.c @@ -228,7 +228,7 @@ DECL_COMMAND(command_end_group, "end_group"); void command_get_status(uint32_t *args) { - sendf("status clock=%u status=%c", sched_read_time(), sched_is_shutdown()); + sendf("status clock=%u status=%c", timer_read_time(), sched_is_shutdown()); } DECL_COMMAND_FLAGS(command_get_status, HF_IN_SHUTDOWN, "get_status"); @@ -237,7 +237,7 @@ static uint32_t stats_send_time, stats_send_time_high; void command_get_uptime(uint32_t *args) { - uint32_t cur = sched_read_time(); + uint32_t cur = timer_read_time(); uint32_t high = stats_send_time_high + (cur < stats_send_time); sendf("uptime high=%u clock=%u", high, cur); } @@ -250,7 +250,7 @@ static void stats_task(void) { static uint32_t last, count, sumsq; - uint32_t cur = sched_read_time(); + uint32_t cur = timer_read_time(); uint32_t diff = cur - last; last = cur; count++; @@ -267,7 +267,7 @@ stats_task(void) nextsumsq = 0xffffffff; sumsq = nextsumsq; - if (sched_is_before(cur, stats_send_time + sched_from_us(5000000))) + if (timer_is_before(cur, stats_send_time + timer_from_us(5000000))) return; sendf("stats count=%u sum=%u sumsq=%u", count, cur - stats_send_time, sumsq); if (cur < stats_send_time) |