Zephyr Project API  3.2.0
A Scalable Open Source RTOS
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
17static ALWAYS_INLINE _cpu_t *arch_curr_cpu(void)
18{
19 return (_cpu_t *)(read_tpidrro_el0() & TPIDRROEL0_CURR_CPU);
20}
21
23{
25}
26
28{
29 uint64_t cpu_mpid = read_mpidr_el1();
30
31 __ASSERT(cpu_mpid == (uint32_t)cpu_mpid, "mpid extends past 32 bits");
32
33 return (uint32_t)cpu_mpid;
34}
35
36#endif /* !_ASMLANGUAGE */
37#endif /* ZEPHYR_INCLUDE_ARCH_ARM64_ARCH_INLINES_H */
static ALWAYS_INLINE uint64_t read_tpidrro_el0(void)
Definition: lib_helpers.h:70
static ALWAYS_INLINE uint64_t read_mpidr_el1(void)
Definition: lib_helpers.h:75
static ALWAYS_INLINE int arch_exception_depth(void)
Definition: arch_inlines.h:22
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:27
#define ALWAYS_INLINE
Definition: common.h:124
__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