summaryrefslogtreecommitdiff
path: root/FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/NXP_Code/utilities/fsl_debug_console.h
diff options
context:
space:
mode:
Diffstat (limited to 'FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/NXP_Code/utilities/fsl_debug_console.h')
-rw-r--r--FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/NXP_Code/utilities/fsl_debug_console.h134
1 files changed, 57 insertions, 77 deletions
diff --git a/FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/NXP_Code/utilities/fsl_debug_console.h b/FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/NXP_Code/utilities/fsl_debug_console.h
index ec50606a5..d3f8b562a 100644
--- a/FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/NXP_Code/utilities/fsl_debug_console.h
+++ b/FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/NXP_Code/utilities/fsl_debug_console.h
@@ -1,8 +1,8 @@
/*
- * Copyright (c) 2013 - 2015, Freescale Semiconductor, Inc.
- * Copyright 2016-2018 NXP
+ * Copyright 2017-2018, 2020 NXP
* All rights reserved.
*
+ *
* SPDX-License-Identifier: BSD-3-Clause
*
* Debug console shall provide input and output functions to scan and print formatted data.
@@ -23,9 +23,8 @@
#define _FSL_DEBUGCONSOLE_H_
#include "fsl_common.h"
-#include "serial_manager.h"
-/*!
+/*
* @addtogroup debugconsole
* @{
*/
@@ -34,24 +33,40 @@
* Definitions
******************************************************************************/
-extern serial_handle_t g_serialHandle; /*!< serial manager handle */
-
/*! @brief Definition select redirect toolchain printf, scanf to uart or not. */
#define DEBUGCONSOLE_REDIRECT_TO_TOOLCHAIN 0U /*!< Select toolchain printf and scanf. */
-#define DEBUGCONSOLE_REDIRECT_TO_SDK 1U /*!< Select SDK version printf, scanf. */
-#define DEBUGCONSOLE_DISABLE 2U /*!< Disable debugconsole function. */
+#define DEBUGCONSOLE_REDIRECT_TO_SDK 1U /*!< Select SDK version printf, scanf. */
+#define DEBUGCONSOLE_DISABLE 2U /*!< Disable debugconsole function. */
-/*! @brief Definition to select sdk or toolchain printf, scanf. The macro only support
- * to be redefined in project setting.
- */
+/*! @brief Definition to select sdk or toolchain printf, scanf. */
#ifndef SDK_DEBUGCONSOLE
-#define SDK_DEBUGCONSOLE 1U
+#define SDK_DEBUGCONSOLE DEBUGCONSOLE_REDIRECT_TO_SDK
#endif
#if defined(SDK_DEBUGCONSOLE) && !(SDK_DEBUGCONSOLE)
#include <stdio.h>
#endif
+/*! @brief Definition to printf the float number. */
+#ifndef PRINTF_FLOAT_ENABLE
+#define PRINTF_FLOAT_ENABLE 0U
+#endif /* PRINTF_FLOAT_ENABLE */
+
+/*! @brief Definition to scanf the float number. */
+#ifndef SCANF_FLOAT_ENABLE
+#define SCANF_FLOAT_ENABLE 0U
+#endif /* SCANF_FLOAT_ENABLE */
+
+/*! @brief Definition to support advanced format specifier for printf. */
+#ifndef PRINTF_ADVANCED_ENABLE
+#define PRINTF_ADVANCED_ENABLE 0U
+#endif /* PRINTF_ADVANCED_ENABLE */
+
+/*! @brief Definition to support advanced format specifier for scanf. */
+#ifndef SCANF_ADVANCED_ENABLE
+#define SCANF_ADVANCED_ENABLE 0U
+#endif /* SCANF_ADVANCED_ENABLE */
+
/*! @brief Definition to select redirect toolchain printf, scanf to uart or not.
*
* if SDK_DEBUGCONSOLE defined to 0,it represents select toolchain printf, scanf.
@@ -64,18 +79,24 @@ extern serial_handle_t g_serialHandle; /*!< serial manager handle */
#define PUTCHAR
#define GETCHAR
#elif SDK_DEBUGCONSOLE == DEBUGCONSOLE_REDIRECT_TO_SDK /* Select printf, scanf, putchar, getchar of SDK version. */
-#define PRINTF DbgConsole_Printf
-#define SCANF DbgConsole_Scanf
+#define PRINTF DbgConsole_Printf
+#define SCANF DbgConsole_Scanf
#define PUTCHAR DbgConsole_Putchar
#define GETCHAR DbgConsole_Getchar
-#elif SDK_DEBUGCONSOLE == DEBUGCONSOLE_REDIRECT_TO_TOOLCHAIN /* Select printf, scanf, putchar, getchar of toolchain. \ \
- */
-#define PRINTF printf
-#define SCANF scanf
+#elif SDK_DEBUGCONSOLE == \
+ DEBUGCONSOLE_REDIRECT_TO_TOOLCHAIN /* Select printf, scanf, putchar, getchar of toolchain. \ */
+#define PRINTF printf
+#define SCANF scanf
#define PUTCHAR putchar
#define GETCHAR getchar
#endif /* SDK_DEBUGCONSOLE */
+typedef enum _serial_port_type
+{
+ kSerialPort_None = 0U, /*!< Serial port is none */
+ kSerialPort_Uart = 1U, /*!< Serial port UART */
+} serial_port_type_t;
+
/*******************************************************************************
* Prototypes
******************************************************************************/
@@ -91,20 +112,25 @@ extern "C" {
/*!
* @brief Initializes the peripheral used for debug messages.
*
- * Call this function to enable debug log messages to be output via the specified peripheral
- * initialized by the serial manager module.
+ * Call this function to enable debug log messages to be output via the specified peripheral,
+ * frequency of peripheral source clock, and base address at the specified baud rate.
* After this function has returned, stdout and stdin are connected to the selected peripheral.
*
- * @param instance The instance of the module.
+ * @param instance The instance of the module.If the device is kSerialPort_Uart,
+ * the instance is UART peripheral instance. The UART hardware peripheral
+ * type is determined by UART adapter. For example, if the instance is 1,
+ * if the lpuart_adapter.c is added to the current project, the UART periheral
+ * is LPUART1.
+ * If the uart_adapter.c is added to the current project, the UART periheral
+ * is UART1.
* @param baudRate The desired baud rate in bits per second.
* @param device Low level device type for the debug console, can be one of the following.
- * @arg kSerialPort_Uart,
- * @arg kSerialPort_UsbCdc
- * @arg kSerialPort_UsbCdcVirtual.
+ * @arg kSerialPort_Uart.
* @param clkSrcFreq Frequency of peripheral source clock.
*
* @return Indicates whether initialization was successful or not.
* @retval kStatus_Success Execution successfully
+ * @retval kStatus_Fail Execution failure
*/
status_t DbgConsole_Init(uint8_t instance, uint32_t baudRate, serial_port_type_t device, uint32_t clkSrcFreq);
@@ -112,11 +138,12 @@ status_t DbgConsole_Init(uint8_t instance, uint32_t baudRate, serial_port_type_t
* @brief De-initializes the peripheral used for debug messages.
*
* Call this function to disable debug log messages to be output via the specified peripheral
- * initialized by the serial manager module.
+ * base address and at the specified baud rate.
*
* @return Indicates whether de-initialization was successful or not.
*/
status_t DbgConsole_Deinit(void);
+
#else
/*!
* Use an error to replace the DbgConsole_Init when SDK_DEBUGCONSOLE is not DEBUGCONSOLE_REDIRECT_TO_SDK and
@@ -141,6 +168,7 @@ static inline status_t DbgConsole_Deinit(void)
{
return (status_t)kStatus_Fail;
}
+
#endif /* ((SDK_DEBUGCONSOLE == DEBUGCONSOLE_REDIRECT_TO_SDK) || defined(SDK_DEBUGCONSOLE_UART)) */
#if SDK_DEBUGCONSOLE
@@ -149,10 +177,10 @@ static inline status_t DbgConsole_Deinit(void)
*
* Call this function to write a formatted output to the standard output stream.
*
- * @param formatString Format control string.
+ * @param fmt_s Format control string.
* @return Returns the number of characters printed or a negative value if an error occurs.
*/
-int DbgConsole_Printf(const char *formatString, ...);
+int DbgConsole_Printf(const char *fmt_s, ...);
/*!
* @brief Writes a character to stdout.
@@ -169,68 +197,20 @@ int DbgConsole_Putchar(int ch);
*
* Call this function to read formatted data from the standard input stream.
*
- * @note Due the limitation in the BM OSA environment (CPU is blocked in the function,
- * other tasks will not be scheduled), the function cannot be used when the
- * DEBUG_CONSOLE_TRANSFER_NON_BLOCKING is set in the BM OSA environment.
- * And an error is returned when the function called in this case. The suggestion
- * is that polling the non-blocking function DbgConsole_TryGetchar to get the input char.
- *
- * @param formatString Format control string.
+ * @param fmt_ptr Format control string.
* @return Returns the number of fields successfully converted and assigned.
*/
-int DbgConsole_Scanf(char *formatString, ...);
+int DbgConsole_Scanf(char *fmt_ptr, ...);
/*!
* @brief Reads a character from standard input.
*
* Call this function to read a character from standard input.
*
- * @note Due the limitation in the BM OSA environment (CPU is blocked in the function,
- * other tasks will not be scheduled), the function cannot be used when the
- * DEBUG_CONSOLE_TRANSFER_NON_BLOCKING is set in the BM OSA environment.
- * And an error is returned when the function called in this case. The suggestion
- * is that polling the non-blocking function DbgConsole_TryGetchar to get the input char.
- *
* @return Returns the character read.
*/
int DbgConsole_Getchar(void);
-/*!
- * @brief Writes formatted output to the standard output stream with the blocking mode.
- *
- * Call this function to write a formatted output to the standard output stream with the blocking mode.
- * The function will send data with blocking mode no matter the DEBUG_CONSOLE_TRANSFER_NON_BLOCKING set
- * or not.
- * The function could be used in system ISR mode with DEBUG_CONSOLE_TRANSFER_NON_BLOCKING set.
- *
- * @param formatString Format control string.
- * @return Returns the number of characters printed or a negative value if an error occurs.
- */
-int DbgConsole_BlockingPrintf(const char *formatString, ...);
-
-/*!
- * @brief Debug console flush.
- *
- * Call this function to wait the tx buffer empty.
- * If interrupt transfer is using, make sure the global IRQ is enable before call this function
- * This function should be called when
- * 1, before enter power down mode
- * 2, log is required to print to terminal immediately
- * @return Indicates whether wait idle was successful or not.
- */
-status_t DbgConsole_Flush(void);
-
-#ifdef DEBUG_CONSOLE_TRANSFER_NON_BLOCKING
-/*!
- * @brief Debug console try to get char
- * This function provides a API which will not block current task, if character is
- * available return it, otherwise return fail.
- * @param ch the address of char to receive
- * @return Indicates get char was successful or not.
- */
-status_t DbgConsole_TryGetchar(char *ch);
-#endif
-
#endif /* SDK_DEBUGCONSOLE */
/*! @} */