xtensa:fpu: add up_fpucmp and enable CONFIG_ARCH_FPU macro

For arch with CP_NUM > 0, enable ARCH_FPU

Signed-off-by: zhuyanlin <zhuyanlin1@xiaomi.com>
This commit is contained in:
zhuyanlin 2022-05-05 16:49:59 +08:00 committed by Petro Karashchenko
parent 5958d3ac62
commit 883337c3a0
4 changed files with 69 additions and 0 deletions

View File

@ -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

View File

@ -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 <nuttx/config.h>
#include <stdint.h>
#include <string.h>
#include <nuttx/irq.h>
#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(&regs1[XCPTCONTEXT_REGS], &regs2[XCPTCONTEXT_REGS],
XTENSA_CP_SA_SIZE);
}
#endif /* CONFIG_ARCH_FPU */

View File

@ -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

View File

@ -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