1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Support for Intel Camera Imaging ISP subsystem.
4  * Copyright (c) 2010 - 2015, Intel Corporation.
5  *
6  * This program is free software; you can redistribute it and/or modify it
7  * under the terms and conditions of the GNU General Public License,
8  * version 2, as published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
13  * more details.
14  */
15 
16 #ifndef __IA_CSS_ISYS_COMM_H
17 #define __IA_CSS_ISYS_COMM_H
18 
19 #include <type_support.h>
20 #include <input_system.h>
21 
22 #ifdef ISP2401
23 #include <platform_support.h>		/* inline */
24 #include <input_system_global.h>
25 #include <ia_css_stream_public.h>	/* IA_CSS_STREAM_MAX_ISYS_STREAM_PER_CH */
26 
27 #define SH_CSS_NODES_PER_THREAD		2
28 #define SH_CSS_MAX_ISYS_CHANNEL_NODES	(SH_CSS_MAX_SP_THREADS * SH_CSS_NODES_PER_THREAD)
29 
30 /*
31  * a) ia_css_isys_stream_h & ia_css_isys_stream_cfg_t come from host.
32  *
33  * b) Here it is better  to use actual structures for stream handle
34  * instead of opaque handles. Otherwise, we need to have another
35  * communication channel to interpret that opaque handle(this handle is
36  * maintained by host and needs to be populated to sp for every stream open)
37  * */
38 typedef virtual_input_system_stream_t		*ia_css_isys_stream_h;
39 typedef virtual_input_system_stream_cfg_t	ia_css_isys_stream_cfg_t;
40 
41 /*
42  * error check for ISYS APIs.
43  * */
44 typedef bool ia_css_isys_error_t;
45 
46 static inline uint32_t ia_css_isys_generate_stream_id(
47     u32	sp_thread_id,
48     uint32_t	stream_id)
49 {
50 	return sp_thread_id * IA_CSS_STREAM_MAX_ISYS_STREAM_PER_CH + stream_id;
51 }
52 
53 #endif  /* ISP2401*/
54 #endif  /*_IA_CSS_ISYS_COMM_H */
55