diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig index e30b9c2832..692117aa57 100644 --- a/arch/xtensa/Kconfig +++ b/arch/xtensa/Kconfig @@ -13,6 +13,7 @@ config ARCH_CHIP_ESP32 bool "Espressif ESP32" select ARCH_FAMILY_LX6 select XTENSA_HAVE_INTERRUPTS + select ARCH_HAVE_FPU select ARCH_HAVE_MULTICPU select ARCH_HAVE_TEXT_HEAP select ARCH_HAVE_SDRAM @@ -77,6 +78,7 @@ config ARCH_CHIP_ESP32S3 bool "Espressif ESP32-S3" select ARCH_FAMILY_LX7 select XTENSA_HAVE_INTERRUPTS + select ARCH_HAVE_FPU select ARCH_HAVE_MULTICPU select ARCH_HAVE_TEXT_HEAP select ARCH_HAVE_SDRAM diff --git a/arch/xtensa/src/common/xtensa_fpucmp.c b/arch/xtensa/src/common/xtensa_fpucmp.c new file mode 100644 index 0000000000..cafd93c3c0 --- /dev/null +++ b/arch/xtensa/src/common/xtensa_fpucmp.c @@ -0,0 +1,59 @@ +/**************************************************************************** + * arch/xtensa/src/common/xtensa_fpucmp.c + * + * 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. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include + +#include "xtensa.h" + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +#ifdef CONFIG_ARCH_FPU + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: up_fpucmp + * + * Description: + * compare FPU areas from thread context + * + ****************************************************************************/ + +bool up_fpucmp(const void *saveregs1, const void *saveregs2) +{ + const uint32_t *regs1 = saveregs1; + const uint32_t *regs2 = saveregs2; + + return memcmp(®s1[XCPTCONTEXT_REGS], ®s2[XCPTCONTEXT_REGS], + XTENSA_CP_SA_SIZE); +} +#endif /* CONFIG_ARCH_FPU */ diff --git a/arch/xtensa/src/esp32/Make.defs b/arch/xtensa/src/esp32/Make.defs index 1161e8bfe4..445c05acec 100644 --- a/arch/xtensa/src/esp32/Make.defs +++ b/arch/xtensa/src/esp32/Make.defs @@ -52,6 +52,10 @@ ifeq ($(CONFIG_DEBUG_ALERT),y) CMN_CSRCS += xtensa_dumpstate.c endif +ifeq ($(CONFIG_ARCH_FPU),y) + CMN_CSRCS += xtensa_fpucmp.c +endif + ifeq ($(CONFIG_SPINLOCK),y) CMN_CSRCS += xtensa_testset.c endif diff --git a/arch/xtensa/src/esp32s3/Make.defs b/arch/xtensa/src/esp32s3/Make.defs index 8987a2b6b9..cbaeb1ed36 100644 --- a/arch/xtensa/src/esp32s3/Make.defs +++ b/arch/xtensa/src/esp32s3/Make.defs @@ -52,6 +52,10 @@ ifeq ($(CONFIG_DEBUG_ALERT),y) CMN_CSRCS += xtensa_dumpstate.c endif +ifeq ($(CONFIG_ARCH_FPU),y) + CMN_CSRCS += xtensa_fpucmp.c +endif + ifeq ($(CONFIG_SPINLOCK),y) CMN_CSRCS += xtensa_testset.c endif