ChibiOS/RT Architecture - Reference Manual - Guides |
00001 /* 00002 ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. 00003 00004 This file is part of ChibiOS/RT. 00005 00006 ChibiOS/RT is free software; you can redistribute it and/or modify 00007 it under the terms of the GNU General Public License as published by 00008 the Free Software Foundation; either version 3 of the License, or 00009 (at your option) any later version. 00010 00011 ChibiOS/RT is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 GNU General Public License for more details. 00015 00016 You should have received a copy of the GNU General Public License 00017 along with this program. If not, see <http://www.gnu.org/licenses/>. 00018 00019 --- 00020 00021 A special exception to the GPL can be applied should you wish to distribute 00022 a combined work that includes ChibiOS/RT, without being obliged to provide 00023 the source code for any proprietary components. See the file exception.txt 00024 for full details of how and when the exception can be applied. 00025 */ 00026 00027 /** 00028 * @file memstreams.h 00029 * @brief Memory streams structures and macros. 00030 00031 * @addtogroup memory_streams 00032 * @{ 00033 */ 00034 00035 #ifndef _MEMSTREAMS_H_ 00036 #define _MEMSTREAMS_H_ 00037 00038 /** 00039 * @brief @p RamStream specific data. 00040 */ 00041 #define _memory_stream_data \ 00042 _base_sequential_stream_data \ 00043 /* Pointer to the stream buffer.*/ \ 00044 uint8_t *buffer; \ 00045 /* Size of the stream.*/ \ 00046 size_t size; \ 00047 /* Current end of stream.*/ \ 00048 size_t eos; \ 00049 /* Current read offset.*/ \ 00050 size_t offset; 00051 00052 /** 00053 * @brief @p MemStream virtual methods table. 00054 */ 00055 struct MemStreamVMT { 00056 _base_sequential_stream_methods 00057 }; 00058 00059 /** 00060 * @extends BaseSequentialStream 00061 * 00062 * @brief Memory stream object. 00063 */ 00064 typedef struct { 00065 /** @brief Virtual Methods Table.*/ 00066 const struct MemStreamVMT *vmt; 00067 _memory_stream_data 00068 } MemoryStream; 00069 00070 #ifdef __cplusplus 00071 extern "C" { 00072 #endif 00073 void msObjectInit(MemoryStream *msp, uint8_t *buffer, size_t size, size_t eos); 00074 #ifdef __cplusplus 00075 } 00076 #endif 00077 00078 #endif /* _MEMSTREAMS_H_ */ 00079 00080 /** @} */