2 * Copyright 2017 - 2018 NXP
\r
3 * All rights reserved.
\r
6 * SPDX-License-Identifier: BSD-3-Clause
\r
8 #ifndef _FSL_DEBUG_CONSOLE_CONF_H_
\r
9 #define _FSL_DEBUG_CONSOLE_CONF_H_
\r
11 /****************Debug console configuration********************/
\r
13 /*! @brief If Non-blocking mode is needed, please define it at project setting,
\r
14 * otherwise blocking mode is the default transfer mode.
\r
15 * Warning: If you want to use non-blocking transfer,please make sure the corresponding
\r
16 * IO interrupt is enable, otherwise there is no output.
\r
17 * And non-blocking is combine with buffer, no matter bare-metal or rtos.
\r
19 #ifdef DEBUG_CONSOLE_TRANSFER_NON_BLOCKING
\r
20 /*! @brief define the transmit buffer length which is used to store the multi task log, buffer is enabled automatically
\r
22 * non-blocking transfer is using,
\r
23 * This value will affect the RAM's ultilization, should be set per paltform's capability and software requirement.
\r
24 * If it is configured too small, log maybe missed , because the log will not be
\r
25 * buffered if the buffer is full, and the print will return immediately with -1.
\r
26 * And this value should be multiple of 4 to meet memory alignment.
\r
29 #ifndef DEBUG_CONSOLE_TRANSMIT_BUFFER_LEN
\r
30 #define DEBUG_CONSOLE_TRANSMIT_BUFFER_LEN (512U)
\r
31 #endif /* DEBUG_CONSOLE_TRANSMIT_BUFFER_LEN */
\r
33 /*! @brief define the receive buffer length which is used to store the user input, buffer is enabled automatically when
\r
34 * non-blocking transfer is using,
\r
35 * This value will affect the RAM's ultilization, should be set per paltform's capability and software requirement.
\r
36 * If it is configured too small, log maybe missed, because buffer will be overwrited if buffer is too small.
\r
37 * And this value should be multiple of 4 to meet memory alignment.
\r
40 #ifndef DEBUG_CONSOLE_RECEIVE_BUFFER_LEN
\r
41 #define DEBUG_CONSOLE_RECEIVE_BUFFER_LEN (512U)
\r
42 #endif /* DEBUG_CONSOLE_RECEIVE_BUFFER_LEN */
\r
45 #define DEBUG_CONSOLE_TRANSFER_BLOCKING
\r
46 #endif /* DEBUG_CONSOLE_TRANSFER_NON_BLOCKING */
\r
48 /*!@ brief Whether enable the RX function
\r
49 * If the macro is zero, the receive function of the debug console is disabled.
\r
51 #ifndef DEBUG_CONSOLE_RX_ENABLE
\r
52 #define DEBUG_CONSOLE_RX_ENABLE (1U)
\r
53 #endif /* DEBUG_CONSOLE_RX_ENABLE */
\r
55 /*!@ brief define the MAX log length debug console support , that is when you call printf("log", x);, the log
\r
56 * length can not bigger than this value.
\r
57 * This macro decide the local log buffer length, the buffer locate at stack, the stack maybe overflow if
\r
58 * the buffer is too big and current task stack size not big enough.
\r
60 #ifndef DEBUG_CONSOLE_PRINTF_MAX_LOG_LEN
\r
61 #define DEBUG_CONSOLE_PRINTF_MAX_LOG_LEN (128U)
\r
62 #endif /* DEBUG_CONSOLE_PRINTF_MAX_LOG_LEN */
\r
64 /*!@ brief define the buffer support buffer scanf log length, that is when you call scanf("log", &x);, the log
\r
65 * length can not bigger than this value.
\r
66 * As same as the DEBUG_CONSOLE_BUFFER_PRINTF_MAX_LOG_LEN.
\r
68 #ifndef DEBUG_CONSOLE_SCANF_MAX_LOG_LEN
\r
69 #define DEBUG_CONSOLE_SCANF_MAX_LOG_LEN (20U)
\r
70 #endif /* DEBUG_CONSOLE_SCANF_MAX_LOG_LEN */
\r
72 /*! @brief Debug console synchronization
\r
73 * User should not change these macro for synchronization mode, but add the
\r
74 * corresponding synchronization mechanism per different software environment.
\r
75 * Such as, if another RTOS is used,
\r
77 * #define DEBUG_CONSOLE_SYNCHRONIZATION_XXXX 3
\r
78 * in this configuration file and implement the synchronization in fsl.log.c.
\r
80 /*! @brief synchronization for baremetal software */
\r
81 #define DEBUG_CONSOLE_SYNCHRONIZATION_BM 0
\r
82 /*! @brief synchronization for freertos software */
\r
83 #define DEBUG_CONSOLE_SYNCHRONIZATION_FREERTOS 1
\r
85 /*! @brief RTOS synchronization mechanism disable
\r
86 * If not defined, default is enable, to avoid multitask log print mess.
\r
87 * If other RTOS is used, you can implement the RTOS's specific synchronization mechanism in fsl.log.c
\r
88 * If synchronization is disabled, log maybe messed on terminal.
\r
90 #ifndef DEBUG_CONSOLE_DISABLE_RTOS_SYNCHRONIZATION
\r
91 #ifdef DEBUG_CONSOLE_TRANSFER_NON_BLOCKING
\r
92 #ifdef FSL_RTOS_FREE_RTOS
\r
93 #define DEBUG_CONSOLE_SYNCHRONIZATION_MODE DEBUG_CONSOLE_SYNCHRONIZATION_FREERTOS
\r
95 #define DEBUG_CONSOLE_SYNCHRONIZATION_MODE DEBUG_CONSOLE_SYNCHRONIZATION_BM
\r
96 #endif /* FSL_RTOS_FREE_RTOS */
\r
98 #define DEBUG_CONSOLE_SYNCHRONIZATION_MODE DEBUG_CONSOLE_SYNCHRONIZATION_BM
\r
99 #endif /* DEBUG_CONSOLE_TRANSFER_NON_BLOCKING */
\r
100 #endif /* DEBUG_CONSOLE_DISABLE_RTOS_SYNCHRONIZATION */
\r
102 /*! @brief echo function support
\r
103 * If you want to use the echo function,please define DEBUG_CONSOLE_ENABLE_ECHO
\r
104 * at your project setting.
\r
106 #ifndef DEBUG_CONSOLE_ENABLE_ECHO
\r
107 #define DEBUG_CONSOLE_ENABLE_ECHO_FUNCTION 0
\r
109 #define DEBUG_CONSOLE_ENABLE_ECHO_FUNCTION 1
\r
110 #endif /* DEBUG_CONSOLE_ENABLE_ECHO */
\r
112 /*********************************************************************/
\r
114 /***************Debug console other configuration*********************/
\r
115 /*! @brief Definition to printf the float number. */
\r
116 #ifndef PRINTF_FLOAT_ENABLE
\r
117 #define PRINTF_FLOAT_ENABLE 0U
\r
118 #endif /* PRINTF_FLOAT_ENABLE */
\r
120 /*! @brief Definition to scanf the float number. */
\r
121 #ifndef SCANF_FLOAT_ENABLE
\r
122 #define SCANF_FLOAT_ENABLE 0U
\r
123 #endif /* SCANF_FLOAT_ENABLE */
\r
125 /*! @brief Definition to support advanced format specifier for printf. */
\r
126 #ifndef PRINTF_ADVANCED_ENABLE
\r
127 #define PRINTF_ADVANCED_ENABLE 0U
\r
128 #endif /* PRINTF_ADVANCED_ENABLE */
\r
130 /*! @brief Definition to support advanced format specifier for scanf. */
\r
131 #ifndef SCANF_ADVANCED_ENABLE
\r
132 #define SCANF_ADVANCED_ENABLE 0U
\r
133 #endif /* SCANF_ADVANCED_ENABLE */
\r
135 /*! @brief Definition to select virtual com(USB CDC) as the debug console. */
\r
136 #ifndef BOARD_USE_VIRTUALCOM
\r
137 #define BOARD_USE_VIRTUALCOM 0U
\r
139 /*******************************************************************/
\r
141 #endif /* _FSL_DEBUG_CONSOLE_CONF_H_ */
\r