1 /* 2 * Copyright (c) 2023 Nordic Semiconductor ASA 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 #ifndef NSI_COMMON_SRC_INCL_NSI_TRACING_H 8 #define NSI_COMMON_SRC_INCL_NSI_TRACING_H 9 10 #include <stdarg.h> 11 12 #ifdef __cplusplus 13 extern "C" { 14 #endif 15 16 /* 17 * Native simulator tracing API: 18 * Print a message/warning/error to the tracing backend 19 * and in case of nsi_print_error_and_exit() also call nsi_exit() 20 * 21 * All print()/vprint() APIs take the same arguments as printf()/vprintf(). 22 */ 23 24 void nsi_print_error_and_exit(const char *format, ...); 25 void nsi_print_warning(const char *format, ...); 26 void nsi_print_trace(const char *format, ...); 27 void nsi_vprint_error_and_exit(const char *format, va_list vargs); 28 void nsi_vprint_warning(const char *format, va_list vargs); 29 void nsi_vprint_trace(const char *format, va_list vargs); 30 31 /* 32 * @brief Is the tracing backend connected to a ptty/terminal or not 33 * 34 * @param nbr: Which output. Options are: 0 trace output, 1: warning and error output 35 * 36 * @return 37 * 0 : Not a ptty (i.e. probably a pipe to another program) 38 * 1 : Connected to a ptty (for ex. stdout/err to the invoking terminal) 39 * -1: Unknown at this point 40 */ 41 int nsi_trace_over_tty(int nbr); 42 43 #ifdef __cplusplus 44 } 45 #endif 46 47 #endif /* NSI_COMMON_SRC_INCL_NSI_TRACING_H */ 48