Zephyr API Documentation 4.5.0-rc1
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
arch.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
17
18#ifndef ZEPHYR_INCLUDE_ARCH_TRICORE_ARCH_H_
19#define ZEPHYR_INCLUDE_ARCH_TRICORE_ARCH_H_
20
26
30
32#define ARCH_STACK_PTR_ALIGN 8
34
35#ifndef _ASMLANGUAGE
36#include <zephyr/sys/util.h>
37
38#ifdef __cplusplus
39extern "C" {
40#endif
41
43
44static ALWAYS_INLINE unsigned int arch_irq_lock(void)
45{
46 unsigned int key = cr_read(TRICORE_ICR);
47
48 __asm__ volatile("disable" ::: "memory");
49
50 return key;
51}
52
53static ALWAYS_INLINE void arch_irq_unlock(unsigned int key)
54{
55 if (arch_irq_unlocked(key)) {
56 __asm__ volatile("enable" ::: "memory");
57 }
58}
59
60static ALWAYS_INLINE bool arch_irq_unlocked(unsigned int key)
61{
62 return !!(key & BIT(15));
63}
64
65static inline bool arch_cpu_irqs_are_enabled(void)
66{
67 return !!(cr_read(TRICORE_ICR) & BIT(15));
68}
69
71
72static inline uint32_t arch_k_cycle_get_32(void)
73{
75}
76
78
79static inline uint64_t arch_k_cycle_get_64(void)
80{
82}
83
84static ALWAYS_INLINE void arch_nop(void)
85{
86 __asm__ volatile("nop");
87}
88
90
91#ifdef __cplusplus
92}
93#endif
94
95#endif /* _ASMLANGUAGE */
96
97#endif /* ZEPHYR_INCLUDE_ARCH_TRICORE_ARCH_H_ */
TriCore specific IRQ macros and helpers.
TriCore specific thread definitions.
TriCore Core Special Function Register (CSFR) addresses.
static bool arch_irq_unlocked(unsigned int key)
Test if calling arch_irq_unlock() with this key would unlock irqs.
static unsigned int arch_irq_lock(void)
Lock interrupts on the current CPU.
static void arch_irq_unlock(unsigned int key)
Unlock interrupts on the current CPU.
static bool arch_cpu_irqs_are_enabled(void)
Probe the current CPU overall interrupt controller lock state without modifying it.
static void arch_nop(void)
Do nothing and return.
static uint32_t arch_k_cycle_get_32(void)
Obtain the current cycle count, in units specified by CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC.
static uint64_t arch_k_cycle_get_64(void)
As for arch_k_cycle_get_32(), but with a 64 bit return value.
uint64_t sys_clock_cycle_get_64(void)
64 bit hardware cycle counter
uint32_t sys_clock_cycle_get_32(void)
Hardware cycle counter.
#define BIT(n)
Unsigned integer with bit position n set (signed in assembly language).
Definition util_macro.h:44
TriCore public error handling.
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
__UINT64_TYPE__ uint64_t
Definition stdint.h:91
Misc utilities.
TriCore public exception handling.