Zephyr API
4.4.99
A Scalable Open Source RTOS
Toggle main menu visibility
Loading...
Searching...
No Matches
shell_fprintf.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2018 Nordic Semiconductor ASA
3
*
4
* SPDX-License-Identifier: Apache-2.0
5
*/
6
11
12
#ifndef ZEPHYR_INCLUDE_SHELL_SHELL_FPRINTF_H_
13
#define ZEPHYR_INCLUDE_SHELL_SHELL_FPRINTF_H_
14
15
#include <
zephyr/kernel.h
>
16
#include <
stdbool.h
>
17
#include <stddef.h>
18
19
#ifdef __cplusplus
20
extern
"C"
{
21
#endif
22
24
25
typedef
void (*shell_fprintf_fwrite)(
const
void
*user_ctx,
26
const
char
*data,
27
size_t
length);
28
29
struct
shell_fprintf_control_block {
30
size_t
buffer_cnt;
31
bool
autoflush;
32
};
36
struct
shell_fprintf
{
37
uint8_t
*buffer;
38
size_t
buffer_size;
39
shell_fprintf_fwrite
fwrite
;
40
const
void
*user_ctx;
41
struct
shell_fprintf_control_block *ctrl_blk;
42
};
43
45
56
#define Z_SHELL_FPRINTF_DEFINE(_name, _user_ctx, _buf, _size, \
57
_autoflush, _fwrite) \
58
static struct shell_fprintf_control_block \
59
_name##_shell_fprintf_ctx = { \
60
.autoflush = _autoflush, \
61
.buffer_cnt = 0 \
62
}; \
63
static const struct shell_fprintf _name = { \
64
.buffer = _buf, \
65
.buffer_size = _size, \
66
.fwrite = _fwrite, \
67
.user_ctx = _user_ctx, \
68
.ctrl_blk = &_name##_shell_fprintf_ctx \
69
}
70
78
void
z_shell_fprintf_fmt(
const
struct
shell_fprintf
*sh_fprintf,
79
char
const
*fmt, va_list args);
80
87
void
z_shell_cbpprintf_fmt(
const
struct
shell_fprintf
*sh_fprintf,
void
*package);
88
94
void
z_shell_fprintf_buffer_flush(
const
struct
shell_fprintf
*sh_fprintf);
95
96
#ifdef __cplusplus
97
}
98
#endif
99
100
#endif
/* ZEPHYR_INCLUDE_SHELL_SHELL_FPRINTF_H_ */
shell_fprintf
#define shell_fprintf(sh, color, fmt,...)
printf-like function which sends formatted data stream to the shell.
Definition
shell.h:1316
kernel.h
Public kernel APIs.
stdbool.h
uint8_t
__UINT8_TYPE__ uint8_t
Definition
stdint.h:88
fwrite
size_t fwrite(const void *ZRESTRICT ptr, size_t size, size_t nitems, FILE *ZRESTRICT stream)
zephyr
shell
shell_fprintf.h
Generated on
for Zephyr API by
1.17.0