* Definitions\r
******************************************************************************/\r
\r
+extern serial_handle_t g_serialHandle; /*!< serial manager handle */\r
+\r
/*! @brief Definition select redirect toolchain printf, scanf to uart or not. */\r
#define DEBUGCONSOLE_REDIRECT_TO_TOOLCHAIN 0U /*!< Select toolchain printf and scanf. */\r
#define DEBUGCONSOLE_REDIRECT_TO_SDK 1U /*!< Select SDK version printf, scanf. */\r
#define DEBUGCONSOLE_DISABLE 2U /*!< Disable debugconsole function. */\r
\r
-/*! @brief Definition to select sdk or toolchain printf, scanf. */\r
+/*! @brief Definition to select sdk or toolchain printf, scanf. The macro only support\r
+ * to be redefined in project setting.\r
+ */\r
#ifndef SDK_DEBUGCONSOLE\r
#define SDK_DEBUGCONSOLE 1U\r
#endif\r
\r
-/*! @brief Definition to select redirect toolchain printf, scanf to uart or not. */\r
-#ifndef SDK_DEBUGCONSOLE_UART\r
-/* mcux will handle this macro, not define it here */\r
-#if (!defined(__MCUXPRESSO))\r
-#define SDK_DEBUGCONSOLE_UART\r
-#endif\r
-#endif\r
-\r
#if defined(SDK_DEBUGCONSOLE) && !(SDK_DEBUGCONSOLE)\r
#include <stdio.h>\r
#endif\r
* if SDK_DEBUGCONSOLE defined to 0,it represents select toolchain printf, scanf.\r
* if SDK_DEBUGCONSOLE defined to 1,it represents select SDK version printf, scanf.\r
* if SDK_DEBUGCONSOLE defined to 2,it represents disable debugconsole function.\r
-*/\r
+ */\r
#if SDK_DEBUGCONSOLE == DEBUGCONSOLE_DISABLE /* Disable debug console */\r
#define PRINTF\r
#define SCANF\r
#define PUTCHAR DbgConsole_Putchar\r
#define GETCHAR DbgConsole_Getchar\r
#elif SDK_DEBUGCONSOLE == DEBUGCONSOLE_REDIRECT_TO_TOOLCHAIN /* Select printf, scanf, putchar, getchar of toolchain. \ \\r
- */\r
+ */\r
#define PRINTF printf\r
#define SCANF scanf\r
#define PUTCHAR putchar\r
/*! @name Initialization*/\r
/* @{ */\r
\r
+#if ((SDK_DEBUGCONSOLE == DEBUGCONSOLE_REDIRECT_TO_SDK) || defined(SDK_DEBUGCONSOLE_UART))\r
/*!\r
* @brief Initializes the peripheral used for debug messages.\r
*\r
* @param baudRate The desired baud rate in bits per second.\r
* @param device Low level device type for the debug console, can be one of the following.\r
* @arg kSerialPort_Uart,\r
- * @arg kSerialPort_UsbCdc.\r
+ * @arg kSerialPort_UsbCdc\r
+ * @arg kSerialPort_UsbCdcVirtual.\r
* @param clkSrcFreq Frequency of peripheral source clock.\r
*\r
* @return Indicates whether initialization was successful or not.\r
* @return Indicates whether de-initialization was successful or not.\r
*/\r
status_t DbgConsole_Deinit(void);\r
+#else\r
+/*!\r
+ * Use an error to replace the DbgConsole_Init when SDK_DEBUGCONSOLE is not DEBUGCONSOLE_REDIRECT_TO_SDK and\r
+ * SDK_DEBUGCONSOLE_UART is not defined.\r
+ */\r
+static inline status_t DbgConsole_Init(uint8_t instance,\r
+ uint32_t baudRate,\r
+ serial_port_type_t device,\r
+ uint32_t clkSrcFreq)\r
+{\r
+ (void)instance;\r
+ (void)baudRate;\r
+ (void)device;\r
+ (void)clkSrcFreq;\r
+ return (status_t)kStatus_Fail;\r
+}\r
+/*!\r
+ * Use an error to replace the DbgConsole_Deinit when SDK_DEBUGCONSOLE is not DEBUGCONSOLE_REDIRECT_TO_SDK and\r
+ * SDK_DEBUGCONSOLE_UART is not defined.\r
+ */\r
+static inline status_t DbgConsole_Deinit(void)\r
+{\r
+ return (status_t)kStatus_Fail;\r
+}\r
+#endif /* ((SDK_DEBUGCONSOLE == DEBUGCONSOLE_REDIRECT_TO_SDK) || defined(SDK_DEBUGCONSOLE_UART)) */\r
\r
#if SDK_DEBUGCONSOLE\r
/*!\r
*/\r
int DbgConsole_Getchar(void);\r
\r
+/*!\r
+ * @brief Writes formatted output to the standard output stream with the blocking mode.\r
+ *\r
+ * Call this function to write a formatted output to the standard output stream with the blocking mode.\r
+ * The function will send data with blocking mode no matter the DEBUG_CONSOLE_TRANSFER_NON_BLOCKING set\r
+ * or not.\r
+ * The function could be used in system ISR mode with DEBUG_CONSOLE_TRANSFER_NON_BLOCKING set.\r
+ *\r
+ * @param formatString Format control string.\r
+ * @return Returns the number of characters printed or a negative value if an error occurs.\r
+ */\r
+int DbgConsole_BlockingPrintf(const char *formatString, ...);\r
+\r
/*!\r
* @brief Debug console flush.\r
*\r