13#ifndef ZEPHYR_INCLUDE_ARCH_XTENSA_ARCH_H_
14#define ZEPHYR_INCLUDE_ARCH_XTENSA_ARCH_H_
19#if !defined(_ASMLANGUAGE) && !defined(__ASSEMBLER__)
29#include <xtensa/config/core.h>
38#ifdef CONFIG_XTENSA_MMU
42#ifdef CONFIG_XTENSA_MPU
64#ifdef CONFIG_XTENSA_MMU
69#ifdef CONFIG_XTENSA_MPU
94#ifdef CONFIG_USERSPACE
96#define ARCH_EXCEPT(reason_p) do { \
97 if (k_is_user_context()) { \
98 arch_syscall_invoke1(reason_p, \
99 K_SYSCALL_XTENSA_USER_FAULT); \
101 xtensa_arch_except(reason_p); \
108#define ARCH_EXCEPT(reason_p) do { \
109 xtensa_arch_except(reason_p); \
117#include <zephyr/syscalls/arch.h>
122#define ARCH_IRQ_CONNECT(irq_p, priority_p, isr_p, isr_param_p, flags_p) \
124 Z_ISR_DECLARE(irq_p, flags_p, isr_p, isr_param_p); \
142 __asm__
volatile(
"nop");
157 __asm__
volatile(
"rsr.vecbase %0" :
"=r" (vecbase));
158 __asm__
volatile(
"wsr.vecbase %0; rsync" : :
"r" (vecbase | 1));
161#if defined(CONFIG_XTENSA_RPO_CACHE) || defined(__DOXYGEN__)
162#if defined(CONFIG_ARCH_HAS_COHERENCE) || defined(__DOXYGEN__)
168 return (addr >> 29) == CONFIG_XTENSA_UNCACHED_REGION;
196#define _REGION_ATTR(r) \
198 ((r) == CONFIG_XTENSA_CACHED_REGION ? 4 : \
199 ((r) == CONFIG_XTENSA_UNCACHED_REGION ? 2 : 15)))
201#define _SET_ONE_TLB(region) do { \
202 uint32_t attr = _REGION_ATTR(region); \
203 if (XCHAL_HAVE_XLT_CACHEATTR) { \
206 if (region != CONFIG_XTENSA_CACHED_REGION) { \
207 __asm__ volatile("wdtlb %0, %1; witlb %0, %1" \
208 :: "r"(attr), "r"(addr)); \
210 __asm__ volatile("wdtlb %0, %1" \
211 :: "r"(attr), "r"(addr)); \
212 __asm__ volatile("j 1f; .align 8; 1:"); \
213 __asm__ volatile("witlb %0, %1; isync" \
214 :: "r"(attr), "r"(addr)); \
222#define ARCH_XTENSA_SET_RPO_TLB() \
224 register uint32_t addr = 0, addrincr = 0x20000000; \
225 FOR_EACH(_SET_ONE_TLB, (;), 0, 1, 2, 3, 4, 5, 6, 7); \
229#if defined(CONFIG_XTENSA_MMU) || defined(__DOXYGEN__)
static ALWAYS_INLINE void arch_nop(void)
Definition arch.h:348
Xtensa specific syscall header.
#define ALWAYS_INLINE
Definition common.h:129
struct _snode sys_snode_t
Single-linked list node structure.
Definition slist.h:39
Public interface for configuring interrupts.
uint64_t sys_clock_cycle_get_64(void)
uint32_t sys_clock_cycle_get_32(void)
static uint32_t arch_k_cycle_get_32(void)
Definition arch.h:99
static uint64_t arch_k_cycle_get_64(void)
Definition arch.h:106
flags
Definition parser.h:96
void * ptr
Definition printk.c:177
Size of off_t must be equal or less than size of size_t
Definition retained_mem.h:28
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
__UINT64_TYPE__ uint64_t
Definition stdint.h:91
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
sys_snode_t node
Definition arch.h:50
pentry_t * ptables
Definition mmustructs.h:75
Struct to hold foreground MPU map and its entries.
Definition mpu.h:186
Software-managed ISR table.
void xtensa_user_fault(unsigned int reason)
void xtensa_arch_kernel_oops(int reason_p, void *ssf)
Generate kernel oops.
void xtensa_arch_except(int reason_p)
Generate hardware exception.
static bool arch_mem_coherent(void *ptr)
Implementation of arch_mem_coherent.
Definition arch.h:164
void arch_xtensa_mmu_post_init(bool is_core0)
Perform additional steps after MMU initialization.
static ALWAYS_INLINE void xtensa_vecbase_lock(void)
Lock VECBASE if supported by hardware.
Definition arch.h:153
Xtensa public exception handling.