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 542 #define Log_MODULE_USE(name) extern const Log_Module LogMod_ ## name 550 #define LOG_MODULE_SYM(name) LogMod_ ## name 559 #define _Log_GUARD_MACRO(x) do{ x }while(0) 575 #define _Log_CAR_ARG(N, ...) N 576 #define _Log_CDR_ARG(N, ...) __VA_ARGS__ 583 #define _Log_CONCAT2_A(x,y) x ## _ ## y 584 #define _Log_CONCAT2(x,y) _Log_CONCAT2_A(x,y) 585 #define _Log_CONCAT3(x,y,z) _Log_CONCAT2(x,_Log_CONCAT2(y,z)) 588 #define _Log__TOKEN2STRING_A(x) #x 589 #define _Log_TOKEN2STRING(x) _Log__TOKEN2STRING_A(x) 592 #define _Log_APPEND_META_TO_FORMAT(opcode, \ 599 _Log_TOKEN2STRING(opcode) "\x1e" \ 600 _Log_TOKEN2STRING(file) "\x1e" \ 601 _Log_TOKEN2STRING(line) "\x1e" \ 602 _Log_TOKEN2STRING(level) "\x1e" \ 603 _Log_TOKEN2STRING(module) "\x1e" \ 604 _Log_TOKEN2STRING(format) "\x1e" \ 605 _Log_TOKEN2STRING(nargs) 610 #if defined(__IAR_SYSTEMS_ICC__) 611 #define _Log_PLACE_FORMAT_IN_SECTOR(name, opcode, level, module, format, nargs)\ 612 __root static const char name[] @ ".log_data" = \ 613 _Log_APPEND_META_TO_FORMAT(opcode, \ 620 __root static const char * const _Log_CONCAT2(Ptr, name) @ _Log_TOKEN2STRING(_Log_CONCAT2(.log_ptr, module)) = name; 621 #elif defined(__TI_COMPILER_VERSION__) || (defined(__clang__) && defined(__ti_version__)) || defined(__GNUC__) 622 #define _Log_PLACE_FORMAT_IN_SECTOR(name, opcode, level, module, format, nargs)\ 623 static const char name[] \ 624 __attribute__((used,section(".log_data"))) = \ 625 _Log_APPEND_META_TO_FORMAT(opcode, \ 632 static const char * const _Log_CONCAT2(Ptr, name) \ 633 __attribute__((used,section(_Log_TOKEN2STRING(_Log_CONCAT3(.log_ptr, __LINE__, module))))) = name; 635 #error Incompatible compiler: Logging is currently supported by the following \ 636 compilers: TI ARM Compiler, TI CLANG Compiler, GCC, IAR. Please migrate to a \ 637 a supported compiler. 644 #define _Log_NUMARGS(...) _Log_NUMARGS_A(__VA_ARGS__, 8, 7, 6, 5, 4, 3, 2, 1, 0) 645 #define _Log_NUMARGS_A(...) _Log_NUMARGS_B(__VA_ARGS__) 646 #define _Log_NUMARGS_B(_first, _8, _7, _6, _5, _4, _3, _2, _1, N, ...) N 654 #define _Log_VARIANT(x, module, level, ...) \ 655 _Log_CONCAT2(x, _Log_NUMARGS_B(__VA_ARGS__, _arg8, _arg7, _arg6, _arg5, _arg4, _arg3, _arg2, _arg1, _noarg)) ( module, level, __VA_ARGS__ ) 664 #define _Log_SECOND_ARG(x, y, ...) y 669 #define _Log_TOKEN_1 0, 678 #define _Log_DEFINED(x) _Log_DEFINED_A(x) 683 #define _Log_DEFINED_A(y) _Log_DEFINED_B(_Log_TOKEN_##y) 690 #define _Log_DEFINED_B(z) _Log_SECOND_ARG(z 1, 0) 695 #define _Log_buf_C_0(module, level, format, data, size) 700 #define _Log_buf_C_1(module, level, format, data, size) \ 702 Log_MODULE_USE(module); \ 703 if ((Log_ENABLED & LogMod_ ## module.levels) && ((level) & LogMod_ ## module.levels)) { \ 704 _Log_PLACE_FORMAT_IN_SECTOR(_Log_CONCAT2(LogSymbol, __LINE__), \ 710 LogMod_ ## module.buf(&LogMod_ ## module, \ 711 (uint32_t)&_Log_CONCAT2(LogSymbol, __LINE__), \ 712 (uint32_t)&_Log_CONCAT3(Ptr, LogSymbol, __LINE__), \ 729 #define _Log_buf_B(module, level, format, data, size) \ 730 _Log_CONCAT2(_Log_buf_C, _Log_DEFINED(ti_log_Log_ENABLE_ ## module))(module, level, format, data, size) 736 #define _Log_printf__arg1(module, level, fmt, a0) \ 737 _Log_printf__arg(module, level, fmt, (uintptr_t)a0) 738 #define _Log_printf__arg2(module, level, fmt, a0, a1) \ 739 _Log_printf__arg(module, level, fmt, (uintptr_t)a0, \ 741 #define _Log_printf__arg3(module, level, fmt, a0, a1, a2) \ 742 _Log_printf__arg(module, level, fmt, (uintptr_t)a0, \ 745 #define _Log_printf__arg4(module, level, fmt, a0, a1, a2, a3) \ 746 _Log_printf__arg(module, level, fmt, (uintptr_t)a0, \ 750 #define _Log_printf__arg5(module, level, fmt, a0, a1, a2, a3, a4) \ 751 _Log_printf__arg(module, level, fmt, (uintptr_t)a0, \ 756 #define _Log_printf__arg6(module, level, fmt, a0, a1, a2, a3, a4, a5) \ 757 _Log_printf__arg(module, level, fmt, (uintptr_t)a0, \ 763 #define _Log_printf__arg7(module, level, fmt, a0, a1, a2, a3, a4, a5, a6) \ 764 _Log_printf__arg(module, level, fmt, (uintptr_t)a0, \ 771 #define _Log_printf__arg8(module, level, fmt, a0, a1, a2, a3, a4, a5, a6, a7) \ 772 _Log_printf__arg(module, level, fmt, (uintptr_t)a0, \ 781 #define _Log_printf__arg(module, level, ...) \ 782 module.printf(&module, \ 783 (uint32_t)&_Log_CONCAT2(LogSymbol, __LINE__), \ 784 (uint32_t)&_Log_CONCAT3(Ptr, LogSymbol, __LINE__), \ 785 _Log_NUMARGS(__VA_ARGS__), \ 786 _Log_CDR_ARG(__VA_ARGS__)) 788 #define _Log_printf__noarg(module, level, ...) \ 789 module.printf(&module, \ 790 (uint32_t)&_Log_CONCAT2(LogSymbol, __LINE__), \ 791 (uint32_t)&_Log_CONCAT3(Ptr, LogSymbol, __LINE__), \ 792 _Log_NUMARGS(__VA_ARGS__)) 797 #define _Log_printf_C_0(opcode, module, level, ...) 802 #define _Log_printf_C_1(opcode, module, level, ...) \ 804 Log_MODULE_USE(module); \ 805 if ((Log_ENABLED & LogMod_ ## module.levels) && \ 806 ((level) & LogMod_ ## module.levels)) { \ 807 _Log_PLACE_FORMAT_IN_SECTOR(_Log_CONCAT2(LogSymbol, __LINE__), \ 811 _Log_CAR_ARG(__VA_ARGS__), \ 812 _Log_NUMARGS(__VA_ARGS__)) \ 813 _Log_VARIANT(_Log_printf, LogMod_ ## module, level, __VA_ARGS__); \ 828 #define _Log_printf_B(opcode, module, level, ...) \ 829 _Log_CONCAT2(_Log_printf_C, _Log_DEFINED(ti_log_Log_ENABLE_ ## module))(opcode, module, level, __VA_ARGS__) 844 #if defined(__IAR_SYSTEMS_ICC__) 845 #define Log_EVENT_DEFINE(name, fmt) \ 846 __root const char LogSymbol_ ## name[] @ ".log_data" = \ 847 _Log_APPEND_META_TO_FORMAT(LOG_EVENT_CONSTRUCT, \ 855 #elif defined(__TI_COMPILER_VERSION__) || (defined(__clang__) && defined(__ti_version__)) || defined(__GNUC__) 856 #define Log_EVENT_DEFINE(name, fmt) \ 857 const char LogSymbol_ ## name[] \ 858 __attribute__((used,section(".log_data"))) = \ 859 _Log_APPEND_META_TO_FORMAT(LOG_EVENT_CONSTRUCT, \ 867 #error Incompatible compiler: Logging is currently supported by the following \ 868 compilers: TI ARM Compiler, TI CLANG Compiler, GCC, IAR. Please migrate to a \ 869 a supported compiler. 880 #define Log_EVENT_USE(name) extern const char[] LogSymbol_ ## name; 897 #define Log_buf(module, level, format, data, size) _Log_buf_B(module, level, format, data, size) 919 #define Log_printf(module, level, ...) _Log_printf_B(LOG_OPCODE_FORMATED_TEXT, module, level, __VA_ARGS__) 921 #define Log_event(module, level, ...) _Log_printf_B(LOG_OPCODE_EVENT, module, level, __VA_ARGS__) 927 #if defined(__IAR_SYSTEMS_ICC__) 928 #define _Log_DEFINE_LOG_VERSION(module, version) \ 929 __root static const char _Log_CONCAT2(Log_ti_log_version, __COUNTER__)[] @ ".log_data" = \ 930 _Log_APPEND_META_TO_FORMAT(LOG_OPCODE_VERSION, \ 937 #elif defined(__TI_COMPILER_VERSION__) || (defined(__clang__) && defined(__ti_version__)) || defined(__GNUC__) 938 #define _Log_DEFINE_LOG_VERSION(module, version) \ 939 static const char _Log_CONCAT2(Log_ti_log_version, __COUNTER__)[] \ 940 __attribute__((used,section(".log_data"))) = \ 941 _Log_APPEND_META_TO_FORMAT(LOG_OPCODE_VERSION, \ 949 #error Incompatible compiler: Logging is currently supported by the following \ 950 compilers: TI ARM Compiler, TI CLANG Compiler, GCC, IAR. Please migrate to a \ 951 a supported compiler. 965 #define Log_MODULE_DEFINE(...) 966 #define Log_MODULE_USE(...) 967 #define Log_EVENT_DEFINE(name, fmt) 968 #define Log_EVENT_USE(name, fmt) 969 #define Log_printf(module, level, ...) 970 #define Log_event(module, level, ...) 971 #define Log_buf(module, level, ...) 972 #define _Log_DEFINE_LOG_VERSION(module, version) 1012 #if defined (__cplusplus) 1016 #endif // ti_log_Log__include
Log_Level
Definition: Log.h:979
const Log_buf_fxn buf
Definition: Log.h:1006
void(* Log_printf_fxn)(const Log_Module *handle, uint32_t header, uint32_t headerPtr, uint32_t numArgs,...)
Definition: Log.h:991
const Log_printf_fxn printf
Definition: Log.h:1005
void(* Log_buf_fxn)(const Log_Module *handle, uint32_t header, uint32_t headerPtr, uint8_t *data, size_t size)
Definition: Log.h:997
#define _Log_DEFINE_LOG_VERSION(module, version)
Definition: Log.h:972
uint32_t levels
Definition: Log.h:1007
void * sinkConfig
Definition: Log.h:1004