drivers: timer: improve sys_timer_disable usage

- Remove the weak symbol definition
- Notify about the capability of disabling via a selected Kconfig option
  (CONFIG_SYSTEM_TIMER_HAS_DISABLE_SUPPORT)
- Provide a dummy inline function when the functionality is not
  available

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
This commit is contained in:
Gerard Marull-Paretas 2021-11-04 14:26:19 +01:00 committed by Anas Nashif
commit 78dc8ce338
10 changed files with 28 additions and 20 deletions

View file

@ -108,6 +108,21 @@ extern void sys_clock_announce(int32_t ticks);
* instantaneous answer.
*/
extern uint32_t sys_clock_elapsed(void);
#if defined(CONFIG_SYS_CLOCK_EXISTS) && \
defined(CONFIG_SYSTEM_TIMER_HAS_DISABLE_SUPPORT) || \
defined(__DOXYGEN__)
/**
* @brief Disable system timer.
*
* This function is a no-op if the system timer does not have the capability
* of being disabled.
*/
extern void sys_clock_disable(void);
#else
static inline void sys_clock_disable(void) {}
#endif /* CONFIG_SYSTEM_TIMER_HAS_DISABLE_SUPPORT */
/**
* @}
*/