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
65#ifdef CONFIG_XTENSA_MMU
70#ifdef CONFIG_XTENSA_MPU
95#ifdef CONFIG_USERSPACE
97#define ARCH_EXCEPT(reason_p) do { \
98 if (k_is_user_context()) { \
99 arch_syscall_invoke1(reason_p, \
100 K_SYSCALL_XTENSA_USER_FAULT); \
102 xtensa_arch_except(reason_p); \
109#define ARCH_EXCEPT(reason_p) do { \
110 xtensa_arch_except(reason_p); \
118#include <zephyr/syscalls/arch.h>
123#define ARCH_IRQ_CONNECT(irq_p, priority_p, isr_p, isr_param_p, flags_p) \
125 Z_ISR_DECLARE(irq_p, flags_p, isr_p, isr_param_p); \
143 __asm__
volatile(
"nop");
158 __asm__
volatile(
"rsr.vecbase %0" :
"=r" (vecbase));
159 __asm__
volatile(
"wsr.vecbase %0; rsync" : :
"r" (vecbase | 1));
162#if defined(CONFIG_XTENSA_RPO_CACHE) || defined(__DOXYGEN__)
163#if defined(CONFIG_ARCH_HAS_COHERENCE) || defined(__DOXYGEN__)
167 size_t addr = (
size_t) ptr;
169 return (addr >> 29) == CONFIG_XTENSA_UNCACHED_REGION;
197#define _REGION_ATTR(r) \
199 ((r) == CONFIG_XTENSA_CACHED_REGION ? 4 : \
200 ((r) == CONFIG_XTENSA_UNCACHED_REGION ? 2 : 15)))
202#define _SET_ONE_TLB(region) do { \
203 uint32_t attr = _REGION_ATTR(region); \
204 if (XCHAL_HAVE_XLT_CACHEATTR) { \
207 if (region != CONFIG_XTENSA_CACHED_REGION) { \
208 __asm__ volatile("wdtlb %0, %1; witlb %0, %1" \
209 :: "r"(attr), "r"(addr)); \
211 __asm__ volatile("wdtlb %0, %1" \
212 :: "r"(attr), "r"(addr)); \
213 __asm__ volatile("j 1f; .align 8; 1:"); \
214 __asm__ volatile("witlb %0, %1; isync" \
215 :: "r"(attr), "r"(addr)); \
223#define ARCH_XTENSA_SET_RPO_TLB() \
225 register uint32_t addr = 0, addrincr = 0x20000000; \
226 FOR_EACH(_SET_ONE_TLB, (;), 0, 1, 2, 3, 4, 5, 6, 7); \
230#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
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:165
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:154
Xtensa public exception handling.