Zephyr Project API
3.7.0
A Scalable Open Source RTOS
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
7
#ifndef SHELL_FPRINTF_H__
8
#define SHELL_FPRINTF_H__
9
10
#include <
zephyr/kernel.h
>
11
#include <
stdbool.h
>
12
#include <stddef.h>
13
14
#ifdef __cplusplus
15
extern
"C"
{
16
#endif
17
18
typedef
void (*
shell_fprintf_fwrite
)(
const
void
*user_ctx,
19
const
char
*
data
,
20
size_t
length);
21
22
struct
shell_fprintf_control_block
{
23
size_t
buffer_cnt
;
24
bool
autoflush
;
25
};
29
struct
shell_fprintf
{
30
uint8_t
*
buffer
;
31
size_t
buffer_size
;
32
shell_fprintf_fwrite
fwrite
;
33
const
void
*
user_ctx
;
34
struct
shell_fprintf_control_block
*
ctrl_blk
;
35
};
36
47
#define Z_SHELL_FPRINTF_DEFINE(_name, _user_ctx, _buf, _size, \
48
_autoflush, _fwrite) \
49
static struct shell_fprintf_control_block \
50
_name##_shell_fprintf_ctx = { \
51
.autoflush = _autoflush, \
52
.buffer_cnt = 0 \
53
}; \
54
static const struct shell_fprintf _name = { \
55
.buffer = _buf, \
56
.buffer_size = _size, \
57
.fwrite = _fwrite, \
58
.user_ctx = _user_ctx, \
59
.ctrl_blk = &_name##_shell_fprintf_ctx \
60
}
61
69
void
z_shell_fprintf_fmt(
const
struct
shell_fprintf
*sh_fprintf,
70
char
const
*fmt, va_list args);
71
77
void
z_shell_fprintf_buffer_flush(
const
struct
shell_fprintf
*sh_fprintf);
78
79
#ifdef __cplusplus
80
}
81
#endif
82
83
#endif
/* SHELL_FPRINTF_H__ */
kernel.h
Public kernel APIs.
shell_fprintf_fwrite
void(* shell_fprintf_fwrite)(const void *user_ctx, const char *data, size_t length)
Definition
shell_fprintf.h:18
stdbool.h
uint8_t
__UINT8_TYPE__ uint8_t
Definition
stdint.h:88
shell_fprintf_control_block
Definition
shell_fprintf.h:22
shell_fprintf_control_block::buffer_cnt
size_t buffer_cnt
Definition
shell_fprintf.h:23
shell_fprintf_control_block::autoflush
bool autoflush
Definition
shell_fprintf.h:24
shell_fprintf
fprintf context
Definition
shell_fprintf.h:29
shell_fprintf::buffer_size
size_t buffer_size
Definition
shell_fprintf.h:31
shell_fprintf::ctrl_blk
struct shell_fprintf_control_block * ctrl_blk
Definition
shell_fprintf.h:34
shell_fprintf::buffer
uint8_t * buffer
Definition
shell_fprintf.h:30
shell_fprintf::fwrite
shell_fprintf_fwrite fwrite
Definition
shell_fprintf.h:32
shell_fprintf::user_ctx
const void * user_ctx
Definition
shell_fprintf.h:33
data
static fdata_t data[2]
Definition
test_fifo_contexts.c:15
include
zephyr
shell
shell_fprintf.h
Generated on Sun Sep 15 2024 17:01:30 for Zephyr Project API by
1.9.8