kernel: add flexibility to k_cycle_get_32() definition
Some arches may want to define this as an inline function, or define in core arch code instead of timer driver code. Unfortunately, this means we need to remove from the footprint tests, but this is not typically a large function. Issue: ZEP-1546 Change-Id: Ic0d7a33507da855995838f4703d872cd613a2ca2 Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
This commit is contained in:
parent
09648cf8ec
commit
e08d07c97d
18 changed files with 28 additions and 12 deletions
|
@ -96,7 +96,7 @@ int _sys_clock_driver_init(struct device *device)
|
|||
}
|
||||
|
||||
|
||||
uint32_t k_cycle_get_32(void)
|
||||
uint32_t _timer_cycle_get_32(void)
|
||||
{
|
||||
/* XXX Per the Altera Embedded IP Peripherals guide, you cannot
|
||||
* use a timer instance for both the system clock and timestamps
|
||||
|
|
|
@ -413,7 +413,7 @@ int sys_clock_device_ctrl(struct device *port, uint32_t ctrl_command,
|
|||
}
|
||||
#endif /* CONFIG_DEVICE_POWER_MANAGEMENT */
|
||||
|
||||
uint32_t k_cycle_get_32(void)
|
||||
uint32_t _timer_cycle_get_32(void)
|
||||
{
|
||||
return (accumulated_cycle_count + timer0_count_register_get());
|
||||
}
|
||||
|
|
|
@ -557,7 +557,7 @@ int _sys_clock_driver_init(struct device *device)
|
|||
* systick counter is a 24-bit down counter which is reset to "reload" value
|
||||
* once it reaches 0.
|
||||
*/
|
||||
uint32_t k_cycle_get_32(void)
|
||||
uint32_t _timer_cycle_get_32(void)
|
||||
{
|
||||
return clock_accumulated_count + (SysTick->LOAD - SysTick->VAL);
|
||||
}
|
||||
|
|
|
@ -593,7 +593,7 @@ int _sys_clock_driver_init(struct device *device)
|
|||
* it will need to call _hpetMainCounterAtomic().
|
||||
*/
|
||||
|
||||
uint32_t k_cycle_get_32(void)
|
||||
uint32_t _timer_cycle_get_32(void)
|
||||
{
|
||||
return (uint32_t) *_HPET_MAIN_COUNTER_VALUE;
|
||||
}
|
||||
|
|
|
@ -588,7 +588,7 @@ int sys_clock_device_ctrl(struct device *port, uint32_t ctrl_command,
|
|||
*
|
||||
* @return up counter of elapsed clock cycles
|
||||
*/
|
||||
uint32_t k_cycle_get_32(void)
|
||||
uint32_t _timer_cycle_get_32(void)
|
||||
{
|
||||
uint32_t val; /* system clock value */
|
||||
|
||||
|
|
|
@ -163,7 +163,7 @@ int _sys_clock_driver_init(struct device *device)
|
|||
return 0;
|
||||
}
|
||||
|
||||
uint32_t k_cycle_get_32(void)
|
||||
uint32_t _timer_cycle_get_32(void)
|
||||
{
|
||||
uint32_t elapsed_cycles;
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ int _sys_clock_driver_init(struct device *device)
|
|||
*
|
||||
* @return up counter of elapsed clock cycles
|
||||
*/
|
||||
uint32_t k_cycle_get_32(void)
|
||||
uint32_t _timer_cycle_get_32(void)
|
||||
{
|
||||
return accumulated_cycle_count + timer->val;
|
||||
}
|
||||
|
|
|
@ -89,7 +89,7 @@ int _sys_clock_driver_init(struct device *device)
|
|||
*
|
||||
* @return up counter of elapsed clock cycles
|
||||
*/
|
||||
uint32_t k_cycle_get_32(void)
|
||||
uint32_t _timer_cycle_get_32(void)
|
||||
{
|
||||
/* We just want a cycle count so just post what's in the low 32
|
||||
* bits of the mtime real-time counter
|
||||
|
|
|
@ -345,7 +345,7 @@ int _sys_clock_driver_init(struct device *device)
|
|||
*
|
||||
* @return up counter of elapsed clock cycles
|
||||
*/
|
||||
uint32_t k_cycle_get_32(void)
|
||||
uint32_t _timer_cycle_get_32(void)
|
||||
{
|
||||
return GET_TIMER_CURRENT_TIME();
|
||||
}
|
||||
|
|
|
@ -22,6 +22,9 @@ extern "C" {
|
|||
extern unsigned int k_cpu_sleep_mode;
|
||||
extern void k_cpu_idle(void);
|
||||
extern void k_cpu_atomic_idle(unsigned int key);
|
||||
|
||||
extern uint32_t _timer_cycle_get_32(void);
|
||||
#define _arch_k_cycle_get_32() _timer_cycle_get_32()
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -20,6 +20,9 @@ extern "C" {
|
|||
|
||||
#ifndef _ASMLANGUAGE
|
||||
extern void k_cpu_idle(void);
|
||||
|
||||
extern uint32_t _timer_cycle_get_32(void);
|
||||
#define _arch_k_cycle_get_32() _timer_cycle_get_32()
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -199,6 +199,9 @@ enum nios2_exception_cause {
|
|||
BIT(NIOS2_EXCEPTION_ECC_DATA_ERR))
|
||||
|
||||
|
||||
extern uint32_t _timer_cycle_get_32(void);
|
||||
#define _arch_k_cycle_get_32() _timer_cycle_get_32()
|
||||
|
||||
#endif /* _ASMLANGUAGE */
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -109,6 +109,9 @@ static ALWAYS_INLINE void _arch_irq_unlock(unsigned int key)
|
|||
: "memory");
|
||||
}
|
||||
|
||||
extern uint32_t _timer_cycle_get_32(void);
|
||||
#define _arch_k_cycle_get_32() _timer_cycle_get_32()
|
||||
|
||||
#endif /*_ASMLANGUAGE */
|
||||
|
||||
#if defined(CONFIG_SOC_RISCV32_PULPINO)
|
||||
|
|
|
@ -488,6 +488,9 @@ extern void k_float_disable(k_tid_t thread);
|
|||
|
||||
extern void k_cpu_idle(void);
|
||||
|
||||
extern uint32_t _timer_cycle_get_32(void);
|
||||
#define _arch_k_cycle_get_32() _timer_cycle_get_32()
|
||||
|
||||
/** Nanokernel provided routine to report any detected fatal error. */
|
||||
extern FUNC_NORETURN void _NanoFatalErrorHandler(unsigned int reason,
|
||||
const NANO_ESF * pEsf);
|
||||
|
|
|
@ -136,6 +136,9 @@ extern void _irq_priority_set(uint32_t irq, uint32_t prio, uint32_t flags);
|
|||
FUNC_NORETURN void _SysFatalErrorHandler(unsigned int reason,
|
||||
const NANO_ESF *esf);
|
||||
|
||||
extern uint32_t _timer_cycle_get_32(void);
|
||||
#define _arch_k_cycle_get_32() _timer_cycle_get_32()
|
||||
|
||||
#endif /* !defined(_ASMLANGUAGE) && !defined(__ASSEMBLER__) */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -1094,7 +1094,7 @@ extern uint32_t k_uptime_delta_32(int64_t *reftime);
|
|||
*
|
||||
* @return Current hardware clock up-counter (in cycles).
|
||||
*/
|
||||
extern uint32_t k_cycle_get_32(void);
|
||||
#define k_cycle_get_32() _arch_k_cycle_get_32()
|
||||
|
||||
/**
|
||||
* @} end addtogroup clock_apis
|
||||
|
|
|
@ -132,7 +132,6 @@ static pfunc func_array[] = {
|
|||
(pfunc)k_uptime_get_32,
|
||||
(pfunc)k_uptime_delta,
|
||||
(pfunc)k_uptime_delta_32,
|
||||
(pfunc)k_cycle_get_32,
|
||||
|
||||
/* thread stuff */
|
||||
(pfunc)k_thread_spawn,
|
||||
|
|
|
@ -48,7 +48,6 @@ static pfunc func_array[] = {
|
|||
(pfunc)k_uptime_get_32,
|
||||
(pfunc)k_uptime_delta,
|
||||
(pfunc)k_uptime_delta_32,
|
||||
(pfunc)k_cycle_get_32,
|
||||
|
||||
/* semaphores */
|
||||
(pfunc)k_sem_init,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue