MCUXpresso_LPC55S69/docs/MCUXpresso SDK API Referenc.../a00268.html

852 lines
55 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.5"/>
<title>MCUXpresso SDK API Reference Manual: Debug Console</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
$(document).ready(initResizable);
$(window).load(resizeHeight);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="customdoxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectlogo"><img alt="Logo" src="fs_logo.gif"/></td>
<td style="padding-left: 0.5em;">
<div id="projectname">MCUXpresso SDK API Reference Manual
&#160;<span id="projectnumber">Rev 2.15.000</span>
</div>
<div id="projectbrief">NXP Semiconductors</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.5 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main&#160;Page</span></a></li>
<li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
<li><a href="modules.html"><span>API&#160;Reference</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('a00268.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Data Structures</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Groups</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Pages</a></div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="header">
<div class="summary">
<a href="#groups">Modules</a> &#124;
<a href="#define-members">Macros</a> &#124;
<a href="#var-members">Variables</a> </div>
<div class="headertitle">
<div class="title">Debug Console</div> </div>
</div><!--header-->
<div class="contents">
<a name="details" id="details"></a><h2 class="groupheader">Overview</h2>
<p>This chapter describes the programming interface of the debug console driver.</p>
<p>The debug console enables debug log messages to be output via the specified peripheral with frequency of the peripheral source clock and base address at the specified baud rate. Additionally, it provides input and output functions to scan and print formatted data. The below picture shows the laylout of debug console.</p>
<div class="image">
<img src="debug_console_overview.jpg" alt="debug_console_overview.jpg"/>
</div>
<h1><a class="anchor" id="DbgConsoleFunGrps"></a>
Function groups</h1>
<h2><a class="anchor" id="DbgConsoleInit"></a>
Initialization</h2>
<p>To initialize the debug console, call the <span style="color:red"><a class="el" href="a00268.html#ga12e50ee0450679fd8ca950a89338d366" title="Initializes the peripheral used for debug messages. ">DbgConsole_Init()</a></span> function with these parameters. This function automatically enables the module and the clock.</p>
<div class="fragment"><div class="line"></div>
<div class="line"><a class="code" href="a00242.html#gaaabdaf7ee58ca7269bd4bf24efcde092">status_t</a> <a class="code" href="a00268.html#ga12e50ee0450679fd8ca950a89338d366">DbgConsole_Init</a>(uint8_t instance, uint32_t baudRate, <a class="code" href="a00054.html#gaa7dc5f93aacda72d14bb0fa66b0401f3">serial_port_type_t</a> device, uint32_t clkSrcFreq);</div>
</div><!-- fragment --><p>Select the supported debug console hardware device type, such as</p>
<div class="fragment"><div class="line"><span class="keyword">typedef</span> <span class="keyword">enum</span> <a class="code" href="a00054.html#ga37012d03963b0a7aac96cda088362180">_serial_port_type</a></div>
<div class="line">{</div>
<div class="line"> <a class="code" href="a00054.html#gga37012d03963b0a7aac96cda088362180a5b4d039d8c91cb19fca7c5dc196f8d77">kSerialPort_Uart</a> = 1U, </div>
<div class="line"> <a class="code" href="a00054.html#gga37012d03963b0a7aac96cda088362180a3785825f30826c61a4ef13bf983381c2">kSerialPort_UsbCdc</a>, </div>
<div class="line"> <a class="code" href="a00054.html#gga37012d03963b0a7aac96cda088362180af6a37935b2767a9ae22825f0bc49ef77">kSerialPort_Swo</a>, </div>
<div class="line">} <a class="code" href="a00054.html#gaa7dc5f93aacda72d14bb0fa66b0401f3">serial_port_type_t</a>;</div>
</div><!-- fragment --><p>After the initialization is successful, stdout and stdin are connected to the selected peripheral.</p>
<p>This example shows how to call the <a class="el" href="a00268.html#ga12e50ee0450679fd8ca950a89338d366" title="Initializes the peripheral used for debug messages. ">DbgConsole_Init()</a> given the user configuration structure.</p>
<div class="fragment"><div class="line"><a class="code" href="a00268.html#ga12e50ee0450679fd8ca950a89338d366">DbgConsole_Init</a>(BOARD_DEBUG_UART_INSTANCE, BOARD_DEBUG_UART_BAUDRATE, BOARD_DEBUG_UART_TYPE,</div>
<div class="line"> BOARD_DEBUG_UART_CLK_FREQ);</div>
</div><!-- fragment --><h2><a class="anchor" id="DbgConsoleAdvFeature"></a>
Advanced Feature</h2>
<p>The debug console provides input and output functions to scan and print formatted data.</p>
<ul>
<li>Support a format specifier for PRINTF following this prototype <span>" %[flags][width][.precision][length]specifier"</span>, which is explained below</li>
</ul>
<div style="width:800px;"> <table class="doxtable">
<tr>
<th>flags </th><th>Description </th></tr>
<tr>
<td>- </td><td>Left-justified within the given field width. Right-justified is the default. </td></tr>
<tr>
<td>+ </td><td>Forces to precede the result with a plus or minus sign (+ or -) even for positive numbers. By default, only negative numbers are preceded with a - sign. </td></tr>
<tr>
<td>(space) </td><td>If no sign is written, a blank space is inserted before the value. </td></tr>
<tr>
<td># </td><td>Used with o, x, or X specifiers the value is preceded with 0, 0x, or 0X respectively for values other than zero. Used with e, E and f, it forces the written output to contain a decimal point even if no digits would follow. By default, if no digits follow, no decimal point is written. Used with g or G the result is the same as with e or E but trailing zeros are not removed. </td></tr>
<tr>
<td>0 </td><td>Left-pads the number with zeroes (0) instead of spaces, where padding is specified (see width sub-specifier). </td></tr>
</table>
</div><div style="width:800px;"> <table class="doxtable">
<tr>
<th>Width </th><th>Description </th></tr>
<tr>
<td>(number) </td><td>A minimum number of characters to be printed. If the value to be printed is shorter than this number, the result is padded with blank spaces. The value is not truncated even if the result is larger. </td></tr>
<tr>
<td>* </td><td>The width is not specified in the format string, but as an additional integer value argument preceding the argument that has to be formatted. </td></tr>
</table>
</div><div style="width:800px;"> <table class="doxtable">
<tr>
<th>.precision </th><th>Description </th></tr>
<tr>
<td>.number </td><td>For integer specifiers (d, i, o, u, x, X) precision specifies the minimum number of digits to be written. If the value to be written is shorter than this number, the result is padded with leading zeros. The value is not truncated even if the result is longer. A precision of 0 means that no character is written for the value 0. For e, E, and f specifiers this is the number of digits to be printed after the decimal point. For g and G specifiers This is the maximum number of significant digits to be printed. For s this is the maximum number of characters to be printed. By default, all characters are printed until the ending null character is encountered. For c type it has no effect. When no precision is specified, the default is 1. If the period is specified without an explicit value for precision, 0 is assumed. </td></tr>
<tr>
<td>.* </td><td>The precision is not specified in the format string, but as an additional integer value argument preceding the argument that has to be formatted. </td></tr>
</table>
</div><table class="doxtable">
<tr>
<th>length </th><th>Description </th></tr>
<tr>
<td colspan="2">Do not support </td></tr>
</table>
<table class="doxtable">
<tr>
<th>specifier </th><th>Description </th></tr>
<tr>
<td>d or i </td><td>Signed decimal integer </td></tr>
<tr>
<td>f </td><td>Decimal floating point </td></tr>
<tr>
<td>F </td><td>Decimal floating point capital letters </td></tr>
<tr>
<td>x </td><td>Unsigned hexadecimal integer </td></tr>
<tr>
<td>X </td><td>Unsigned hexadecimal integer capital letters </td></tr>
<tr>
<td>o </td><td>Signed octal </td></tr>
<tr>
<td>b </td><td>Binary value </td></tr>
<tr>
<td>p </td><td>Pointer address </td></tr>
<tr>
<td>u </td><td>Unsigned decimal integer </td></tr>
<tr>
<td>c </td><td>Character </td></tr>
<tr>
<td>s </td><td>String of characters </td></tr>
<tr>
<td>n </td><td>Nothing printed </td></tr>
</table>
<ul>
<li>Support a format specifier for SCANF following this prototype <span style="color:red">" %[*][width][length]specifier"</span>, which is explained below</li>
</ul>
<div style="width:800px;"> <table class="doxtable">
<tr>
<th>* </th><th>Description </th></tr>
<tr>
<td colspan="2">An optional starting asterisk indicates that the data is to be read from the stream but ignored. In other words, it is not stored in the corresponding argument. </td></tr>
</table>
</div><div style="width:800px;"> <table class="doxtable">
<tr>
<th>width </th><th>Description </th></tr>
<tr>
<td colspan="2">This specifies the maximum number of characters to be read in the current reading operation. </td></tr>
</table>
</div><div style="width:800px;"> <table class="doxtable">
<tr>
<th>length </th><th>Description </th></tr>
<tr>
<td>hh </td><td>The argument is interpreted as a signed character or unsigned character (only applies to integer specifiers: i, d, o, u, x, and X). </td></tr>
<tr>
<td>h </td><td>The argument is interpreted as a short integer or unsigned short integer (only applies to integer specifiers: i, d, o, u, x, and X). </td></tr>
<tr>
<td>l </td><td>The argument is interpreted as a long integer or unsigned long integer for integer specifiers (i, d, o, u, x, and X) and as a wide character or wide character string for specifiers c and s. </td></tr>
<tr>
<td>ll </td><td>The argument is interpreted as a long long integer or unsigned long long integer for integer specifiers (i, d, o, u, x, and X) and as a wide character or wide character string for specifiers c and s. </td></tr>
<tr>
<td>L </td><td>The argument is interpreted as a long double (only applies to floating point specifiers: e, E, f, g, and G). </td></tr>
<tr>
<td>j or z or t </td><td>Not supported </td></tr>
</table>
</div><div style="width:800px;"> <table class="doxtable">
<tr>
<th>specifier </th><th>Qualifying Input </th><th>Type of argument </th></tr>
<tr>
<td>c </td><td>Single character: Reads the next character. If a width different from 1 is specified, the function reads width characters and stores them in the successive locations of the array passed as argument. No null character is appended at the end. </td><td>char * </td></tr>
<tr>
<td>i </td><td>Integer: : Number optionally preceded with a + or - sign </td><td>int * </td></tr>
<tr>
<td>d </td><td>Decimal integer: Number optionally preceded with a + or - sign </td><td>int * </td></tr>
<tr>
<td>a, A, e, E, f, F, g, G </td><td>Floating point: Decimal number containing a decimal point, optionally preceded by a + or - sign and optionally followed by the e or E character and a decimal number. Two examples of valid entries are -732.103 and 7.12e4 </td><td>float * </td></tr>
<tr>
<td>o </td><td>Octal Integer: </td><td>int * </td></tr>
<tr>
<td>s </td><td>String of characters. This reads subsequent characters until a white space is found (white space characters are considered to be blank, newline, and tab). </td><td>char * </td></tr>
<tr>
<td>u </td><td>Unsigned decimal integer. </td><td>unsigned int * </td></tr>
</table>
</div><p>The debug console has its own printf/scanf/putchar/getchar functions which are defined in the header file.</p>
<div class="fragment"><div class="line"><span class="keywordtype">int</span> <a class="code" href="a00268.html#ga7f9e0678f4c708ed5640b0823c07dc35">DbgConsole_Printf</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *fmt_s, ...); </div>
<div class="line"><span class="keywordtype">int</span> <a class="code" href="a00268.html#gada572d86a06f028b5b1a5d0440f683e3">DbgConsole_Putchar</a>(<span class="keywordtype">int</span> ch); </div>
<div class="line"><span class="keywordtype">int</span> <a class="code" href="a00268.html#ga53b115907016172dcf58fcffab144a6d">DbgConsole_Scanf</a>(<span class="keywordtype">char</span> *fmt_ptr, ...); </div>
<div class="line"><span class="keywordtype">int</span> <a class="code" href="a00268.html#ga11898c5015274863741c4f3f4d9edc08">DbgConsole_Getchar</a>(<span class="keywordtype">void</span>); </div>
</div><!-- fragment --><p>This utility supports selecting toolchain's printf/scanf or the MCUXpresso SDK printf/scanf.</p>
<div class="fragment"><div class="line"><span class="preprocessor">#if SDK_DEBUGCONSOLE == DEBUGCONSOLE_DISABLE </span><span class="comment">/* Disable debug console */</span><span class="preprocessor"></span></div>
<div class="line"><span class="preprocessor"></span><span class="preprocessor">#define PRINTF</span></div>
<div class="line"><span class="preprocessor"></span><span class="preprocessor">#define SCANF</span></div>
<div class="line"><span class="preprocessor"></span><span class="preprocessor">#define PUTCHAR</span></div>
<div class="line"><span class="preprocessor"></span><span class="preprocessor">#define GETCHAR</span></div>
<div class="line"><span class="preprocessor"></span><span class="preprocessor">#elif SDK_DEBUGCONSOLE == DEBUGCONSOLE_REDIRECT_TO_SDK </span><span class="comment">/* Select printf, scanf, putchar, getchar of SDK version. */</span><span class="preprocessor"></span></div>
<div class="line"><span class="preprocessor"></span><span class="preprocessor">#define PRINTF DbgConsole_Printf</span></div>
<div class="line"><span class="preprocessor"></span><span class="preprocessor">#define SCANF DbgConsole_Scanf</span></div>
<div class="line"><span class="preprocessor"></span><span class="preprocessor">#define PUTCHAR DbgConsole_Putchar</span></div>
<div class="line"><span class="preprocessor"></span><span class="preprocessor">#define GETCHAR DbgConsole_Getchar</span></div>
<div class="line"><span class="preprocessor"></span><span class="preprocessor">#elif SDK_DEBUGCONSOLE == DEBUGCONSOLE_REDIRECT_TO_TOOLCHAIN </span><span class="comment">/* Select printf, scanf, putchar, getchar of toolchain. */</span><span class="preprocessor"></span></div>
<div class="line"><span class="preprocessor"></span><span class="preprocessor">#define PRINTF printf</span></div>
<div class="line"><span class="preprocessor"></span><span class="preprocessor">#define SCANF scanf</span></div>
<div class="line"><span class="preprocessor"></span><span class="preprocessor">#define PUTCHAR putchar</span></div>
<div class="line"><span class="preprocessor"></span><span class="preprocessor">#define GETCHAR getchar</span></div>
<div class="line"><span class="preprocessor">#endif </span><span class="comment">/* SDK_DEBUGCONSOLE */</span><span class="preprocessor"></span></div>
</div><!-- fragment --><h2><a class="anchor" id="DbgConsoleFrontendAndBackend"></a>
SDK_DEBUGCONSOLE and SDK_DEBUGCONSOLE_UART</h2>
<p>There are two macros SDK_DEBUGCONSOLE and SDK_DEBUGCONSOLE_UART added to configure PRINTF and low level output perihperal.</p>
<ul>
<li>The macro SDK_DEBUGCONSOLE is used for forntend. Whether debug console redirect to toolchain or SDK or disabled, it decides which is the frontend of the debug console, Tool chain or SDK. The fucntion can be set by the macro SDK_DEBUGCONSOLE.</li>
<li>The macro SDK_DEBUGCONSOLE_UART is used for backend. It is use to decide whether provide low level IO implementation to toolchain printf and scanf. For example, within MCUXpresso, if the macro SDK_DEBUGCONSOLE_UART is defined, __sys_write and __sys_readc will be used when __REDLIB__ is defined; _write and _read will be used in other cases.The macro does not specifically refer to the perihpheral "UART". It refers to the external perihperal similar to UART, like as USB CDC, UART, SWO, etc. So if the macro SDK_DEBUGCONSOLE_UART is not defined when tool-chain printf is calling, the semihosting will be used.</li>
</ul>
<p>The following the matrix show the effects of SDK_DEBUGCONSOLE and SDK_DEBUGCONSOLE_UART on PRINTF and printf. The green mark is the default setting of the debug console. </p>
<div style="width:800px;"> <table class="doxtable">
<tr>
<th>SDK_DEBUGCONSOLE </th><th>SDK_DEBUGCONSOLE_UART </th><th>PRINTF </th><th>printf </th></tr>
<tr>
<td>DEBUGCONSOLE_REDIRECT_TO_SDK </td><td>defined </td><td>Low level peripheral* </td><td>Low level peripheral* </td></tr>
<tr>
<td style="color:green">DEBUGCONSOLE_REDIRECT_TO_SDK </td><td style="color:green">undefined </td><td style="color:green">Low level peripheral* </td><td style="color:green">semihost </td></tr>
<tr>
<td>DEBUGCONSOLE_REDIRECT_TO_TOOLCHAIN </td><td>defined </td><td>Low level peripheral* </td><td>Low level peripheral* </td></tr>
<tr>
<td>DEBUGCONSOLE_REDIRECT_TO_TOOLCHAIN </td><td>undefined </td><td>semihost </td><td>semihost </td></tr>
<tr>
<td>DEBUGCONSOLE_DISABLE </td><td>defined </td><td>No ouput </td><td>Low level peripheral* </td></tr>
<tr>
<td>DEBUGCONSOLE_DISABLE </td><td>undefined </td><td>No ouput </td><td>semihost </td></tr>
</table>
</div><p> <b>*</b> the <b>low level peripheral</b> could be USB CDC, UART, or SWO, and so on.</p>
<h1><a class="anchor" id="DbgConsoleTpyUC"></a>
Typical use case</h1>
<h2>Some examples use the PUTCHAR &amp; GETCHAR function</h2>
<div class="fragment"><div class="line">ch = GETCHAR();</div>
<div class="line">PUTCHAR(ch);</div>
</div><!-- fragment --><h2>Some examples use the PRINTF function</h2>
<p>Statement prints the string format.</p>
<div class="fragment"><div class="line"><a class="code" href="a00268.html#gae1649fc947ca37a86917a08354f48d1a">PRINTF</a>(<span class="stringliteral">&quot;%s %s\r\n&quot;</span>, <span class="stringliteral">&quot;Hello&quot;</span>, <span class="stringliteral">&quot;world!&quot;</span>);</div>
</div><!-- fragment --><p>Statement prints the hexadecimal format/</p>
<div class="fragment"><div class="line"><a class="code" href="a00268.html#gae1649fc947ca37a86917a08354f48d1a">PRINTF</a>(<span class="stringliteral">&quot;0x%02X hexadecimal number equivalents 255&quot;</span>, 255);</div>
</div><!-- fragment --><p>Statement prints the decimal floating point and unsigned decimal.</p>
<div class="fragment"><div class="line"><a class="code" href="a00268.html#gae1649fc947ca37a86917a08354f48d1a">PRINTF</a>(<span class="stringliteral">&quot;Execution timer: %s\n\rTime: %u ticks %2.5f milliseconds\n\rDONE\n\r&quot;</span>, <span class="stringliteral">&quot;1 day&quot;</span>, 86400, 86.4);</div>
</div><!-- fragment --><h2>Some examples use the SCANF function</h2>
<div class="fragment"><div class="line"><a class="code" href="a00268.html#gae1649fc947ca37a86917a08354f48d1a">PRINTF</a>(<span class="stringliteral">&quot;Enter a decimal number: &quot;</span>);</div>
<div class="line">SCANF(<span class="stringliteral">&quot;%d&quot;</span>, &amp;i);</div>
<div class="line"><a class="code" href="a00268.html#gae1649fc947ca37a86917a08354f48d1a">PRINTF</a>(<span class="stringliteral">&quot;\r\nYou have entered %d.\r\n&quot;</span>, i, i);</div>
<div class="line"><a class="code" href="a00268.html#gae1649fc947ca37a86917a08354f48d1a">PRINTF</a>(<span class="stringliteral">&quot;Enter a hexadecimal number: &quot;</span>);</div>
<div class="line">SCANF(<span class="stringliteral">&quot;%x&quot;</span>, &amp;i);</div>
<div class="line"><a class="code" href="a00268.html#gae1649fc947ca37a86917a08354f48d1a">PRINTF</a>(<span class="stringliteral">&quot;\r\nYou have entered 0x%X (%d).\r\n&quot;</span>, i, i);</div>
</div><!-- fragment --><h2>Print out failure messages using MCUXpresso SDK __assert_func:</h2>
<div class="fragment"><div class="line"><span class="keywordtype">void</span> __assert_func(<span class="keyword">const</span> <span class="keywordtype">char</span> *file, <span class="keywordtype">int</span> line, <span class="keyword">const</span> <span class="keywordtype">char</span> *func, <span class="keyword">const</span> <span class="keywordtype">char</span> *failedExpr)</div>
<div class="line">{</div>
<div class="line"> <a class="code" href="a00268.html#gae1649fc947ca37a86917a08354f48d1a">PRINTF</a>(<span class="stringliteral">&quot;ASSERT ERROR \&quot; %s \&quot;: file \&quot;%s\&quot; Line \&quot;%d\&quot; function name \&quot;%s\&quot; \n&quot;</span>, failedExpr, file , line, func);</div>
<div class="line"> <span class="keywordflow">for</span> (;;)</div>
<div class="line"> {}</div>
<div class="line">}</div>
</div><!-- fragment --> <h2>Note:</h2>
<p>To use 'printf' and 'scanf' for GNUC Base, add file <b>'fsl_sbrk.c'</b> in path: <b>..\{package}\devices\{subset}\utilities\fsl_sbrk.c </b> to your project.</p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="groups"></a>
Modules</h2></td></tr>
<tr class="memitem:a00271"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00271.html">SWO</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a00270"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00270.html">Semihosting</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a00269"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00269.html">debug console configuration</a></td></tr>
<tr class="memdesc:a00269"><td class="mdescLeft">&#160;</td><td class="mdescRight">The configuration is used for debug console only. <br/></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="define-members"></a>
Macros</h2></td></tr>
<tr class="memitem:gabb8f0adbec02f143b4f84d2eb42126df"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00268.html#gabb8f0adbec02f143b4f84d2eb42126df">DEBUGCONSOLE_REDIRECT_TO_TOOLCHAIN</a>&#160;&#160;&#160;0U</td></tr>
<tr class="memdesc:gabb8f0adbec02f143b4f84d2eb42126df"><td class="mdescLeft">&#160;</td><td class="mdescRight">Definition select redirect toolchain printf, scanf to uart or not. <a href="#gabb8f0adbec02f143b4f84d2eb42126df">More...</a><br/></td></tr>
<tr class="separator:gabb8f0adbec02f143b4f84d2eb42126df"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gac33031f28afa29dc8fe1718bbc86ee23"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00268.html#gac33031f28afa29dc8fe1718bbc86ee23">DEBUGCONSOLE_REDIRECT_TO_SDK</a>&#160;&#160;&#160;1U</td></tr>
<tr class="memdesc:gac33031f28afa29dc8fe1718bbc86ee23"><td class="mdescLeft">&#160;</td><td class="mdescRight">Select SDK version printf, scanf. <a href="#gac33031f28afa29dc8fe1718bbc86ee23">More...</a><br/></td></tr>
<tr class="separator:gac33031f28afa29dc8fe1718bbc86ee23"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaf8f85fd102e4aedcee3d061dc2d3e0c2"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00268.html#gaf8f85fd102e4aedcee3d061dc2d3e0c2">DEBUGCONSOLE_DISABLE</a>&#160;&#160;&#160;2U</td></tr>
<tr class="memdesc:gaf8f85fd102e4aedcee3d061dc2d3e0c2"><td class="mdescLeft">&#160;</td><td class="mdescRight">Disable debugconsole function. <a href="#gaf8f85fd102e4aedcee3d061dc2d3e0c2">More...</a><br/></td></tr>
<tr class="separator:gaf8f85fd102e4aedcee3d061dc2d3e0c2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga7fdd594efdc8374ecd8684ed758d6cec"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00268.html#ga7fdd594efdc8374ecd8684ed758d6cec">SDK_DEBUGCONSOLE</a>&#160;&#160;&#160;<a class="el" href="a00268.html#gac33031f28afa29dc8fe1718bbc86ee23">DEBUGCONSOLE_REDIRECT_TO_SDK</a></td></tr>
<tr class="memdesc:ga7fdd594efdc8374ecd8684ed758d6cec"><td class="mdescLeft">&#160;</td><td class="mdescRight">Definition to select sdk or toolchain printf, scanf. <a href="#ga7fdd594efdc8374ecd8684ed758d6cec">More...</a><br/></td></tr>
<tr class="separator:ga7fdd594efdc8374ecd8684ed758d6cec"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gae1649fc947ca37a86917a08354f48d1a"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00268.html#gae1649fc947ca37a86917a08354f48d1a">PRINTF</a>&#160;&#160;&#160;<a class="el" href="a00268.html#ga7f9e0678f4c708ed5640b0823c07dc35">DbgConsole_Printf</a></td></tr>
<tr class="memdesc:gae1649fc947ca37a86917a08354f48d1a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Definition to select redirect toolchain printf, scanf to uart or not. <a href="#gae1649fc947ca37a86917a08354f48d1a">More...</a><br/></td></tr>
<tr class="separator:gae1649fc947ca37a86917a08354f48d1a"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="var-members"></a>
Variables</h2></td></tr>
<tr class="memitem:gaad3c4240a1364156a239471ccdb9aa0b"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="gaad3c4240a1364156a239471ccdb9aa0b"></a>
<a class="el" href="a00054.html#gaba1cc3859c4f829ee0bc6091184d4b08">serial_handle_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00268.html#gaad3c4240a1364156a239471ccdb9aa0b">g_serialHandle</a></td></tr>
<tr class="memdesc:gaad3c4240a1364156a239471ccdb9aa0b"><td class="mdescLeft">&#160;</td><td class="mdescRight">serial manager handle <br/></td></tr>
<tr class="separator:gaad3c4240a1364156a239471ccdb9aa0b"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="member-group"></a>
Initialization</h2></td></tr>
<tr class="memitem:ga12e50ee0450679fd8ca950a89338d366"><td class="memItemLeft" align="right" valign="top"><a class="el" href="a00242.html#gaaabdaf7ee58ca7269bd4bf24efcde092">status_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00268.html#ga12e50ee0450679fd8ca950a89338d366">DbgConsole_Init</a> (uint8_t instance, uint32_t baudRate, <a class="el" href="a00054.html#gaa7dc5f93aacda72d14bb0fa66b0401f3">serial_port_type_t</a> device, uint32_t clkSrcFreq)</td></tr>
<tr class="memdesc:ga12e50ee0450679fd8ca950a89338d366"><td class="mdescLeft">&#160;</td><td class="mdescRight">Initializes the peripheral used for debug messages. <a href="#ga12e50ee0450679fd8ca950a89338d366">More...</a><br/></td></tr>
<tr class="separator:ga12e50ee0450679fd8ca950a89338d366"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gad80e7aa70bbb3fce1a9168621372833e"><td class="memItemLeft" align="right" valign="top"><a class="el" href="a00242.html#gaaabdaf7ee58ca7269bd4bf24efcde092">status_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00268.html#gad80e7aa70bbb3fce1a9168621372833e">DbgConsole_Deinit</a> (void)</td></tr>
<tr class="memdesc:gad80e7aa70bbb3fce1a9168621372833e"><td class="mdescLeft">&#160;</td><td class="mdescRight">De-initializes the peripheral used for debug messages. <a href="#gad80e7aa70bbb3fce1a9168621372833e">More...</a><br/></td></tr>
<tr class="separator:gad80e7aa70bbb3fce1a9168621372833e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga9ce272e795c2b235265d3dfb50669bee"><td class="memItemLeft" align="right" valign="top"><a class="el" href="a00242.html#gaaabdaf7ee58ca7269bd4bf24efcde092">status_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00268.html#ga9ce272e795c2b235265d3dfb50669bee">DbgConsole_EnterLowpower</a> (void)</td></tr>
<tr class="memdesc:ga9ce272e795c2b235265d3dfb50669bee"><td class="mdescLeft">&#160;</td><td class="mdescRight">Prepares to enter low power consumption. <a href="#ga9ce272e795c2b235265d3dfb50669bee">More...</a><br/></td></tr>
<tr class="separator:ga9ce272e795c2b235265d3dfb50669bee"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga21831f5ee970f3a1f13ff375405f3592"><td class="memItemLeft" align="right" valign="top"><a class="el" href="a00242.html#gaaabdaf7ee58ca7269bd4bf24efcde092">status_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00268.html#ga21831f5ee970f3a1f13ff375405f3592">DbgConsole_ExitLowpower</a> (void)</td></tr>
<tr class="memdesc:ga21831f5ee970f3a1f13ff375405f3592"><td class="mdescLeft">&#160;</td><td class="mdescRight">Restores from low power consumption. <a href="#ga21831f5ee970f3a1f13ff375405f3592">More...</a><br/></td></tr>
<tr class="separator:ga21831f5ee970f3a1f13ff375405f3592"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga7f9e0678f4c708ed5640b0823c07dc35"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00268.html#ga7f9e0678f4c708ed5640b0823c07dc35">DbgConsole_Printf</a> (const char *fmt_s,...)</td></tr>
<tr class="memdesc:ga7f9e0678f4c708ed5640b0823c07dc35"><td class="mdescLeft">&#160;</td><td class="mdescRight">Writes formatted output to the standard output stream. <a href="#ga7f9e0678f4c708ed5640b0823c07dc35">More...</a><br/></td></tr>
<tr class="separator:ga7f9e0678f4c708ed5640b0823c07dc35"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga48560c409b88fbe195e140aa20c5307b"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00268.html#ga48560c409b88fbe195e140aa20c5307b">DbgConsole_Vprintf</a> (const char *fmt_s, va_list formatStringArg)</td></tr>
<tr class="memdesc:ga48560c409b88fbe195e140aa20c5307b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Writes formatted output to the standard output stream. <a href="#ga48560c409b88fbe195e140aa20c5307b">More...</a><br/></td></tr>
<tr class="separator:ga48560c409b88fbe195e140aa20c5307b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gada572d86a06f028b5b1a5d0440f683e3"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00268.html#gada572d86a06f028b5b1a5d0440f683e3">DbgConsole_Putchar</a> (int ch)</td></tr>
<tr class="memdesc:gada572d86a06f028b5b1a5d0440f683e3"><td class="mdescLeft">&#160;</td><td class="mdescRight">Writes a character to stdout. <a href="#gada572d86a06f028b5b1a5d0440f683e3">More...</a><br/></td></tr>
<tr class="separator:gada572d86a06f028b5b1a5d0440f683e3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga53b115907016172dcf58fcffab144a6d"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00268.html#ga53b115907016172dcf58fcffab144a6d">DbgConsole_Scanf</a> (char *fmt_s,...)</td></tr>
<tr class="memdesc:ga53b115907016172dcf58fcffab144a6d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Reads formatted data from the standard input stream. <a href="#ga53b115907016172dcf58fcffab144a6d">More...</a><br/></td></tr>
<tr class="separator:ga53b115907016172dcf58fcffab144a6d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga11898c5015274863741c4f3f4d9edc08"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00268.html#ga11898c5015274863741c4f3f4d9edc08">DbgConsole_Getchar</a> (void)</td></tr>
<tr class="memdesc:ga11898c5015274863741c4f3f4d9edc08"><td class="mdescLeft">&#160;</td><td class="mdescRight">Reads a character from standard input. <a href="#ga11898c5015274863741c4f3f4d9edc08">More...</a><br/></td></tr>
<tr class="separator:ga11898c5015274863741c4f3f4d9edc08"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga23e7c243b07d594a0a1016dcab28d3a3"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00268.html#ga23e7c243b07d594a0a1016dcab28d3a3">DbgConsole_BlockingPrintf</a> (const char *fmt_s,...)</td></tr>
<tr class="memdesc:ga23e7c243b07d594a0a1016dcab28d3a3"><td class="mdescLeft">&#160;</td><td class="mdescRight">Writes formatted output to the standard output stream with the blocking mode. <a href="#ga23e7c243b07d594a0a1016dcab28d3a3">More...</a><br/></td></tr>
<tr class="separator:ga23e7c243b07d594a0a1016dcab28d3a3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaed722925a966ae462d5d44cd33f836c3"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00268.html#gaed722925a966ae462d5d44cd33f836c3">DbgConsole_BlockingVprintf</a> (const char *fmt_s, va_list formatStringArg)</td></tr>
<tr class="memdesc:gaed722925a966ae462d5d44cd33f836c3"><td class="mdescLeft">&#160;</td><td class="mdescRight">Writes formatted output to the standard output stream with the blocking mode. <a href="#gaed722925a966ae462d5d44cd33f836c3">More...</a><br/></td></tr>
<tr class="separator:gaed722925a966ae462d5d44cd33f836c3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga3194467c3dae6c5015b8b29c3cc1db1e"><td class="memItemLeft" align="right" valign="top"><a class="el" href="a00242.html#gaaabdaf7ee58ca7269bd4bf24efcde092">status_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00268.html#ga3194467c3dae6c5015b8b29c3cc1db1e">DbgConsole_Flush</a> (void)</td></tr>
<tr class="memdesc:ga3194467c3dae6c5015b8b29c3cc1db1e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Debug console flush. <a href="#ga3194467c3dae6c5015b8b29c3cc1db1e">More...</a><br/></td></tr>
<tr class="separator:ga3194467c3dae6c5015b8b29c3cc1db1e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga867a9778cd1401d3336ae5599851c1fd"><td class="memItemLeft" align="right" valign="top"><a class="el" href="a00242.html#gaaabdaf7ee58ca7269bd4bf24efcde092">status_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00268.html#ga867a9778cd1401d3336ae5599851c1fd">DbgConsole_TryGetchar</a> (char *ch)</td></tr>
<tr class="memdesc:ga867a9778cd1401d3336ae5599851c1fd"><td class="mdescLeft">&#160;</td><td class="mdescRight">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. <a href="#ga867a9778cd1401d3336ae5599851c1fd">More...</a><br/></td></tr>
<tr class="separator:ga867a9778cd1401d3336ae5599851c1fd"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Macro Definition Documentation</h2>
<a class="anchor" id="gabb8f0adbec02f143b4f84d2eb42126df"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define DEBUGCONSOLE_REDIRECT_TO_TOOLCHAIN&#160;&#160;&#160;0U</td>
</tr>
</table>
</div><div class="memdoc">
<p>Select toolchain printf and scanf. </p>
</div>
</div>
<a class="anchor" id="gac33031f28afa29dc8fe1718bbc86ee23"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define DEBUGCONSOLE_REDIRECT_TO_SDK&#160;&#160;&#160;1U</td>
</tr>
</table>
</div><div class="memdoc">
</div>
</div>
<a class="anchor" id="gaf8f85fd102e4aedcee3d061dc2d3e0c2"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define DEBUGCONSOLE_DISABLE&#160;&#160;&#160;2U</td>
</tr>
</table>
</div><div class="memdoc">
</div>
</div>
<a class="anchor" id="ga7fdd594efdc8374ecd8684ed758d6cec"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define SDK_DEBUGCONSOLE&#160;&#160;&#160;<a class="el" href="a00268.html#gac33031f28afa29dc8fe1718bbc86ee23">DEBUGCONSOLE_REDIRECT_TO_SDK</a></td>
</tr>
</table>
</div><div class="memdoc">
<p>The macro only support to be redefined in project setting. </p>
</div>
</div>
<a class="anchor" id="gae1649fc947ca37a86917a08354f48d1a"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define PRINTF&#160;&#160;&#160;<a class="el" href="a00268.html#ga7f9e0678f4c708ed5640b0823c07dc35">DbgConsole_Printf</a></td>
</tr>
</table>
</div><div class="memdoc">
<p>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. </p>
</div>
</div>
<h2 class="groupheader">Function Documentation</h2>
<a class="anchor" id="ga12e50ee0450679fd8ca950a89338d366"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="a00242.html#gaaabdaf7ee58ca7269bd4bf24efcde092">status_t</a> DbgConsole_Init </td>
<td>(</td>
<td class="paramtype">uint8_t&#160;</td>
<td class="paramname"><em>instance</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t&#160;</td>
<td class="paramname"><em>baudRate</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="a00054.html#gaa7dc5f93aacda72d14bb0fa66b0401f3">serial_port_type_t</a>&#160;</td>
<td class="paramname"><em>device</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t&#160;</td>
<td class="paramname"><em>clkSrcFreq</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>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.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">instance</td><td>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. </td></tr>
<tr><td class="paramname">baudRate</td><td>The desired baud rate in bits per second. </td></tr>
<tr><td class="paramname">device</td><td>Low level device type for the debug console, can be one of the following. <ul>
<li>kSerialPort_Uart, </li>
<li>kSerialPort_UsbCdc </li>
</ul>
</td></tr>
<tr><td class="paramname">clkSrcFreq</td><td>Frequency of peripheral source clock.</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Indicates whether initialization was successful or not. </dd></dl>
<dl class="retval"><dt>Return values</dt><dd>
<table class="retval">
<tr><td class="paramname">kStatus_Success</td><td>Execution successfully </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="gad80e7aa70bbb3fce1a9168621372833e"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="a00242.html#gaaabdaf7ee58ca7269bd4bf24efcde092">status_t</a> DbgConsole_Deinit </td>
<td>(</td>
<td class="paramtype">void&#160;</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Call this function to disable debug log messages to be output via the specified peripheral initialized by the serial manager module.</p>
<dl class="section return"><dt>Returns</dt><dd>Indicates whether de-initialization was successful or not. </dd></dl>
</div>
</div>
<a class="anchor" id="ga9ce272e795c2b235265d3dfb50669bee"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="a00242.html#gaaabdaf7ee58ca7269bd4bf24efcde092">status_t</a> DbgConsole_EnterLowpower </td>
<td>(</td>
<td class="paramtype">void&#160;</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>This function is used to prepare to enter low power consumption.</p>
<dl class="section return"><dt>Returns</dt><dd>Indicates whether de-initialization was successful or not. </dd></dl>
</div>
</div>
<a class="anchor" id="ga21831f5ee970f3a1f13ff375405f3592"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="a00242.html#gaaabdaf7ee58ca7269bd4bf24efcde092">status_t</a> DbgConsole_ExitLowpower </td>
<td>(</td>
<td class="paramtype">void&#160;</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>This function is used to restore from low power consumption.</p>
<dl class="section return"><dt>Returns</dt><dd>Indicates whether de-initialization was successful or not. </dd></dl>
</div>
</div>
<a class="anchor" id="ga7f9e0678f4c708ed5640b0823c07dc35"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int DbgConsole_Printf </td>
<td>(</td>
<td class="paramtype">const char *&#160;</td>
<td class="paramname"><em>fmt_s</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">&#160;</td>
<td class="paramname"><em>...</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Call this function to write a formatted output to the standard output stream.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">fmt_s</td><td>Format control string. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Returns the number of characters printed or a negative value if an error occurs. </dd></dl>
</div>
</div>
<a class="anchor" id="ga48560c409b88fbe195e140aa20c5307b"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int DbgConsole_Vprintf </td>
<td>(</td>
<td class="paramtype">const char *&#160;</td>
<td class="paramname"><em>fmt_s</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">va_list&#160;</td>
<td class="paramname"><em>formatStringArg</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Call this function to write a formatted output to the standard output stream.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">fmt_s</td><td>Format control string. </td></tr>
<tr><td class="paramname">formatStringArg</td><td>Format arguments. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Returns the number of characters printed or a negative value if an error occurs. </dd></dl>
</div>
</div>
<a class="anchor" id="gada572d86a06f028b5b1a5d0440f683e3"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int DbgConsole_Putchar </td>
<td>(</td>
<td class="paramtype">int&#160;</td>
<td class="paramname"><em>ch</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Call this function to write a character to stdout.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">ch</td><td>Character to be written. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Returns the character written. </dd></dl>
</div>
</div>
<a class="anchor" id="ga53b115907016172dcf58fcffab144a6d"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int DbgConsole_Scanf </td>
<td>(</td>
<td class="paramtype">char *&#160;</td>
<td class="paramname"><em>fmt_s</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">&#160;</td>
<td class="paramname"><em>...</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Call this function to read formatted data from the standard input stream.</p>
<dl class="section note"><dt>Note</dt><dd>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.</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">fmt_s</td><td>Format control string. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Returns the number of fields successfully converted and assigned. </dd></dl>
</div>
</div>
<a class="anchor" id="ga11898c5015274863741c4f3f4d9edc08"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int DbgConsole_Getchar </td>
<td>(</td>
<td class="paramtype">void&#160;</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Call this function to read a character from standard input.</p>
<dl class="section note"><dt>Note</dt><dd>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.</dd></dl>
<dl class="section return"><dt>Returns</dt><dd>Returns the character read. </dd></dl>
</div>
</div>
<a class="anchor" id="ga23e7c243b07d594a0a1016dcab28d3a3"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int DbgConsole_BlockingPrintf </td>
<td>(</td>
<td class="paramtype">const char *&#160;</td>
<td class="paramname"><em>fmt_s</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">&#160;</td>
<td class="paramname"><em>...</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>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.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">fmt_s</td><td>Format control string. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Returns the number of characters printed or a negative value if an error occurs. </dd></dl>
</div>
</div>
<a class="anchor" id="gaed722925a966ae462d5d44cd33f836c3"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int DbgConsole_BlockingVprintf </td>
<td>(</td>
<td class="paramtype">const char *&#160;</td>
<td class="paramname"><em>fmt_s</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">va_list&#160;</td>
<td class="paramname"><em>formatStringArg</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>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.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">fmt_s</td><td>Format control string. </td></tr>
<tr><td class="paramname">formatStringArg</td><td>Format arguments. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Returns the number of characters printed or a negative value if an error occurs. </dd></dl>
</div>
</div>
<a class="anchor" id="ga3194467c3dae6c5015b8b29c3cc1db1e"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="a00242.html#gaaabdaf7ee58ca7269bd4bf24efcde092">status_t</a> DbgConsole_Flush </td>
<td>(</td>
<td class="paramtype">void&#160;</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>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 </p>
<dl class="section return"><dt>Returns</dt><dd>Indicates whether wait idle was successful or not. </dd></dl>
</div>
</div>
<a class="anchor" id="ga867a9778cd1401d3336ae5599851c1fd"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="a00242.html#gaaabdaf7ee58ca7269bd4bf24efcde092">status_t</a> DbgConsole_TryGetchar </td>
<td>(</td>
<td class="paramtype">char *&#160;</td>
<td class="paramname"><em>ch</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">ch</td><td>the address of char to receive </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Indicates get char was successful or not. </dd></dl>
</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- HTML footer for doxygen 1.8.5-->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul class="foot">
<li class="footer">&copy; 2016 NXP Semiconductors. All rights reserved.
</li>
</ul>
</div>
</body>
</html>