2016-10-12 21:11:05 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* arch/xtensa/include/irq.h
|
|
|
|
*
|
2021-03-28 17:44:37 +02:00
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed with
|
|
|
|
* this work for additional information regarding copyright ownership. The
|
|
|
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
|
|
|
* "License"); you may not use this file except in compliance with the
|
|
|
|
* License. You may obtain a copy of the License at
|
2016-10-12 21:11:05 +02:00
|
|
|
*
|
2021-03-28 17:44:37 +02:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2016-10-12 21:11:05 +02:00
|
|
|
*
|
2021-03-28 17:44:37 +02:00
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
|
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
|
|
* License for the specific language governing permissions and limitations
|
|
|
|
* under the License.
|
2016-10-12 21:11:05 +02:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2020-04-05 23:00:04 +02:00
|
|
|
/* This file should never be included directly but, rather, only indirectly
|
2016-10-12 21:11:05 +02:00
|
|
|
* through nuttx/irq.h
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __ARCH_XTENSA_INCLUDE_IRQ_H
|
|
|
|
#define __ARCH_XTENSA_INCLUDE_IRQ_H
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Included Files
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/* Include NuttX-specific IRQ definitions */
|
|
|
|
|
2016-10-23 16:00:17 +02:00
|
|
|
#include <nuttx/config.h>
|
2016-10-12 21:11:05 +02:00
|
|
|
#include <nuttx/irq.h>
|
2016-10-29 18:27:46 +02:00
|
|
|
|
2022-05-17 06:16:29 +02:00
|
|
|
#include <sys/types.h>
|
|
|
|
#ifndef __ASSEMBLY__
|
|
|
|
# include <stdbool.h>
|
|
|
|
#endif
|
|
|
|
|
2016-10-15 20:23:36 +02:00
|
|
|
#include <arch/types.h>
|
2016-10-29 18:27:46 +02:00
|
|
|
#include <arch/chip/tie.h>
|
2016-10-20 19:44:14 +02:00
|
|
|
#include <arch/chip/core-isa.h>
|
2022-01-14 09:52:11 +01:00
|
|
|
#include <arch/xtensa/core.h>
|
2016-10-29 18:27:46 +02:00
|
|
|
|
2016-10-23 16:04:57 +02:00
|
|
|
#include <arch/xtensa/xtensa_specregs.h>
|
|
|
|
#include <arch/xtensa/xtensa_corebits.h>
|
2016-10-28 18:33:20 +02:00
|
|
|
#include <arch/xtensa/xtensa_coproc.h>
|
2016-10-12 21:11:05 +02:00
|
|
|
|
2021-08-04 12:29:01 +02:00
|
|
|
/* Include chip-specific IRQ definitions (including IRQ numbers) */
|
|
|
|
|
|
|
|
#include <arch/chip/irq.h>
|
|
|
|
|
2016-10-12 22:50:28 +02:00
|
|
|
/* Include architecture-specific IRQ definitions */
|
2016-10-12 21:11:05 +02:00
|
|
|
|
2016-10-13 22:48:29 +02:00
|
|
|
#ifdef CONFIG_ARCH_FAMILY_LX6
|
2016-10-12 22:50:28 +02:00
|
|
|
# include <arch/lx6/irq.h>
|
|
|
|
|
2021-05-20 22:07:54 +02:00
|
|
|
#elif CONFIG_ARCH_FAMILY_LX7
|
|
|
|
# include <arch/lx7/irq.h>
|
|
|
|
|
2016-10-12 22:50:28 +02:00
|
|
|
#else
|
|
|
|
# error Unknown XTENSA architecture
|
|
|
|
#endif
|
2016-10-12 21:11:05 +02:00
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Pre-processor Definitions
|
|
|
|
****************************************************************************/
|
|
|
|
|
2022-08-24 22:38:05 +02:00
|
|
|
#ifndef ALIGN_UP
|
|
|
|
# define ALIGN_UP(num, align) (((num) + ((align) - 1)) & ~((align) - 1))
|
|
|
|
#endif
|
|
|
|
|
2016-10-14 21:17:48 +02:00
|
|
|
/* IRQ Stack Frame Format. Each value is a uint32_t register index */
|
|
|
|
|
2016-10-20 19:44:14 +02:00
|
|
|
#define REG_PC (0) /* Return PC */
|
|
|
|
#define REG_PS (1) /* Return PS */
|
|
|
|
#define REG_A0 (2)
|
|
|
|
#define REG_A1 (3) /* Stack pointer before interrupt */
|
|
|
|
#define REG_A2 (4)
|
|
|
|
#define REG_A3 (5)
|
|
|
|
#define REG_A4 (6)
|
|
|
|
#define REG_A5 (7)
|
|
|
|
#define REG_A6 (8)
|
|
|
|
#define REG_A7 (9)
|
|
|
|
#define REG_A8 (10)
|
|
|
|
#define REG_A9 (11)
|
|
|
|
#define REG_A10 (12)
|
|
|
|
#define REG_A11 (13)
|
|
|
|
#define REG_A12 (14)
|
|
|
|
#define REG_A13 (15)
|
|
|
|
#define REG_A14 (16)
|
|
|
|
#define REG_A15 (17)
|
|
|
|
#define REG_SAR (18)
|
|
|
|
#define REG_EXCCAUSE (19)
|
|
|
|
#define REG_EXCVADDR (20)
|
|
|
|
|
2021-10-12 14:32:55 +02:00
|
|
|
#define _REG_EXTRA_START (21)
|
|
|
|
|
|
|
|
#if XCHAL_HAVE_S32C1I != 0
|
|
|
|
# define REG_SCOMPARE1 (_REG_EXTRA_START + 0)
|
|
|
|
# define _REG_LOOPS_START (_REG_EXTRA_START + 1)
|
|
|
|
#else
|
|
|
|
# define _REG_LOOPS_START _REG_EXTRA_START
|
|
|
|
#endif
|
2016-10-20 19:44:14 +02:00
|
|
|
|
2021-05-21 23:32:28 +02:00
|
|
|
#if XCHAL_HAVE_LOOPS != 0
|
2016-10-14 21:17:48 +02:00
|
|
|
# define REG_LBEG (_REG_LOOPS_START + 0)
|
|
|
|
# define REG_LEND (_REG_LOOPS_START + 1)
|
|
|
|
# define REG_LCOUNT (_REG_LOOPS_START + 2)
|
2016-12-16 16:20:36 +01:00
|
|
|
# define _REG_WINDOW_TMPS (_REG_LOOPS_START + 3)
|
2016-10-14 21:17:48 +02:00
|
|
|
#else
|
2016-12-16 16:20:36 +01:00
|
|
|
# define _REG_WINDOW_TMPS _REG_LOOPS_START
|
2016-10-14 21:17:48 +02:00
|
|
|
#endif
|
|
|
|
|
2016-10-30 14:37:51 +01:00
|
|
|
#ifndef __XTENSA_CALL0_ABI__
|
2022-03-11 19:36:56 +01:00
|
|
|
/* Temporary space for saving stuff during window spill. */
|
2016-10-14 21:17:48 +02:00
|
|
|
|
2022-05-20 17:40:04 +02:00
|
|
|
# define REG_TMP0 (_REG_WINDOW_TMPS + 0)
|
|
|
|
# define _REG_INT_CTX_START (_REG_WINDOW_TMPS + 1)
|
2016-10-14 21:17:48 +02:00
|
|
|
#else
|
2022-05-20 17:40:04 +02:00
|
|
|
# define _REG_INT_CTX_START _REG_WINDOW_TMPS
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef CONFIG_BUILD_FLAT
|
|
|
|
/* Temporary space for saving Interrupt Context information */
|
|
|
|
|
|
|
|
# define REG_INT_CTX (_REG_INT_CTX_START + 0)
|
|
|
|
# define _REG_OVLY_START (_REG_INT_CTX_START + 1)
|
|
|
|
#else
|
|
|
|
# define _REG_OVLY_START _REG_INT_CTX_START
|
2016-10-14 21:17:48 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef CONFIG_XTENSA_USE_OVLY
|
|
|
|
/* Storage for overlay state */
|
|
|
|
|
2016-10-23 14:24:35 +02:00
|
|
|
# error Overlays not supported
|
2022-05-05 09:57:52 +02:00
|
|
|
# define _REG_CP_START _REG_OVLY_START
|
2016-10-14 21:17:48 +02:00
|
|
|
#else
|
2022-05-05 09:57:52 +02:00
|
|
|
# define _REG_CP_START _REG_OVLY_START
|
2016-10-14 21:17:48 +02:00
|
|
|
#endif
|
|
|
|
|
2022-05-05 09:57:52 +02:00
|
|
|
#if XCHAL_CP_NUM > 0
|
2022-08-24 22:38:05 +02:00
|
|
|
/* FPU first address must align to CP align size. */
|
|
|
|
|
2022-08-25 20:36:53 +02:00
|
|
|
# define COMMON_CTX_REGS ALIGN_UP(_REG_CP_START, XCHAL_TOTAL_SA_ALIGN / 4)
|
|
|
|
# define COPROC_CTX_REGS (XTENSA_CP_SA_SIZE / 4)
|
|
|
|
# define RESERVE_REGS 8
|
|
|
|
# define XCPTCONTEXT_REGS (COMMON_CTX_REGS + COPROC_CTX_REGS + RESERVE_REGS)
|
2022-05-05 09:57:52 +02:00
|
|
|
#else
|
2022-10-26 23:55:55 +02:00
|
|
|
# define COMMON_CTX_REGS _REG_CP_START
|
2022-08-25 20:36:53 +02:00
|
|
|
# define RESERVE_REGS 8
|
2022-10-26 23:55:55 +02:00
|
|
|
# define XCPTCONTEXT_REGS (COMMON_CTX_REGS + RESERVE_REGS)
|
2022-05-05 09:57:52 +02:00
|
|
|
#endif
|
2016-10-14 21:17:48 +02:00
|
|
|
|
2022-08-25 20:36:53 +02:00
|
|
|
#define XCPTCONTEXT_SIZE (4 * XCPTCONTEXT_REGS)
|
|
|
|
|
2016-10-12 21:11:05 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* Public Types
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifndef __ASSEMBLY__
|
|
|
|
|
2022-05-11 23:53:07 +02:00
|
|
|
#ifdef CONFIG_LIB_SYSCALL
|
|
|
|
/* This structure represents the return state from a system call */
|
|
|
|
|
|
|
|
struct xcpt_syscall_s
|
|
|
|
{
|
|
|
|
uintptr_t sysreturn; /* The return PC */
|
2022-05-20 17:40:04 +02:00
|
|
|
#ifndef CONFIG_BUILD_FLAT
|
|
|
|
uintptr_t int_ctx; /* Interrupt context */
|
|
|
|
#endif
|
2022-05-11 23:53:07 +02:00
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
2016-10-14 21:17:48 +02:00
|
|
|
/* This struct defines the way the registers are stored. */
|
|
|
|
|
|
|
|
struct xcptcontext
|
|
|
|
{
|
|
|
|
/* The following function pointer is non-zero if there are pending signals
|
|
|
|
* to be processed.
|
|
|
|
*/
|
|
|
|
|
|
|
|
void *sigdeliver; /* Actual type is sig_deliver_t */
|
|
|
|
|
2019-02-04 15:35:03 +01:00
|
|
|
/* These are saved copies of registers used during signal processing.
|
|
|
|
*
|
|
|
|
* REVISIT: Because there is only one copy of these save areas,
|
|
|
|
* only a single signal handler can be active. This precludes
|
|
|
|
* queuing of signal actions. As a result, signals received while
|
|
|
|
* another signal handler is executing will be ignored!
|
|
|
|
*/
|
2016-10-14 21:17:48 +02:00
|
|
|
|
2022-04-20 23:50:12 +02:00
|
|
|
uint32_t *saved_regs;
|
2016-10-14 21:17:48 +02:00
|
|
|
|
2016-10-16 15:57:16 +02:00
|
|
|
/* Register save area */
|
2016-10-14 21:17:48 +02:00
|
|
|
|
2022-04-20 23:50:12 +02:00
|
|
|
uint32_t *regs;
|
2016-10-14 21:17:48 +02:00
|
|
|
|
2022-05-11 23:53:07 +02:00
|
|
|
#ifndef CONFIG_BUILD_FLAT
|
|
|
|
/* This is the saved address to use when returning from a user-space
|
|
|
|
* signal handler.
|
|
|
|
*/
|
|
|
|
|
|
|
|
uintptr_t sigreturn;
|
|
|
|
#endif
|
|
|
|
|
2016-10-14 21:17:48 +02:00
|
|
|
#ifdef CONFIG_LIB_SYSCALL
|
|
|
|
/* The following array holds the return address and the exc_return value
|
|
|
|
* needed to return from each nested system call.
|
|
|
|
*/
|
|
|
|
|
|
|
|
uint8_t nsyscalls;
|
|
|
|
struct xcpt_syscall_s syscall[CONFIG_SYS_NNEST];
|
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
2016-10-12 21:11:05 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* Inline functions
|
|
|
|
****************************************************************************/
|
|
|
|
|
2016-10-23 16:00:17 +02:00
|
|
|
/* Return the current value of the PS register */
|
|
|
|
|
|
|
|
static inline uint32_t xtensa_getps(void)
|
|
|
|
{
|
|
|
|
uint32_t ps;
|
|
|
|
|
|
|
|
__asm__ __volatile__
|
|
|
|
(
|
|
|
|
"rsr %0, PS" : "=r"(ps)
|
|
|
|
);
|
|
|
|
|
|
|
|
return ps;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Set the value of the PS register */
|
|
|
|
|
2023-10-25 14:11:20 +02:00
|
|
|
noinstrument_function static inline void xtensa_setps(uint32_t ps)
|
2016-10-23 16:00:17 +02:00
|
|
|
{
|
|
|
|
__asm__ __volatile__
|
|
|
|
(
|
2021-06-17 06:30:27 +02:00
|
|
|
"wsr %0, PS \n"
|
|
|
|
"rsync \n"
|
|
|
|
:
|
|
|
|
: "r"(ps)
|
|
|
|
: "memory"
|
2016-10-23 16:00:17 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2022-06-29 21:47:43 +02:00
|
|
|
/* Return the current value of the stack pointer */
|
|
|
|
|
|
|
|
static inline uint32_t up_getsp(void)
|
|
|
|
{
|
|
|
|
register uint32_t sp;
|
|
|
|
|
|
|
|
__asm__ __volatile__
|
|
|
|
(
|
|
|
|
"mov %0, sp\n"
|
|
|
|
: "=r" (sp)
|
|
|
|
);
|
|
|
|
|
|
|
|
return sp;
|
|
|
|
}
|
|
|
|
|
2016-10-23 16:00:17 +02:00
|
|
|
/* Restore the value of the PS register */
|
|
|
|
|
2023-10-25 14:11:20 +02:00
|
|
|
noinstrument_function static inline void up_irq_restore(uint32_t ps)
|
2016-10-23 16:00:17 +02:00
|
|
|
{
|
|
|
|
__asm__ __volatile__
|
|
|
|
(
|
2022-03-08 10:21:02 +01:00
|
|
|
"wsr %0, PS\n"
|
2021-06-17 06:30:27 +02:00
|
|
|
"rsync \n"
|
|
|
|
:
|
|
|
|
: "r"(ps)
|
|
|
|
: "memory"
|
2016-10-23 16:00:17 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Disable interrupts and return the previous value of the PS register */
|
|
|
|
|
2023-10-25 14:11:20 +02:00
|
|
|
noinstrument_function static inline uint32_t up_irq_save(void)
|
2016-10-23 16:00:17 +02:00
|
|
|
{
|
2016-10-23 21:37:40 +02:00
|
|
|
uint32_t ps;
|
2016-10-23 16:00:17 +02:00
|
|
|
|
|
|
|
/* Disable all low- and medium-priority interrupts. High priority
|
|
|
|
* interrupts should not interfere with ongoing RTOS operations and
|
|
|
|
* are not disabled.
|
|
|
|
*/
|
|
|
|
|
2016-10-23 21:37:40 +02:00
|
|
|
__asm__ __volatile__
|
|
|
|
(
|
2022-01-14 09:52:11 +01:00
|
|
|
"rsil %0, %1" : "=r"(ps) : "i"(XCHAL_IRQ_LEVEL)
|
2016-10-23 21:37:40 +02:00
|
|
|
);
|
2016-10-23 16:00:17 +02:00
|
|
|
|
|
|
|
/* Return the previous PS value so that it can be restored with
|
|
|
|
* up_irq_restore().
|
|
|
|
*/
|
|
|
|
|
|
|
|
return ps;
|
|
|
|
}
|
|
|
|
|
2016-10-23 16:04:57 +02:00
|
|
|
/* Enable interrupts at all levels */
|
|
|
|
|
|
|
|
static inline void up_irq_enable(void)
|
|
|
|
{
|
2016-10-30 14:37:51 +01:00
|
|
|
#ifdef __XTENSA_CALL0_ABI__
|
2016-10-23 16:04:57 +02:00
|
|
|
xtensa_setps(PS_INTLEVEL(0) | PS_UM);
|
|
|
|
#else
|
|
|
|
xtensa_setps(PS_INTLEVEL(0) | PS_UM | PS_WOE);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Disable low- and medium- priority interrupts */
|
|
|
|
|
2023-10-25 14:11:20 +02:00
|
|
|
noinstrument_function static inline void up_irq_disable(void)
|
2016-10-23 16:04:57 +02:00
|
|
|
{
|
2016-10-30 14:37:51 +01:00
|
|
|
#ifdef __XTENSA_CALL0_ABI__
|
2016-10-23 16:04:57 +02:00
|
|
|
xtensa_setps(PS_INTLEVEL(XCHAL_EXCM_LEVEL) | PS_UM);
|
|
|
|
#else
|
|
|
|
xtensa_setps(PS_INTLEVEL(XCHAL_EXCM_LEVEL) | PS_UM | PS_WOE);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2021-08-18 20:26:16 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* Name: xtensa_disable_all
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
static inline void xtensa_disable_all(void)
|
|
|
|
{
|
|
|
|
__asm__ __volatile__
|
|
|
|
(
|
|
|
|
"movi a2, 0\n"
|
|
|
|
"xsr a2, INTENABLE\n"
|
2022-03-08 10:21:02 +01:00
|
|
|
"rsync\n"
|
2021-08-18 20:26:16 +02:00
|
|
|
: : : "a2"
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: xtensa_intclear
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
static inline void xtensa_intclear(uint32_t mask)
|
|
|
|
{
|
|
|
|
__asm__ __volatile__
|
|
|
|
(
|
|
|
|
"wsr %0, INTCLEAR\n"
|
2022-03-08 10:21:02 +01:00
|
|
|
"rsync\n"
|
2021-09-13 15:50:46 +02:00
|
|
|
:
|
|
|
|
: "r"(mask)
|
|
|
|
:
|
2021-08-18 20:26:16 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2016-10-12 21:11:05 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
#define EXTERN extern "C"
|
|
|
|
extern "C"
|
|
|
|
{
|
|
|
|
#else
|
|
|
|
#define EXTERN extern
|
|
|
|
#endif
|
|
|
|
|
2022-05-17 06:16:29 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* Public Data
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifndef __ASSEMBLY__
|
|
|
|
/* g_current_regs[] holds a references to the current interrupt level
|
2024-03-06 02:11:21 +01:00
|
|
|
* register storage structure. It is non-NULL only during interrupt
|
2022-05-17 06:16:29 +02:00
|
|
|
* processing. Access to g_current_regs[] must be through the macro
|
|
|
|
* CURRENT_REGS for portability.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* For the case of architectures with multiple CPUs, then there must be one
|
|
|
|
* such value for each processor that can receive an interrupt.
|
|
|
|
*/
|
|
|
|
|
|
|
|
EXTERN volatile uint32_t *g_current_regs[CONFIG_SMP_NCPUS];
|
|
|
|
#define CURRENT_REGS (g_current_regs[up_cpu_index()])
|
|
|
|
#endif
|
|
|
|
|
2016-10-15 20:23:36 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* Public Function Prototypes
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: xtensa_enable_interrupts
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Enables a set of interrupts. Does not simply set INTENABLE directly,
|
|
|
|
* but computes it as a function of the current virtual priority.
|
|
|
|
* Can be called from interrupt handlers.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
irqstate_t xtensa_enable_interrupts(irqstate_t mask);
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: xtensa_disable_interrupts
|
|
|
|
*
|
|
|
|
* Description:
|
2020-10-06 18:59:57 +02:00
|
|
|
* Disables a set of interrupts. Does not simply clear INTENABLE directly,
|
2016-10-15 20:23:36 +02:00
|
|
|
* but computes it as a function of the current virtual priority.
|
|
|
|
* Can be called from interrupt handlers.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
irqstate_t xtensa_disable_interrupts(irqstate_t mask);
|
|
|
|
|
2022-05-17 06:16:29 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* Name: up_cpu_index
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Return an index in the range of 0 through (CONFIG_SMP_NCPUS-1) that
|
|
|
|
* corresponds to the currently executing CPU.
|
|
|
|
*
|
|
|
|
* Input Parameters:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
* An integer index in the range of 0 through (CONFIG_SMP_NCPUS-1) that
|
|
|
|
* corresponds to the currently executing CPU.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifdef CONFIG_SMP
|
|
|
|
int up_cpu_index(void);
|
|
|
|
#else
|
|
|
|
# define up_cpu_index() (0)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: up_interrupt_context
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Return true is we are currently executing in the interrupt
|
|
|
|
* handler context.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifndef __ASSEMBLY__
|
2023-10-25 14:11:20 +02:00
|
|
|
noinstrument_function static inline bool up_interrupt_context(void)
|
2022-05-17 06:16:29 +02:00
|
|
|
{
|
|
|
|
#ifdef CONFIG_SMP
|
|
|
|
irqstate_t flags = up_irq_save();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
bool ret = CURRENT_REGS != NULL;
|
|
|
|
|
|
|
|
#ifdef CONFIG_SMP
|
|
|
|
up_irq_restore(flags);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2016-10-12 21:11:05 +02:00
|
|
|
#undef EXTERN
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* __ASSEMBLY__ */
|
|
|
|
#endif /* __ARCH_XTENSA_INCLUDE_IRQ_H */
|