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#include <platform_support.h>		/* inline */
23#include <input_system_global.h>
24#include <ia_css_stream_public.h>	/* IA_CSS_STREAM_MAX_ISYS_STREAM_PER_CH */
25
26#define SH_CSS_NODES_PER_THREAD		2
27#define SH_CSS_MAX_ISYS_CHANNEL_NODES	(SH_CSS_MAX_SP_THREADS * SH_CSS_NODES_PER_THREAD)
28
29/*
30 * a) ia_css_isys_stream_h & ia_css_isys_stream_cfg_t come from host.
31 *
32 * b) Here it is better  to use actual structures for stream handle
33 * instead of opaque handles. Otherwise, we need to have another
34 * communication channel to interpret that opaque handle(this handle is
35 * maintained by host and needs to be populated to sp for every stream open)
36 * */
37typedef virtual_input_system_stream_t		*ia_css_isys_stream_h;
38typedef virtual_input_system_stream_cfg_t	ia_css_isys_stream_cfg_t;
39
40/*
41 * error check for ISYS APIs.
42 * */
43typedef bool ia_css_isys_error_t;
44
45static inline uint32_t ia_css_isys_generate_stream_id(
46    u32	sp_thread_id,
47    uint32_t	stream_id)
48{
49	return sp_thread_id * IA_CSS_STREAM_MAX_ISYS_STREAM_PER_CH + stream_id;
50}
51
52#endif  /*_IA_CSS_ISYS_COMM_H */
53