Macros | Typedefs | Functions | Variables
Debugconsole

Macros

#define DEBUGCONSOLE_DISABLE   2U
 
#define DEBUGCONSOLE_REDIRECT_TO_SDK   1U
 
#define DEBUGCONSOLE_REDIRECT_TO_TOOLCHAIN   0U
 Definition select redirect toolchain printf, scanf to uart or not. More...
 
#define GETCHAR   DbgConsole_Getchar
 
#define PRINTF   DbgConsole_Printf
 Definition to select redirect toolchain printf, scanf to uart or not. More...
 
#define PUTCHAR   DbgConsole_Putchar
 
#define SCANF   DbgConsole_Scanf
 
#define SDK_DEBUGCONSOLE   1U
 Definition to select sdk or toolchain printf, scanf. The macro only support to be redefined in project setting. More...
 

Typedefs

typedef void(* printfCb) (char *buf, int32_t *indicator, char val, int len)
 A function pointer which is used when format printf log. More...
 

Functions

int StrFormatPrintf (const char *fmt, va_list ap, char *buf, printfCb cb)
 This function outputs its parameters according to a formatted string. More...
 
int StrFormatScanf (const char *line_ptr, char *format, va_list args_ptr)
 Converts an input line of ASCII characters based upon a provided string format. More...
 

Variables

serial_handle_t g_serialHandle
 

Initialization

status_t DbgConsole_Init (uint8_t instance, uint32_t baudRate, serial_port_type_t device, uint32_t clkSrcFreq)
 Initializes the peripheral used for debug messages. More...
 
status_t DbgConsole_Deinit (void)
 De-initializes the peripheral used for debug messages. More...
 
int DbgConsole_Printf (const char *formatString,...)
 Writes formatted output to the standard output stream. More...
 
int DbgConsole_Putchar (int ch)
 Writes a character to stdout. More...
 
int DbgConsole_Scanf (char *formatString,...)
 Reads formatted data from the standard input stream. More...
 
int DbgConsole_Getchar (void)
 Reads a character from standard input. More...
 
int DbgConsole_BlockingPrintf (const char *formatString,...)
 Writes formatted output to the standard output stream with the blocking mode. More...
 
status_t DbgConsole_Flush (void)
 Debug console flush. More...
 

Detailed Description

Macro Definition Documentation

◆ DEBUGCONSOLE_DISABLE

#define DEBUGCONSOLE_DISABLE   2U

Disable debugconsole function.

Definition at line 42 of file fsl_debug_console.h.

◆ DEBUGCONSOLE_REDIRECT_TO_SDK

#define DEBUGCONSOLE_REDIRECT_TO_SDK   1U

Select SDK version printf, scanf.

Definition at line 41 of file fsl_debug_console.h.

◆ DEBUGCONSOLE_REDIRECT_TO_TOOLCHAIN

#define DEBUGCONSOLE_REDIRECT_TO_TOOLCHAIN   0U

Definition select redirect toolchain printf, scanf to uart or not.

Select toolchain printf and scanf.

Definition at line 40 of file fsl_debug_console.h.

◆ GETCHAR

#define GETCHAR   DbgConsole_Getchar

Definition at line 79 of file fsl_debug_console.h.

◆ PRINTF

#define PRINTF   DbgConsole_Printf

Definition to select redirect toolchain printf, scanf to uart or not.

if SDK_DEBUGCONSOLE defined to 0,it represents select toolchain printf, scanf. if SDK_DEBUGCONSOLE defined to 1,it represents select SDK version printf, scanf. if SDK_DEBUGCONSOLE defined to 2,it represents disable debugconsole function.

Definition at line 76 of file fsl_debug_console.h.

◆ PUTCHAR

#define PUTCHAR   DbgConsole_Putchar

Definition at line 78 of file fsl_debug_console.h.

◆ SCANF

#define SCANF   DbgConsole_Scanf

Definition at line 77 of file fsl_debug_console.h.

◆ SDK_DEBUGCONSOLE

#define SDK_DEBUGCONSOLE   1U

Definition to select sdk or toolchain printf, scanf. The macro only support to be redefined in project setting.

Definition at line 48 of file fsl_debug_console.h.

Typedef Documentation

◆ printfCb

typedef void(* printfCb) (char *buf, int32_t *indicator, char val, int len)

A function pointer which is used when format printf log.

Definition at line 30 of file fsl_str.h.

Function Documentation

◆ DbgConsole_BlockingPrintf()

int DbgConsole_BlockingPrintf ( const char *  formatString,
  ... 
)

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.

Parameters
formatStringFormat control string.
Returns
Returns the number of characters printed or a negative value if an error occurs.

Definition at line 922 of file fsl_debug_console.c.

◆ DbgConsole_Deinit()

status_t DbgConsole_Deinit ( void  )

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.

Returns
Indicates whether de-initialization was successful or not.

Definition at line 801 of file fsl_debug_console.c.

◆ DbgConsole_Flush()

status_t DbgConsole_Flush ( void  )

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

Returns
Indicates whether wait idle was successful or not.

Definition at line 838 of file fsl_debug_console.c.

◆ DbgConsole_Getchar()

int DbgConsole_Getchar ( void  )

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.
Returns
Returns the character read.

Definition at line 990 of file fsl_debug_console.c.

◆ DbgConsole_Init()

status_t DbgConsole_Init ( uint8_t  instance,
uint32_t  baudRate,
serial_port_type_t  device,
uint32_t  clkSrcFreq 
)

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. After this function has returned, stdout and stdin are connected to the selected peripheral.

Parameters
instanceThe instance of the module.
baudRateThe desired baud rate in bits per second.
deviceLow level device type for the debug console, can be one of the following.
  • kSerialPort_Uart,
  • kSerialPort_UsbCdc
  • kSerialPort_UsbCdcVirtual.
clkSrcFreqFrequency of peripheral source clock.
Returns
Indicates whether initialization was successful or not.
Return values
kStatus_SuccessExecution successfully

Definition at line 670 of file fsl_debug_console.c.

◆ DbgConsole_Printf()

int DbgConsole_Printf ( const char *  formatString,
  ... 
)

Writes formatted output to the standard output stream.

Call this function to write a formatted output to the standard output stream.

Parameters
formatStringFormat control string.
Returns
Returns the number of characters printed or a negative value if an error occurs.

Definition at line 877 of file fsl_debug_console.c.

◆ DbgConsole_Putchar()

int DbgConsole_Putchar ( int  ch)

Writes a character to stdout.

Call this function to write a character to stdout.

Parameters
chCharacter to be written.
Returns
Returns the character written.

Definition at line 897 of file fsl_debug_console.c.

◆ DbgConsole_Scanf()

int DbgConsole_Scanf ( char *  formatString,
  ... 
)

Reads formatted data from the standard input stream.

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.
Parameters
formatStringFormat control string.
Returns
Returns the number of fields successfully converted and assigned.

Definition at line 904 of file fsl_debug_console.c.

◆ StrFormatPrintf()

int StrFormatPrintf ( const char *  fmt,
va_list  ap,
char *  buf,
printfCb  cb 
)

This function outputs its parameters according to a formatted string.

Note
I/O is performed by calling given function pointer using following (*func_ptr)(c);
Parameters
[in]fmtFormat string for printf.
[in]apArguments to printf.
[in]bufpointer to the buffer
cbprint callbck function pointer
Returns
Number of characters to be print

brief This function outputs its parameters according to a formatted string.

note I/O is performed by calling given function pointer using following (*func_ptr)(c);

param[in] fmt_ptr Format string for printf. param[in] args_ptr Arguments to printf. param[in] buf pointer to the buffer param cb print callback function pointer

return Number of characters to be print

Definition at line 737 of file fsl_str.c.

◆ StrFormatScanf()

int StrFormatScanf ( const char *  line_ptr,
char *  format,
va_list  args_ptr 
)

Converts an input line of ASCII characters based upon a provided string format.

Parameters
[in]line_ptrThe input line of ASCII data.
[in]formatFormat first points to the format string.
[in]args_ptrThe list of parameters.
Returns
Number of input items converted and assigned.
Return values
IO_EOFWhen line_ptr is empty string "".

brief Converts an input line of ASCII characters based upon a provided string format.

param[in] line_ptr The input line of ASCII data. param[in] format Format first points to the format string. param[in] args_ptr The list of parameters.

return Number of input items converted and assigned. retval IO_EOF When line_ptr is empty string "".

Definition at line 1317 of file fsl_str.c.

Variable Documentation

◆ g_serialHandle

serial_handle_t g_serialHandle

serial manager handle

Definition at line 229 of file fsl_debug_console.c.



picovoice_driver
Author(s):
autogenerated on Fri Apr 1 2022 02:15:11