ChibiOS/HAL
7.2.0
bufstreams.h
Go to the documentation of this file.
1
/*
2
ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
3
4
Licensed under the Apache License, Version 2.0 (the "License");
5
you may not use this file except in compliance with the License.
6
You may obtain a copy of the License at
7
8
http://www.apache.org/licenses/LICENSE-2.0
9
10
Unless required by applicable law or agreed to in writing, software
11
distributed under the License is distributed on an "AS IS" BASIS,
12
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
See the License for the specific language governing permissions and
14
limitations under the License.
15
*/
16
17
/*
18
This file was contributed by Alex Lewontin.
19
*/
20
21
/**
22
* @file bufstreams.h
23
* @brief Buffered streams structures and macros.
24
25
* @addtogroup HAL_BUFFERED_STREAMS
26
* @{
27
*/
28
29
#ifndef BUFSTREAMS_H
30
#define BUFSTREAMS_H
31
32
/*===========================================================================*/
33
/* Driver constants. */
34
/*===========================================================================*/
35
36
/**
37
* @brief Buffer size for unget.
38
*/
39
#if !defined(BUFSTREAM_BUFFER_SIZE) || defined(__DOXYGEN__)
40
#define BUFSTREAM_BUFFER_SIZE 1
41
#endif
42
43
/*===========================================================================*/
44
/* Driver pre-compile time settings. */
45
/*===========================================================================*/
46
47
/*===========================================================================*/
48
/* Derived constants and error checks. */
49
/*===========================================================================*/
50
51
/*===========================================================================*/
52
/* Driver data structures and types. */
53
/*===========================================================================*/
54
55
/**
56
* @brief @p BufferedStreamAdapter specific data.
57
*/
58
#define _buffered_stream_adapter_data \
59
_base_buffered_stream_data \
60
/* Pointer to a wrapped BaseSequentialStream object */
\
61
BaseSequentialStream* bssp; \
62
/* Stream buffer */
\
63
uint8_t buffer[BUFSTREAM_BUFFER_SIZE]; \
64
/* Index in the stream buffer */
\
65
size_t ndx;
66
67
/**
68
* @brief @p BufferedStreamAdapter virtual methods table.
69
*/
70
struct
BufferedStreamAdapterVMT
{
71
_base_buffered_stream_methods
72
};
73
74
/**
75
* @extends BufferedStream
76
*
77
* @brief Buffered stream adapter object.
78
*/
79
typedef
struct
{
80
/** @brief Virtual Methods Table.*/
81
const
struct
BufferedStreamAdapterVMT
*
vmt
;
82
_buffered_stream_adapter_data
83
}
BufferedStreamAdapter
;
84
85
/*===========================================================================*/
86
/* Driver macros. */
87
/*===========================================================================*/
88
89
/*===========================================================================*/
90
/* External declarations. */
91
/*===========================================================================*/
92
93
#ifdef __cplusplus
94
extern
"C"
{
95
#endif
96
void
bsaObjectInit
(
BufferedStreamAdapter
*bsap,
BaseSequentialStream
* bssp);
97
#ifdef __cplusplus
98
}
99
#endif
100
101
#endif
/* MEMSTREAMS_H */
102
103
/** @} */
bsaObjectInit
void bsaObjectInit(BufferedStreamAdapter *bsap, BaseSequentialStream *bssp)
Buffered stream adapter object initialization.
Definition:
bufstreams.c:115
BufferedStreamAdapterVMT
BufferedStreamAdapter virtual methods table.
Definition:
bufstreams.h:70
BaseSequentialStream
Base stream class.
Definition:
hal_streams.h:83
BufferedStreamAdapter::vmt
const struct BufferedStreamAdapterVMT * vmt
Virtual Methods Table.
Definition:
bufstreams.h:81
BufferedStreamAdapter
Buffered stream adapter object.
Definition:
bufstreams.h:79
_base_buffered_stream_methods
#define _base_buffered_stream_methods
BaseBufferedStream specific methods.
Definition:
hal_streams.h:157
_buffered_stream_adapter_data
#define _buffered_stream_adapter_data
BufferedStreamAdapter specific data.
Definition:
bufstreams.h:58
home
giovanni
Projects
ChibiStudio
chibios_stable-21.6.x
os
hal
lib
streams
bufstreams.h
Generated on Sun Jun 13 2021 16:13:17 for ChibiOS/HAL by
1.8.17