aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/sp_public.h
blob: b8db5469b592dd54e048ddbca10feee463c8144f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
/*
 * Support for Intel Camera Imaging ISP subsystem.
 * Copyright (c) 2015, Intel Corporation.
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms and conditions of the GNU General Public License,
 * version 2, as published by the Free Software Foundation.
 *
 * This program is distributed in the hope it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 * more details.
 */

#ifndef __SP_PUBLIC_H_INCLUDED__
#define __SP_PUBLIC_H_INCLUDED__

#include <type_support.h>
#include "system_types.h"

typedef struct sp_state_s		sp_state_t;
typedef struct sp_stall_s		sp_stall_t;

/*! Enable or disable the program complete irq signal of SP[ID]

 \param	ID[in]				SP identifier
 \param	cnd[in]				predicate

 \return none, if(cnd) enable(SP[ID].irq) else disable(SP[ID].irq)
 */
void cnd_sp_irq_enable(
    const sp_ID_t		ID,
    const bool			cnd);

/*! Read the state of cell SP[ID]

 \param	ID[in]				SP identifier
 \param	state[out]			sp state structure
 \param	stall[out]			isp stall conditions

 \return none, state = SP[ID].state, stall = SP[ID].stall
 */
void sp_get_state(
    const sp_ID_t		ID,
    sp_state_t			*state,
    sp_stall_t			*stall);

/*! Write to the status and control register of SP[ID]

 \param	ID[in]				SP identifier
 \param	reg[in]				register index
 \param value[in]			The data to be written

 \return none, SP[ID].sc[reg] = value
 */
STORAGE_CLASS_SP_H void sp_ctrl_store(
    const sp_ID_t		ID,
    const hrt_address	reg,
    const hrt_data		value);

/*! Read from the status and control register of SP[ID]

 \param	ID[in]				SP identifier
 \param	reg[in]				register index
 \param value[in]			The data to be written

 \return SP[ID].sc[reg]
 */
STORAGE_CLASS_SP_H hrt_data sp_ctrl_load(
    const sp_ID_t		ID,
    const hrt_address	reg);

/*! Get the status of a bitfield in the control register of SP[ID]

 \param	ID[in]				SP identifier
 \param	reg[in]				register index
 \param bit[in]				The bit index to be checked

 \return  (SP[ID].sc[reg] & (1<<bit)) != 0
 */
STORAGE_CLASS_SP_H bool sp_ctrl_getbit(
    const sp_ID_t		ID,
    const hrt_address	reg,
    const unsigned int	bit);

/*! Set a bitfield in the control register of SP[ID]

 \param	ID[in]				SP identifier
 \param	reg[in]				register index
 \param bit[in]				The bit index to be set

 \return none, SP[ID].sc[reg] |= (1<<bit)
 */
STORAGE_CLASS_SP_H void sp_ctrl_setbit(
    const sp_ID_t		ID,
    const hrt_address	reg,
    const unsigned int	bit);

/*! Clear a bitfield in the control register of SP[ID]

 \param	ID[in]				SP identifier
 \param	reg[in]				register index
 \param bit[in]				The bit index to be set

 \return none, SP[ID].sc[reg] &= ~(1<<bit)
 */
STORAGE_CLASS_SP_H void sp_ctrl_clearbit(
    const sp_ID_t		ID,
    const hrt_address	reg,
    const unsigned int	bit);

/*! Write to the DMEM of SP[ID]

 \param	ID[in]				SP identifier
 \param	addr[in]			the address in DMEM
 \param data[in]			The data to be written
 \param size[in]			The size(in bytes) of the data to be written

 \return none, SP[ID].dmem[addr...addr+size-1] = data
 */
STORAGE_CLASS_SP_H void sp_dmem_store(
    const sp_ID_t		ID,
    hrt_address		addr,
    const void			*data,
    const size_t		size);

/*! Read from the DMEM of SP[ID]

 \param	ID[in]				SP identifier
 \param	addr[in]			the address in DMEM
 \param data[in]			The data to be read
 \param size[in]			The size(in bytes) of the data to be read

 \return none, data = SP[ID].dmem[addr...addr+size-1]
 */
STORAGE_CLASS_SP_H void sp_dmem_load(
    const sp_ID_t		ID,
    const hrt_address	addr,
    void			*data,
    const size_t		size);

/*! Write a 8-bit datum to the DMEM of SP[ID]

 \param	ID[in]				SP identifier
 \param	addr[in]			the address in DMEM
 \param data[in]			The data to be written
 \param size[in]			The size(in bytes) of the data to be written

 \return none, SP[ID].dmem[addr...addr+size-1] = data
 */
STORAGE_CLASS_SP_H void sp_dmem_store_uint8(
    const sp_ID_t		ID,
    hrt_address		addr,
    const uint8_t		data);

/*! Write a 16-bit datum to the DMEM of SP[ID]

 \param	ID[in]				SP identifier
 \param	addr[in]			the address in DMEM
 \param data[in]			The data to be written
 \param size[in]			The size(in bytes) of the data to be written

 \return none, SP[ID].dmem[addr...addr+size-1] = data
 */
STORAGE_CLASS_SP_H void sp_dmem_store_uint16(
    const sp_ID_t		ID,
    hrt_address		addr,
    const uint16_t		data);

/*! Write a 32-bit datum to the DMEM of SP[ID]

 \param	ID[in]				SP identifier
 \param	addr[in]			the address in DMEM
 \param data[in]			The data to be written
 \param size[in]			The size(in bytes) of the data to be written

 \return none, SP[ID].dmem[addr...addr+size-1] = data
 */
STORAGE_CLASS_SP_H void sp_dmem_store_uint32(
    const sp_ID_t		ID,
    hrt_address		addr,
    const uint32_t		data);

/*! Load a 8-bit datum from the DMEM of SP[ID]

 \param	ID[in]				SP identifier
 \param	addr[in]			the address in DMEM
 \param data[in]			The data to be read
 \param size[in]			The size(in bytes) of the data to be read

 \return none, data = SP[ID].dmem[addr...addr+size-1]
 */
STORAGE_CLASS_SP_H uint8_t sp_dmem_load_uint8(
    const sp_ID_t		ID,
    const hrt_address	addr);

/*! Load a 16-bit datum from the DMEM of SP[ID]

 \param	ID[in]				SP identifier
 \param	addr[in]			the address in DMEM
 \param data[in]			The data to be read
 \param size[in]			The size(in bytes) of the data to be read

 \return none, data = SP[ID].dmem[addr...addr+size-1]
 */
STORAGE_CLASS_SP_H uint16_t sp_dmem_load_uint16(
    const sp_ID_t		ID,
    const hrt_address	addr);

/*! Load a 32-bit datum from the DMEM of SP[ID]

 \param	ID[in]				SP identifier
 \param	addr[in]			the address in DMEM
 \param data[in]			The data to be read
 \param size[in]			The size(in bytes) of the data to be read

 \return none, data = SP[ID].dmem[addr...addr+size-1]
 */
STORAGE_CLASS_SP_H uint32_t sp_dmem_load_uint32(
    const sp_ID_t		ID,
    const hrt_address	addr);

#endif /* __SP_PUBLIC_H_INCLUDED__ */