Stream redirection.
More...
#include <stdio.h>
#include "sarmfsw.h"
#include "UART_term.h"
#include "stdream_rdir.h"
|
int | _write (int file, char *ptr, int len) |
| syscalls implementation of _write
|
|
Stream redirection.
- Author
- SMFSW
- Copyright
- MIT (c) 2017-2024, SMFSW
- Note
- define ITM_REDIRECT in compiler defines for stings to be printed to ITM0 port
-
define UART_REDIRECT and DBG_SERIAL in compiler defines with an UART instance to send printf likes strings to UART
- Warning
- By default when using syscalls, stdout stream is buffered, meaning that output will only be processed when '\n' (new line) character is sent to buffer. To override this behavior, stdout_no_buffer has to be called once in init routine to disable buffering, thus processing characters as they come.
◆ _write()
int _write |
( |
int | file, |
|
|
char * | ptr, |
|
|
int | len ) |
syscalls implementation of _write
- Strong Functions
- Strong implementation of _write for UART & ITM string send to stream
- Parameters
-
[in] | file | - unused |
[in] | ptr | - pointer to string to send to stream |
[in] | len | - length of string to send to stream |
- Returns
- length written to stream (-1 otherwise)
- Return values
-
-1 | is returned in case of failure (UART) |