Zephyr API Documentation 4.0.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 ZEPHYR_INCLUDE_SHELL_FPRINTF_H_
8#define ZEPHYR_INCLUDE_SHELL_FPRINTF_H_
9
10#include <zephyr/kernel.h>
11#include <stdbool.h>
12#include <stddef.h>
13
14#ifdef __cplusplus
15extern "C" {
16#endif
17
18typedef void (*shell_fprintf_fwrite)(const void *user_ctx,
19 const char *data,
20 size_t length);
21
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
69void z_shell_fprintf_fmt(const struct shell_fprintf *sh_fprintf,
70 char const *fmt, va_list args);
71
77void z_shell_fprintf_buffer_flush(const struct shell_fprintf *sh_fprintf);
78
79#ifdef __cplusplus
80}
81#endif
82
83#endif /* ZEPHYR_INCLUDE_SHELL_FPRINTF_H_ */
Public kernel APIs.
void(* shell_fprintf_fwrite)(const void *user_ctx, const char *data, size_t length)
Definition shell_fprintf.h:18
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
Definition shell_fprintf.h:22
size_t buffer_cnt
Definition shell_fprintf.h:23
bool autoflush
Definition shell_fprintf.h:24
fprintf context
Definition shell_fprintf.h:29
size_t buffer_size
Definition shell_fprintf.h:31
struct shell_fprintf_control_block * ctrl_blk
Definition shell_fprintf.h:34
uint8_t * buffer
Definition shell_fprintf.h:30
shell_fprintf_fwrite fwrite
Definition shell_fprintf.h:32
const void * user_ctx
Definition shell_fprintf.h:33