498 #ifndef ti_log_Log__include 499 #define ti_log_Log__include 507 #if defined (__cplusplus) 519 #if defined(DOXYGEN) || ti_log_Log_ENABLE 529 #define Log_TI_LOG_VERSION 0.1.0 565 #define Log_MODULE_DEFINE(name, init) const Log_Module LogMod_ ## name = init 586 #if defined(DOXYGEN) || defined(__IAR_SYSTEMS_ICC__) 587 #define Log_MODULE_DEFINE_WEAK(name, init) const __weak Log_Module LogMod_ ## name = init 588 #elif defined(__TI_COMPILER_VERSION__) || (defined(__clang__) && defined(__ti_version__)) || defined(__GNUC__) 589 #define Log_MODULE_DEFINE_WEAK(name, init) const Log_Module LogMod_ ## name __attribute__((weak)) = init 591 #error "Incompatible compiler: Logging is currently supported by the following \ 592 compilers: TI ARM Compiler, TI CLANG Compiler, GCC, IAR. Please migrate to a \ 606 #define Log_MODULE_USE(name) extern const Log_Module LogMod_ ## name 614 #define LOG_MODULE_SYM(name) LogMod_ ## name 623 #define _Log_GUARD_MACRO(x) do{ x }while(0) 639 #define _Log_CAR_ARG(N, ...) N 640 #define _Log_CDR_ARG(N, ...) __VA_ARGS__ 647 #define _Log_CONCAT2_A(x,y) x ## _ ## y 648 #define _Log_CONCAT2(x,y) _Log_CONCAT2_A(x,y) 649 #define _Log_CONCAT3(x,y,z) _Log_CONCAT2(x,_Log_CONCAT2(y,z)) 652 #define _Log__TOKEN2STRING_A(x) #x 653 #define _Log_TOKEN2STRING(x) _Log__TOKEN2STRING_A(x) 656 #define _Log_APPEND_META_TO_FORMAT(opcode, \ 663 _Log_TOKEN2STRING(opcode) "\x1e" \ 664 _Log_TOKEN2STRING(file) "\x1e" \ 665 _Log_TOKEN2STRING(line) "\x1e" \ 666 _Log_TOKEN2STRING(level) "\x1e" \ 667 _Log_TOKEN2STRING(module) "\x1e" \ 668 _Log_TOKEN2STRING(format) "\x1e" \ 669 _Log_TOKEN2STRING(nargs) 674 #if defined(__IAR_SYSTEMS_ICC__) 675 #define _Log_PLACE_FORMAT_IN_SECTOR(name, opcode, level, module, format, nargs)\ 676 __root static const char name[] @ ".log_data" = \ 677 _Log_APPEND_META_TO_FORMAT(opcode, \ 684 __root static const char * const _Log_CONCAT2(Ptr, name) @ _Log_TOKEN2STRING(_Log_CONCAT2(.log_ptr, module)) = name; 685 #elif defined(__TI_COMPILER_VERSION__) || (defined(__clang__) && defined(__ti_version__)) || defined(__GNUC__) 686 #define _Log_PLACE_FORMAT_IN_SECTOR(name, opcode, level, module, format, nargs)\ 687 static const char name[] \ 688 __attribute__((used,section(".log_data"))) = \ 689 _Log_APPEND_META_TO_FORMAT(opcode, \ 696 static const char * const _Log_CONCAT2(Ptr, name) \ 697 __attribute__((used,section(_Log_TOKEN2STRING(_Log_CONCAT3(.log_ptr, __LINE__, module))))) = name; 699 #error "Incompatible compiler: Logging is currently supported by the following \ 700 compilers: TI ARM Compiler, TI CLANG Compiler, GCC, IAR. Please migrate to a \ 708 #define _Log_NUMARGS(...) _Log_NUMARGS_A(__VA_ARGS__, 8, 7, 6, 5, 4, 3, 2, 1, 0) 709 #define _Log_NUMARGS_A(...) _Log_NUMARGS_B(__VA_ARGS__) 710 #define _Log_NUMARGS_B(_first, _8, _7, _6, _5, _4, _3, _2, _1, N, ...) N 718 #define _Log_VARIANT(x, module, level, ...) \ 719 _Log_CONCAT2(x, _Log_NUMARGS_B(__VA_ARGS__, _arg8, _arg7, _arg6, _arg5, _arg4, _arg3, _arg2, _arg1, _noarg)) ( module, level, __VA_ARGS__ ) 728 #define _Log_SECOND_ARG(x, y, ...) y 733 #define _Log_TOKEN_1 0, 742 #define _Log_DEFINED(x) _Log_DEFINED_A(x) 747 #define _Log_DEFINED_A(y) _Log_DEFINED_B(_Log_TOKEN_##y) 754 #define _Log_DEFINED_B(z) _Log_SECOND_ARG(z 1, 0) 759 #define _Log_buf_C_0(module, level, format, data, size) 764 #define _Log_buf_C_1(module, level, format, data, size) \ 766 Log_MODULE_USE(module); \ 767 if ((level) & LogMod_ ## module.levels) { \ 768 _Log_PLACE_FORMAT_IN_SECTOR(_Log_CONCAT2(LogSymbol, __LINE__), \ 774 LogMod_ ## module.buf(&LogMod_ ## module, \ 775 (uint32_t)&_Log_CONCAT2(LogSymbol, __LINE__), \ 776 (uint32_t)&_Log_CONCAT3(Ptr, LogSymbol, __LINE__), \ 793 #define _Log_buf_B(module, level, format, data, size) \ 794 _Log_CONCAT2(_Log_buf_C, _Log_DEFINED(ti_log_Log_ENABLE_ ## module))(module, level, format, data, size) 813 #define _Log_printf__arg1(module, level, fmt, a0) \ 814 module.printf1(&module, \ 815 (uint32_t)&_Log_CONCAT2(LogSymbol, __LINE__), \ 816 (uint32_t)&_Log_CONCAT3(Ptr, LogSymbol, __LINE__), \ 818 #define _Log_printf__arg2(module, level, fmt, a0, a1) \ 819 module.printf2(&module, \ 820 (uint32_t)&_Log_CONCAT2(LogSymbol, __LINE__), \ 821 (uint32_t)&_Log_CONCAT3(Ptr, LogSymbol, __LINE__), \ 824 #define _Log_printf__arg3(module, level, fmt, a0, a1, a2) \ 825 module.printf3(&module, \ 826 (uint32_t)&_Log_CONCAT2(LogSymbol, __LINE__), \ 827 (uint32_t)&_Log_CONCAT3(Ptr, LogSymbol, __LINE__), \ 831 #define _Log_printf__arg4(module, level, fmt, a0, a1, a2, a3) \ 832 _Log_printf__arg(module, level, fmt, (uintptr_t)a0, \ 836 #define _Log_printf__arg5(module, level, fmt, a0, a1, a2, a3, a4) \ 837 _Log_printf__arg(module, level, fmt, (uintptr_t)a0, \ 842 #define _Log_printf__arg6(module, level, fmt, a0, a1, a2, a3, a4, a5) \ 843 _Log_printf__arg(module, level, fmt, (uintptr_t)a0, \ 849 #define _Log_printf__arg7(module, level, fmt, a0, a1, a2, a3, a4, a5, a6) \ 850 _Log_printf__arg(module, level, fmt, (uintptr_t)a0, \ 857 #define _Log_printf__arg8(module, level, fmt, a0, a1, a2, a3, a4, a5, a6, a7) \ 858 _Log_printf__arg(module, level, fmt, (uintptr_t)a0, \ 867 #define _Log_printf__arg(module, level, ...) \ 868 module.printf(&module, \ 869 (uint32_t)&_Log_CONCAT2(LogSymbol, __LINE__), \ 870 (uint32_t)&_Log_CONCAT3(Ptr, LogSymbol, __LINE__), \ 871 _Log_NUMARGS(__VA_ARGS__), \ 872 _Log_CDR_ARG(__VA_ARGS__)) 874 #define _Log_printf__noarg(module, level, ...) \ 875 module.printf0(&module, \ 876 (uint32_t)&_Log_CONCAT2(LogSymbol, __LINE__), \ 877 (uint32_t)&_Log_CONCAT3(Ptr, LogSymbol, __LINE__)) 882 #define _Log_printf_C_0(opcode, module, level, ...) 887 #define _Log_printf_C_1(opcode, module, level, ...) \ 889 Log_MODULE_USE(module); \ 890 if (((LogMod_ ## module.dynamicLevelsPtr != NULL) && ((level) & *LogMod_ ## module.dynamicLevelsPtr)) || \ 891 ((level) & LogMod_ ## module.levels)) { \ 892 _Log_PLACE_FORMAT_IN_SECTOR(_Log_CONCAT2(LogSymbol, __LINE__), \ 896 _Log_CAR_ARG(__VA_ARGS__), \ 897 _Log_NUMARGS(__VA_ARGS__)) \ 898 _Log_VARIANT(_Log_printf, LogMod_ ## module, level, __VA_ARGS__); \ 913 #define _Log_printf_B(opcode, module, level, ...) \ 914 _Log_CONCAT2(_Log_printf_C, _Log_DEFINED(ti_log_Log_ENABLE_ ## module))(opcode, module, level, __VA_ARGS__) 932 #define Log_buf(module, level, format, data, size) _Log_buf_B(module, level, format, data, size) 953 #define Log_printf(module, level, ...) _Log_printf_B(LOG_OPCODE_FORMATED_TEXT, module, level, __VA_ARGS__) 959 #if defined(__IAR_SYSTEMS_ICC__) 960 #define _Log_DEFINE_LOG_VERSION(module, version) \ 961 __root static const char _Log_CONCAT2(Log_ti_log_version, __COUNTER__)[] @ ".log_data" = \ 962 _Log_APPEND_META_TO_FORMAT(LOG_OPCODE_VERSION, \ 969 #elif defined(__TI_COMPILER_VERSION__) || (defined(__clang__) && defined(__ti_version__)) || defined(__GNUC__) 970 #define _Log_DEFINE_LOG_VERSION(module, version) \ 971 static const char _Log_CONCAT2(Log_ti_log_version, __COUNTER__)[] \ 972 __attribute__((used,section(".log_data"))) = \ 973 _Log_APPEND_META_TO_FORMAT(LOG_OPCODE_VERSION, \ 981 #error "Incompatible compiler: Logging is currently supported by the following \ 982 compilers: TI ARM Compiler, TI CLANG Compiler, GCC, IAR. Please migrate to a \ 1001 #define Log_MODULE_SET_LEVELS(module, levels) \ 1003 Log_MODULE_USE(module); \ 1004 if (LogMod_ ## module.dynamicLevelsPtr != NULL) { \ 1005 *LogMod_ ## module.dynamicLevelsPtr = levels; \ 1018 #define Log_MODULE_GET_LEVELS(module) \ 1020 Log_MODULE_USE(module); \ 1021 if (LogMod_ ## module.dynamicLevelsPtr != NULL) { \ 1022 *LogMod_ ## module.dynamicLevelsPtr; \ 1025 LogMod_ ## module.levels; \ 1037 #define Log_MODULE_DEFINE(...) 1038 #define Log_MODULE_DEFINE_WEAK(name, init) 1039 #define Log_MODULE_USE(...) 1040 #define Log_printf(module, level, ...) 1041 #define Log_buf(module, level, ...) 1042 #define _Log_DEFINE_LOG_VERSION(module, version) 1043 #define Log_MODULE_SET_LEVELS(module, levels) 1044 #define Log_MODULE_GET_LEVELS(module) 1160 #if defined (__cplusplus) 1164 #endif // ti_log_Log__include
void(* Log_printfN_fxn)(const Log_Module *handle, uint32_t header, uint32_t headerPtr,...)
Definition: Log.h:1131
Log_Level
Log level bitmask values.
Definition: Log.h:1056
const Log_buf_fxn buf
Definition: Log.h:1154
void(* Log_printf_fxn)(const Log_Module *handle, uint32_t header, uint32_t headerPtr, uint32_t numArgs,...)
Definition: Log.h:1125
const Log_printf_fxn printf
Definition: Log.h:1149
void(* Log_buf_fxn)(const Log_Module *handle, uint32_t header, uint32_t headerPtr, uint8_t *data, size_t size)
Definition: Log.h:1136
const Log_printfN_fxn printf0
Definition: Log.h:1150
Log module.
Definition: Log.h:1147
uint32_t *const dynamicLevelsPtr
Definition: Log.h:1156
uint32_t levels
Definition: Log.h:1155
#define Log_TI_LOG_VERSION
Log version.
Definition: Log.h:529
const Log_printfN_fxn printf1
Definition: Log.h:1151
const Log_printfN_fxn printf3
Definition: Log.h:1153
const Log_printfN_fxn printf2
Definition: Log.h:1152
void * sinkConfig
Definition: Log.h:1148