18#ifndef __VSF_BLOCK_STREAM_H__
19#define __VSF_BLOCK_STREAM_H__
25#if VSF_USE_SIMPLE_STREAM == ENABLED && VSF_USE_FIFO == ENABLED
27#include "../../fifo/vsf_fifo.h"
30#if defined(__VSF_BLOCK_STREAM_CLASS_IMPLEMENT)
31# define __VSF_CLASS_IMPLEMENT__
32#elif defined(__VSF_BLOCK_STREAM_CLASS_INHERIT__)
33# define __VSF_CLASS_INHERIT__
44#if VSF_USE_FIFO != ENABLED
45# error block stream need VSF_USE_FIFO
48#define vsf_block_stream_size_t uint32_t
50#define __VSF_BLOCK_STREAM_INIT(__BLOCK_NUM, __BLOCK_SIZE) \
51 .op = &vsf_block_stream_op, \
52 .block_size = (vsf_fifo_item_size_t)(((__BLOCK_SIZE) + 3) & ~3),\
53 .block_num = (vsf_fifo_index_t)(__BLOCK_NUM),
54#define VSF_BLOCK_STREAM_INIT(__BLOCK_NUM, __BLOCK_SIZE) \
55 __VSF_BLOCK_STREAM_INIT((__BLOCK_NUM), (__BLOCK_SIZE))
57#define __vsf_block_stream_type(__name) __name##_block_stream_t
58#define vsf_block_stream_type(__name) __vsf_block_stream_type(__name)
60#define __declare_block_stream(__name) \
61 vsf_dcl_class(vsf_block_stream_type(__name)) \
64#define __define_block_stream(__name, __block_num, __block_size) \
65 typedef struct __name##_block_stream_item_t { \
66 implement(vsf_block_stream_item_t) \
67 uint32_t __buffer[(__block_size + 3) >> 2]; \
68 } __name##_block_stream_item_t; \
69 def_vsf_fifo(__name, __name##_block_stream_item_t, (__block_num)) \
70 vsf_class(vsf_block_stream_type(__name)) { \
72 implement(__vsf_block_stream_t) \
75 vsf_fifo(__name) fifo; \
79#define declare_block_stream(__name) \
80 __declare_block_stream(__name)
81#define dcl_block_stream(__name) \
82 declare_block_stream(__name)
83#define define_block_stream(__name, __block_num, __block_size) \
84 __define_block_stream(__name, (__block_num), (__block_size))
85#define def_block_stream(__name, __block_num, __block_size) \
86 define_block_stream(__name, (__block_num), (__block_size))
88#define __describe_block_stream(__name, __block_num, __block_size) \
89 declare_block_stream(__name) \
90 define_block_stream(__name, (__block_num), (__block_size)) \
91 vsf_block_stream_type(__name) __name = { \
92 VSF_BLOCK_STREAM_INIT(__block_num, __block_size) \
95#define describe_block_stream(__name, __block_num, __block_size) \
96 __describe_block_stream(__name, (__block_num), (__block_size))
135#undef __VSF_BLOCK_STREAM_CLASS_IMPLEMENT
136#undef __VSF_BLOCK_STREAM_CLASS_INHERIT__
Definition vsf_block_stream.h:106
Definition vsf_block_stream.h:117
Definition vsf_fifo.h:175
Definition vsf_simple_stream.h:176
Definition vsf_simple_stream.h:254
#define vsf_class(__name)
Definition ooc_class.h:48
Definition vsf_block_stream.h:101
vsf_block_stream_size_t pos
Definition vsf_block_stream.h:103
vsf_block_stream_size_t size
Definition vsf_block_stream.h:102
const vsf_stream_op_t vsf_block_stream_op
Definition vsf_block_stream.c:67
#define vsf_block_stream_size_t
Definition vsf_block_stream.h:48
#define vsf_fifo_index_t
Definition vsf_fifo.h:161
#define vsf_fifo_item_size_t
Definition vsf_fifo.h:167