Zephyr API Documentation 4.5.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
arch_inlines.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: Copyright (c) 2024 Infineon Technologies AG,
3 * SPDX-FileCopyrightText: or an affiliate of Infineon Technologies AG. All rights reserved.
4 * SPDX-FileCopyrightText: Copyright (c) 2026 Linumiz
5 *
6 * SPDX-License-Identifier: Apache-2.0
7 */
8
13
14#ifndef ZEPHYR_INCLUDE_ARCH_TRICORE_ARCH_INLINES_H_
15#define ZEPHYR_INCLUDE_ARCH_TRICORE_ARCH_INLINES_H_
16
18
19#ifndef _ASMLANGUAGE
20
22
24
25static ALWAYS_INLINE uint32_t arch_proc_id(void)
26{
27 uint32_t id = cr_read(TRICORE_CORE_ID) & 0x7U;
28
29 /* TC1.6.2 devices number CPU5 as CORE_ID 6; CORE_ID 5 is not used */
30 if (IS_ENABLED(CONFIG_CPU_TC162) && (id == 6U)) {
31 id = 5U;
32 }
33
34 return id;
35}
36
37static ALWAYS_INLINE _cpu_t *arch_curr_cpu(void)
38{
39#if defined(CONFIG_SMP)
40 return &_kernel.cpus[arch_proc_id()];
41#else
42 return &_kernel.cpus[0];
43#endif
44}
45
46static ALWAYS_INLINE unsigned int arch_num_cpus(void)
47{
48 return CONFIG_MP_MAX_NUM_CPUS;
49}
50
52
53#endif /* !_ASMLANGUAGE */
54#endif /* ZEPHYR_INCLUDE_ARCH_TRICORE_ARCH_INLINES_H_ */
TriCore Core Special Function Register (CSFR) addresses.
static unsigned int arch_num_cpus(void)
Returns the number of CPUs.
static struct _cpu * arch_curr_cpu(void)
Return the CPU struct for the currently executing CPU.
static uint32_t arch_proc_id(void)
Processor hardware ID.
#define IS_ENABLED(config_macro)
Check for macro definition in compiler-visible expressions.
Definition util_macro.h:154
__UINT32_TYPE__ uint32_t
Definition stdint.h:90