Embedded TCP/IP stack: Serial Input/Output library API
From FNET
![]() |
Embedded TCP/IP stack
4.1.0
|
Serial Input/Output library API
Detailed Description
The Serial Input/Output (I/O) library provides commonly used I/O functions like printf(), putchar() and getchar().
It uses stream abstraction to allow reading and writing data in an uniform way. There are three standard streams allocated automatically that are associated with physical serial ports (one per UART module).
For the serial library usage example, refer to FNET demo application source code.
NOTE: The HW serial ports associated with I/O streams are not initialized by the serial library and should be initialized by the application. It can be inialized by the fnet_cpu_serial_init() function.
Configuration parameters:
Data Structures | |
| struct | fnet_serial_stream |
| Stream control structure. More... | |
Macros | |
| #define | FNET_SERIAL_STREAM_PORT0 |
| Stream descriptor associated with the serial port 0. More... | |
| #define | FNET_SERIAL_STREAM_PORT1 |
| Stream descriptor associated with the serial port 1. More... | |
| #define | FNET_SERIAL_STREAM_PORT2 |
| Stream descriptor associated with the serial port 2. More... | |
| #define | FNET_SERIAL_STREAM_PORT3 |
| Stream descriptor associated with the serial port 3. More... | |
| #define | FNET_SERIAL_STREAM_PORT4 |
| Stream descriptor associated with the serial port 4. More... | |
| #define | FNET_SERIAL_STREAM_PORT5 |
| Stream descriptor associated with the serial port 5. More... | |
| #define | FNET_SERIAL_STREAM_DEFAULT |
| Descriptor of the default stream. It's assigned to the default serial port defined by FNET_CFG_CPU_SERIAL_PORT_DEFAULT (usually the serial port 0). More... | |
Typedefs | |
| typedef const struct fnet_serial_stream * | fnet_serial_stream_t |
| Serial stream descriptor. More... | |
Functions | |
| void | fnet_serial_putchar (fnet_serial_stream_t stream, fnet_char_t character) |
| Writes character to the stream. More... | |
| fnet_int32_t | fnet_serial_getchar (fnet_serial_stream_t stream) |
| Reads character from the stream. More... | |
| void | fnet_serial_flush (fnet_serial_stream_t stream) |
| Sends data from the internal stream buffer to the stream client. More... | |
| void | fnet_putchar (fnet_char_t character) |
| Writes character to the default stream. More... | |
| fnet_int32_t | fnet_getchar (void) |
| Reads character from the default stream. More... | |
| fnet_size_t | fnet_serial_printf (fnet_serial_stream_t stream, const fnet_char_t *format,...) |
| Prints formatted text to the stream. More... | |
| fnet_size_t | fnet_serial_vprintf (fnet_serial_stream_t stream, const fnet_char_t *format, va_list arg) |
| Prints formatted variable argument list to the stream. More... | |
| fnet_size_t | fnet_printf (const fnet_char_t *format,...) |
| Prints formatted text to the default stream. More... | |
| fnet_size_t | fnet_println (const fnet_char_t *format,...) |
| Prints formatted text to the default stream and terminates the printed text by the line separator string. More... | |
| fnet_size_t | fnet_sprintf (fnet_char_t *str, const fnet_char_t *format,...) |
| Prints formatted text to the buffer. More... | |
| fnet_size_t | fnet_snprintf (fnet_char_t *str, fnet_size_t size, const fnet_char_t *format,...) |
| Prints formatted text to the buffer. The length of the buffer is given, that prevents the buffer overflows. More... | |
© 2005-2018 by Andrey Butok. http://fnet.sourceforge.net
