/* * Copyright 2022 IoT.bzh * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_INCLUDE_ARCH_ARM_ARCH_INLINES_H #define ZEPHYR_INCLUDE_ARCH_ARM_ARCH_INLINES_H #include #if defined(CONFIG_CPU_AARCH32_CORTEX_R) || defined(CONFIG_CPU_AARCH32_CORTEX_A) #include #include static ALWAYS_INLINE _cpu_t *arch_curr_cpu(void) { return (_cpu_t *)(read_tpidruro() & TPIDRURO_CURR_CPU); } #else #ifndef CONFIG_SMP static ALWAYS_INLINE _cpu_t *arch_curr_cpu(void) { /* Dummy implementation always return the first cpu */ return &_kernel.cpus[0]; } #endif #endif static ALWAYS_INLINE uint32_t arch_proc_id(void) { /* * Placeholder implementation to be replaced with an architecture * specific call to get processor ID */ return arch_curr_cpu()->id; } static ALWAYS_INLINE unsigned int arch_num_cpus(void) { return CONFIG_MP_MAX_NUM_CPUS; } #endif /* ZEPHYR_INCLUDE_ARCH_ARM_ARCH_INLINES_H */