1 /*
2  * Support for Intel Camera Imaging ISP subsystem.
3  * Copyright (c) 2015, Intel Corporation.
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms and conditions of the GNU General Public License,
7  * version 2, as published by the Free Software Foundation.
8  *
9  * This program is distributed in the hope it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
12  * more details.
13  */
14 
15 #ifndef __SH_CSS_STRUCT_H
16 #define __SH_CSS_STRUCT_H
17 
18 /* This header files contains the definition of the
19    sh_css struct and friends; locigally the file would
20    probably be called sh_css.h after the pattern
21    <type>.h but sh_css.h is the predecesssor of ia_css.h
22    so this could cause confusion; hence the _struct
23    in the filename
24 */
25 
26 #include <type_support.h>
27 #include <system_types.h>
28 #include "ia_css_pipeline.h"
29 #include "ia_css_pipe_public.h"
30 #include "ia_css_frame_public.h"
31 #include "ia_css_queue.h"
32 #include "ia_css_irq.h"
33 
34 struct sh_css {
35 	struct ia_css_pipe            *active_pipes[IA_CSS_PIPELINE_NUM_MAX];
36 	/* All of the pipes created at any point of time. At this moment there can
37 	 * be no more than MAX_SP_THREADS of them because pipe_num is reused as SP
38 	 * thread_id to which a pipe's pipeline is associated. At a later point, if
39 	 * we support more pipe objects, we should add test code to test that
40 	 * possibility. Also, active_pipes[] should be able to hold only
41 	 * SH_CSS_MAX_SP_THREADS objects. Anything else is misleading. */
42 	struct ia_css_pipe            *all_pipes[IA_CSS_PIPELINE_NUM_MAX];
43 	void *(*malloc)(size_t bytes, bool zero_mem);
44 	void (*free)(void *ptr);
45 	void (*flush)(struct ia_css_acc_fw *fw);
46 
47 /* ISP2401 */
48 	void *(*malloc_ex)(size_t bytes, bool zero_mem, const char *caller_func,
49 			   int caller_line);
50 	void (*free_ex)(void *ptr, const char *caller_func, int caller_line);
51 
52 /* ISP2400 */
53 	bool stop_copy_preview;
54 
55 	bool                           check_system_idle;
56 	unsigned int                   num_cont_raw_frames;
57 #if defined(USE_INPUT_SYSTEM_VERSION_2) || defined(USE_INPUT_SYSTEM_VERSION_2401)
58 	unsigned int                   num_mipi_frames[N_CSI_PORTS];
59 	struct ia_css_frame
60 		*mipi_frames[N_CSI_PORTS][NUM_MIPI_FRAMES_PER_STREAM];
61 	struct ia_css_metadata
62 		*mipi_metadata[N_CSI_PORTS][NUM_MIPI_FRAMES_PER_STREAM];
63 	unsigned int
64 	mipi_sizes_for_check[N_CSI_PORTS][IA_CSS_MIPI_SIZE_CHECK_MAX_NOF_ENTRIES_PER_PORT];
65 	unsigned int                   mipi_frame_size[N_CSI_PORTS];
66 #endif
67 	ia_css_ptr                   sp_bin_addr;
68 	hrt_data                       page_table_base_index;
69 
70 	unsigned int
71 	size_mem_words; /* \deprecated{Use ia_css_mipi_buffer_config instead.}*/
72 	enum ia_css_irq_type           irq_type;
73 	unsigned int                   pipe_counter;
74 
75 	unsigned int		type;	/* 2400 or 2401 for now */
76 };
77 
78 #define IPU_2400		1
79 #define IPU_2401		2
80 
81 #define IS_2400()		(my_css.type == IPU_2400)
82 #define IS_2401()		(my_css.type == IPU_2401)
83 
84 extern struct sh_css my_css;
85 
86 #endif /* __SH_CSS_STRUCT_H */
87