GNU Linux-libre 4.14.324-gnu1
[releases.git] / drivers / staging / media / atomisp / pci / atomisp2 / css2400 / hive_isp_css_include / host / isp_public.h
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 __ISP_PUBLIC_H_INCLUDED__
16 #define __ISP_PUBLIC_H_INCLUDED__
17
18 #include <type_support.h>
19 #include "system_types.h"
20
21 /*! Enable or disable the program complete irq signal of ISP[ID]
22
23  \param ID[in]                          SP identifier
24  \param cnd[in]                         predicate
25
26  \return none, if(cnd) enable(ISP[ID].irq) else disable(ISP[ID].irq)
27  */
28 extern void cnd_isp_irq_enable(
29         const isp_ID_t          ID,
30         const bool                      cnd);
31
32 /*! Read the state of cell ISP[ID]
33
34  \param ID[in]                          ISP identifier
35  \param state[out]                      isp state structure
36  \param stall[out]                      isp stall conditions
37
38  \return none, state = ISP[ID].state, stall = ISP[ID].stall
39  */
40 extern void isp_get_state(
41         const isp_ID_t          ID,
42         isp_state_t                     *state,
43         isp_stall_t                     *stall);
44
45
46 /*! Write to the status and control register of ISP[ID]
47
48  \param ID[in]                          ISP identifier
49  \param reg[in]                         register index
50  \param value[in]                       The data to be written
51
52  \return none, ISP[ID].sc[reg] = value
53  */
54 STORAGE_CLASS_ISP_H void isp_ctrl_store(
55         const isp_ID_t          ID,
56         const unsigned int      reg,
57         const hrt_data          value);
58
59 /*! Read from the status and control register of ISP[ID]
60
61  \param ID[in]                          ISP identifier
62  \param reg[in]                         register index
63  \param value[in]                       The data to be written
64
65  \return ISP[ID].sc[reg]
66  */
67 STORAGE_CLASS_ISP_H hrt_data isp_ctrl_load(
68         const isp_ID_t          ID,
69         const unsigned int      reg);
70
71 /*! Get the status of a bitfield in the control register of ISP[ID]
72
73  \param ID[in]                          ISP identifier
74  \param reg[in]                         register index
75  \param bit[in]                         The bit index to be checked
76
77  \return  (ISP[ID].sc[reg] & (1<<bit)) != 0
78  */
79 STORAGE_CLASS_ISP_H bool isp_ctrl_getbit(
80         const isp_ID_t          ID,
81         const unsigned int      reg,
82         const unsigned int      bit);
83
84 /*! Set a bitfield in the control register of ISP[ID]
85
86  \param ID[in]                          ISP identifier
87  \param reg[in]                         register index
88  \param bit[in]                         The bit index to be set
89
90  \return none, ISP[ID].sc[reg] |= (1<<bit)
91  */
92 STORAGE_CLASS_ISP_H void isp_ctrl_setbit(
93         const isp_ID_t          ID,
94         const unsigned int      reg,
95         const unsigned int      bit);
96
97 /*! Clear a bitfield in the control register of ISP[ID]
98
99  \param ID[in]                          ISP identifier
100  \param reg[in]                         register index
101  \param bit[in]                         The bit index to be set
102
103  \return none, ISP[ID].sc[reg] &= ~(1<<bit)
104  */
105 STORAGE_CLASS_ISP_H void isp_ctrl_clearbit(
106         const isp_ID_t          ID,
107         const unsigned int      reg,
108         const unsigned int      bit);
109
110 /*! Write to the DMEM of ISP[ID]
111
112  \param ID[in]                          ISP identifier
113  \param addr[in]                        the address in DMEM
114  \param data[in]                        The data to be written
115  \param size[in]                        The size(in bytes) of the data to be written
116
117  \return none, ISP[ID].dmem[addr...addr+size-1] = data
118  */
119 STORAGE_CLASS_ISP_H void isp_dmem_store(
120         const isp_ID_t          ID,
121         unsigned int            addr,
122         const void                      *data,
123         const size_t            size);
124
125 /*! Read from the DMEM of ISP[ID]
126
127  \param ID[in]                          ISP identifier
128  \param addr[in]                        the address in DMEM
129  \param data[in]                        The data to be read
130  \param size[in]                        The size(in bytes) of the data to be read
131
132  \return none, data = ISP[ID].dmem[addr...addr+size-1]
133  */
134 STORAGE_CLASS_ISP_H void isp_dmem_load(
135         const isp_ID_t          ID,
136         const unsigned int      addr,
137         void                            *data,
138         const size_t            size);
139
140 /*! Write a 32-bit datum to the DMEM of ISP[ID]
141
142  \param ID[in]                          ISP identifier
143  \param addr[in]                        the address in DMEM
144  \param data[in]                        The data to be written
145  \param size[in]                        The size(in bytes) of the data to be written
146
147  \return none, ISP[ID].dmem[addr] = data
148  */
149 STORAGE_CLASS_ISP_H void isp_dmem_store_uint32(
150         const isp_ID_t          ID,
151         unsigned int            addr,
152         const uint32_t          data);
153
154 /*! Load a 32-bit datum from the DMEM of ISP[ID]
155
156  \param ID[in]                          ISP identifier
157  \param addr[in]                        the address in DMEM
158  \param data[in]                        The data to be read
159  \param size[in]                        The size(in bytes) of the data to be read
160
161  \return none, data = ISP[ID].dmem[addr]
162  */
163 STORAGE_CLASS_ISP_H uint32_t isp_dmem_load_uint32(
164         const isp_ID_t          ID,
165         const unsigned int      addr);
166
167 /*! Concatenate the LSW and MSW into a double precision word
168
169  \param x0[in]                          Integer containing the LSW
170  \param x1[in]                          Integer containing the MSW
171
172  \return x0 | (x1 << bits_per_vector_element)
173  */
174 STORAGE_CLASS_ISP_H uint32_t isp_2w_cat_1w(
175         const uint16_t          x0,
176         const uint16_t          x1);
177
178 unsigned isp_is_ready(isp_ID_t ID);
179
180 unsigned isp_is_sleeping(isp_ID_t ID);
181
182 void isp_start(isp_ID_t ID);
183
184 void isp_wake(isp_ID_t ID);
185
186 #endif /* __ISP_PUBLIC_H_INCLUDED__ */