lib: system: template: remove template/sys.h for generic and freeRTOS

Declare sys_irq_enable() and sys_irq_enable() directly in
lib/system/@PROJECT_SYSTEM@/sys.h.
This allows to declare the machine out of tree of the libmetal but
also to support the in-tree template.

[minor style fix by tanmay]

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
Signed-off-by: Tanmay Shah <tanmay.shah@amd.com>
This commit is contained in:
Arnaud Pouliquen
2025-12-22 09:58:44 +01:00
committed by Arnaud Pouliquen
parent 9c593d7a95
commit ece95f0e71
6 changed files with 28 additions and 80 deletions

View File

@@ -20,7 +20,6 @@
#include <metal/errno.h>
#include <metal/cpu.h>
#include "./@PROJECT_MACHINE@/sys.h"
#ifdef __cplusplus
extern "C" {
#endif
@@ -50,6 +49,20 @@ void sys_irq_restore_enable(unsigned int flags);
*/
unsigned int sys_irq_save_disable(void);
/**
* @brief Enable interrupt identified by the "vector" ID
*
* External function to define in the machine
*/
void sys_irq_enable(unsigned int vector);
/**
* @brief Disable interrupt identified by the "vector" ID
*
* External function to define in the machine
*/
void sys_irq_disable(unsigned int vector);
#endif /* METAL_INTERNAL */
#ifdef __cplusplus

View File

@@ -1,4 +1,2 @@
collect (PROJECT_LIB_HEADERS sys.h)
collect (PROJECT_LIB_SOURCES sys.c)

View File

@@ -1,39 +0,0 @@
/*
* Copyright (c) 2018, Linaro Inc. and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
/**
* @file freertos/template/sys.h
* @brief freertos template system primitives for libmetal.
*/
#ifndef __METAL_FREERTOS_SYS__H__
#error "Include metal/sys.h instead of metal/freertos/@PROJECT_MACHINE@/sys.h"
#endif
#ifndef __METAL_FREERTOS_TEMPLATE_SYS__H__
#define __METAL_FREERTOS_TEMPLATE_SYS__H__
#include <metal/cpu.h>
#ifdef __cplusplus
extern "C" {
#endif
#define metal_yield() metal_cpu_yield()
#ifdef METAL_INTERNAL
void sys_irq_enable(unsigned int vector);
void sys_irq_disable(unsigned int vector);
#endif /* METAL_INTERNAL */
#ifdef __cplusplus
}
#endif
#endif /* __METAL_FREERTOS_SYS__H__ */

View File

@@ -24,7 +24,6 @@
#include <stdarg.h>
#include <string.h>
#include "./@PROJECT_MACHINE@/sys.h"
#ifdef __cplusplus
extern "C" {
#endif
@@ -54,6 +53,20 @@ void sys_irq_restore_enable(unsigned int flags);
*/
unsigned int sys_irq_save_disable(void);
/**
* @brief Enable interruptidentified by the "vector" ID
*
* External function to define in the machine
*/
void sys_irq_enable(unsigned int vector);
/**
* @brief Disable interrupt identified by the "vector" IDr
*
* External function to define in the machine
*/
void sys_irq_disable(unsigned int vector);
#endif /* METAL_INTERNAL */
#ifdef __cplusplus

View File

@@ -1,3 +1 @@
collect (PROJECT_LIB_HEADERS sys.h)
collect (PROJECT_LIB_SOURCES sys.c)

View File

@@ -1,35 +0,0 @@
/*
* Copyright (c) 2018, Linaro Inc. and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
/**
* @file generic/template/sys.h
* @brief generic template system primitives for libmetal.
*/
#ifndef __METAL_GENERIC_SYS__H__
#error "Include metal/sys.h instead of metal/generic/@PROJECT_MACHINE@/sys.h"
#endif
#ifndef __METAL_GENERIC_TEMPLATE_SYS__H__
#define __METAL_GENERIC_TEMPLATE_SYS__H__
#ifdef __cplusplus
extern "C" {
#endif
#ifdef METAL_INTERNAL
void sys_irq_enable(unsigned int vector);
void sys_irq_disable(unsigned int vector);
#endif /* METAL_INTERNAL */
#ifdef __cplusplus
}
#endif
#endif /* __METAL_GENERIC_TEMPLATE_SYS__H__ */