1 /*------------------------------------------------------------------------------
3 * Copyright (c) 2004-2019 ARM Germany GmbH. All rights reserved.
4 *------------------------------------------------------------------------------
5 * Name: retarget_user.c
6 * Purpose: User specific retarget of stdin, stdout and stderr
7 *----------------------------------------------------------------------------*/
10 #include "fsl_debug_console.h" // NXP::Device:SDK Utilities:debug_console
12 int DbgConsole_SendDataReliable(uint8_t *ch, size_t size);
13 int DbgConsole_ReadCharacter(uint8_t *ch);
16 Put a character to the stderr
18 \param[in] ch Character to output
19 \return The character written, or -1 on write error.
21 int stderr_putchar (int ch) {
24 ret = DbgConsole_SendDataReliable((uint8_t *)(&ch), 1);
33 Put a character to the stdout
35 \param[in] ch Character to output
36 \return The character written, or -1 on write error.
38 int stdout_putchar (int ch) {
41 ret = DbgConsole_SendDataReliable((uint8_t *)(&ch), 1);
50 Get a character from the stdio
52 \return The next character from the input, or -1 on read error.
54 int stdin_getchar (void) {
58 ret = DbgConsole_ReadCharacter(&ch);