summaryrefslogtreecommitdiffstats
path: root/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/input_system_public.h
blob: 1596757fe9ef86ce565f1ffa37a10f1cb10fa1f9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
/*
 * Support for Intel Camera Imaging ISP subsystem.
 * Copyright (c) 2015, Intel Corporation.
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms and conditions of the GNU General Public License,
 * version 2, as published by the Free Software Foundation.
 *
 * This program is distributed in the hope it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 * more details.
 */

#ifndef __INPUT_SYSTEM_PUBLIC_H_INCLUDED__
#define __INPUT_SYSTEM_PUBLIC_H_INCLUDED__

#include <type_support.h>
#ifdef USE_INPUT_SYSTEM_VERSION_2401
#include "isys_public.h"
#else

typedef struct input_system_state_s		input_system_state_t;
typedef struct receiver_state_s			receiver_state_t;

/*! Read the state of INPUT_SYSTEM[ID]

 \param	ID[in]				INPUT_SYSTEM identifier
 \param	state[out]			input system state structure

 \return none, state = INPUT_SYSTEM[ID].state
 */
extern void input_system_get_state(
	const input_system_ID_t		ID,
	input_system_state_t		*state);

/*! Read the state of RECEIVER[ID]

 \param	ID[in]				RECEIVER identifier
 \param	state[out]			receiver state structure

 \return none, state = RECEIVER[ID].state
 */
extern void receiver_get_state(
	const rx_ID_t				ID,
	receiver_state_t			*state);

/*! Flag whether a MIPI format is YUV420

 \param	mipi_format[in]		MIPI format

 \return mipi_format == YUV420
 */
extern bool is_mipi_format_yuv420(
	const mipi_format_t			mipi_format);

/*! Set compression parameters for cfg[cfg_ID] of RECEIVER[ID]

 \param	ID[in]				RECEIVER identifier
 \param	cfg_ID[in]			Configuration identifier
 \param	comp[in]			Compression method
 \param	pred[in]			Predictor method

 \NOTE: the storage of compression configuration is
        implementation specific. The config can be
        carried either on MIPI ports or on MIPI channels

 \return none, RECEIVER[ID].cfg[cfg_ID] = {comp, pred}
 */
extern void receiver_set_compression(
	const rx_ID_t				ID,
	const unsigned int			cfg_ID,
	const mipi_compressor_t		comp,
	const mipi_predictor_t		pred);

/*! Enable PORT[port_ID] of RECEIVER[ID]

 \param	ID[in]				RECEIVER identifier
 \param	port_ID[in]			mipi PORT identifier
 \param	cnd[in]				irq predicate

 \return None, enable(RECEIVER[ID].PORT[port_ID])
 */
extern void receiver_port_enable(
	const rx_ID_t				ID,
	const mipi_port_ID_t		port_ID,
	const bool					cnd);

/*! Flag if PORT[port_ID] of RECEIVER[ID] is enabled

 \param	ID[in]				RECEIVER identifier
 \param	port_ID[in]			mipi PORT identifier

 \return enable(RECEIVER[ID].PORT[port_ID]) == true
 */
extern bool is_receiver_port_enabled(
	const rx_ID_t				ID,
	const mipi_port_ID_t		port_ID);

/*! Enable the IRQ channels of PORT[port_ID] of RECEIVER[ID]

 \param	ID[in]				RECEIVER identifier
 \param	port_ID[in]			mipi PORT identifier
 \param	irq_info[in]		irq channels

 \return None, enable(RECEIVER[ID].PORT[port_ID].irq_info)
 */
extern void receiver_irq_enable(
	const rx_ID_t				ID,
	const mipi_port_ID_t		port_ID,
	const rx_irq_info_t			irq_info);

/*! Return the IRQ status of PORT[port_ID] of RECEIVER[ID]

 \param	ID[in]				RECEIVER identifier
 \param	port_ID[in]			mipi PORT identifier

 \return RECEIVER[ID].PORT[port_ID].irq_info
 */
extern rx_irq_info_t receiver_get_irq_info(
	const rx_ID_t				ID,
	const mipi_port_ID_t		port_ID);

/*! Clear the IRQ status of PORT[port_ID] of RECEIVER[ID]

 \param	ID[in]				RECEIVER identifier
 \param	port_ID[in]			mipi PORT identifier
 \param	irq_info[in]		irq status

 \return None, clear(RECEIVER[ID].PORT[port_ID].irq_info)
 */
extern void receiver_irq_clear(
	const rx_ID_t				ID,
	const mipi_port_ID_t			port_ID,
	const rx_irq_info_t			irq_info);

/*! Write to a control register of INPUT_SYSTEM[ID]

 \param	ID[in]				INPUT_SYSTEM identifier
 \param	reg[in]				register index
 \param value[in]			The data to be written

 \return none, INPUT_SYSTEM[ID].ctrl[reg] = value
 */
STORAGE_CLASS_INPUT_SYSTEM_H void input_system_reg_store(
	const input_system_ID_t			ID,
	const hrt_address			reg,
	const hrt_data				value);

/*! Read from a control register of INPUT_SYSTEM[ID]

 \param	ID[in]				INPUT_SYSTEM identifier
 \param	reg[in]				register index
 \param value[in]			The data to be written

 \return INPUT_SYSTEM[ID].ctrl[reg]
 */
STORAGE_CLASS_INPUT_SYSTEM_H hrt_data input_system_reg_load(
	const input_system_ID_t			ID,
	const hrt_address			reg);

/*! Write to a control register of RECEIVER[ID]

 \param	ID[in]				RECEIVER identifier
 \param	reg[in]				register index
 \param value[in]			The data to be written

 \return none, RECEIVER[ID].ctrl[reg] = value
 */
STORAGE_CLASS_INPUT_SYSTEM_H void receiver_reg_store(
	const rx_ID_t				ID,
	const hrt_address			reg,
	const hrt_data				value);

/*! Read from a control register of RECEIVER[ID]

 \param	ID[in]				RECEIVER identifier
 \param	reg[in]				register index
 \param value[in]			The data to be written

 \return RECEIVER[ID].ctrl[reg]
 */
STORAGE_CLASS_INPUT_SYSTEM_H hrt_data receiver_reg_load(
	const rx_ID_t				ID,
	const hrt_address			reg);

/*! Write to a control register of PORT[port_ID] of RECEIVER[ID]

 \param	ID[in]				RECEIVER identifier
 \param	port_ID[in]			mipi PORT identifier
 \param	reg[in]				register index
 \param value[in]			The data to be written

 \return none, RECEIVER[ID].PORT[port_ID].ctrl[reg] = value
 */
STORAGE_CLASS_INPUT_SYSTEM_H void receiver_port_reg_store(
	const rx_ID_t				ID,
	const mipi_port_ID_t			port_ID,
	const hrt_address			reg,
	const hrt_data				value);

/*! Read from a control register PORT[port_ID] of of RECEIVER[ID]

 \param	ID[in]				RECEIVER identifier
 \param	port_ID[in]			mipi PORT identifier
 \param	reg[in]				register index
 \param value[in]			The data to be written

 \return RECEIVER[ID].PORT[port_ID].ctrl[reg]
 */
STORAGE_CLASS_INPUT_SYSTEM_H hrt_data receiver_port_reg_load(
	const rx_ID_t				ID,
	const mipi_port_ID_t		port_ID,
	const hrt_address			reg);

/*! Write to a control register of SUB_SYSTEM[sub_ID] of INPUT_SYSTEM[ID]

 \param	ID[in]				INPUT_SYSTEM identifier
 \param	port_ID[in]			sub system identifier
 \param	reg[in]				register index
 \param value[in]			The data to be written

 \return none, INPUT_SYSTEM[ID].SUB_SYSTEM[sub_ID].ctrl[reg] = value
 */
STORAGE_CLASS_INPUT_SYSTEM_H void input_system_sub_system_reg_store(
	const input_system_ID_t			ID,
	const sub_system_ID_t			sub_ID,
	const hrt_address			reg,
	const hrt_data				value);

/*! Read from a control register SUB_SYSTEM[sub_ID] of INPUT_SYSTEM[ID]

 \param	ID[in]				INPUT_SYSTEM identifier
 \param	port_ID[in]			sub system identifier
 \param	reg[in]				register index
 \param value[in]			The data to be written

 \return INPUT_SYSTEM[ID].SUB_SYSTEM[sub_ID].ctrl[reg]
 */
STORAGE_CLASS_INPUT_SYSTEM_H hrt_data input_system_sub_system_reg_load(
	const input_system_ID_t		ID,
	const sub_system_ID_t		sub_ID,
	const hrt_address			reg);



///////////////////////////////////////////////////////////////////////////
//
//    Functions for configuration phase on input system.
//
///////////////////////////////////////////////////////////////////////////

// Function that resets current configuration.
// remove the argument since it should be private.
input_system_error_t input_system_configuration_reset(void);

// Function that commits current configuration.
// remove the argument since it should be private.
input_system_error_t input_system_configuration_commit(void);

///////////////////////////////////////////////////////////////////////////
//
// User functions:
//		(encoded generic function)
//    - no checking
//    - decoding name and agruments into the generic (channel) configuration
//    function.
//
///////////////////////////////////////////////////////////////////////////


// FIFO channel config function user

input_system_error_t	input_system_csi_fifo_channel_cfg(
	uint32_t				ch_id,
	input_system_csi_port_t	port,
	backend_channel_cfg_t	backend_ch,
	target_cfg2400_t			target
);

input_system_error_t	input_system_csi_fifo_channel_with_counting_cfg(
	uint32_t				ch_id,
	uint32_t				nof_frame,
	input_system_csi_port_t	port,
	backend_channel_cfg_t	backend_ch,
	uint32_t				mem_region_size,
	uint32_t				nof_mem_regions,
	target_cfg2400_t			target
);


// SRAM channel config function user

input_system_error_t	input_system_csi_sram_channel_cfg(
	uint32_t				ch_id,
	input_system_csi_port_t	port,
	backend_channel_cfg_t	backend_ch,
	uint32_t				csi_mem_region_size,
	uint32_t				csi_nof_mem_regions,
	target_cfg2400_t 			target
);


//XMEM channel config function user

input_system_error_t	input_system_csi_xmem_channel_cfg(
	uint32_t 				ch_id,
	input_system_csi_port_t port,
	backend_channel_cfg_t	backend_ch,
	uint32_t 				mem_region_size,
	uint32_t 				nof_mem_regions,
	uint32_t 				acq_mem_region_size,
	uint32_t 				acq_nof_mem_regions,
	target_cfg2400_t 			target,
	uint32_t 				nof_xmem_buffers
);

input_system_error_t	input_system_csi_xmem_capture_only_channel_cfg(
	uint32_t 				ch_id,
	uint32_t 				nof_frames,
	input_system_csi_port_t port,
	uint32_t 				csi_mem_region_size,
	uint32_t 				csi_nof_mem_regions,
	uint32_t 				acq_mem_region_size,
	uint32_t 				acq_nof_mem_regions,
	target_cfg2400_t 			target
);

input_system_error_t	input_system_csi_xmem_acquire_only_channel_cfg(
	uint32_t 				ch_id,
	uint32_t 				nof_frames,
	input_system_csi_port_t port,
	backend_channel_cfg_t	backend_ch,
	uint32_t 				acq_mem_region_size,
	uint32_t 				acq_nof_mem_regions,
	target_cfg2400_t 			target
);

// Non - CSI channel config function user

input_system_error_t	input_system_prbs_channel_cfg(
	uint32_t 		ch_id,
	uint32_t		nof_frames,
	uint32_t		seed,
	uint32_t		sync_gen_width,
	uint32_t		sync_gen_height,
	uint32_t		sync_gen_hblank_cycles,
	uint32_t		sync_gen_vblank_cycles,
	target_cfg2400_t	target
);


input_system_error_t	input_system_tpg_channel_cfg(
	uint32_t 		ch_id,
	uint32_t 		nof_frames,//not used yet
	uint32_t		x_mask,
	uint32_t		y_mask,
	uint32_t		x_delta,
	uint32_t		y_delta,
	uint32_t		xy_mask,
	uint32_t		sync_gen_width,
	uint32_t		sync_gen_height,
	uint32_t		sync_gen_hblank_cycles,
	uint32_t		sync_gen_vblank_cycles,
	target_cfg2400_t	target
);


input_system_error_t	input_system_gpfifo_channel_cfg(
	uint32_t 		ch_id,
	uint32_t 		nof_frames,
	target_cfg2400_t	target
);
#endif /* #ifdef USE_INPUT_SYSTEM_VERSION_2401 */

#endif /* __INPUT_SYSTEM_PUBLIC_H_INCLUDED__ */
OpenPOWER on IntegriCloud