Zephyr Project API 4.4.99
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_ */
static ALWAYS_INLINE void arch_nop(void)
Definition arch.h:351
TriCore specific IRQ macros and helpers.
TriCore specific thread definitions.
TriCore Core Special Function Register (CSFR) addresses.
#define BIT(n)
Unsigned integer with bit position n set (signed in assembly language).
Definition util_macro.h:44
uint64_t sys_clock_cycle_get_64(void)
Get the current system clock cycle count as a 64-bit value.
uint32_t sys_clock_cycle_get_32(void)
Get the current system clock cycle count as a 32-bit value.
static uint32_t arch_k_cycle_get_32(void)
Get the current cycle count (32-bit).
Definition arch.h:54
static uint64_t arch_k_cycle_get_64(void)
Get the current cycle count (64-bit).
Definition arch.h:71
TriCore public error handling.
#define ALWAYS_INLINE
Definition common.h:186
static ALWAYS_INLINE unsigned int arch_irq_lock(void)
Definition arch.h:72
static ALWAYS_INLINE void arch_irq_unlock(unsigned int key)
Definition arch.h:83
static ALWAYS_INLINE bool arch_cpu_irqs_are_enabled(void)
Implementation of arch_cpu_irqs_are_enabled.
Definition arch.h:102
static ALWAYS_INLINE bool arch_irq_unlocked(unsigned int key)
Definition arch.h:96
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
__UINT64_TYPE__ uint64_t
Definition stdint.h:91
Misc utilities.
TriCore public exception handling.