Zephyr API Documentation 3.7.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
arch_inlines.h
Go to the documentation of this file.
1/*
2 * Copyright 2020 NXP
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7#ifndef ZEPHYR_INCLUDE_ARCH_ARM64_ARCH_INLINES_H
8#define ZEPHYR_INCLUDE_ARCH_ARM64_ARCH_INLINES_H
9
10#ifndef _ASMLANGUAGE
11
15#include <zephyr/sys/__assert.h>
16
17/* Note: keep in sync with `get_cpu` in arch/arm64/core/macro_priv.inc */
18static ALWAYS_INLINE _cpu_t *arch_curr_cpu(void)
19{
20 return (_cpu_t *)(read_tpidrro_el0() & TPIDRROEL0_CURR_CPU);
21}
22
27
29{
30 uint64_t cpu_mpid = read_mpidr_el1();
31
32 __ASSERT(cpu_mpid == (uint32_t)cpu_mpid, "mpid extends past 32 bits");
33
34 return (uint32_t)cpu_mpid;
35}
36
37static ALWAYS_INLINE unsigned int arch_num_cpus(void)
38{
39 return CONFIG_MP_MAX_NUM_CPUS;
40}
41
42#endif /* !_ASMLANGUAGE */
43#endif /* ZEPHYR_INCLUDE_ARCH_ARM64_ARCH_INLINES_H */
static ALWAYS_INLINE uint64_t read_tpidrro_el0(void)
Definition lib_helpers.h:77
static ALWAYS_INLINE uint64_t read_mpidr_el1(void)
Definition lib_helpers.h:72
static ALWAYS_INLINE _cpu_t * arch_curr_cpu(void)
Definition arch_inlines.h:17
static ALWAYS_INLINE uint32_t arch_proc_id(void)
Definition arch_inlines.h:30
static ALWAYS_INLINE unsigned int arch_num_cpus(void)
Definition arch_inlines.h:39
static ALWAYS_INLINE int arch_exception_depth(void)
Definition arch_inlines.h:23
#define ALWAYS_INLINE
Definition common.h:129
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
__UINT64_TYPE__ uint64_t
Definition stdint.h:91
tpidrro_el0 bits allocation
#define TPIDRROEL0_EXC_UNIT
Definition tpidrro_el0.h:25
#define TPIDRROEL0_CURR_CPU
Definition tpidrro_el0.h:22
#define TPIDRROEL0_EXC_DEPTH
Definition tpidrro_el0.h:24