GNU Linux-libre 4.14.324-gnu1
[releases.git] / drivers / staging / media / atomisp / pci / atomisp2 / css2400 / hive_isp_css_include / host / sp_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 __SP_PUBLIC_H_INCLUDED__
16 #define __SP_PUBLIC_H_INCLUDED__
17
18 #include <type_support.h>
19 #include "system_types.h"
20
21 typedef struct sp_state_s               sp_state_t;
22 typedef struct sp_stall_s               sp_stall_t;
23
24 /*! Enable or disable the program complete irq signal of SP[ID]
25  
26  \param ID[in]                          SP identifier
27  \param cnd[in]                         predicate
28
29  \return none, if(cnd) enable(SP[ID].irq) else disable(SP[ID].irq)
30  */
31 extern void cnd_sp_irq_enable(
32         const sp_ID_t           ID,
33         const bool                      cnd);
34
35 /*! Read the state of cell SP[ID]
36  
37  \param ID[in]                          SP identifier
38  \param state[out]                      sp state structure
39  \param stall[out]                      isp stall conditions
40
41  \return none, state = SP[ID].state, stall = SP[ID].stall
42  */
43 extern void sp_get_state(
44         const sp_ID_t           ID,
45         sp_state_t                      *state,
46         sp_stall_t                      *stall);
47
48 /*! Write to the status and control register of SP[ID]
49
50  \param ID[in]                          SP identifier
51  \param reg[in]                         register index
52  \param value[in]                       The data to be written
53
54  \return none, SP[ID].sc[reg] = value
55  */
56 STORAGE_CLASS_SP_H void sp_ctrl_store(
57         const sp_ID_t           ID,
58         const hrt_address       reg,
59         const hrt_data          value);
60
61 /*! Read from the status and control register of SP[ID]
62
63  \param ID[in]                          SP identifier
64  \param reg[in]                         register index
65  \param value[in]                       The data to be written
66
67  \return SP[ID].sc[reg]
68  */
69 STORAGE_CLASS_SP_H hrt_data sp_ctrl_load(
70         const sp_ID_t           ID,
71         const hrt_address       reg);
72
73 /*! Get the status of a bitfield in the control register of SP[ID]
74
75  \param ID[in]                          SP identifier
76  \param reg[in]                         register index
77  \param bit[in]                         The bit index to be checked
78
79  \return  (SP[ID].sc[reg] & (1<<bit)) != 0
80  */
81 STORAGE_CLASS_SP_H bool sp_ctrl_getbit(
82         const sp_ID_t           ID,
83         const hrt_address       reg,
84         const unsigned int      bit);
85
86 /*! Set a bitfield in the control register of SP[ID]
87
88  \param ID[in]                          SP identifier
89  \param reg[in]                         register index
90  \param bit[in]                         The bit index to be set
91
92  \return none, SP[ID].sc[reg] |= (1<<bit)
93  */
94 STORAGE_CLASS_SP_H void sp_ctrl_setbit(
95         const sp_ID_t           ID,
96         const hrt_address       reg,
97         const unsigned int      bit);
98
99 /*! Clear a bitfield in the control register of SP[ID]
100
101  \param ID[in]                          SP identifier
102  \param reg[in]                         register index
103  \param bit[in]                         The bit index to be set
104
105  \return none, SP[ID].sc[reg] &= ~(1<<bit)
106  */
107 STORAGE_CLASS_SP_H void sp_ctrl_clearbit(
108         const sp_ID_t           ID,
109         const hrt_address       reg,
110         const unsigned int      bit);
111
112 /*! Write to the DMEM of SP[ID]
113
114  \param ID[in]                          SP identifier
115  \param addr[in]                        the address in DMEM
116  \param data[in]                        The data to be written
117  \param size[in]                        The size(in bytes) of the data to be written
118
119  \return none, SP[ID].dmem[addr...addr+size-1] = data
120  */
121 STORAGE_CLASS_SP_H void sp_dmem_store(
122         const sp_ID_t           ID,
123         hrt_address             addr,
124         const void                      *data,
125         const size_t            size);
126
127 /*! Read from the DMEM of SP[ID]
128
129  \param ID[in]                          SP identifier
130  \param addr[in]                        the address in DMEM
131  \param data[in]                        The data to be read
132  \param size[in]                        The size(in bytes) of the data to be read
133
134  \return none, data = SP[ID].dmem[addr...addr+size-1]
135  */
136 STORAGE_CLASS_SP_H void sp_dmem_load(
137         const sp_ID_t           ID,
138         const hrt_address       addr,
139         void                    *data,
140         const size_t            size);
141
142 /*! Write a 8-bit datum to the DMEM of SP[ID]
143
144  \param ID[in]                          SP identifier
145  \param addr[in]                        the address in DMEM
146  \param data[in]                        The data to be written
147  \param size[in]                        The size(in bytes) of the data to be written
148
149  \return none, SP[ID].dmem[addr...addr+size-1] = data
150  */
151 STORAGE_CLASS_SP_H void sp_dmem_store_uint8(
152         const sp_ID_t           ID,
153         hrt_address             addr,
154         const uint8_t           data);
155
156 /*! Write a 16-bit datum to the DMEM of SP[ID]
157
158  \param ID[in]                          SP identifier
159  \param addr[in]                        the address in DMEM
160  \param data[in]                        The data to be written
161  \param size[in]                        The size(in bytes) of the data to be written
162
163  \return none, SP[ID].dmem[addr...addr+size-1] = data
164  */
165 STORAGE_CLASS_SP_H void sp_dmem_store_uint16(
166         const sp_ID_t           ID,
167         hrt_address             addr,
168         const uint16_t          data);
169
170 /*! Write a 32-bit datum to the DMEM of SP[ID]
171
172  \param ID[in]                          SP identifier
173  \param addr[in]                        the address in DMEM
174  \param data[in]                        The data to be written
175  \param size[in]                        The size(in bytes) of the data to be written
176
177  \return none, SP[ID].dmem[addr...addr+size-1] = data
178  */
179 STORAGE_CLASS_SP_H void sp_dmem_store_uint32(
180         const sp_ID_t           ID,
181         hrt_address             addr,
182         const uint32_t          data);
183
184 /*! Load a 8-bit datum from the DMEM of SP[ID]
185
186  \param ID[in]                          SP identifier
187  \param addr[in]                        the address in DMEM
188  \param data[in]                        The data to be read
189  \param size[in]                        The size(in bytes) of the data to be read
190
191  \return none, data = SP[ID].dmem[addr...addr+size-1]
192  */
193 STORAGE_CLASS_SP_H uint8_t sp_dmem_load_uint8(
194         const sp_ID_t           ID,
195         const hrt_address       addr);
196
197 /*! Load a 16-bit datum from the DMEM of SP[ID]
198
199  \param ID[in]                          SP identifier
200  \param addr[in]                        the address in DMEM
201  \param data[in]                        The data to be read
202  \param size[in]                        The size(in bytes) of the data to be read
203
204  \return none, data = SP[ID].dmem[addr...addr+size-1]
205  */
206 STORAGE_CLASS_SP_H uint16_t sp_dmem_load_uint16(
207         const sp_ID_t           ID,
208         const hrt_address       addr);
209
210 /*! Load a 32-bit datum from the DMEM of SP[ID]
211
212  \param ID[in]                          SP identifier
213  \param addr[in]                        the address in DMEM
214  \param data[in]                        The data to be read
215  \param size[in]                        The size(in bytes) of the data to be read
216
217  \return none, data = SP[ID].dmem[addr...addr+size-1]
218  */
219 STORAGE_CLASS_SP_H uint32_t sp_dmem_load_uint32(
220         const sp_ID_t           ID,
221         const hrt_address       addr);
222
223 #endif /* __SP_PUBLIC_H_INCLUDED__ */