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