drivers/timer: Unify timeout setting APIs
The existing API had two almost identical functions: _set_time() and _timer_idle_enter(). Both simply instruct the timer driver to set the next timer interrupt expiration appropriately so that the call to z_clock_announce() will be made at the requested number of ticks. On most/all hardware, these should be implementable identically. Unfortunately because they are specified differently, existing drivers have implemented them in parallel. Specify a new, unified, z_clock_set_timeout(). Document it clearly for implementors. And provide a shim layer for legacy drivers that will continue to use the old functions. Note that this patch fixes an existing bug found by inspection: the old call to _set_time() out of z_clock_announce() failed to test for the "wait forever" case in the situation where clock_always_on is true, meaning that a system that reached this point and then never set another timeout would freeze its uptime clock incorrectly. Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
This commit is contained in:
parent
fa99ad66d0
commit
ab488277bc
15 changed files with 91 additions and 9 deletions
|
@ -42,6 +42,8 @@ static volatile u32_t clock_accumulated_count;
|
|||
|
||||
#include <board.h>
|
||||
|
||||
#include "legacy_api.h"
|
||||
|
||||
#ifdef CONFIG_TICKLESS_IDLE
|
||||
#define TIMER_MODE_PERIODIC 0 /* normal running mode */
|
||||
#define TIMER_MODE_ONE_SHOT 1 /* emulated, since sysTick has 1 mode */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue