blob: 973adad0b5179ccda3f1de5dba4fc68ec3180d04 [file] [log] [blame]
Harald Welte361ed202019-02-24 21:15:39 +01001/**
2 * \file
3 *
4 * \brief STDIO redirection terminal
5 *
6 * Copyright (c) 2015-2018 Microchip Technology Inc. and its subsidiaries.
7 *
8 * \asf_license_start
9 *
10 * \page License
11 *
12 * Subject to your compliance with these terms, you may use Microchip
13 * software and any derivatives exclusively with Microchip products.
14 * It is your responsibility to comply with third party license terms applicable
15 * to your use of third party software (including open source software) that
16 * may accompany Microchip software.
17 *
18 * THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES,
19 * WHETHER EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE,
20 * INCLUDING ANY IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY,
21 * AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT WILL MICROCHIP BE
22 * LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE, INCIDENTAL OR CONSEQUENTIAL
23 * LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND WHATSOEVER RELATED TO THE
24 * SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS BEEN ADVISED OF THE
25 * POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE FULLEST EXTENT
26 * ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN ANY WAY
27 * RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY,
28 * THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE.
29 *
30 * \asf_license_stop
31 *
32 */
33
34#ifndef _STDIO_IO_H_INCLUDED
35#define _STDIO_IO_H_INCLUDED
36
37#include <hal_io.h>
38
39#ifdef __cplusplus
40extern "C" {
41#endif /* __cplusplus */
42
43/**
44 * \brief Initialize STDIO access
45 * \param[in] io Pointer to IO descriptor,
46 * NULL to discard R/W without any error.
47 */
48void stdio_io_init(struct io_descriptor *io);
49
50/**
51 * \brief Change IO descriptor for terminal to R/W data
52 * \param[in] io Pointer to IO descriptor,
53 * NULL to discard R/W without any error.
54 */
55void stdio_io_set_io(struct io_descriptor *io);
56
57/**
58 * \brief Read through specified terminal
59 * \param[out] buf Pointer to buffer to place read data
60 * \param[in] len Data length in number of bytes
61 * \return status
62 * \retval >=0 number of bytes read
63 * \retval <0 error
64 */
65int32_t stdio_io_read(uint8_t *buf, const int32_t len);
66
67/**
68 * \brief Write through specified terminal
69 * \param[in] buf Pointer to buffer to place data to write
70 * \param[in] len Data length in number of bytes
71 * \return status
72 * \retval >=0 number of bytes read
73 * \retval <0 error
74 */
75int32_t stdio_io_write(const uint8_t *buf, const int32_t len);
76
77#ifdef __cplusplus
78}
79#endif /* __cplusplus */
80
81#endif /* _STDIO_IO_H_INCLUDED */