432 #ifndef ti_log_Log__include 433 #define ti_log_Log__include 445 #if defined (__cplusplus) 456 #if ti_log_Log_ENABLE 463 #define Log_TI_LOG_VERSION 0.1.0 489 #define Log_MODULE_DEFINE(name, init) const Log_Module LogMod_ ## name = init 501 #define Log_MODULE_USE(name) extern const Log_Module LogMod_ ## name 509 #define LOG_MODULE_SYM(name) LogMod_ ## name 518 #define _Log_GUARD_MACRO(x) do{ x }while(0) 534 #define _Log_CAR_ARG(N, ...) N 535 #define _Log_CDR_ARG(N, ...) __VA_ARGS__ 542 #define _Log_CONCAT2_A(x,y) x ## _ ## y 543 #define _Log_CONCAT2(x,y) _Log_CONCAT2_A(x,y) 544 #define _Log_CONCAT3(x,y,z) _Log_CONCAT2(x,_Log_CONCAT2(y,z)) 547 #define _Log__TOKEN2STRING_A(x) #x 548 #define _Log_TOKEN2STRING(x) _Log__TOKEN2STRING_A(x) 553 #define _Log_LOG_PTR_TO_INDEX(ptr) (((uint32_t)(&ptr) - 0x08) & 0x7FFFC) 556 #define _Log_APPEND_META_TO_FORMAT(opcode, \ 563 _Log_TOKEN2STRING(opcode) "\x1e" \ 564 _Log_TOKEN2STRING(file) "\x1e" \ 565 _Log_TOKEN2STRING(line) "\x1e" \ 566 _Log_TOKEN2STRING(level) "\x1e" \ 567 _Log_TOKEN2STRING(module) "\x1e" \ 568 _Log_TOKEN2STRING(format) "\x1e" \ 569 _Log_TOKEN2STRING(nargs) 574 #if defined(__IAR_SYSTEMS_ICC__) 575 #define _Log_PLACE_FORMAT_IN_SECTOR(name, opcode, level, module, format, nargs)\ 576 __root static const char name[] @ ".log_data" = \ 577 _Log_APPEND_META_TO_FORMAT(opcode, \ 584 __root static const char * const _Log_CONCAT2(Ptr, name) @ _Log_TOKEN2STRING(_Log_CONCAT2(.log_ptr, module)) = name; 585 #elif defined(__TI_COMPILER_VERSION__) || (defined(__clang__) && defined(__ti_version__)) || defined(__GNUC__) 586 #define _Log_PLACE_FORMAT_IN_SECTOR(name, opcode, level, module, format, nargs)\ 587 static const char name[] \ 588 __attribute__((used,section(".log_data"))) = \ 589 _Log_APPEND_META_TO_FORMAT(opcode, \ 596 static const char * const _Log_CONCAT2(Ptr, name) \ 597 __attribute__((used,section(_Log_TOKEN2STRING(_Log_CONCAT3(.log_ptr, __LINE__, module))))) = name; 599 #error Incompatible compiler: Logging is currently supported by the following \ 600 compilers: TI ARM Compiler, TI CLANG Compiler, GCC, IAR. Please migrate to a \ 601 a supported compiler. 608 #define _Log_NUMARGS(...) _Log_NUMARGS_A(__VA_ARGS__, 8, 7, 6, 5, 4, 3, 2, 1, 0) 609 #define _Log_NUMARGS_A(...) _Log_NUMARGS_B(__VA_ARGS__) 610 #define _Log_NUMARGS_B(_first, _8, _7, _6, _5, _4, _3, _2, _1, N, ...) N 618 #define _Log_VARIANT(x, module, level, ...) \ 619 _Log_CONCAT2(x, _Log_NUMARGS_B(__VA_ARGS__, _arg8, _arg7, _arg6, _arg5, _arg4, _arg3, _arg2, _arg1, _noarg)) ( module, level, __VA_ARGS__ ) 621 #define _Log_buf_B(module , level, format, data, size) \ 622 Log_MODULE_USE(module); \ 623 if ((Log_ENABLED & LogMod_ ## module.levels) && \ 624 ((level) & LogMod_ ## module.levels)) { \ 625 _Log_PLACE_FORMAT_IN_SECTOR(_Log_CONCAT2(LogSymbol, __LINE__), \ 631 LogMod_ ## module.buf(&LogMod_ ## module, \ 632 (uint32_t)&_Log_CONCAT2(LogSymbol, __LINE__), \ 633 _Log_LOG_PTR_TO_INDEX(_Log_CONCAT3(Ptr, LogSymbol, __LINE__)), \ 642 #define _Log_printf__arg1(module, level, fmt, a0) \ 643 _Log_printf__arg(module, level, fmt, (uintptr_t)a0) 644 #define _Log_printf__arg2(module, level, fmt, a0, a1) \ 645 _Log_printf__arg(module, level, fmt, (uintptr_t)a0, \ 647 #define _Log_printf__arg3(module, level, fmt, a0, a1, a2) \ 648 _Log_printf__arg(module, level, fmt, (uintptr_t)a0, \ 651 #define _Log_printf__arg4(module, level, fmt, a0, a1, a2, a3) \ 652 _Log_printf__arg(module, level, fmt, (uintptr_t)a0, \ 656 #define _Log_printf__arg5(module, level, fmt, a0, a1, a2, a3, a4) \ 657 _Log_printf__arg(module, level, fmt, (uintptr_t)a0, \ 662 #define _Log_printf__arg6(module, level, fmt, a0, a1, a2, a3, a4, a5) \ 663 _Log_printf__arg(module, level, fmt, (uintptr_t)a0, \ 669 #define _Log_printf__arg7(module, level, fmt, a0, a1, a2, a3, a4, a5, a6) \ 670 _Log_printf__arg(module, level, fmt, (uintptr_t)a0, \ 677 #define _Log_printf__arg8(module, level, fmt, a0, a1, a2, a3, a4, a5, a6, a7) \ 678 _Log_printf__arg(module, level, fmt, (uintptr_t)a0, \ 687 #define _Log_printf__arg(module, level, ...) \ 688 module.printf(&module, \ 689 (uint32_t)&_Log_CONCAT2(LogSymbol, __LINE__), \ 690 _Log_LOG_PTR_TO_INDEX(_Log_CONCAT3(Ptr, LogSymbol, __LINE__)), \ 691 _Log_NUMARGS(__VA_ARGS__), \ 692 _Log_CDR_ARG(__VA_ARGS__)) 694 #define _Log_printf__noarg(module, level, ...) \ 695 module.printf(&module, \ 696 (uint32_t)&_Log_CONCAT2(LogSymbol, __LINE__), \ 697 _Log_LOG_PTR_TO_INDEX(_Log_CONCAT3(Ptr, LogSymbol, __LINE__)), \ 698 _Log_NUMARGS(__VA_ARGS__)) 700 #define _Log_printf_B(opcode, module, level, ...) \ 701 Log_MODULE_USE(module); \ 702 if ((Log_ENABLED & LogMod_ ## module.levels) && \ 703 ((level) & LogMod_ ## module.levels)) { \ 704 _Log_PLACE_FORMAT_IN_SECTOR(_Log_CONCAT2(LogSymbol, __LINE__), \ 708 _Log_CAR_ARG(__VA_ARGS__), \ 709 _Log_NUMARGS(__VA_ARGS__)) \ 710 _Log_VARIANT(_Log_printf, LogMod_ ## module, level, __VA_ARGS__); \ 726 #if defined(__IAR_SYSTEMS_ICC__) 727 #define Log_EVENT_DEFINE(name, fmt) \ 728 __root const char LogSymbol_ ## name[] @ ".log_data" = \ 729 _Log_APPEND_META_TO_FORMAT(LOG_EVENT_CONSTRUCT, \ 737 #elif defined(__TI_COMPILER_VERSION__) || (defined(__clang__) && defined(__ti_version__)) || defined(__GNUC__) 738 #define Log_EVENT_DEFINE(name, fmt) \ 739 const char LogSymbol_ ## name[] \ 740 __attribute__((used,section(".log_data"))) = \ 741 _Log_APPEND_META_TO_FORMAT(LOG_EVENT_CONSTRUCT, \ 749 #error Incompatible compiler: Logging is currently supported by the following \ 750 compilers: TI ARM Compiler, TI CLANG Compiler, GCC, IAR. Please migrate to a \ 751 a supported compiler. 762 #define Log_EVENT_USE(name) extern const char[] LogSymbol_ ## name; 779 #define Log_buf(module, level, format, data, size) \ 780 _Log_GUARD_MACRO(_Log_buf_B(module , level, format, data, size)) 802 #define Log_printf(module, level, ...) \ 803 _Log_GUARD_MACRO(_Log_printf_B(LOG_OPCODE_FORMATED_TEXT, module, level, __VA_ARGS__)) 805 #define Log_event(module, level, ...) \ 806 _Log_GUARD_MACRO(_Log_printf_B(LOG_OPCODE_EVENT, module, level, __VA_ARGS__)) 812 #if defined(__IAR_SYSTEMS_ICC__) 813 #define _Log_DEFINE_LOG_VERSION(module, version) \ 814 __root static const char _Log_CONCAT2(Log_ti_log_version, __COUNTER__)[] @ ".log_data" = \ 815 _Log_APPEND_META_TO_FORMAT(LOG_OPCODE_VERSION, \ 822 #elif defined(__TI_COMPILER_VERSION__) || (defined(__clang__) && defined(__ti_version__)) || defined(__GNUC__) 823 #define _Log_DEFINE_LOG_VERSION(module, version) \ 824 static const char _Log_CONCAT2(Log_ti_log_version, __COUNTER__)[] \ 825 __attribute__((used,section(".log_data"))) = \ 826 _Log_APPEND_META_TO_FORMAT(LOG_OPCODE_VERSION, \ 834 #error Incompatible compiler: Logging is currently supported by the following \ 835 compilers: TI ARM Compiler, TI CLANG Compiler, GCC, IAR. Please migrate to a \ 836 a supported compiler. 850 #define Log_MODULE_DEFINE(...) 851 #define Log_MODULE_USE(...) 852 #define Log_EVENT_DEFINE(name, fmt) 853 #define Log_EVENT_USE(name, fmt) 854 #define Log_printf(module, level, ...) 855 #define Log_event(module, level, ...) 856 #define Log_buf(module, level, ...) 857 #define _Log_DEFINE_LOG_VERSION(module, version) 897 #if defined (__cplusplus) 901 #endif // ti_log_Log__include
Log_Level
Definition: Log.h:864
const Log_buf_fxn buf
Definition: Log.h:891
const Log_printf_fxn printf
Definition: Log.h:890
#define _Log_DEFINE_LOG_VERSION(module, version)
Definition: Log.h:857
void(* Log_buf_fxn)(const Log_Module *handle, uint32_t header, uint32_t index, uint8_t *data, size_t size)
Definition: Log.h:882
uint32_t levels
Definition: Log.h:892
void(* Log_printf_fxn)(const Log_Module *handle, uint32_t header, uint32_t index, uint32_t numArgs,...)
Definition: Log.h:876
void * sinkConfig
Definition: Log.h:889