mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
78 lines
1.7 KiB
C
78 lines
1.7 KiB
C
/*
|
|
* Copyright (C) 2015 Kaspar Schleiser <kaspar@schleiser.de>
|
|
* 2018 Freie Universität Berlin
|
|
*
|
|
* This file is subject to the terms and conditions of the GNU Lesser
|
|
* General Public License v2.1. See the file LICENSE in the top level
|
|
* directory for more details.
|
|
*/
|
|
|
|
/**
|
|
* @defgroup sys_stdio STDIO abstraction
|
|
* @ingroup sys
|
|
*
|
|
* @brief Simple standard input/output (STDIO) abstraction for RIOT
|
|
*
|
|
* @{
|
|
* @file
|
|
*
|
|
* @author Kaspar Schleiser <kaspar@schleiser.de>
|
|
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
|
|
*/
|
|
|
|
#ifndef STDIO_BASE_H
|
|
#define STDIO_BASE_H
|
|
|
|
#include <unistd.h>
|
|
|
|
#include "modules.h"
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/**
|
|
* @brief initialize the module
|
|
*/
|
|
void stdio_init(void);
|
|
|
|
#if IS_USED(MODULE_STDIO_AVAILABLE) || DOXYGEN
|
|
/**
|
|
* @brief Get the number of bytes available for reading from stdio.
|
|
*
|
|
* @warning This function is only available if the implementation supports
|
|
* it and the @c stdio_available module is enabled.
|
|
*
|
|
* @return number of available bytes
|
|
*/
|
|
int stdio_available(void);
|
|
#endif
|
|
|
|
/**
|
|
* @brief read @p len bytes from stdio uart into @p buffer
|
|
*
|
|
* @param[out] buffer buffer to read into
|
|
* @param[in] max_len nr of bytes to read
|
|
*
|
|
* @return nr of bytes read
|
|
* @return <0 on error
|
|
*/
|
|
ssize_t stdio_read(void* buffer, size_t max_len);
|
|
|
|
/**
|
|
* @brief write @p len bytes from @p buffer into uart
|
|
*
|
|
* @param[in] buffer buffer to read from
|
|
* @param[in] len nr of bytes to write
|
|
*
|
|
* @return nr of bytes written
|
|
* @return <0 on error
|
|
*/
|
|
ssize_t stdio_write(const void* buffer, size_t len);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
/** @} */
|
|
#endif /* STDIO_BASE_H */
|