mirror of
https://github.com/OpenAMP/libmetal.git
synced 2026-09-28 15:53:47 +08:00
Refactor equal processor headers into new generic ones
Refactor all processor headers which had the same content into a generic set, to reduce the number of duplicates. Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
This commit is contained in:
committed by
Arnaud Pouliquen
parent
dabb14f677
commit
85fb13958d
@@ -107,7 +107,11 @@ using std::atomic_signal_fence;
|
||||
#elif defined(__GNUC__)
|
||||
# include <metal/compiler/gcc/atomic.h>
|
||||
#else
|
||||
#if defined(HAVE_PROCESSOR_ATOMIC_H)
|
||||
# include <metal/processor/@PROJECT_PROCESSOR@/atomic.h>
|
||||
#else
|
||||
# include <metal/processor/generic/atomic.h>
|
||||
#endif /* defined(HAVE_PROCESSOR_ATOMIC_H) */
|
||||
#endif
|
||||
|
||||
#endif /* __METAL_ATOMIC__H__ */
|
||||
|
||||
@@ -42,6 +42,8 @@ extern "C" {
|
||||
|
||||
#cmakedefine HAVE_STDATOMIC_H
|
||||
#cmakedefine HAVE_FUTEX_H
|
||||
#cmakedefine HAVE_PROCESSOR_ATOMIC_H
|
||||
#cmakedefine HAVE_PROCESSOR_CPU_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -12,6 +12,12 @@
|
||||
#ifndef __METAL_CPU__H__
|
||||
#define __METAL_CPU__H__
|
||||
|
||||
#include <metal/config.h>
|
||||
|
||||
#if defined(HAVE_PROCESSOR_CPU_H)
|
||||
# include <metal/processor/@PROJECT_PROCESSOR@/cpu.h>
|
||||
#else
|
||||
# include <metal/processor/generic/cpu.h>
|
||||
#endif
|
||||
|
||||
#endif /* __METAL_CPU__H__ */
|
||||
|
||||
@@ -1,2 +1,14 @@
|
||||
add_subdirectory (${PROJECT_PROCESSOR})
|
||||
if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_PROCESSOR}/cpu.h")
|
||||
collect (PROJECT_LIB_HEADERS ${PROJECT_PROCESSOR}/cpu.h)
|
||||
set(HAVE_PROCESSOR_CPU_H 1 CACHE INTERNAL "Have include ${PROJECT_PROCESSOR}/cpu.h")
|
||||
else()
|
||||
collect (PROJECT_LIB_HEADERS generic/cpu.h)
|
||||
endif()
|
||||
|
||||
if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_PROCESSOR}/atomic.h")
|
||||
collect (PROJECT_LIB_HEADERS ${PROJECT_PROCESSOR}/atomic.h)
|
||||
set(HAVE_PROCESSOR_ATOMIC_H 1 CACHE INTERNAL "Have include ${PROJECT_PROCESSOR}/atomic.h")
|
||||
else()
|
||||
collect (PROJECT_LIB_HEADERS generic/atomic.h)
|
||||
endif()
|
||||
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
collect (PROJECT_LIB_HEADERS atomic.h)
|
||||
collect (PROJECT_LIB_HEADERS cpu.h)
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Xilinx Inc. and Contributors. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
/*
|
||||
* @file gcc/atomic.h
|
||||
* @brief GCC specific atomic primitives for libmetal.
|
||||
*/
|
||||
|
||||
#ifndef __METAL_AARCH64_ATOMIC__H__
|
||||
#define __METAL_AARCH64_ATOMIC__H__
|
||||
|
||||
#endif /* __METAL_ARM_ATOMIC__H__ */
|
||||
@@ -1,3 +0,0 @@
|
||||
collect (PROJECT_LIB_HEADERS atomic.h)
|
||||
collect (PROJECT_LIB_HEADERS cpu.h)
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Xilinx Inc. and Contributors. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
/*
|
||||
* @file arm/atomic.h
|
||||
* @brief Arm specific atomic primitives for libmetal.
|
||||
*/
|
||||
|
||||
#ifndef __METAL_ARM_ATOMIC__H__
|
||||
#define __METAL_ARM_ATOMIC__H__
|
||||
|
||||
#endif /* __METAL_ARM_ATOMIC__H__ */
|
||||
@@ -1,17 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Xilinx Inc. and Contributors. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
/*
|
||||
* @file cpu.h
|
||||
* @brief CPU specific primitives
|
||||
*/
|
||||
|
||||
#ifndef __METAL_ARM_CPU__H__
|
||||
#define __METAL_ARM_CPU__H__
|
||||
|
||||
#define metal_cpu_yield()
|
||||
|
||||
#endif /* __METAL_ARM_CPU__H__ */
|
||||
@@ -1,2 +0,0 @@
|
||||
collect (PROJECT_LIB_HEADERS cpu.h)
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
collect (PROJECT_LIB_HEADERS cpu.h)
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Pinecone Inc. and Contributors. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
/*
|
||||
* @file cpu.h
|
||||
* @brief CPU specific primitives
|
||||
*/
|
||||
|
||||
#ifndef __METAL_CSKY_CPU__H__
|
||||
#define __METAL_CSKY_CPU__H__
|
||||
|
||||
#define metal_cpu_yield()
|
||||
|
||||
#endif /* __METAL_CSKY_CPU__H__ */
|
||||
@@ -0,0 +1,15 @@
|
||||
/*
|
||||
* Copyright (c) 2023 Nordic Semiconductor ASA
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
/*
|
||||
* @file generic/atomic.h
|
||||
* @brief Generic environment atomic primitives for libmetal.
|
||||
*/
|
||||
|
||||
#ifndef __METAL_GENERIC_ATOMIC__H__
|
||||
#define __METAL_GENERIC_ATOMIC__H__
|
||||
|
||||
#endif /* __METAL_GENERIC_ATOMIC__H__ */
|
||||
@@ -0,0 +1,17 @@
|
||||
/*
|
||||
* Copyright (c) 2023 Nordic Semiconductor ASA
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
/*
|
||||
* @file generic/cpu.h
|
||||
* @brief Generic CPU specific primitives
|
||||
*/
|
||||
|
||||
#ifndef __METAL_GENERIC_CPU__H__
|
||||
#define __METAL_GENERIC_CPU__H__
|
||||
|
||||
#define metal_cpu_yield()
|
||||
|
||||
#endif /* __METAL_GENERIC_CPU__H__ */
|
||||
@@ -1,2 +0,0 @@
|
||||
collect (PROJECT_LIB_HEADERS atomic.h)
|
||||
collect (PROJECT_LIB_HEADERS cpu.h)
|
||||
@@ -1,15 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2023 Nordic Semiconductor ASA
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
/*
|
||||
* @file hosted/atomic.h
|
||||
* @brief Hosted environment atomic primitives for libmetal.
|
||||
*/
|
||||
|
||||
#ifndef __METAL_HOSTED_ATOMIC__H__
|
||||
#define __METAL_HOSTED_ATOMIC__H__
|
||||
|
||||
#endif /* __METAL_HOSTED_ATOMIC__H__ */
|
||||
@@ -1,3 +0,0 @@
|
||||
collect (PROJECT_LIB_HEADERS atomic.h)
|
||||
collect (PROJECT_LIB_HEADERS cpu.h)
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Xilinx Inc. and Contributors. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
/*
|
||||
* @file microblaze/atomic.h
|
||||
* @brief Microblaze specific atomic primitives for libmetal
|
||||
*/
|
||||
|
||||
#ifndef __METAL_MICROBLAZE_ATOMIC__H__
|
||||
#define __METAL_MICROBLAZE_ATOMIC__H__
|
||||
|
||||
#endif /* __METAL_MICROBLAZE_ATOMIC__H__ */
|
||||
@@ -1,20 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Xilinx Inc. and Contributors. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
/*
|
||||
* @file cpu.h
|
||||
* @brief CPU specific primitives on microblaze platform.
|
||||
*/
|
||||
|
||||
#ifndef __METAL_MICROBLAZE__H__
|
||||
#define __METAL_MICROBLAZE__H__
|
||||
|
||||
#include <stdint.h>
|
||||
#include <metal/atomic.h>
|
||||
|
||||
#define metal_cpu_yield()
|
||||
|
||||
#endif /* __METAL_MICROBLAZE__H__ */
|
||||
@@ -1,2 +0,0 @@
|
||||
collect (PROJECT_LIB_HEADERS cpu.h)
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Pinecone Inc. and Contributors. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
/*
|
||||
* @file cpu.h
|
||||
* @brief CPU specific primitives
|
||||
*/
|
||||
|
||||
#ifndef __METAL_RISCV_CPU__H__
|
||||
#define __METAL_RISCV_CPU__H__
|
||||
|
||||
#define metal_cpu_yield()
|
||||
|
||||
#endif /* __METAL_RISCV_CPU__H__ */
|
||||
@@ -1,3 +0,0 @@
|
||||
collect (PROJECT_LIB_HEADERS atomic.h)
|
||||
collect (PROJECT_LIB_HEADERS cpu.h)
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Xilinx Inc. and Contributors. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
/*
|
||||
* @file gcc/atomic.h
|
||||
* @brief GCC specific atomic primitives for libmetal.
|
||||
*/
|
||||
|
||||
#ifndef __METAL_X86_ATOMIC__H__
|
||||
#define __METAL_X86_ATOMIC__H__
|
||||
|
||||
|
||||
#endif /* __METAL_X86_ATOMIC__H__ */
|
||||
@@ -1,3 +0,0 @@
|
||||
collect (PROJECT_LIB_HEADERS atomic.h)
|
||||
collect (PROJECT_LIB_HEADERS cpu.h)
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Xilinx Inc. and Contributors. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
/*
|
||||
* @file gcc/atomic.h
|
||||
* @brief GCC specific atomic primitives for libmetal.
|
||||
*/
|
||||
|
||||
#ifndef __METAL_X86_64_ATOMIC__H__
|
||||
#define __METAL_X86_64_ATOMIC__H__
|
||||
|
||||
|
||||
#endif /* __METAL_X86_64_ATOMIC__H__ */
|
||||
@@ -1,2 +0,0 @@
|
||||
collect (PROJECT_LIB_HEADERS atomic.h)
|
||||
collect (PROJECT_LIB_HEADERS cpu.h)
|
||||
@@ -1,15 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2021, Xiaomi Inc. and Contributors. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
/*
|
||||
* @file xtensa/atomic.h
|
||||
* @brief Xtensa specific atomic primitives for libmetal.
|
||||
*/
|
||||
|
||||
#ifndef __METAL_XTENSA_ATOMIC__H__
|
||||
#define __METAL_XTENSA_ATOMIC__H__
|
||||
|
||||
#endif /* __METAL_XTENSA_ATOMIC__H__ */
|
||||
Reference in New Issue
Block a user