ChibiOS/HAL 9.0.0
memstreams.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 * @file memstreams.h
19 * @brief Memory streams structures and macros.
20
21 * @addtogroup HAL_MEMORY_STREAMS
22 * @{
23 */
24
25#ifndef MEMSTREAMS_H
26#define MEMSTREAMS_H
27
28/*===========================================================================*/
29/* Driver constants. */
30/*===========================================================================*/
31
32/*===========================================================================*/
33/* Driver pre-compile time settings. */
34/*===========================================================================*/
35
36/*===========================================================================*/
37/* Derived constants and error checks. */
38/*===========================================================================*/
39
40/*===========================================================================*/
41/* Driver data structures and types. */
42/*===========================================================================*/
43
44/**
45 * @brief @p MemStream specific data.
46 */
47#define _memory_stream_data \
48 _base_buffered_stream_data \
49 /* Pointer to the stream buffer.*/ \
50 uint8_t *buffer; \
51 /* Size of the stream.*/ \
52 size_t size; \
53 /* Current end of stream.*/ \
54 size_t eos; \
55 /* Current read offset.*/ \
56 size_t offset;
57
58/**
59 * @brief @p MemStream virtual methods table.
60 */
64
65/**
66 * @extends BaseSequentialStream
67 *
68 * @brief Memory stream object.
69 */
70typedef struct {
71 /** @brief Virtual Methods Table.*/
72 const struct MemStreamVMT *vmt;
75
76/*===========================================================================*/
77/* Driver macros. */
78/*===========================================================================*/
79
80/*===========================================================================*/
81/* External declarations. */
82/*===========================================================================*/
83
84#ifdef __cplusplus
85extern "C" {
86#endif
87 void msObjectInit(MemoryStream *msp, uint8_t *buffer,
88 size_t size, size_t eos);
89#ifdef __cplusplus
90}
91#endif
92
93#endif /* MEMSTREAMS_H */
94
95/** @} */
void msObjectInit(MemoryStream *msp, uint8_t *buffer, size_t size, size_t eos)
Memory stream object initialization.
Definition memstreams.c:116
#define _memory_stream_data
MemStream specific data.
Definition memstreams.h:47
#define _base_buffered_stream_methods
BaseBufferedStream specific methods.
MemStream virtual methods table.
Definition memstreams.h:61
Memory stream object.
Definition memstreams.h:70
const struct MemStreamVMT * vmt
Virtual Methods Table.
Definition memstreams.h:72