1 /*
2  * Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #ifndef _PICO_STDIO_SEMIHOSTING_H
8 #define _PICO_STDIO_SEMIHOSTING_H
9 
10 #include "pico/stdio.h"
11 
12 /** \brief Experimental support for stdout using RAM semihosting
13  *  \defgroup pico_stdio_semihosting pico_stdio_semihosting
14  *  \ingroup pico_stdio
15  *
16  *  Linking this library or calling `pico_enable_stdio_semihosting(TARGET ENABLED)` in the CMake (which
17  *  achieves the same thing) will add semihosting to the drivers used for standard output
18  */
19 
20 // PICO_CONFIG: PICO_STDIO_SEMIHOSTING_DEFAULT_CRLF, Default state of CR/LF translation for semihosting output, type=bool, default=PICO_STDIO_DEFAULT_CRLF, group=pico_stdio_semihosting
21 #ifndef PICO_STDIO_SEMIHOSTING_DEFAULT_CRLF
22 #define PICO_STDIO_SEMIHOSTING_DEFAULT_CRLF PICO_STDIO_DEFAULT_CRLF
23 #endif
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
29 extern stdio_driver_t stdio_semihosting;
30 
31 /*! \brief Explicitly initialize stdout over semihosting and add it to the current set of stdout targets
32  *  \ingroup pico_stdio_semihosting
33  *
34  * \note this method is automatically called by \ref stdio_init_all() if `pico_stdio_semihosting` is included in the build
35  */
36 void stdio_semihosting_init(void);
37 
38 /*! \brief Explicitly deinitialize stdout over semihosting and add it to the current set of stdout targets
39  *  \ingroup pico_stdio_semihosting
40  *
41  * \note this method is automatically called by \ref stdio_deinit_all() if `pico_stdio_semihosting` is included in the build
42  */
43 void stdio_semihosting_deinit(void);
44 
45 #ifdef __cplusplus
46 }
47 #endif
48 
49 #endif
50