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
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
|
/*
*
* Copyright (C) 2016 Samsung Electrnoics
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef __IVA_IPC_PARAM_H__
#define __IVA_IPC_PARAM_H__
#include <stddef.h>
#define IVA_IPC_PARAM_ARCH64_SUPPORT
#undef CONFIG_TEST_PARAM
#undef CONFIG_IVA_RT_PARAM
/* command parameter control switch */
#ifdef CONFIG_TEST_PARAM
#define SCL_IF_PARAM_TO_CMD_PARAM
#define PYRAMID_PARAM_TO_CMD_PARAM
#define WARP_MESH_PARAM_TO_CMD_PARAM
#define WARP_AFFINE_PARAM_TO_CMD_PARAM
#define NOISE_FILTER_PARAM_TO_CMD_PARAM
#define CORNER_COMP_PARAM_TO_CMD_PARAM
#define LOCAL_MINMAX_PARAM_TO_CMD_PARAM
#define LKT_IF_PARAM_TO_CMD_PARAM
#define MCH_LINEAR_PARAM_TO_CMD_PARAM
#define ORB_IN_PARAM_TO_CMD_PARAM
#define DSP_IPC_PARAM_TO_CMD_PARAM
#define GEN_IPC_PARAM_TO_CMD_PARAM
/* response parameter control switch */
#define MCH_OUT_PARAM_TO_RES_PARAM
#define LMD_OUT_PARAM_TO_RES_PARAM
#define LKT_OUT_PARAM_TO_RES_PARAM
#define ORB_OUT_PARAM_TO_RES_PARAM
#define TIME_TO_RES_PARAM
#endif
/* ipc parameter definitions */
struct ipc_msg_node
{
uint32_t table_id;
uint32_t guid;
};
struct ipc_msg_schedule
{
/* tables */
uint32_t p_rt_table;
#ifdef CONFIG_IVA_RT_PARAM
uint32_t p_g_sched_t;
uint32_t p_rt_param_t;
#endif
/* sizes */
uint32_t rt_table_size;
#ifdef CONFIG_IVA_RT_PARAM
uint32_t g_sched_t_size;
uint32_t rt_param_size;
#endif
};
#define SCL_IF_MAKE_RECT(w, h) ((w << 16) | h)
#define SCL_IF_GET_HEIGHT(r) (r & 0xFFFF)
#define SCL_IF_GET_WIDTH(r) ((r >> 16) & 0xFFFF)
#define SCL_IF_MAKE_CONFIG(in_bpp, out_bpp, inter_mode, bdr_mode) \
((in_bpp << 24) | (out_bpp << 16) | (inter_mode << 8) | bdr_mode)
#define SCL_IF_GET_IN_BPP(cfg) ((cfg >> 24) & 0xFF)
#define SCL_IF_GET_OUT_BPP(cfg) ((cfg >> 16) & 0xFF)
#define SCL_IF_GET_INTER_MODE(cfg) ((cfg >> 8) & 0xFF)
#define SCL_IF_GET_BORDER_MODE(cfg) ((cfg) & 0xFF)
struct scale_if_param {
uint32_t in_buf_pa;
uint32_t in_rect; /* width and height */
uint32_t in_stride;
uint32_t out_buf_pa;
uint32_t out_rect;
uint32_t out_stride;
uint32_t config;
uint32_t const_val;
};
/**
* pyramid of scaled images.
* Level-0 is the full-resolution input image itself
*/
struct pyr_level {
uint32_t img_pa;
uint32_t width;
uint32_t height;
};
struct pyramid_param {
/* input file information */
uint32_t in_frame_pa; /* physical address for input frame*/
int32_t in_width;
int32_t in_height;
int32_t in_stride;
uint32_t max_level;
uint32_t inter_mode;
uint32_t scale_n;
uint32_t scale_d;
uint32_t border_mode;
uint32_t border_const;
#define SCL_PYRAMID_MAX_LEVELS (8)
struct pyr_level pyr_info[SCL_PYRAMID_MAX_LEVELS];
};
struct warp_mesh_param {
int32_t width; /* Width of the input frame */
int32_t height; /* Height of the input frame */
int32_t stride; /* Stride of the input frame */
uint32_t input_bpp;
uint32_t p_buf_ptr; /* Pointer to the input buffer */
uint32_t p_buf_mesh_ptr; /* Pointer to the output buffer */
uint32_t p_buf_out_ptr; /* Pointer to the output buffer */
uint32_t out_width; /* Width of the output frame */
uint32_t out_height; /* Height of the output frame */
uint32_t out_stride; /* Stride of output frame */
uint32_t out_tile_width; /* Output tile width */
uint32_t out_tile_height;/* Output tile height */
uint32_t inter_mode; /* Interpolation mode */
uint32_t mesh_log_space; /* Space parameter for mesh warp */
};
struct warp_affine_param{
/* TODO: parameter for tiling */
int32_t width;
int32_t height;
int32_t stride;
uint32_t input_bpp;
uint32_t p_buf_ptr;
uint32_t p_buf_out_ptr;
uint32_t out_width;
uint32_t out_height;
uint32_t out_stride;
uint32_t inter_mode;
float aff_matrix[8];
int32_t in_tile_xoff;
int32_t in_tile_yoff;
int32_t out_tile_xoff;
int32_t out_tile_yoff;
};
struct noise_filter_param {
uint32_t i_frame_ptr;
uint32_t m_frame_ptr;
uint32_t o_frame_ptr;
uint32_t config_param_ptr;
int32_t width;
int32_t height;
int32_t stride;
int32_t m_stride;
int32_t o_stride;
int32_t border_mode;
int32_t border_const;
};
struct corner_compute_param {
uint32_t i_frame_ptr;
uint32_t o_frame_ptr;
int32_t width;
int32_t height;
int32_t stride;
int32_t o_stride;
float harris_k;
uint32_t block_size;
uint32_t use_harris;
uint32_t output_mode;
int32_t border_mode;
int32_t border_const;
};
struct local_minmax_param {
uint32_t i_frame_ptr;
uint32_t o_array_ptr;
uint32_t o_cnt_ptr;
int32_t width;
int32_t height;
int32_t stride;
uint32_t min_thresh;
uint32_t max_thresh;
uint32_t output_size;
uint32_t input_bpp;
uint32_t input_signed;
uint32_t min_enable;
uint32_t max_enable;
uint32_t kernel_size;
uint32_t strict_compare;
};
struct lkt_if_param {
/* addr */
uint32_t ref_frm_ptr;
uint32_t trk_frm_ptr;
uint32_t ref_point_ptr;
uint32_t out_point_ptr;
/* image & canvas info */
uint32_t ref_width;
uint32_t ref_height;
uint32_t trk_width;
uint32_t trk_height;
uint32_t ref_left_coord;
uint32_t ref_right_coord;
uint32_t ref_top_coord;
uint32_t ref_bot_coord;
uint32_t track_left_coord;
uint32_t track_right_coord;
uint32_t track_top_coord;
uint32_t track_bot_coord;
/* tile info */
uint32_t ft_tiles;
uint32_t ref_tile_xoff;
uint32_t ref_tile_yoff;
uint32_t trk_tile_xoff;
uint32_t trk_tile_yoff;
/* policy */
uint32_t ft_win_size;
uint32_t ft_min_step;
uint32_t ft_max_iter;
uint32_t enable_min_step;
uint32_t ft_use_scharr;
uint32_t ft_max_level;
uint32_t ft_output_mode;
uint32_t lkt_border_mode;
uint32_t lkt_border_constant;
/* ftr info */
uint32_t num_point_list[16];
uint32_t ft_num_point;
};
struct mch_linear_param {
uint32_t frame_id;
uint32_t db_description_ptr;
uint32_t query_description_ptr;
uint32_t out_ptr;
uint32_t query_size;
uint32_t db_size;
uint32_t dist_mode;
uint32_t vector_size;
uint32_t num_nearest;
uint32_t output_mode;
uint32_t thresh_val;
uint32_t thresh_on;
};
struct orb_in_param {
int32_t frame_id; /* Id of the frame.*/
int32_t width; /* Width of the frame */
int32_t height; /* Height of the frame */
int32_t stride; /* Stride of the frame */
uint32_t tile_width;
uint32_t tile_height;
uint32_t p_buf_ptr; /* Pointer to the input buffer */
uint32_t p_chroma_buf_ptr;/* Pointer to the input chroma buffer */
uint32_t metadata;
uint32_t diameter;
uint32_t fast_th;
uint32_t har_th;
uint32_t har_on;
uint32_t x_scale;
uint32_t y_scale;
uint32_t iterations;
uint32_t p_keypoint_ptr;
uint32_t p_description_ptr;
uint32_t p_keypoint_sorted_ptr;
} ;
/* Generalized command parameters */
struct gen_cmd_param {
uint32_t param0;
uint32_t param1;
uint32_t param2;
uint32_t param3;
};
/* DSP_IPC input/out structure */
/// @brief Number of parameters in each group
#define NUM_OF_GRP_PARAM (26)
/// @brief Packet group parameter struct about raw parameters
typedef struct _ScorePacketGroupData {
unsigned int params[NUM_OF_GRP_PARAM]; /* Raw packet parameters */
} ScorePacketGroupData;
/// @brief Packet group information struct. each group has this
typedef struct _ScorePacketGroupHeader {
unsigned int valid_size: 6; ///< Number of valid words in a packet group
unsigned int fd_bitmap: 26; ///< Represent the start word of sc_buffer in
/// the params array
} ScorePacketGroupHeader;
/// @brief Packet group struct. Group means a bunch of params and its meta info
typedef struct _ScorePacketGroup {
/*
* Not used ScorePacketGroupHeader when send to score firmware.
*/
// ScorePacketGroupHeader header; /* Meta information of packet group */
/* Actual parameters to be delivered */
ScorePacketGroupData data; /* Raw payload of packet group */
} ScorePacketGroup;
/// @brief IPC packet header contains meta information for calling SCore kernel
typedef struct _score_packet_header_t {
unsigned int queue_id: 2; /* Uniqueue ID of message queue */
unsigned int kernel_name: 12; /* Name of kernel */
unsigned int task_id: 7; /* Uniqueue Id internally assigned to every task */
unsigned int reserved: 8; /* RESERVED */
unsigned int worker_name: 3; /* DMA option */
} ScorePacketHeader, score_packet_header_t;
/// @brief IPC packet header contains about packet size
typedef struct _score_packet_size_t {
unsigned int packet_size: 14; /* Packet size of whole packets to send */
unsigned int reserved: 10; /* RESERVED */
unsigned int group_count: 8; /* Number of group in a packet */
} ScorePacketSize, score_packet_size_t;
typedef struct dsp_ipc_params {
ScorePacketSize size; /* Packet header for representing size */
ScorePacketHeader header; /* Packet header for representing general info */
// ScorePacketGroup group[0]; /* Real payload of packet and its meta info */
unsigned int params[NUM_OF_GRP_PARAM]; ///< Raw packet parameters
} score_ipc_packet;
#ifdef IVA_IPC_PARAM_ARCH64_SUPPORT
struct cmd_align_param {
#ifdef CONFIG_TEST_PARAM
#define MAX_CMD_PARAM_SIZE (0xD0) /* 208 B */
#else
#define MAX_CMD_PARAM_SIZE (0x8) /* 8 B */
#endif
uint32_t reserved[MAX_CMD_PARAM_SIZE/sizeof(uint32_t)];
};
#endif
/* definition for output params */
struct mch_out_param {
uint32_t result_size;
};
struct lkt_out_param {
uint32_t trk_point_ptr;
int32_t trk_num_point;
};
struct lmd_out_param {
uint32_t cnt_result;
};
struct orb_out_param {
uint32_t frame_id;
uint32_t num_keypoints;
};
#ifdef IVA_IPC_PARAM_ARCH64_SUPPORT
struct res_align_param {
#define MAX_RES_PARAM_SIZE (0x8) /* 8 B */
uint32_t reserved[MAX_RES_PARAM_SIZE/sizeof(uint32_t)];
};
#endif
/*
* data for command parameters
* LIMITATION: do not use explicit byte- or word-typed member inside.
*/
union ipc_cmd_data {
struct ipc_msg_schedule p;
struct ipc_msg_node m;
#ifdef IVA_IPC_PARAM_ARCH64_SUPPORT
struct cmd_align_param align_param; /* do not exceed */
#endif
#ifdef SCL_IF_PARAM_TO_CMD_PARAM
struct scale_if_param scale_param;
#endif
#ifdef PYRAMID_PARAM_TO_CMD_PARAM
struct pyramid_param pyrmd_param;
#endif
#ifdef WARP_MESH_PARAM_TO_CMD_PARAM
struct warp_mesh_param mesh_param;
#endif
#ifdef WARP_AFFINE_PARAM_TO_CMD_PARAM
struct warp_affine_param aff_param;
#endif
#ifdef NOISE_FILTER_PARAM_TO_CMD_PARAM
struct noise_filter_param nf_param;
#endif
#ifdef CORNER_COMP_PARAM_TO_CMD_PARAM
struct corner_compute_param cc_param;
#endif
#ifdef LOCAL_MINMAX_PARAM_TO_CMD_PARAM
struct local_minmax_param lm_param;
#endif
#ifdef LKT_IF_PARAM_TO_CMD_PARAM
struct lkt_if_param lkt_param;
#endif
#ifdef MCH_LINEAR_PARAM_TO_CMD_PARAM
struct mch_linear_param mch_param;
#endif
#ifdef ORB_IN_PARAM_TO_CMD_PARAM
struct orb_in_param orb_param;
#endif
#ifdef DSP_IPC_PARAM_TO_CMD_PARAM
struct dsp_ipc_params score_param;
#endif
#ifdef GEN_IPC_PARAM_TO_CMD_PARAM
struct gen_cmd_param cmd_param;
#endif
};
/*
* data for response parameters
* LIMITATION: do not use explicit byte- or word-typed member inside.
*/
union ipc_res_data {
struct ipc_msg_node m;
#ifdef IVA_IPC_PARAM_ARCH64_SUPPORT
struct res_align_param align_param; /* do not exceed */
#endif
/* add from here */
#ifdef MCH_OUT_PARAM_TO_RES_PARAM
struct mch_out_param mch_param;
#endif
#ifdef LMD_OUT_PARAM_TO_RES_PARAM
struct lmd_out_param lmd_param;
#endif
#ifdef LKT_OUT_PARAM_TO_RES_PARAM
struct lkt_out_param lkt_out_param;
#endif
#ifdef ORB_OUT_PARAM_TO_RES_PARAM
struct orb_out_param orb_param;
#endif
#ifdef TIME_TO_RES_PARAM
uint32_t time;
#endif
};
struct ipc_cmd_param {
uint32_t header;
uint32_t ipc_cmd_type;
union {
uint32_t cmd_src;
uint32_t param_0;
};
union {
uint32_t cmd_id;
uint32_t param_1;
};
union ipc_cmd_data data;
};
struct ipc_res_param {
uint32_t header;
uint32_t ipc_cmd_type;
union {
uint32_t rep_id; /* match with cmd id */
uint32_t param_0;
};
union {
uint32_t ret; /* success or failure */
uint32_t param_1;
};
union ipc_res_data data;
};
#endif //__IVA_IPC_PARAM_H__
|