1 /* 2 * Copyright (c) 2017, Linaro Limited. and Contributors. All rights reserved. 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 6 7 /* 8 * @file zephyr/sys.h 9 * @brief Zephyr system primitives for libmetal. 10 */ 11 12 #ifndef __METAL_SYS__H__ 13 #error "Include metal/sys.h instead of metal/zephyr/sys.h" 14 #endif 15 16 #ifndef __METAL_ZEPHYR_SYS__H__ 17 #define __METAL_ZEPHYR_SYS__H__ 18 19 #include <metal/cpu.h> 20 #include <stdlib.h> 21 #include <zephyr/kernel.h> 22 23 #ifdef __cplusplus 24 extern "C" { 25 #endif 26 27 #define metal_yield() metal_cpu_yield() 28 29 #define METAL_INIT_DEFAULTS \ 30 { \ 31 .log_handler = metal_zephyr_log_handler, \ 32 .log_level = METAL_LOG_INFO, \ 33 } 34 35 #ifndef METAL_MAX_DEVICE_REGIONS 36 #define METAL_MAX_DEVICE_REGIONS 1 37 #endif 38 39 /** Structure of zephyr libmetal runtime state. */ 40 struct metal_state { 41 42 /** Common (system independent) data. */ 43 struct metal_common_state common; 44 }; 45 metal_wait_usec(uint32_t usec_to_wait)46static inline void metal_wait_usec(uint32_t usec_to_wait) 47 { 48 k_busy_wait(usec_to_wait); 49 } 50 51 #ifdef __cplusplus 52 } 53 #endif 54 55 #endif /* __METAL_ZEPHYR_SYS__H__ */ 56