473 #ifndef ti_log_Log__include 474 #define ti_log_Log__include 486 #if defined (__cplusplus) 497 #if ti_log_Log_ENABLE 504 #define Log_TI_LOG_VERSION 0.1.0 530 #define Log_MODULE_DEFINE(name, init) const Log_Module LogMod_ ## name = init 551 #if defined(__IAR_SYSTEMS_ICC__) 552 #define Log_MODULE_DEFINE_WEAK(name, init) const __weak Log_Module LogMod_ ## name = init 553 #elif defined(__TI_COMPILER_VERSION__) || (defined(__clang__) && defined(__ti_version__)) || defined(__GNUC__) 554 #define Log_MODULE_DEFINE_WEAK(name, init) const Log_Module LogMod_ ## name __attribute__((weak)) = init 556 #error "Incompatible compiler: Logging is currently supported by the following \ 557 compilers: TI ARM Compiler, TI CLANG Compiler, GCC, IAR. Please migrate to a \ 558 a supported compiler." 571 #define Log_MODULE_USE(name) extern const Log_Module LogMod_ ## name 579 #define LOG_MODULE_SYM(name) LogMod_ ## name 588 #define _Log_GUARD_MACRO(x) do{ x }while(0) 604 #define _Log_CAR_ARG(N, ...) N 605 #define _Log_CDR_ARG(N, ...) __VA_ARGS__ 612 #define _Log_CONCAT2_A(x,y) x ## _ ## y 613 #define _Log_CONCAT2(x,y) _Log_CONCAT2_A(x,y) 614 #define _Log_CONCAT3(x,y,z) _Log_CONCAT2(x,_Log_CONCAT2(y,z)) 617 #define _Log__TOKEN2STRING_A(x) #x 618 #define _Log_TOKEN2STRING(x) _Log__TOKEN2STRING_A(x) 621 #define _Log_APPEND_META_TO_FORMAT(opcode, \ 628 _Log_TOKEN2STRING(opcode) "\x1e" \ 629 _Log_TOKEN2STRING(file) "\x1e" \ 630 _Log_TOKEN2STRING(line) "\x1e" \ 631 _Log_TOKEN2STRING(level) "\x1e" \ 632 _Log_TOKEN2STRING(module) "\x1e" \ 633 _Log_TOKEN2STRING(format) "\x1e" \ 634 _Log_TOKEN2STRING(nargs) 639 #if defined(__IAR_SYSTEMS_ICC__) 640 #define _Log_PLACE_FORMAT_IN_SECTOR(name, opcode, level, module, format, nargs)\ 641 __root static const char name[] @ ".log_data" = \ 642 _Log_APPEND_META_TO_FORMAT(opcode, \ 649 __root static const char * const _Log_CONCAT2(Ptr, name) @ _Log_TOKEN2STRING(_Log_CONCAT2(.log_ptr, module)) = name; 650 #elif defined(__TI_COMPILER_VERSION__) || (defined(__clang__) && defined(__ti_version__)) || defined(__GNUC__) 651 #define _Log_PLACE_FORMAT_IN_SECTOR(name, opcode, level, module, format, nargs)\ 652 static const char name[] \ 653 __attribute__((used,section(".log_data"))) = \ 654 _Log_APPEND_META_TO_FORMAT(opcode, \ 661 static const char * const _Log_CONCAT2(Ptr, name) \ 662 __attribute__((used,section(_Log_TOKEN2STRING(_Log_CONCAT3(.log_ptr, __LINE__, module))))) = name; 664 #error "Incompatible compiler: Logging is currently supported by the following \ 665 compilers: TI ARM Compiler, TI CLANG Compiler, GCC, IAR. Please migrate to a \ 666 a supported compiler." 673 #define _Log_NUMARGS(...) _Log_NUMARGS_A(__VA_ARGS__, 8, 7, 6, 5, 4, 3, 2, 1, 0) 674 #define _Log_NUMARGS_A(...) _Log_NUMARGS_B(__VA_ARGS__) 675 #define _Log_NUMARGS_B(_first, _8, _7, _6, _5, _4, _3, _2, _1, N, ...) N 683 #define _Log_VARIANT(x, module, level, ...) \ 684 _Log_CONCAT2(x, _Log_NUMARGS_B(__VA_ARGS__, _arg8, _arg7, _arg6, _arg5, _arg4, _arg3, _arg2, _arg1, _noarg)) ( module, level, __VA_ARGS__ ) 693 #define _Log_SECOND_ARG(x, y, ...) y 698 #define _Log_TOKEN_1 0, 707 #define _Log_DEFINED(x) _Log_DEFINED_A(x) 712 #define _Log_DEFINED_A(y) _Log_DEFINED_B(_Log_TOKEN_##y) 719 #define _Log_DEFINED_B(z) _Log_SECOND_ARG(z 1, 0) 724 #define _Log_buf_C_0(module, level, format, data, size) 729 #define _Log_buf_C_1(module, level, format, data, size) \ 731 Log_MODULE_USE(module); \ 732 if ((Log_ENABLED & LogMod_ ## module.levels) && ((level) & LogMod_ ## module.levels)) { \ 733 _Log_PLACE_FORMAT_IN_SECTOR(_Log_CONCAT2(LogSymbol, __LINE__), \ 739 LogMod_ ## module.buf(&LogMod_ ## module, \ 740 (uint32_t)&_Log_CONCAT2(LogSymbol, __LINE__), \ 741 (uint32_t)&_Log_CONCAT3(Ptr, LogSymbol, __LINE__), \ 758 #define _Log_buf_B(module, level, format, data, size) \ 759 _Log_CONCAT2(_Log_buf_C, _Log_DEFINED(ti_log_Log_ENABLE_ ## module))(module, level, format, data, size) 765 #define _Log_printf__arg1(module, level, fmt, a0) \ 766 _Log_printf__arg(module, level, fmt, (uintptr_t)a0) 767 #define _Log_printf__arg2(module, level, fmt, a0, a1) \ 768 _Log_printf__arg(module, level, fmt, (uintptr_t)a0, \ 770 #define _Log_printf__arg3(module, level, fmt, a0, a1, a2) \ 771 _Log_printf__arg(module, level, fmt, (uintptr_t)a0, \ 774 #define _Log_printf__arg4(module, level, fmt, a0, a1, a2, a3) \ 775 _Log_printf__arg(module, level, fmt, (uintptr_t)a0, \ 779 #define _Log_printf__arg5(module, level, fmt, a0, a1, a2, a3, a4) \ 780 _Log_printf__arg(module, level, fmt, (uintptr_t)a0, \ 785 #define _Log_printf__arg6(module, level, fmt, a0, a1, a2, a3, a4, a5) \ 786 _Log_printf__arg(module, level, fmt, (uintptr_t)a0, \ 792 #define _Log_printf__arg7(module, level, fmt, a0, a1, a2, a3, a4, a5, a6) \ 793 _Log_printf__arg(module, level, fmt, (uintptr_t)a0, \ 800 #define _Log_printf__arg8(module, level, fmt, a0, a1, a2, a3, a4, a5, a6, a7) \ 801 _Log_printf__arg(module, level, fmt, (uintptr_t)a0, \ 810 #define _Log_printf__arg(module, level, ...) \ 811 module.printf(&module, \ 812 (uint32_t)&_Log_CONCAT2(LogSymbol, __LINE__), \ 813 (uint32_t)&_Log_CONCAT3(Ptr, LogSymbol, __LINE__), \ 814 _Log_NUMARGS(__VA_ARGS__), \ 815 _Log_CDR_ARG(__VA_ARGS__)) 817 #define _Log_printf__noarg(module, level, ...) \ 818 module.printf(&module, \ 819 (uint32_t)&_Log_CONCAT2(LogSymbol, __LINE__), \ 820 (uint32_t)&_Log_CONCAT3(Ptr, LogSymbol, __LINE__), \ 821 _Log_NUMARGS(__VA_ARGS__)) 826 #define _Log_printf_C_0(opcode, module, level, ...) 831 #define _Log_printf_C_1(opcode, module, level, ...) \ 833 Log_MODULE_USE(module); \ 834 if ((Log_ENABLED & LogMod_ ## module.levels) && \ 835 ((level) & LogMod_ ## module.levels)) { \ 836 _Log_PLACE_FORMAT_IN_SECTOR(_Log_CONCAT2(LogSymbol, __LINE__), \ 840 _Log_CAR_ARG(__VA_ARGS__), \ 841 _Log_NUMARGS(__VA_ARGS__)) \ 842 _Log_VARIANT(_Log_printf, LogMod_ ## module, level, __VA_ARGS__); \ 857 #define _Log_printf_B(opcode, module, level, ...) \ 858 _Log_CONCAT2(_Log_printf_C, _Log_DEFINED(ti_log_Log_ENABLE_ ## module))(opcode, module, level, __VA_ARGS__) 873 #if defined(__IAR_SYSTEMS_ICC__) 874 #define Log_EVENT_DEFINE(name, fmt) \ 875 __root const char LogSymbol_ ## name[] @ ".log_data" = \ 876 _Log_APPEND_META_TO_FORMAT(LOG_EVENT_CONSTRUCT, \ 884 #elif defined(__TI_COMPILER_VERSION__) || (defined(__clang__) && defined(__ti_version__)) || defined(__GNUC__) 885 #define Log_EVENT_DEFINE(name, fmt) \ 886 const char LogSymbol_ ## name[] \ 887 __attribute__((used,section(".log_data"))) = \ 888 _Log_APPEND_META_TO_FORMAT(LOG_EVENT_CONSTRUCT, \ 896 #error "Incompatible compiler: Logging is currently supported by the following \ 897 compilers: TI ARM Compiler, TI CLANG Compiler, GCC, IAR. Please migrate to a \ 898 a supported compiler." 909 #define Log_EVENT_USE(name) extern const char[] LogSymbol_ ## name; 926 #define Log_buf(module, level, format, data, size) _Log_buf_B(module, level, format, data, size) 948 #define Log_printf(module, level, ...) _Log_printf_B(LOG_OPCODE_FORMATED_TEXT, module, level, __VA_ARGS__) 950 #define Log_event(module, level, ...) _Log_printf_B(LOG_OPCODE_EVENT, module, level, __VA_ARGS__) 956 #if defined(__IAR_SYSTEMS_ICC__) 957 #define _Log_DEFINE_LOG_VERSION(module, version) \ 958 __root static const char _Log_CONCAT2(Log_ti_log_version, __COUNTER__)[] @ ".log_data" = \ 959 _Log_APPEND_META_TO_FORMAT(LOG_OPCODE_VERSION, \ 966 #elif defined(__TI_COMPILER_VERSION__) || (defined(__clang__) && defined(__ti_version__)) || defined(__GNUC__) 967 #define _Log_DEFINE_LOG_VERSION(module, version) \ 968 static const char _Log_CONCAT2(Log_ti_log_version, __COUNTER__)[] \ 969 __attribute__((used,section(".log_data"))) = \ 970 _Log_APPEND_META_TO_FORMAT(LOG_OPCODE_VERSION, \ 978 #error "Incompatible compiler: Logging is currently supported by the following \ 979 compilers: TI ARM Compiler, TI CLANG Compiler, GCC, IAR. Please migrate to a \ 980 a supported compiler." 994 #define Log_MODULE_DEFINE(...) 995 #define Log_MODULE_DEFINE_WEAK(name, init) 996 #define Log_MODULE_USE(...) 997 #define Log_EVENT_DEFINE(name, fmt) 998 #define Log_EVENT_USE(name, fmt) 999 #define Log_printf(module, level, ...) 1000 #define Log_event(module, level, ...) 1001 #define Log_buf(module, level, ...) 1002 #define _Log_DEFINE_LOG_VERSION(module, version) 1041 #if defined (__cplusplus) 1045 #endif // ti_log_Log__include
Log_Level
Definition: Log.h:1009
const Log_buf_fxn buf
Definition: Log.h:1036
void(* Log_printf_fxn)(const Log_Module *handle, uint32_t header, uint32_t headerPtr, uint32_t numArgs,...)
Definition: Log.h:1021
const Log_printf_fxn printf
Definition: Log.h:1035
void(* Log_buf_fxn)(const Log_Module *handle, uint32_t header, uint32_t headerPtr, uint8_t *data, size_t size)
Definition: Log.h:1027
#define _Log_DEFINE_LOG_VERSION(module, version)
Definition: Log.h:1002
uint32_t levels
Definition: Log.h:1037
void * sinkConfig
Definition: Log.h:1034