1 /* 2 * Copyright (c) 2018, Pinecone Inc. and Contributors. All rights reserved. 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 6 7 /* 8 * @file nuttx/sys.h 9 * @brief NuttX system primitives for libmetal. 10 */ 11 12 #ifndef __METAL_SYS__H__ 13 #error "Include metal/sys.h instead of metal/nuttx/sys.h" 14 #endif 15 16 #ifndef __METAL_NUTTX_SYS__H__ 17 #define __METAL_NUTTX_SYS__H__ 18 19 #include <metal/sleep.h> 20 21 #ifdef __cplusplus 22 extern "C" { 23 #endif 24 25 #define metal_yield() metal_sleep_usec(1000) 26 27 #define METAL_INIT_DEFAULTS \ 28 { \ 29 .log_handler = (metal_log_handler)syslog, \ 30 .log_level = METAL_LOG_INFO, \ 31 } 32 33 /** Structure of nuttx libmetal runtime state. */ 34 struct metal_state { 35 36 /** Common (system independent) data. */ 37 struct metal_common_state common; 38 }; 39 40 #ifdef __cplusplus 41 } 42 #endif 43 44 #endif /* __METAL_NUTTX_SYS__H__ */ 45