2016-10-13 03:11:05 +08:00
|
|
|
/****************************************************************************
|
|
|
|
* arch/xtensa/include/irq.h
|
|
|
|
*
|
2021-03-28 23:44:37 +08: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-13 03:11:05 +08:00
|
|
|
*
|
2021-03-28 23:44:37 +08:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2016-10-13 03:11:05 +08:00
|
|
|
*
|
2021-03-28 23:44:37 +08: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-13 03:11:05 +08:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2020-04-06 05:00:04 +08:00
|
|
|
/* This file should never be included directly but, rather, only indirectly
|
2016-10-13 03:11:05 +08: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 22:00:17 +08:00
|
|
|
#include <nuttx/config.h>
|
2016-10-13 03:11:05 +08:00
|
|
|
#include <nuttx/irq.h>
|
2016-10-30 00:27:46 +08:00
|
|
|
|
2022-05-17 12:16:29 +08:00
|
|
|
#include <sys/types.h>
|
|
|
|
#ifndef __ASSEMBLY__
|
|
|
|
# include <stdbool.h>
|
|
|
|
#endif
|
|
|
|
|
2016-10-16 02:23:36 +08:00
|
|
|
#include <arch/types.h>
|
2016-10-30 00:27:46 +08:00
|
|
|
#include <arch/chip/tie.h>
|
2016-10-21 01:44:14 +08:00
|
|
|
#include <arch/chip/core-isa.h>
|
2022-01-14 16:52:11 +08:00
|
|
|
#include <arch/xtensa/core.h>
|
2016-10-30 00:27:46 +08:00
|
|
|
|
2016-10-23 22:04:57 +08:00
|
|
|
#include <arch/xtensa/xtensa_specregs.h>
|
|
|
|
#include <arch/xtensa/xtensa_corebits.h>
|
2016-10-29 00:33:20 +08:00
|
|
|
#include <arch/xtensa/xtensa_coproc.h>
|
2016-10-13 03:11:05 +08:00
|
|
|
|
2021-08-04 18:29:01 +08:00
|
|
|
/* Include chip-specific IRQ definitions (including IRQ numbers) */
|
|
|
|
|
|
|
|
#include <arch/chip/irq.h>
|
|
|
|
|
2016-10-13 04:50:28 +08:00
|
|
|
/* Include architecture-specific IRQ definitions */
|
2016-10-13 03:11:05 +08:00
|
|
|
|
2016-10-14 04:48:29 +08:00
|
|
|
#ifdef CONFIG_ARCH_FAMILY_LX6
|
2016-10-13 04:50:28 +08:00
|
|
|
# include <arch/lx6/irq.h>
|
|
|
|
|
2021-05-21 04:07:54 +08:00
|
|
|
#elif CONFIG_ARCH_FAMILY_LX7
|
|
|
|
# include <arch/lx7/irq.h>
|
|
|
|
|
2016-10-13 04:50:28 +08:00
|
|
|
#else
|
|
|
|
# error Unknown XTENSA architecture
|
|
|
|
#endif
|
2016-10-13 03:11:05 +08:00
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Pre-processor Definitions
|
|
|
|
****************************************************************************/
|
|
|
|
|
2022-08-25 04:38:05 +08:00
|
|
|
#ifndef ALIGN_UP
|
|
|
|
# define ALIGN_UP(num, align) (((num) + ((align) - 1)) & ~((align) - 1))
|
|
|
|
#endif
|
|
|
|
|
2016-10-15 03:17:48 +08:00
|
|
|
/* IRQ Stack Frame Format. Each value is a uint32_t register index */
|
|
|
|
|
2016-10-21 01:44:14 +08: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 20:32:55 +08: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-21 01:44:14 +08:00
|
|
|
|
2021-05-22 05:32:28 +08:00
|
|
|
#if XCHAL_HAVE_LOOPS != 0
|
2016-10-15 03:17:48 +08: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 23:20:36 +08:00
|
|
|
# define _REG_WINDOW_TMPS (_REG_LOOPS_START + 3)
|
2016-10-15 03:17:48 +08:00
|
|
|
#else
|
2016-12-16 23:20:36 +08:00
|
|
|
# define _REG_WINDOW_TMPS _REG_LOOPS_START
|
2016-10-15 03:17:48 +08:00
|
|
|
#endif
|
|
|
|
|
2016-10-30 21:37:51 +08:00
|
|
|
#ifndef __XTENSA_CALL0_ABI__
|
2022-03-12 02:36:56 +08:00
|
|
|
/* Temporary space for saving stuff during window spill. */
|
2016-10-15 03:17:48 +08:00
|
|
|
|
2022-05-20 23:40:04 +08:00
|
|
|
# define REG_TMP0 (_REG_WINDOW_TMPS + 0)
|
|
|
|
# define _REG_INT_CTX_START (_REG_WINDOW_TMPS + 1)
|
2016-10-15 03:17:48 +08:00
|
|
|
#else
|
2022-05-20 23:40:04 +08: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-15 03:17:48 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef CONFIG_XTENSA_USE_OVLY
|
|
|
|
/* Storage for overlay state */
|
|
|
|
|
2016-10-23 20:24:35 +08:00
|
|
|
# error Overlays not supported
|
2022-05-05 15:57:52 +08:00
|
|
|
# define _REG_CP_START _REG_OVLY_START
|
2016-10-15 03:17:48 +08:00
|
|
|
#else
|
2022-05-05 15:57:52 +08:00
|
|
|
# define _REG_CP_START _REG_OVLY_START
|
2016-10-15 03:17:48 +08:00
|
|
|
#endif
|
|
|
|
|
2022-05-05 15:57:52 +08:00
|
|
|
#if XCHAL_CP_NUM > 0
|
2022-08-25 04:38:05 +08:00
|
|
|
/* FPU first address must align to CP align size. */
|
|
|
|
|
2022-08-26 02:36:53 +08: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 15:57:52 +08:00
|
|
|
#else
|
2022-10-27 05:55:55 +08:00
|
|
|
# define COMMON_CTX_REGS _REG_CP_START
|
2022-08-26 02:36:53 +08:00
|
|
|
# define RESERVE_REGS 8
|
2022-10-27 05:55:55 +08:00
|
|
|
# define XCPTCONTEXT_REGS (COMMON_CTX_REGS + RESERVE_REGS)
|
2022-05-05 15:57:52 +08:00
|
|
|
#endif
|
2016-10-15 03:17:48 +08:00
|
|
|
|
2022-08-26 02:36:53 +08:00
|
|
|
#define XCPTCONTEXT_SIZE (4 * XCPTCONTEXT_REGS)
|
|
|
|
|
2016-10-13 03:11:05 +08:00
|
|
|
/****************************************************************************
|
|
|
|
* Public Types
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifndef __ASSEMBLY__
|
|
|
|
|
2022-05-12 05:53:07 +08: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 23:40:04 +08:00
|
|
|
#ifndef CONFIG_BUILD_FLAT
|
|
|
|
uintptr_t int_ctx; /* Interrupt context */
|
|
|
|
#endif
|
2022-05-12 05:53:07 +08:00
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
2016-10-15 03:17:48 +08: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 22:35:03 +08: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-15 03:17:48 +08:00
|
|
|
|
2022-04-21 05:50:12 +08:00
|
|
|
uint32_t *saved_regs;
|
2016-10-15 03:17:48 +08:00
|
|
|
|
2016-10-16 21:57:16 +08:00
|
|
|
/* Register save area */
|
2016-10-15 03:17:48 +08:00
|
|
|
|
2022-04-21 05:50:12 +08:00
|
|
|
uint32_t *regs;
|
2016-10-15 03:17:48 +08:00
|
|
|
|
2022-05-12 05:53:07 +08: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-15 03:17:48 +08: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-13 03:11:05 +08:00
|
|
|
/****************************************************************************
|
|
|
|
* Inline functions
|
|
|
|
****************************************************************************/
|
|
|
|
|
2016-10-23 22:00:17 +08: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 20:11:20 +08:00
|
|
|
noinstrument_function static inline void xtensa_setps(uint32_t ps)
|
2016-10-23 22:00:17 +08:00
|
|
|
{
|
|
|
|
__asm__ __volatile__
|
|
|
|
(
|
2021-06-17 12:30:27 +08:00
|
|
|
"wsr %0, PS \n"
|
|
|
|
"rsync \n"
|
|
|
|
:
|
|
|
|
: "r"(ps)
|
|
|
|
: "memory"
|
2016-10-23 22:00:17 +08:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2022-06-30 03:47:43 +08: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 22:00:17 +08:00
|
|
|
/* Restore the value of the PS register */
|
|
|
|
|
2023-10-25 20:11:20 +08:00
|
|
|
noinstrument_function static inline void up_irq_restore(uint32_t ps)
|
2016-10-23 22:00:17 +08:00
|
|
|
{
|
|
|
|
__asm__ __volatile__
|
|
|
|
(
|
2022-03-08 17:21:02 +08:00
|
|
|
"wsr %0, PS\n"
|
2021-06-17 12:30:27 +08:00
|
|
|
"rsync \n"
|
|
|
|
:
|
|
|
|
: "r"(ps)
|
|
|
|
: "memory"
|
2016-10-23 22:00:17 +08:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Disable interrupts and return the previous value of the PS register */
|
|
|
|
|
2023-10-25 20:11:20 +08:00
|
|
|
noinstrument_function static inline uint32_t up_irq_save(void)
|
2016-10-23 22:00:17 +08:00
|
|
|
{
|
2016-10-24 03:37:40 +08:00
|
|
|
uint32_t ps;
|
2016-10-23 22:00:17 +08:00
|
|
|
|
|
|
|
/* Disable all low- and medium-priority interrupts. High priority
|
|
|
|
* interrupts should not interfere with ongoing RTOS operations and
|
|
|
|
* are not disabled.
|
|
|
|
*/
|
|
|
|
|
2016-10-24 03:37:40 +08:00
|
|
|
__asm__ __volatile__
|
|
|
|
(
|
2022-01-14 16:52:11 +08:00
|
|
|
"rsil %0, %1" : "=r"(ps) : "i"(XCHAL_IRQ_LEVEL)
|
2016-10-24 03:37:40 +08:00
|
|
|
);
|
2016-10-23 22:00:17 +08:00
|
|
|
|
|
|
|
/* Return the previous PS value so that it can be restored with
|
|
|
|
* up_irq_restore().
|
|
|
|
*/
|
|
|
|
|
|
|
|
return ps;
|
|
|
|
}
|
|
|
|
|
2016-10-23 22:04:57 +08:00
|
|
|
/* Enable interrupts at all levels */
|
|
|
|
|
|
|
|
static inline void up_irq_enable(void)
|
|
|
|
{
|
2016-10-30 21:37:51 +08:00
|
|
|
#ifdef __XTENSA_CALL0_ABI__
|
2016-10-23 22:04:57 +08: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 20:11:20 +08:00
|
|
|
noinstrument_function static inline void up_irq_disable(void)
|
2016-10-23 22:04:57 +08:00
|
|
|
{
|
2016-10-30 21:37:51 +08:00
|
|
|
#ifdef __XTENSA_CALL0_ABI__
|
2016-10-23 22:04:57 +08: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-19 02:26:16 +08: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 17:21:02 +08:00
|
|
|
"rsync\n"
|
2021-08-19 02:26:16 +08:00
|
|
|
: : : "a2"
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: xtensa_intclear
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
static inline void xtensa_intclear(uint32_t mask)
|
|
|
|
{
|
|
|
|
__asm__ __volatile__
|
|
|
|
(
|
|
|
|
"wsr %0, INTCLEAR\n"
|
2022-03-08 17:21:02 +08:00
|
|
|
"rsync\n"
|
2021-09-13 21:50:46 +08:00
|
|
|
:
|
|
|
|
: "r"(mask)
|
|
|
|
:
|
2021-08-19 02:26:16 +08:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2016-10-13 03:11:05 +08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
#define EXTERN extern "C"
|
|
|
|
extern "C"
|
|
|
|
{
|
|
|
|
#else
|
|
|
|
#define EXTERN extern
|
|
|
|
#endif
|
|
|
|
|
2022-05-17 12:16:29 +08:00
|
|
|
/****************************************************************************
|
|
|
|
* Public Data
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifndef __ASSEMBLY__
|
|
|
|
/* g_current_regs[] holds a references to the current interrupt level
|
2024-03-06 09:11:21 +08:00
|
|
|
* register storage structure. It is non-NULL only during interrupt
|
2022-05-17 12:16:29 +08: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-16 02:23:36 +08: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-07 00:59:57 +08:00
|
|
|
* Disables a set of interrupts. Does not simply clear INTENABLE directly,
|
2016-10-16 02:23:36 +08: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 12:16:29 +08: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 20:11:20 +08:00
|
|
|
noinstrument_function static inline bool up_interrupt_context(void)
|
2022-05-17 12:16:29 +08: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-13 03:11:05 +08:00
|
|
|
#undef EXTERN
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* __ASSEMBLY__ */
|
|
|
|
#endif /* __ARCH_XTENSA_INCLUDE_IRQ_H */
|