From a73fc2acb60265b71d2a450b34b816ab8673d6e7 Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Wed, 1 Nov 2023 09:27:50 +0100 Subject: [PATCH] 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 --- lib/processor/CMakeLists.txt | 12 +++++++++++- lib/processor/aarch64/CMakeLists.txt | 3 --- lib/processor/aarch64/atomic.h | 15 --------------- lib/processor/arm/CMakeLists.txt | 3 --- lib/processor/arm/atomic.h | 15 --------------- lib/processor/arm/cpu.h | 17 ----------------- lib/processor/ceva/CMakeLists.txt | 2 -- lib/processor/csky/CMakeLists.txt | 2 -- lib/processor/csky/cpu.h | 17 ----------------- lib/processor/generic/atomic.h | 15 +++++++++++++++ lib/processor/generic/cpu.h | 17 +++++++++++++++++ lib/processor/hosted/CMakeLists.txt | 2 -- lib/processor/hosted/atomic.h | 15 --------------- lib/processor/microblaze/CMakeLists.txt | 3 --- lib/processor/microblaze/atomic.h | 15 --------------- lib/processor/microblaze/cpu.h | 20 -------------------- lib/processor/riscv/CMakeLists.txt | 2 -- lib/processor/riscv/cpu.h | 17 ----------------- lib/processor/x86/CMakeLists.txt | 3 --- lib/processor/x86/atomic.h | 16 ---------------- lib/processor/x86_64/CMakeLists.txt | 3 --- lib/processor/x86_64/atomic.h | 16 ---------------- lib/processor/xtensa/CMakeLists.txt | 2 -- lib/processor/xtensa/atomic.h | 15 --------------- 24 files changed, 43 insertions(+), 204 deletions(-) delete mode 100644 lib/processor/aarch64/CMakeLists.txt delete mode 100644 lib/processor/aarch64/atomic.h delete mode 100644 lib/processor/arm/CMakeLists.txt delete mode 100644 lib/processor/arm/atomic.h delete mode 100644 lib/processor/arm/cpu.h delete mode 100644 lib/processor/ceva/CMakeLists.txt delete mode 100644 lib/processor/csky/CMakeLists.txt delete mode 100644 lib/processor/csky/cpu.h create mode 100644 lib/processor/generic/atomic.h create mode 100644 lib/processor/generic/cpu.h delete mode 100644 lib/processor/hosted/CMakeLists.txt delete mode 100644 lib/processor/hosted/atomic.h delete mode 100644 lib/processor/microblaze/CMakeLists.txt delete mode 100644 lib/processor/microblaze/atomic.h delete mode 100644 lib/processor/microblaze/cpu.h delete mode 100644 lib/processor/riscv/CMakeLists.txt delete mode 100644 lib/processor/riscv/cpu.h delete mode 100644 lib/processor/x86/CMakeLists.txt delete mode 100644 lib/processor/x86/atomic.h delete mode 100644 lib/processor/x86_64/CMakeLists.txt delete mode 100644 lib/processor/x86_64/atomic.h delete mode 100644 lib/processor/xtensa/CMakeLists.txt delete mode 100644 lib/processor/xtensa/atomic.h diff --git a/lib/processor/CMakeLists.txt b/lib/processor/CMakeLists.txt index d542b56a..5ee5d318 100644 --- a/lib/processor/CMakeLists.txt +++ b/lib/processor/CMakeLists.txt @@ -1,2 +1,12 @@ -add_subdirectory (${PROJECT_PROCESSOR}) +if (EXISTS "${PROJECT_PROCESSOR}/cpu.h") + collect (PROJECT_LIB_HEADERS ${PROJECT_PROCESSOR}/cpu.h) +else() + collect (PROJECT_LIB_HEADERS generic/cpu.h) +endif() + +if (EXISTS "${PROJECT_PROCESSOR}/atomic.h") + collect (PROJECT_LIB_HEADERS ${PROJECT_PROCESSOR}/atomic.h) +else() + collect (PROJECT_LIB_HEADERS generic/atomic.h) +endif() diff --git a/lib/processor/aarch64/CMakeLists.txt b/lib/processor/aarch64/CMakeLists.txt deleted file mode 100644 index a20967bf..00000000 --- a/lib/processor/aarch64/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -collect (PROJECT_LIB_HEADERS atomic.h) -collect (PROJECT_LIB_HEADERS cpu.h) - diff --git a/lib/processor/aarch64/atomic.h b/lib/processor/aarch64/atomic.h deleted file mode 100644 index 410346c1..00000000 --- a/lib/processor/aarch64/atomic.h +++ /dev/null @@ -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__ */ diff --git a/lib/processor/arm/CMakeLists.txt b/lib/processor/arm/CMakeLists.txt deleted file mode 100644 index a20967bf..00000000 --- a/lib/processor/arm/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -collect (PROJECT_LIB_HEADERS atomic.h) -collect (PROJECT_LIB_HEADERS cpu.h) - diff --git a/lib/processor/arm/atomic.h b/lib/processor/arm/atomic.h deleted file mode 100644 index ab5ee406..00000000 --- a/lib/processor/arm/atomic.h +++ /dev/null @@ -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__ */ diff --git a/lib/processor/arm/cpu.h b/lib/processor/arm/cpu.h deleted file mode 100644 index 0ea96102..00000000 --- a/lib/processor/arm/cpu.h +++ /dev/null @@ -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__ */ diff --git a/lib/processor/ceva/CMakeLists.txt b/lib/processor/ceva/CMakeLists.txt deleted file mode 100644 index 11b0f7d5..00000000 --- a/lib/processor/ceva/CMakeLists.txt +++ /dev/null @@ -1,2 +0,0 @@ -collect (PROJECT_LIB_HEADERS cpu.h) - diff --git a/lib/processor/csky/CMakeLists.txt b/lib/processor/csky/CMakeLists.txt deleted file mode 100644 index 11b0f7d5..00000000 --- a/lib/processor/csky/CMakeLists.txt +++ /dev/null @@ -1,2 +0,0 @@ -collect (PROJECT_LIB_HEADERS cpu.h) - diff --git a/lib/processor/csky/cpu.h b/lib/processor/csky/cpu.h deleted file mode 100644 index a3938488..00000000 --- a/lib/processor/csky/cpu.h +++ /dev/null @@ -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__ */ diff --git a/lib/processor/generic/atomic.h b/lib/processor/generic/atomic.h new file mode 100644 index 00000000..9a2b252c --- /dev/null +++ b/lib/processor/generic/atomic.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__ */ diff --git a/lib/processor/generic/cpu.h b/lib/processor/generic/cpu.h new file mode 100644 index 00000000..60a72576 --- /dev/null +++ b/lib/processor/generic/cpu.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__ */ diff --git a/lib/processor/hosted/CMakeLists.txt b/lib/processor/hosted/CMakeLists.txt deleted file mode 100644 index 13ce0230..00000000 --- a/lib/processor/hosted/CMakeLists.txt +++ /dev/null @@ -1,2 +0,0 @@ -collect (PROJECT_LIB_HEADERS atomic.h) -collect (PROJECT_LIB_HEADERS cpu.h) diff --git a/lib/processor/hosted/atomic.h b/lib/processor/hosted/atomic.h deleted file mode 100644 index ed153c30..00000000 --- a/lib/processor/hosted/atomic.h +++ /dev/null @@ -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__ */ diff --git a/lib/processor/microblaze/CMakeLists.txt b/lib/processor/microblaze/CMakeLists.txt deleted file mode 100644 index a20967bf..00000000 --- a/lib/processor/microblaze/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -collect (PROJECT_LIB_HEADERS atomic.h) -collect (PROJECT_LIB_HEADERS cpu.h) - diff --git a/lib/processor/microblaze/atomic.h b/lib/processor/microblaze/atomic.h deleted file mode 100644 index d576662f..00000000 --- a/lib/processor/microblaze/atomic.h +++ /dev/null @@ -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__ */ diff --git a/lib/processor/microblaze/cpu.h b/lib/processor/microblaze/cpu.h deleted file mode 100644 index 012df465..00000000 --- a/lib/processor/microblaze/cpu.h +++ /dev/null @@ -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 -#include - -#define metal_cpu_yield() - -#endif /* __METAL_MICROBLAZE__H__ */ diff --git a/lib/processor/riscv/CMakeLists.txt b/lib/processor/riscv/CMakeLists.txt deleted file mode 100644 index 11b0f7d5..00000000 --- a/lib/processor/riscv/CMakeLists.txt +++ /dev/null @@ -1,2 +0,0 @@ -collect (PROJECT_LIB_HEADERS cpu.h) - diff --git a/lib/processor/riscv/cpu.h b/lib/processor/riscv/cpu.h deleted file mode 100644 index ff02d9f8..00000000 --- a/lib/processor/riscv/cpu.h +++ /dev/null @@ -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__ */ diff --git a/lib/processor/x86/CMakeLists.txt b/lib/processor/x86/CMakeLists.txt deleted file mode 100644 index a20967bf..00000000 --- a/lib/processor/x86/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -collect (PROJECT_LIB_HEADERS atomic.h) -collect (PROJECT_LIB_HEADERS cpu.h) - diff --git a/lib/processor/x86/atomic.h b/lib/processor/x86/atomic.h deleted file mode 100644 index bf98a9d1..00000000 --- a/lib/processor/x86/atomic.h +++ /dev/null @@ -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__ */ diff --git a/lib/processor/x86_64/CMakeLists.txt b/lib/processor/x86_64/CMakeLists.txt deleted file mode 100644 index a20967bf..00000000 --- a/lib/processor/x86_64/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -collect (PROJECT_LIB_HEADERS atomic.h) -collect (PROJECT_LIB_HEADERS cpu.h) - diff --git a/lib/processor/x86_64/atomic.h b/lib/processor/x86_64/atomic.h deleted file mode 100644 index ee773997..00000000 --- a/lib/processor/x86_64/atomic.h +++ /dev/null @@ -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__ */ diff --git a/lib/processor/xtensa/CMakeLists.txt b/lib/processor/xtensa/CMakeLists.txt deleted file mode 100644 index 13ce0230..00000000 --- a/lib/processor/xtensa/CMakeLists.txt +++ /dev/null @@ -1,2 +0,0 @@ -collect (PROJECT_LIB_HEADERS atomic.h) -collect (PROJECT_LIB_HEADERS cpu.h) diff --git a/lib/processor/xtensa/atomic.h b/lib/processor/xtensa/atomic.h deleted file mode 100644 index 6f87ea92..00000000 --- a/lib/processor/xtensa/atomic.h +++ /dev/null @@ -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__ */