1 /* 2 * Copyright (c) 2017, Linaro Limited 3 * SPDX-License-Identifier: BSD-2-Clause 4 */ 5 6 #ifndef COMMON_H 7 #define COMMON_H 8 9 /* 10 * Misc. output defines 11 */ 12 13 #define OUTPUT_APP_PREFIX "Benchmark" 14 15 #ifdef DEBUG 16 #define DBG(fmt, args...) printf("[" OUTPUT_APP_PREFIX \ 17 "] DEBUG: %s:%d:%s(): " fmt "\n", __FILE__, __LINE__, __func__, ##args) 18 #else 19 #define DBG(fmt, args...) 20 #endif 21 22 #define INFO(fmt, args...) printf("[" OUTPUT_APP_PREFIX \ 23 "] INFO: " fmt "\n", ##args) 24 #define ERROR(fmt, args...) fprintf(stderr, "[" OUTPUT_APP_PREFIX \ 25 "] ERROR: " fmt "\n", ##args) 26 27 #define ERROR_EXIT(fmt, args...) do { \ 28 ERROR(fmt, ##args); \ 29 exit(EXIT_FAILURE); \ 30 } while(0) 31 32 #define ERROR_RETURN_FALSE(fmt, args...) do { \ 33 ERROR(fmt, ##args); \ 34 return false; \ 35 } while(0) 36 37 #define ERROR_GOTO(label, fmt, args...) do { \ 38 ERROR(fmt, ##args); \ 39 goto label; \ 40 } while(0) 41 42 43 44 45 #define STAT_AMOUNT 5 46 #define TSFILE_NAME_SUFFIX ".ts" 47 #define YAML_IMPLICIT 1 48 /* 49 * Ringbuffer return codes 50 */ 51 #define RING_SUCCESS 0 52 #define RING_BADPARM -1 53 #define RING_NODATA -2 54 55 #define LIBTEEC_NAME "libteec.so" 56 #endif /* COMMON.H */ 57 58