VSF Documented
vsf_fifo_stream.h
Go to the documentation of this file.
1/*****************************************************************************
2 * Copyright(C)2009-2022 by VSF Team *
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#ifndef __VSF_FIFO_STREAM_H__
19#define __VSF_FIFO_STREAM_H__
20
21/*============================ INCLUDES ======================================*/
22
24
25#if VSF_USE_SIMPLE_STREAM == ENABLED
26
27#if defined(__VSF_FIFO_STREAM_CLASS_IMPLEMENT)
28# define __VSF_CLASS_IMPLEMENT__
29# undef __VSF_FIFO_STREAM_CLASS_IMPLEMENT
30#elif defined(__VSF_FIFO_STREAM_CLASS_INHERIT__)
31# define __VSF_CLASS_INHERIT__
32# undef __VSF_FIFO_STREAM_CLASS_INHERIT__
33#endif
34
35#include "utilities/ooc_class.h"
36
37#ifdef __cplusplus
38extern "C" {
39#endif
40
41/*============================ MACROS ========================================*/
42
43#define vsf_fifo_stream_size_t uint32_t
44
45#define __VSF_FIFO_STREAM_INIT(__BUFFER, __SIZE) \
46 .op = &vsf_fifo_stream_op, \
47 .buffer = (__BUFFER), \
48 .size = (__SIZE),
49#define VSF_FIFO_STREAM_INIT(__BUFFER, __SIZE) \
50 __VSF_FIFO_STREAM_INIT((__BUFFER), (__SIZE))
51
52#define __vsf_fifo_stream_type(__name) __name##_fifo_stream_t
53#define vsf_fifo_stream_type(__name) __vsf_fifo_stream_type(__name)
54
55#define __declare_fifo_stream(__name) \
56 vsf_dcl_class(vsf_fifo_stream_type(__name))
57
58#define __define_fifo_stream(__name, __size) \
59 vsf_class(vsf_fifo_stream_type(__name)) { \
60 public_member( \
61 implement(vsf_fifo_stream_t) \
62 uint8_t __buffer[__size]; \
63 ) \
64 };
65
66#define declare_fifo_stream(__name) \
67 __declare_fifo_stream(__name)
68#define dcl_fifo_stream(__name) \
69 declare_fifo_stream(__name)
70#define define_fifo_stream(__name, __size) \
71 __define_fifo_stream(__name, (__size))
72#define def_fifo_stream(__name, __size) \
73 define_fifo_stream(__name, (__size))
74
75#define __describe_fifo_stream(__name, __size) \
76 declare_fifo_stream(__name) \
77 define_fifo_stream(__name, (__size)) \
78 vsf_fifo_stream_type(__name) __name = { \
79 VSF_FIFO_STREAM_INIT(__name.__buffer, (__size)) \
80 };
81
82#define describe_fifo_stream(__name, __size) \
83 __describe_fifo_stream(__name, (__size))
84
85/*============================ MACROFIED FUNCTIONS ===========================*/
86/*============================ TYPES =========================================*/
87
89 public_member(
90 uint8_t *buffer;
92 )
93 private_member(
96 )
97};
98
100 public_member(
101 implement(vsf_stream_t)
102 implement(vsf_byte_fifo_t)
103 )
104};
105
106/*============================ GLOBAL VARIABLES ==============================*/
107
109
110/*============================ PROTOTYPES ====================================*/
111
121
122#ifdef __cplusplus
123}
124#endif
125
126#endif // VSF_USE_SIMPLE_STREAM
127#endif // __VSF_FIFO_STREAM_H__
vsf_err_t
Definition __type.h:42
Definition vsf_fifo_stream.h:88
Definition vsf_fifo_stream.h:99
Definition vsf_simple_stream.h:176
Definition vsf_simple_stream.h:254
struct ieee80211_ext_chansw_ie data
Definition ieee80211.h:80
#define vsf_class(__name)
Definition ooc_class.h:48
unsigned int uint_fast32_t
Definition stdint.h:27
unsigned char uint8_t
Definition stdint.h:5
const vsf_stream_op_t vsf_fifo_stream_op
Definition vsf_fifo_stream.c:45
uint_fast32_t vsf_byte_fifo_get_wbuf(vsf_byte_fifo_t *fifo, uint8_t **data)
Definition vsf_fifo_stream.c:135
uint_fast32_t vsf_byte_fifo_write(vsf_byte_fifo_t *fifo, uint8_t *data, uint_fast32_t size)
Definition vsf_fifo_stream.c:94
uint_fast32_t vsf_byte_fifo_get_data_length(vsf_byte_fifo_t *fifo)
Definition vsf_fifo_stream.c:72
uint_fast32_t vsf_byte_fifo_read(vsf_byte_fifo_t *fifo, uint8_t *data, uint_fast32_t size)
Definition vsf_fifo_stream.c:169
#define vsf_fifo_stream_size_t
Definition vsf_fifo_stream.h:43
uint_fast32_t vsf_byte_fifo_get_avail_length(vsf_byte_fifo_t *fifo)
Definition vsf_fifo_stream.c:82
uint_fast32_t vsf_byte_fifo_get_buff_length(vsf_byte_fifo_t *fifo)
Definition vsf_fifo_stream.c:66
uint_fast32_t vsf_byte_fifo_peek(vsf_byte_fifo_t *fifo, uint8_t *data, uint_fast32_t size)
Definition vsf_fifo_stream.c:147
uint_fast32_t vsf_byte_fifo_get_rbuf(vsf_byte_fifo_t *fifo, uint8_t **data)
Definition vsf_fifo_stream.c:123
vsf_err_t vsf_byte_fifo_init(vsf_byte_fifo_t *fifo)
Definition vsf_fifo_stream.c:59
uint32_t size
Definition vsf_memfs.h:50
__bfs_node_fifo_t fifo
Definition vsf_msg_tree.h:247
uint16_t tail
Definition vsf_queue.h:632
uint16_t head
Definition vsf_queue.h:632