1 /* 2 * Copyright (c) 2016, Xilinx Inc. and Contributors. All rights reserved. 3 * Copyright (c) 2022-2023 Advanced Micro Devices, Inc. All Rights Reserved. 4 * 5 * SPDX-License-Identifier: BSD-3-Clause 6 */ 7 8 /* 9 * @file freertos/sys.h 10 * @brief FreeRTOS system primitives for libmetal. 11 */ 12 13 #ifndef __METAL_SYS__H__ 14 #error "Include metal/sys.h instead of metal/freertos/sys.h" 15 #endif 16 17 #ifndef __METAL_FREERTOS_SYS__H__ 18 #define __METAL_FREERTOS_SYS__H__ 19 20 #include <metal/errno.h> 21 #include <metal/cpu.h> 22 23 #ifdef XLNX_PLATFORM 24 #include <metal/system/freertos/xlnx/sys.h> 25 #else 26 #include "./@PROJECT_MACHINE@/sys.h" 27 #endif 28 29 #ifdef __cplusplus 30 extern "C" { 31 #endif 32 33 #ifndef METAL_MAX_DEVICE_REGIONS 34 #define METAL_MAX_DEVICE_REGIONS 1 35 #endif 36 37 #define metal_yield() metal_cpu_yield() 38 39 /** Structure for FreeRTOS libmetal runtime state. */ 40 struct metal_state { 41 42 /** Common (system independent) data. */ 43 struct metal_common_state common; 44 }; 45 46 #ifdef METAL_INTERNAL 47 48 /** 49 * @brief restore interrupts to state before disable_global_interrupt() 50 */ 51 void sys_irq_restore_enable(unsigned int flags); 52 53 /** 54 * @brief disable all interrupts 55 */ 56 unsigned int sys_irq_save_disable(void); 57 58 #endif /* METAL_INTERNAL */ 59 60 #ifdef __cplusplus 61 } 62 #endif 63 64 #endif /* __METAL_FREERTOS_SYS__H__ */ 65