sys_clock.h: Remove sys_clock_ticks_per_sec()
This just got turned into a function from a "variable" API, but post-the-most-recent-patch it turns out to be degenerate anyway. Everyone everywhere should always have been using the kconfig variable directly, and it was only a weirdness in the tickless API that made it confusing. Fix. Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
This commit is contained in:
parent
393ec71ec3
commit
cbb77be675
5 changed files with 15 additions and 20 deletions
|
@ -186,7 +186,7 @@ static int ti_adc108s102_read(struct device *dev,
|
||||||
|
|
||||||
/* convert to milliseconds */
|
/* convert to milliseconds */
|
||||||
delay = (s32_t)((MSEC_PER_SEC * (u64_t)delay) /
|
delay = (s32_t)((MSEC_PER_SEC * (u64_t)delay) /
|
||||||
sys_clock_ticks_per_sec());
|
CONFIG_SYS_CLOCK_TICKS_PER_SEC);
|
||||||
|
|
||||||
k_sleep(delay);
|
k_sleep(delay);
|
||||||
|
|
||||||
|
|
|
@ -584,7 +584,7 @@ int _sys_clock_driver_init(struct device *device)
|
||||||
* Get tick time (in femptoseconds).
|
* Get tick time (in femptoseconds).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
tickFempto = 1000000000000000ull / sys_clock_ticks_per_sec();
|
tickFempto = 1000000000000000ull / CONFIG_SYS_CLOCK_TICKS_PER_SEC;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This driver shall read the COUNTER_CLK_PERIOD value from the general
|
* This driver shall read the COUNTER_CLK_PERIOD value from the general
|
||||||
|
@ -615,7 +615,7 @@ int _sys_clock_driver_init(struct device *device)
|
||||||
|
|
||||||
sys_clock_hw_cycles_per_tick = counter_load_value;
|
sys_clock_hw_cycles_per_tick = counter_load_value;
|
||||||
z_clock_hw_cycles_per_sec = sys_clock_hw_cycles_per_tick *
|
z_clock_hw_cycles_per_sec = sys_clock_hw_cycles_per_tick *
|
||||||
sys_clock_ticks_per_sec();
|
CONFIG_SYS_CLOCK_TICKS_PER_SEC;
|
||||||
|
|
||||||
|
|
||||||
#ifdef CONFIG_INT_LATENCY_BENCHMARK
|
#ifdef CONFIG_INT_LATENCY_BENCHMARK
|
||||||
|
|
|
@ -103,7 +103,7 @@ int _sys_clock_driver_init(struct device *device)
|
||||||
{
|
{
|
||||||
ARG_UNUSED(device);
|
ARG_UNUSED(device);
|
||||||
|
|
||||||
tick_period = 1000000ul / sys_clock_ticks_per_sec();
|
tick_period = 1000000ul / CONFIG_SYS_CLOCK_TICKS_PER_SEC;
|
||||||
|
|
||||||
hwtimer_enable(tick_period);
|
hwtimer_enable(tick_period);
|
||||||
|
|
||||||
|
|
|
@ -26,11 +26,6 @@ extern "C" {
|
||||||
#include <toolchain.h>
|
#include <toolchain.h>
|
||||||
#include <zephyr/types.h>
|
#include <zephyr/types.h>
|
||||||
|
|
||||||
static inline int sys_clock_ticks_per_sec(void)
|
|
||||||
{
|
|
||||||
return CONFIG_SYS_CLOCK_TICKS_PER_SEC;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef CONFIG_TICKLESS_KERNEL
|
#ifdef CONFIG_TICKLESS_KERNEL
|
||||||
extern int _sys_clock_always_on;
|
extern int _sys_clock_always_on;
|
||||||
extern void _enable_sys_clock(void);
|
extern void _enable_sys_clock(void);
|
||||||
|
@ -102,10 +97,10 @@ static ALWAYS_INLINE s32_t _ms_to_ticks(s32_t ms)
|
||||||
return (s32_t)ceiling_fraction(
|
return (s32_t)ceiling_fraction(
|
||||||
(s64_t)ms * sys_clock_hw_cycles_per_sec(),
|
(s64_t)ms * sys_clock_hw_cycles_per_sec(),
|
||||||
((s64_t)MSEC_PER_SEC * sys_clock_hw_cycles_per_sec()) /
|
((s64_t)MSEC_PER_SEC * sys_clock_hw_cycles_per_sec()) /
|
||||||
sys_clock_ticks_per_sec());
|
CONFIG_SYS_CLOCK_TICKS_PER_SEC);
|
||||||
#else
|
#else
|
||||||
/* simple division keeps precision */
|
/* simple division keeps precision */
|
||||||
s32_t ms_per_tick = MSEC_PER_SEC / sys_clock_ticks_per_sec();
|
s32_t ms_per_tick = MSEC_PER_SEC / CONFIG_SYS_CLOCK_TICKS_PER_SEC;
|
||||||
|
|
||||||
return (s32_t)ceiling_fraction(ms, ms_per_tick);
|
return (s32_t)ceiling_fraction(ms, ms_per_tick);
|
||||||
#endif
|
#endif
|
||||||
|
@ -122,10 +117,10 @@ static inline s64_t __ticks_to_ms(s64_t ticks)
|
||||||
|
|
||||||
#ifdef _NEED_PRECISE_TICK_MS_CONVERSION
|
#ifdef _NEED_PRECISE_TICK_MS_CONVERSION
|
||||||
/* use 64-bit math to keep precision */
|
/* use 64-bit math to keep precision */
|
||||||
return (u64_t)ticks * MSEC_PER_SEC / sys_clock_ticks_per_sec();
|
return (u64_t)ticks * MSEC_PER_SEC / CONFIG_SYS_CLOCK_TICKS_PER_SEC;
|
||||||
#else
|
#else
|
||||||
/* simple multiplication keeps precision */
|
/* simple multiplication keeps precision */
|
||||||
u32_t ms_per_tick = MSEC_PER_SEC / sys_clock_ticks_per_sec();
|
u32_t ms_per_tick = MSEC_PER_SEC / CONFIG_SYS_CLOCK_TICKS_PER_SEC;
|
||||||
|
|
||||||
return (u64_t)ticks * ms_per_tick;
|
return (u64_t)ticks * ms_per_tick;
|
||||||
#endif
|
#endif
|
||||||
|
@ -212,11 +207,11 @@ extern s32_t _timeout_remaining_get(struct _timeout *timeout);
|
||||||
/*
|
/*
|
||||||
* Number of ticks for x seconds. NOTE: With MSEC() or USEC(),
|
* Number of ticks for x seconds. NOTE: With MSEC() or USEC(),
|
||||||
* since it does an integer division, x must be greater or equal to
|
* since it does an integer division, x must be greater or equal to
|
||||||
* 1000/sys_clock_ticks_per_sec() to get a non-zero value.
|
* 1000/CONFIG_SYS_CLOCK_TICKS_PER_SEC to get a non-zero value.
|
||||||
* You may want to raise CONFIG_SYS_CLOCK_TICKS_PER_SEC depending on
|
* You may want to raise CONFIG_SYS_CLOCK_TICKS_PER_SEC depending on
|
||||||
* your requirements.
|
* your requirements.
|
||||||
*/
|
*/
|
||||||
#define SECONDS(x) ((x) * sys_clock_ticks_per_sec())
|
#define SECONDS(x) ((x) * CONFIG_SYS_CLOCK_TICKS_PER_SEC)
|
||||||
#define MSEC(x) (SECONDS(x) / MSEC_PER_SEC)
|
#define MSEC(x) (SECONDS(x) / MSEC_PER_SEC)
|
||||||
#define USEC(x) (MSEC(x) / USEC_PER_MSEC)
|
#define USEC(x) (MSEC(x) / USEC_PER_MSEC)
|
||||||
|
|
||||||
|
|
|
@ -35,10 +35,10 @@
|
||||||
/* length of the output line */
|
/* length of the output line */
|
||||||
#define SLINE_LEN 256
|
#define SLINE_LEN 256
|
||||||
|
|
||||||
#define SLEEP_TIME ((sys_clock_ticks_per_sec() / 4) > 0 ? \
|
#define SLEEP_TIME ((CONFIG_SYS_CLOCK_TICKS_PER_SEC / 4) > 0 ? \
|
||||||
sys_clock_ticks_per_sec() / 4 : 1)
|
CONFIG_SYS_CLOCK_TICKS_PER_SEC / 4 : 1)
|
||||||
#define WAIT_TIME ((sys_clock_ticks_per_sec() / 10) > 0 ? \
|
#define WAIT_TIME ((CONFIG_SYS_CLOCK_TICKS_PER_SEC / 10) > 0 ? \
|
||||||
sys_clock_ticks_per_sec() / 10 : 1)
|
CONFIG_SYS_CLOCK_TICKS_PER_SEC / 10 : 1)
|
||||||
#define NR_OF_NOP_RUNS 10000
|
#define NR_OF_NOP_RUNS 10000
|
||||||
#define NR_OF_FIFO_RUNS 500
|
#define NR_OF_FIFO_RUNS 500
|
||||||
#define NR_OF_SEMA_RUNS 500
|
#define NR_OF_SEMA_RUNS 500
|
||||||
|
@ -48,7 +48,7 @@
|
||||||
#define NR_OF_EVENT_RUNS 1000
|
#define NR_OF_EVENT_RUNS 1000
|
||||||
#define NR_OF_MBOX_RUNS 128
|
#define NR_OF_MBOX_RUNS 128
|
||||||
#define NR_OF_PIPE_RUNS 256
|
#define NR_OF_PIPE_RUNS 256
|
||||||
/* #define SEMA_WAIT_TIME (5 * sys_clock_ticks_per_sec()) */
|
/* #define SEMA_WAIT_TIME (5 * CONFIG_SYS_CLOCK_TICKS_PER_SEC) */
|
||||||
#define SEMA_WAIT_TIME (5000)
|
#define SEMA_WAIT_TIME (5000)
|
||||||
/* global data */
|
/* global data */
|
||||||
extern char msg[MAX_MSG];
|
extern char msg[MAX_MSG];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue