1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16#ifndef _IA_CSS_ACC_TYPES_H
17#define _IA_CSS_ACC_TYPES_H
18
19
20
21
22
23#include <system_local.h>
24#include <type_support.h>
25#include <platform_support.h>
26#include <debug_global.h>
27
28#include "ia_css_types.h"
29#include "ia_css_frame_format.h"
30
31
32
33
34
35#include "runtime/isp_param/interface/ia_css_isp_param_types.h"
36
37
38
39
40
41
42
43
44
45
46enum ia_css_acc_type {
47 IA_CSS_ACC_NONE,
48 IA_CSS_ACC_OUTPUT,
49 IA_CSS_ACC_VIEWFINDER,
50 IA_CSS_ACC_STANDALONE,
51};
52
53
54
55enum ia_css_cell_type {
56 IA_CSS_SP0 = 0,
57 IA_CSS_SP1,
58 IA_CSS_ISP,
59 MAX_NUM_OF_CELLS
60};
61
62
63
64enum ia_css_fw_type {
65 ia_css_sp_firmware,
66 ia_css_isp_firmware,
67 ia_css_bootloader_firmware,
68 ia_css_acc_firmware
69};
70
71struct ia_css_blob_descr;
72
73
74
75
76
77
78
79struct ia_css_blob_info {
80
81 u32 offset;
82 struct ia_css_isp_param_memory_offsets
83 memory_offsets;
84 u32 prog_name_offset;
85 u32 size;
86 u32 padding_size;
87 u32 icache_source;
88 u32 icache_size;
89 u32 icache_padding;
90 u32 text_source;
91 u32 text_size;
92 u32 text_padding;
93 u32 data_source;
94 u32 data_target;
95 u32 data_size;
96 u32 data_padding;
97 u32 bss_target;
98 u32 bss_size;
99
100 CSS_ALIGN(const void *code,
101 8);
102 CSS_ALIGN(const void *data,
103 8);
104};
105
106struct ia_css_binary_input_info {
107 u32 min_width;
108 u32 min_height;
109 u32 max_width;
110 u32 max_height;
111 u32 source;
112};
113
114struct ia_css_binary_output_info {
115 u32 min_width;
116 u32 min_height;
117 u32 max_width;
118 u32 max_height;
119 u32 num_chunks;
120 u32 variable_format;
121};
122
123struct ia_css_binary_internal_info {
124 u32 max_width;
125 u32 max_height;
126};
127
128struct ia_css_binary_bds_info {
129 u32 supported_bds_factors;
130};
131
132struct ia_css_binary_dvs_info {
133 u32 max_envelope_width;
134 u32 max_envelope_height;
135};
136
137struct ia_css_binary_vf_dec_info {
138 u32 is_variable;
139 u32 max_log_downscale;
140};
141
142struct ia_css_binary_s3a_info {
143 u32 s3atbl_use_dmem;
144 u32 fixed_s3a_deci_log;
145};
146
147
148struct ia_css_binary_dpc_info {
149 u32 bnr_lite;
150};
151
152struct ia_css_binary_iterator_info {
153 u32 num_stripes;
154 u32 row_stripes_height;
155 u32 row_stripes_overlap_lines;
156};
157
158struct ia_css_binary_address_info {
159 u32 isp_addresses;
160 u32 main_entry;
161 u32 in_frame;
162 u32 out_frame;
163 u32 in_data;
164 u32 out_data;
165 u32 sh_dma_cmd_ptr;
166};
167
168struct ia_css_binary_uds_info {
169 u16 bpp;
170 u16 use_bci;
171 u16 use_str;
172 u16 woix;
173 u16 woiy;
174 u16 extra_out_vecs;
175 u16 vectors_per_line_in;
176 u16 vectors_per_line_out;
177 u16 vectors_c_per_line_in;
178 u16 vectors_c_per_line_out;
179 u16 vmem_gdc_in_block_height_y;
180 u16 vmem_gdc_in_block_height_c;
181
182};
183
184struct ia_css_binary_pipeline_info {
185 u32 mode;
186 u32 isp_pipe_version;
187 u32 pipelining;
188 u32 c_subsampling;
189 u32 top_cropping;
190 u32 left_cropping;
191 u32 variable_resolution;
192};
193
194struct ia_css_binary_block_info {
195 u32 block_width;
196 u32 block_height;
197 u32 output_block_height;
198};
199
200
201
202
203
204
205
206
207struct ia_css_binary_info {
208 CSS_ALIGN(u32 id, 8);
209 struct ia_css_binary_pipeline_info pipeline;
210 struct ia_css_binary_input_info input;
211 struct ia_css_binary_output_info output;
212 struct ia_css_binary_internal_info internal;
213 struct ia_css_binary_bds_info bds;
214 struct ia_css_binary_dvs_info dvs;
215 struct ia_css_binary_vf_dec_info vf_dec;
216 struct ia_css_binary_s3a_info s3a;
217 struct ia_css_binary_dpc_info dpc_bnr;
218 struct ia_css_binary_iterator_info iterator;
219 struct ia_css_binary_address_info addresses;
220 struct ia_css_binary_uds_info uds;
221 struct ia_css_binary_block_info block;
222 struct ia_css_isp_param_isp_segments mem_initializers;
223
224 struct {
225
226 u8 luma_only;
227 u8 input_yuv;
228 u8 input_raw;
229
230 u8 reduced_pipe;
231 u8 vf_veceven;
232 u8 dis;
233 u8 dvs_envelope;
234 u8 uds;
235 u8 dvs_6axis;
236 u8 block_output;
237 u8 streaming_dma;
238 u8 ds;
239 u8 bayer_fir_6db;
240 u8 raw_binning;
241 u8 continuous;
242 u8 s3a;
243 u8 fpnr;
244 u8 sc;
245 u8 macc;
246 u8 output;
247 u8 ref_frame;
248 u8 tnr;
249 u8 xnr;
250 u8 params;
251 u8 ca_gdc;
252 u8 isp_addresses;
253 u8 in_frame;
254 u8 out_frame;
255 u8 high_speed;
256 u8 dpc;
257 u8 padding[2];
258 } enable;
259 struct {
260
261 u8 ref_y_channel;
262 u8 ref_c_channel;
263 u8 tnr_channel;
264 u8 tnr_out_channel;
265 u8 dvs_coords_channel;
266 u8 output_channel;
267 u8 c_channel;
268 u8 vfout_channel;
269 u8 vfout_c_channel;
270 u8 vfdec_bits_per_pixel;
271 u8 claimed_by_isp;
272 u8 padding[2];
273 } dma;
274};
275
276
277
278
279
280struct ia_css_binary_xinfo {
281
282 struct ia_css_binary_info sp;
283
284
285 enum ia_css_acc_type type;
286
287 CSS_ALIGN(s32 num_output_formats, 8);
288 enum ia_css_frame_format output_formats[IA_CSS_FRAME_FORMAT_NUM];
289
290 CSS_ALIGN(s32 num_vf_formats, 8);
291 enum ia_css_frame_format
292 vf_formats[IA_CSS_FRAME_FORMAT_NUM];
293 u8 num_output_pins;
294 ia_css_ptr xmem_addr;
295
296 CSS_ALIGN(const struct ia_css_blob_descr *blob, 8);
297 CSS_ALIGN(u32 blob_index, 8);
298 CSS_ALIGN(union ia_css_all_memory_offsets mem_offsets, 8);
299 CSS_ALIGN(struct ia_css_binary_xinfo *next, 8);
300};
301
302
303
304
305
306struct ia_css_bl_info {
307 u32 num_dma_cmds;
308 u32 dma_cmd_list;
309 u32 sw_state;
310
311 u32 bl_entry;
312};
313
314
315
316
317
318struct ia_css_sp_info {
319 u32 init_dmem_data;
320 u32 per_frame_data;
321 u32 group;
322 u32 output;
323 u32 host_sp_queue;
324 u32 host_sp_com;
325 u32 isp_started;
326 u32 sw_state;
327 u32 host_sp_queues_initialized;
328 u32 sleep_mode;
329 u32 invalidate_tlb;
330
331
332 u32 stop_copy_preview;
333
334 u32 debug_buffer_ddr_address;
335
336 u32 perf_counter_input_system_error;
337
338#ifdef HAS_WATCHDOG_SP_THREAD_DEBUG
339 u32 debug_wait;
340 u32 debug_stage;
341 u32 debug_stripe;
342#endif
343 u32 threads_stack;
344 u32 threads_stack_size;
345 u32 curr_binary_id;
346 u32 raw_copy_line_count;
347 u32 ddr_parameter_address;
348 u32 ddr_parameter_size;
349
350 u32 sp_entry;
351 u32 tagger_frames_addr;
352};
353
354
355
356
357
358
359
360
361
362struct ia_css_acc_info {
363 u32 per_frame_data;
364};
365
366
367
368union ia_css_fw_union {
369 struct ia_css_binary_xinfo isp;
370 struct ia_css_sp_info sp;
371 struct ia_css_bl_info bl;
372 struct ia_css_acc_info acc;
373};
374
375
376
377struct ia_css_fw_info {
378 size_t header_size;
379
380 CSS_ALIGN(u32 type, 8);
381 union ia_css_fw_union info;
382 struct ia_css_blob_info blob;
383
384 struct ia_css_fw_info *next;
385
386 CSS_ALIGN(u32 loaded, 8);
387 CSS_ALIGN(const u8 *isp_code, 8);
388
389 CSS_ALIGN(u32 handle, 8);
390
391 struct ia_css_isp_param_css_segments mem_initializers;
392
393};
394
395struct ia_css_blob_descr {
396 const unsigned char *blob;
397 struct ia_css_fw_info header;
398 const char *name;
399 union ia_css_all_memory_offsets mem_offsets;
400};
401
402struct ia_css_acc_fw;
403
404
405
406struct ia_css_acc_sp {
407 void (*init)(struct ia_css_acc_fw *);
408 u32 sp_prog_name_offset;
409 u32 sp_blob_offset;
410 void *entry;
411 u32 *css_abort;
412 void *isp_code;
413
414 struct ia_css_fw_info fw;
415 const u8 *code;
416};
417
418
419
420
421
422struct ia_css_acc_fw_hdr {
423 enum ia_css_acc_type type;
424 u32 isp_prog_name_offset;
425
426 u32 isp_blob_offset;
427
428 u32 isp_size;
429 const u8 *isp_code;
430 struct ia_css_acc_sp sp;
431
432 u32 handle;
433 struct ia_css_data parameters;
434};
435
436
437
438
439
440
441
442
443struct ia_css_acc_fw {
444 struct ia_css_acc_fw_hdr header;
445
446
447
448
449
450
451};
452
453
454#define IA_CSS_ACC_OFFSET(t, f, n) ((t)((uint8_t *)(f) + (f->header.n)))
455#define IA_CSS_ACC_SP_PROG_NAME(f) IA_CSS_ACC_OFFSET(const char *, f, \
456 sp.sp_prog_name_offset)
457#define IA_CSS_ACC_ISP_PROG_NAME(f) IA_CSS_ACC_OFFSET(const char *, f, \
458 isp_prog_name_offset)
459#define IA_CSS_ACC_SP_CODE(f) IA_CSS_ACC_OFFSET(uint8_t *, f, \
460 sp.sp_blob_offset)
461#define IA_CSS_ACC_SP_DATA(f) (IA_CSS_ACC_SP_CODE(f) + \
462 (f)->header.sp.fw.blob.data_source)
463#define IA_CSS_ACC_ISP_CODE(f) IA_CSS_ACC_OFFSET(uint8_t*, f,\
464 isp_blob_offset)
465#define IA_CSS_ACC_ISP_SIZE(f) ((f)->header.isp_size)
466
467
468#define IA_CSS_EXT_ISP_PROG_NAME(f) ((const char *)(f) + (f)->blob.prog_name_offset)
469#define IA_CSS_EXT_ISP_MEM_OFFSETS(f) \
470 ((const struct ia_css_memory_offsets *)((const char *)(f) + (f)->blob.mem_offsets))
471
472enum ia_css_sp_sleep_mode {
473 SP_DISABLE_SLEEP_MODE = 0,
474 SP_SLEEP_AFTER_FRAME = 1 << 0,
475 SP_SLEEP_AFTER_IRQ = 1 << 1
476};
477#endif
478