This is an automated email from the ASF dual-hosted git repository. xiaoxiang pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit 7926bce26b125f460857b562ae03e30f91b1878c Author: Gustavo Henrique Nihei <gustavo.ni...@espressif.com> AuthorDate: Thu Mar 24 18:12:55 2022 -0300 xtensa: Move XCHAL_SWINT_CALL definition into syscall header This is required to avoid the interface header (syscall.h) depending on the xtensa_swi.h header from the implementation Signed-off-by: Gustavo Henrique Nihei <gustavo.ni...@espressif.com> --- arch/xtensa/include/syscall.h | 41 ++++++++++++++++++- arch/xtensa/src/common/xtensa_context.S | 1 - arch/xtensa/src/common/xtensa_swi.h | 72 --------------------------------- 3 files changed, 40 insertions(+), 74 deletions(-) diff --git a/arch/xtensa/include/syscall.h b/arch/xtensa/include/syscall.h index e2a3285..2e96162 100644 --- a/arch/xtensa/include/syscall.h +++ b/arch/xtensa/include/syscall.h @@ -30,6 +30,7 @@ ****************************************************************************/ #include <nuttx/config.h> + #ifndef __ASSEMBLY__ # include <stdint.h> #endif @@ -37,12 +38,50 @@ # include <syscall.h> #endif -#include "xtensa_swi.h" +#include <arch/xtensa/core.h> +#include <arch/xtensa/xtensa_corebits.h> /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ +/* Select software interrupt number for context-switch. + * The SW interrupt level must be greater than XCHAL_SYSCALL_LEVEL + * and less than XCHAL_EXCM_LEVEL. + * So that we can generate an interrupt when up_irq_save is called. + * and not generate interrupt when up_irq_disable is called. + * Return an error if no suitable software interrupt was found. + */ + +#ifndef XTENSA_SWINT +# ifdef XCHAL_SOFTWARE2_INTERRUPT +# if XCHAL_INT_LEVEL(XCHAL_SOFTWARE2_INTERRUPT) > XCHAL_SYSCALL_LEVEL && \ + XCHAL_INT_LEVEL(XCHAL_SOFTWARE2_INTERRUPT) <= XCHAL_EXCM_LEVEL +# undef XTENSA_SWINT +# define XTENSA_SWINT XCHAL_SOFTWARE2_INTERRUPT +# endif +# endif +# ifdef XCHAL_SOFTWARE1_INTERRUPT +# if XCHAL_INT_LEVEL(XCHAL_SOFTWARE1_INTERRUPT) > XCHAL_SYSCALL_LEVEL && \ + XCHAL_INT_LEVEL(XCHAL_SOFTWARE1_INTERRUPT) <= XCHAL_EXCM_LEVEL +# undef XTENSA_SWINT +# define XTENSA_SWINT XCHAL_SOFTWARE1_INTERRUPT +# endif +# endif +# ifdef XCHAL_SOFTWARE0_INTERRUPT +# if XCHAL_INT_LEVEL(XCHAL_SOFTWARE0_INTERRUPT) > XCHAL_SYSCALL_LEVEL && \ + XCHAL_INT_LEVEL(XCHAL_SOFTWARE0_INTERRUPT) <= XCHAL_EXCM_LEVEL +# undef XTENSA_SWINT +# define XTENSA_SWINT XCHAL_SOFTWARE0_INTERRUPT +# endif +# endif +#endif +#ifndef XTENSA_SWINT +# error "There is no suitable sw interrupt in this Xtensa configuration." +#endif + +#define XCHAL_SWINT_CALL (1 << XTENSA_SWINT) + #define SYS_syscall 0x00 /* This logic uses three system calls {0,1,2} for context switching and one diff --git a/arch/xtensa/src/common/xtensa_context.S b/arch/xtensa/src/common/xtensa_context.S index ec78a44..5395183 100644 --- a/arch/xtensa/src/common/xtensa_context.S +++ b/arch/xtensa/src/common/xtensa_context.S @@ -67,7 +67,6 @@ #include <arch/xtensa/xtensa_specregs.h> #include "syscall.h" -#include "xtensa_swi.h" #include "xtensa_asm_utils.h" /**************************************************************************** diff --git a/arch/xtensa/src/common/xtensa_swi.h b/arch/xtensa/src/common/xtensa_swi.h deleted file mode 100644 index be73139..0000000 --- a/arch/xtensa/src/common/xtensa_swi.h +++ /dev/null @@ -1,72 +0,0 @@ -/**************************************************************************** - * arch/xtensa/src/common/xtensa_swi.h - * - * 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 - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * 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. - * - ****************************************************************************/ - -#ifndef __ARCH_XTENSA_SRC_COMMON_XTENSA_SWI_H -#define __ARCH_XTENSA_SRC_COMMON_XTENSA_SWI_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include <arch/xtensa/core.h> -#include <arch/xtensa/xtensa_corebits.h> - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/* Select software interrupt number for context-switch. - * The SW interrupt level must be greater than XCHAL_SYSCALL_LEVEL - * and less than XCHAL_EXCM_LEVEL. - * So that we can generate an interrupt when up_irq_save is called. - * and not generate interrupt when up_irq_disable is called. - * Return an error if no suitable software interrupt was found. - */ - -#ifndef XTENSA_SWINT -# ifdef XCHAL_SOFTWARE2_INTERRUPT -# if XCHAL_INT_LEVEL(XCHAL_SOFTWARE2_INTERRUPT) > XCHAL_SYSCALL_LEVEL && \ - XCHAL_INT_LEVEL(XCHAL_SOFTWARE2_INTERRUPT) <= XCHAL_EXCM_LEVEL -# undef XTENSA_SWINT -# define XTENSA_SWINT XCHAL_SOFTWARE2_INTERRUPT -# endif -# endif -# ifdef XCHAL_SOFTWARE1_INTERRUPT -# if XCHAL_INT_LEVEL(XCHAL_SOFTWARE1_INTERRUPT) > XCHAL_SYSCALL_LEVEL && \ - XCHAL_INT_LEVEL(XCHAL_SOFTWARE1_INTERRUPT) <= XCHAL_EXCM_LEVEL -# undef XTENSA_SWINT -# define XTENSA_SWINT XCHAL_SOFTWARE1_INTERRUPT -# endif -# endif -# ifdef XCHAL_SOFTWARE0_INTERRUPT -# if XCHAL_INT_LEVEL(XCHAL_SOFTWARE0_INTERRUPT) > XCHAL_SYSCALL_LEVEL && \ - XCHAL_INT_LEVEL(XCHAL_SOFTWARE0_INTERRUPT) <= XCHAL_EXCM_LEVEL -# undef XTENSA_SWINT -# define XTENSA_SWINT XCHAL_SOFTWARE0_INTERRUPT -# endif -# endif -#endif -#ifndef XTENSA_SWINT -# error "There is no suitable sw interrupt in this Xtensa configuration." -#endif - -#define XCHAL_SWINT_CALL (1 << XTENSA_SWINT) - -#endif /* __ARCH_XTENSA_SRC_COMMON_XTENSA_SWI_H */