fsl_debug_console_conf.h 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. /*
  2. * The Clear BSD License
  3. * Copyright 2017 NXP
  4. * All rights reserved.
  5. *
  6. *
  7. * Redistribution and use in source and binary forms, with or without modification,
  8. * are permitted (subject to the limitations in the disclaimer below) provided
  9. * that the following conditions are met:
  10. *
  11. * o Redistributions of source code must retain the above copyright notice, this list
  12. * of conditions and the following disclaimer.
  13. *
  14. * o Redistributions in binary form must reproduce the above copyright notice, this
  15. * list of conditions and the following disclaimer in the documentation and/or
  16. * other materials provided with the distribution.
  17. *
  18. * o Neither the name of the copyright holder nor the names of its
  19. * contributors may be used to endorse or promote products derived from this
  20. * software without specific prior written permission.
  21. *
  22. * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS LICENSE.
  23. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  24. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  25. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  26. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
  27. * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  28. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  29. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
  30. * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  31. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  32. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  33. */
  34. #ifndef _FSL_DEBUG_CONSOLE_CONF_H_
  35. #define _FSL_DEBUG_CONSOLE_CONF_H_
  36. /****************Debug console configuration********************/
  37. /*! @brief If Non-blocking mode is needed, please define it at project setting,
  38. * otherwise blocking mode is the default transfer mode.
  39. * Warning: If you want to use non-blocking transfer,please make sure the corresponding
  40. * IO interrupt is enable, otherwise there is no output.
  41. * And non-blocking is combine with buffer, no matter bare-metal or rtos.
  42. */
  43. #ifdef DEBUG_CONSOLE_TRANSFER_NON_BLOCKING
  44. /*! @brief define the transmit buffer length which is used to store the multi task log, buffer is enabled automatically
  45. * when
  46. * non-blocking transfer is using,
  47. * This value will affect the RAM's ultilization, should be set per paltform's capability and software requirement.
  48. * If it is configured too small, log maybe missed , because the log will not be
  49. * buffered if the buffer is full, and the print will return immediately with -1.
  50. * And this value should be multiple of 4 to meet memory alignment.
  51. *
  52. */
  53. #ifndef DEBUG_CONSOLE_TRANSMIT_BUFFER_LEN
  54. #define DEBUG_CONSOLE_TRANSMIT_BUFFER_LEN (512U)
  55. #endif /* DEBUG_CONSOLE_TRANSMIT_BUFFER_LEN */
  56. /*! @brief define the receive buffer length which is used to store the user input, buffer is enabled automatically when
  57. * non-blocking transfer is using,
  58. * This value will affect the RAM's ultilization, should be set per paltform's capability and software requirement.
  59. * If it is configured too small, log maybe missed, because buffer will be overwrited if buffer is too small.
  60. * And this value should be multiple of 4 to meet memory alignment.
  61. *
  62. */
  63. #ifndef DEBUG_CONSOLE_RECEIVE_BUFFER_LEN
  64. #define DEBUG_CONSOLE_RECEIVE_BUFFER_LEN (512U)
  65. #endif /* DEBUG_CONSOLE_RECEIVE_BUFFER_LEN */
  66. #else
  67. #define DEBUG_CONSOLE_TRANSFER_BLOCKING
  68. #endif /* DEBUG_CONSOLE_TRANSFER_NON_BLOCKING */
  69. /*!@ brief define the MAX log length debug console support , that is when you call printf("log", x);, the log
  70. * length can not bigger than this value.
  71. * This macro decide the local log buffer length, the buffer locate at stack, the stack maybe overflow if
  72. * the buffer is too big and current task stack size not big enough.
  73. */
  74. #ifndef DEBUG_CONSOLE_PRINTF_MAX_LOG_LEN
  75. #define DEBUG_CONSOLE_PRINTF_MAX_LOG_LEN (128U)
  76. #endif /* DEBUG_CONSOLE_PRINTF_MAX_LOG_LEN */
  77. /*!@ brief define the buffer support buffer scanf log length, that is when you call scanf("log", &x);, the log
  78. * length can not bigger than this value.
  79. * As same as the DEBUG_CONSOLE_BUFFER_PRINTF_MAX_LOG_LEN.
  80. */
  81. #ifndef DEBUG_CONSOLE_SCANF_MAX_LOG_LEN
  82. #define DEBUG_CONSOLE_SCANF_MAX_LOG_LEN (20U)
  83. #endif /* DEBUG_CONSOLE_SCANF_MAX_LOG_LEN */
  84. /*! @brief Debug console synchronization
  85. * User should not change these macro for synchronization mode, but add the
  86. * corresponding synchronization mechanism per different software environment.
  87. * Such as, if another RTOS is used,
  88. * add:
  89. * #define DEBUG_CONSOLE_SYNCHRONIZATION_XXXX 3
  90. * in this configuration file and implement the synchronization in fsl.log.c.
  91. */
  92. /*! @brief synchronization for baremetal software */
  93. #define DEBUG_CONSOLE_SYNCHRONIZATION_BM 0
  94. /*! @brief synchronization for freertos software */
  95. #define DEBUG_CONSOLE_SYNCHRONIZATION_FREERTOS 1
  96. /*! @brief RTOS synchronization mechanism disable
  97. * If not defined, default is enable, to avoid multitask log print mess.
  98. * If other RTOS is used, you can implement the RTOS's specific synchronization mechanism in fsl.log.c
  99. * If synchronization is disabled, log maybe messed on terminal.
  100. */
  101. #ifndef DEBUG_CONSOLE_DISABLE_RTOS_SYNCHRONIZATION
  102. #ifdef DEBUG_CONSOLE_TRANSFER_NON_BLOCKING
  103. #ifdef FSL_RTOS_FREE_RTOS
  104. #define DEBUG_CONSOLE_SYNCHRONIZATION_MODE DEBUG_CONSOLE_SYNCHRONIZATION_FREERTOS
  105. #else
  106. #define DEBUG_CONSOLE_SYNCHRONIZATION_MODE DEBUG_CONSOLE_SYNCHRONIZATION_BM
  107. #endif /* FSL_RTOS_FREE_RTOS */
  108. #else
  109. #define DEBUG_CONSOLE_SYNCHRONIZATION_MODE DEBUG_CONSOLE_SYNCHRONIZATION_BM
  110. #endif /* DEBUG_CONSOLE_TRANSFER_NON_BLOCKING */
  111. #endif /* DEBUG_CONSOLE_DISABLE_RTOS_SYNCHRONIZATION */
  112. /*! @brief echo function support
  113. * If you want to use the echo function,please define DEBUG_CONSOLE_ENABLE_ECHO
  114. * at your project setting.
  115. */
  116. #ifndef DEBUG_CONSOLE_ENABLE_ECHO
  117. #define DEBUG_CONSOLE_ENABLE_ECHO_FUNCTION 0
  118. #else
  119. #define DEBUG_CONSOLE_ENABLE_ECHO_FUNCTION 1
  120. #endif /* DEBUG_CONSOLE_ENABLE_ECHO */
  121. /*********************************************************************/
  122. /***************Debug console other configuration*********************/
  123. /*! @brief Definition to printf the float number. */
  124. #ifndef PRINTF_FLOAT_ENABLE
  125. #define PRINTF_FLOAT_ENABLE 0U
  126. #endif /* PRINTF_FLOAT_ENABLE */
  127. /*! @brief Definition to scanf the float number. */
  128. #ifndef SCANF_FLOAT_ENABLE
  129. #define SCANF_FLOAT_ENABLE 0U
  130. #endif /* SCANF_FLOAT_ENABLE */
  131. /*! @brief Definition to support advanced format specifier for printf. */
  132. #ifndef PRINTF_ADVANCED_ENABLE
  133. #define PRINTF_ADVANCED_ENABLE 0U
  134. #endif /* PRINTF_ADVANCED_ENABLE */
  135. /*! @brief Definition to support advanced format specifier for scanf. */
  136. #ifndef SCANF_ADVANCED_ENABLE
  137. #define SCANF_ADVANCED_ENABLE 0U
  138. #endif /* SCANF_ADVANCED_ENABLE */
  139. /*! @brief Definition to select virtual com(USB CDC) as the debug console. */
  140. #ifndef BOARD_USE_VIRTUALCOM
  141. #define BOARD_USE_VIRTUALCOM 0U
  142. #endif
  143. /*******************************************************************/
  144. #endif /* _FSL_DEBUG_CONSOLE_CONF_H_ */