• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * drivers/amlogic/media/stream_input/parser/stream_buffer_base.h
3  *
4  * Copyright (C) 2016 Amlogic, Inc. All rights reserved.
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
14  * more details.
15  *
16  */
17 
18 #ifndef STREAM_BUFFER_INTERFACE_H
19 #define STREAM_BUFFER_INTERFACE_H
20 #include "streambuf.h"
21 #include "streambuf_reg.h"
22 
23 #define STBUF_READ(s, func, args...)			\
24 ({							\
25 	u32 ret = 0;					\
26 	if ((s) && (s)->ops)				\
27 		ret = (s)->ops->func((s), ##args);	\
28 	ret;						\
29 })
30 
31 #define STBUF_WRITE(s, func, args...)			\
32 ({							\
33 	if ((s) && (s)->ops)				\
34 		(s)->ops->func((s), ##args);		\
35 })
36 
37 extern struct stream_buf_ops *get_stbuf_ops(void);
38 extern struct stream_buf_ops *get_esparser_stbuf_ops(void);
39 extern struct stream_buf_ops *get_tsparser_stbuf_ops(void);
40 extern struct stream_buf_ops *get_psparser_stbuf_ops(void);
41 
42 int stream_buffer_base_init(struct stream_buf_s *stbuf,
43 			    struct stream_buf_ops *ops,
44 			    struct parser_args *pars);
45 
46 void stream_buffer_set_ext_buf(struct stream_buf_s *stbuf,
47 			   ulong addr,
48 			   u32 size);
49 
50 int stream_buffer_write(struct file *file,
51 			struct stream_buf_s *stbuf,
52 			const char *buf,
53 			size_t count);
54 
55 ssize_t stream_buffer_write_ex(struct file *file,
56 			   struct stream_buf_s *stbuf,
57 			   const char __user *buf,
58 			   size_t count,
59 			   int flags);
60 
61 #endif /* STREAM_BUFFER_INTERFACE_H */
62 
63