1 /*\r
2 * Copyright (C) 2022 Texas Instruments Incorporated - http://www.ti.com/\r
3 *\r
4 * Redistribution and use in source and binary forms, with or without\r
5 * modification, are permitted provided that the following conditions\r
6 * are met:\r
7 *\r
8 * Redistributions of source code must retain the above copyright\r
9 * notice, this list of conditions and the following disclaimer.\r
10 *\r
11 * Redistributions in binary form must reproduce the above copyright\r
12 * notice, this list of conditions and the following disclaimer in the\r
13 * documentation and/or other materials provided with the\r
14 * distribution.\r
15 *\r
16 * Neither the name of Texas Instruments Incorporated nor the names of\r
17 * its contributors may be used to endorse or promote products derived\r
18 * from this software without specific prior written permission.\r
19 *\r
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\r
21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\r
22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\r
23 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\r
24 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r
25 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\r
26 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\r
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\r
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\r
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\r
30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
31 *\r
32 */\r
33 /**\r
34 * \file SAFERTOS_log.h\r
35 *\r
36 * \brief This file contains the prototypes for the log print functions. By\r
37 default the prints will be directed to serial console using UART.\r
38 *\r
39 */\r
40 \r
41 #ifndef SAFERTOS_LOG_H\r
42 #define SAFERTOS_LOG_H\r
43 \r
44 #ifdef __cplusplus\r
45 extern "C" {\r
46 #endif\r
47 \r
48 #include <stdio.h>\r
49 #if defined (BUILD_M4F)\r
50 #undef UART_CONSOLE\r
51 #else\r
52 #define UART_CONSOLE\r
53 #endif\r
54 \r
55 #if defined(UART_CONSOLE)\r
56 /* UART Header files */\r
57 #include <ti/drv/uart/UART.h>\r
58 #include <ti/drv/uart/UART_stdio.h>\r
59 /**********************************************************************\r
60 ************************** Global Variables **************************\r
61 **********************************************************************/\r
62 extern void UART_printf(const char *pcString, ...);\r
63 extern void ConsoleUtilsInit(void);\r
64 \r
65 /**********************************************************************\r
66 ************************** Macros ************************************\r
67 **********************************************************************/\r
68 #define SAFERTOS_log UART_printf\r
69 #else\r
70 #if defined(EMPTY_OSAL_LOG)\r
71 static void dummy_printf(const char *pcString, ...)\r
72 {\r
73 }\r
74 #define SAFERTOS_log dummy_printf\r
75 #else\r
76 #if defined(USE_BIOS)\r
77 #include <xdc/runtime/System.h>\r
78 #define SAFERTOS_log System_printf\r
79 #else\r
80 #define SAFERTOS_log printf\r
81 #endif /* BARE_METAL */\r
82 #endif /* EMPTY_OSAL_LOG */\r
83 #endif /* UART_CONSOLE */\r
84 \r
85 #ifdef __cplusplus\r
86 }\r
87 #endif\r
88 \r
89 #endif /* SAFERTOS_LOG_H */\r