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