1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Support for Intel Camera Imaging ISP subsystem.
4  * Copyright (c) 2015, Intel Corporation.
5  */
6 
7 #ifndef __INPUT_FORMATTER_PUBLIC_H_INCLUDED__
8 #define __INPUT_FORMATTER_PUBLIC_H_INCLUDED__
9 
10 #include <type_support.h>
11 #include "system_local.h"
12 
13 /*! Reset INPUT_FORMATTER[ID]
14 
15  \param	ID[in]				INPUT_FORMATTER identifier
16 
17  \return none, reset(INPUT_FORMATTER[ID])
18  */
19 void input_formatter_rst(
20     const input_formatter_ID_t		ID);
21 
22 /*! Set the blocking mode of INPUT_FORMATTER[ID]
23 
24  \param	ID[in]				INPUT_FORMATTER identifier
25  \param	enable[in]			blocking enable flag
26 
27  \use
28 	- In HW, the capture unit will deliver an infinite stream of frames,
29 	  the input formatter will synchronise on the first SOF. In simulation
30 	  there are only a fixed number of frames, presented only once. By
31 	  enabling blocking the inputformatter will wait on the first presented
32 	  frame, thus avoiding race in the simulation setup.
33 
34  \return none, INPUT_FORMATTER[ID].blocking_mode = enable
35  */
36 void input_formatter_set_fifo_blocking_mode(
37     const input_formatter_ID_t		ID,
38     const bool						enable);
39 
40 /*! Return the data alignment of INPUT_FORMATTER[ID]
41 
42  \param	ID[in]				INPUT_FORMATTER identifier
43 
44  \return alignment(INPUT_FORMATTER[ID].data)
45  */
46 unsigned int input_formatter_get_alignment(
47     const input_formatter_ID_t		ID);
48 
49 /*! Read the source switch state into INPUT_FORMATTER[ID]
50 
51  \param	ID[in]				INPUT_FORMATTER identifier
52  \param	state[out]			input formatter switch state structure
53 
54  \return none, state = INPUT_FORMATTER[ID].switch_state
55  */
56 void input_formatter_get_switch_state(
57     const input_formatter_ID_t		ID,
58     input_formatter_switch_state_t	*state);
59 
60 /*! Read the control registers of INPUT_FORMATTER[ID]
61 
62  \param	ID[in]				INPUT_FORMATTER identifier
63  \param	state[out]			input formatter state structure
64 
65  \return none, state = INPUT_FORMATTER[ID].state
66  */
67 void input_formatter_get_state(
68     const input_formatter_ID_t		ID,
69     input_formatter_state_t			*state);
70 
71 /*! Read the control registers of bin copy INPUT_FORMATTER[ID]
72 
73  \param	ID[in]				INPUT_FORMATTER identifier
74  \param	state[out]			input formatter state structure
75 
76  \return none, state = INPUT_FORMATTER[ID].state
77  */
78 void input_formatter_bin_get_state(
79     const input_formatter_ID_t		ID,
80     input_formatter_bin_state_t		*state);
81 
82 /*! Write to a control register of INPUT_FORMATTER[ID]
83 
84  \param	ID[in]				INPUT_FORMATTER identifier
85  \param	reg_addr[in]		register byte address
86  \param value[in]			The data to be written
87 
88  \return none, INPUT_FORMATTER[ID].ctrl[reg] = value
89  */
90 STORAGE_CLASS_INPUT_FORMATTER_H void input_formatter_reg_store(
91     const input_formatter_ID_t	ID,
92     const hrt_address		reg_addr,
93     const hrt_data				value);
94 
95 /*! Read from a control register of INPUT_FORMATTER[ID]
96 
97  \param	ID[in]				INPUT_FORMATTER identifier
98  \param	reg_addr[in]		register byte address
99  \param value[in]			The data to be written
100 
101  \return INPUT_FORMATTER[ID].ctrl[reg]
102  */
103 STORAGE_CLASS_INPUT_FORMATTER_H hrt_data input_formatter_reg_load(
104     const input_formatter_ID_t	ID,
105     const unsigned int			reg_addr);
106 
107 #endif /* __INPUT_FORMATTER_PUBLIC_H_INCLUDED__ */
108