sys_clock.h: Make "global variable" APIs into proper functions

The existing API defined sys_clock_{hw_cycles,ticks}_per_sec as simple
"variables" to be shared, except that they were only real storage in
certain modes (the HPET driver, basically) and everywhere else they
were a build constant.

Properly, these should be an API defined by the timer driver (who
controls those rates) and consumed by the clock subsystem.  So give
them function syntax as a stepping stone to get there.

Note that this also removes the deprecated variable
_sys_clock_us_per_tick rather than give it the same treatment.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
This commit is contained in:
Andy Ross 2018-09-19 10:52:07 -07:00 committed by Anas Nashif
commit 220d4f8347
14 changed files with 57 additions and 46 deletions

View file

@ -34,7 +34,7 @@ static s8_t dht_measure_signal_duration(struct dht_data *drv_data,
u32_t elapsed_cycles;
u32_t max_wait_cycles = (u32_t)(
(u64_t)DHT_SIGNAL_MAX_WAIT_DURATION *
(u64_t)sys_clock_hw_cycles_per_sec /
(u64_t)sys_clock_hw_cycles_per_sec() /
(u64_t)USEC_PER_SEC
);
u32_t start_cycles = k_cycle_get_32();
@ -50,7 +50,7 @@ static s8_t dht_measure_signal_duration(struct dht_data *drv_data,
return (u64_t)elapsed_cycles *
(u64_t)USEC_PER_SEC /
(u64_t)sys_clock_hw_cycles_per_sec;
(u64_t)sys_clock_hw_cycles_per_sec();
}
static int dht_sample_fetch(struct device *dev, enum sensor_channel chan)