mirror of
https://github.com/Klipper3d/klipper.git
synced 2025-07-17 19:57:57 -06:00
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>
This commit is contained in:
parent
14340ac4df
commit
60e488eb17
9 changed files with 48 additions and 47 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue