hc
2023-03-13 2ec15ae1cb4be1b4fcb56c6d621123d7ebdaad6c
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
/*
 * Copyright 2020 Rockchip Electronics Co. LTD
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
 
#ifndef __HAL_VP9D_REG_H__
#define __HAL_VP9D_REG_H__
 
#include "rk_type.h"
 
typedef struct {
    struct {
        RK_U32   minor_ver   : 8;
        RK_U32    level       : 1;
        RK_U32    dec_support : 3;
        RK_U32    profile     : 1;
        RK_U32    reserve0    : 1;
        RK_U32    codec_flag  : 1;
        RK_U32    reserve1    : 1;
        RK_U32    prod_num    : 16;
    } swreg0_id;
 
    struct {
        RK_U32    sw_dec_e                        : 1;//0
        RK_U32    sw_dec_clkgate_e                : 1; // 1
        RK_U32    reserve0                        : 1;// 2
        RK_U32    sw_timeout_mode                 : 1; // 3
        RK_U32    sw_dec_irq_dis                  : 1;//4    // 4
        RK_U32    sw_dec_timeout_e                : 1; //5
        RK_U32    sw_buf_empty_en                 : 1; // 6
        RK_U32    sw_stmerror_waitdecfifo_empty   : 1; // 7
        RK_U32    sw_dec_irq                      : 1; // 8
        RK_U32    sw_dec_irq_raw                  : 1; // 9
        RK_U32    reserve2                        : 2;
        RK_U32    sw_dec_rdy_sta                  : 1; //12
        RK_U32    sw_dec_bus_sta                  : 1; //13
        RK_U32    sw_dec_error_sta                : 1; // 14
        RK_U32    sw_dec_timeout_sta              : 1; //15
        RK_U32    sw_dec_empty_sta                : 1; // 16
        RK_U32    sw_colmv_ref_error_sta          : 1; // 17
        RK_U32    sw_cabu_end_sta                 : 1; // 18
        RK_U32    sw_h264orvp9_error_mode         : 1; //19
        RK_U32    sw_softrst_en_p                 : 1; //20
        RK_U32    sw_force_softreset_valid        : 1; //21
        RK_U32    sw_softreset_rdy                : 1; // 22
    } swreg1_int;
 
    struct {
        RK_U32    sw_in_endian                    : 1;
        RK_U32    sw_in_swap32_e                  : 1;
        RK_U32    sw_in_swap64_e                  : 1;
        RK_U32    sw_str_endian                   : 1;
        RK_U32    sw_str_swap32_e                 : 1;
        RK_U32    sw_str_swap64_e                 : 1;
        RK_U32    sw_out_endian                   : 1;
        RK_U32    sw_out_swap32_e                 : 1;
        RK_U32    sw_out_cbcr_swap                : 1;
        RK_U32    reserve0                        : 1;
        RK_U32    sw_rlc_mode_direct_write        : 1;
        RK_U32    sw_rlc_mode                     : 1;
        RK_U32    sw_strm_start_bit               : 7;
        RK_U32    reserve1                        : 1;
        RK_U32    sw_dec_mode                     : 2;
        RK_U32    reserve2                        : 2;
        RK_U32    sw_h264_rps_mode                : 1;
        RK_U32    sw_h264_stream_mode             : 1;
        RK_U32    sw_h264_stream_lastpacket       : 1;
        RK_U32    sw_h264_firstslice_flag         : 1;
        RK_U32    sw_h264_frame_orslice           : 1;
        RK_U32    sw_buspr_slot_disable           : 1;
        RK_U32  reserve3                        : 2;
    } swreg2_sysctrl;
 
    struct {
        RK_U32    sw_y_hor_virstride              : 9;
        RK_U32    reserve                         : 2;
        RK_U32    sw_slice_num_highbit            : 1;
        RK_U32    sw_uv_hor_virstride             : 9;
        RK_U32    sw_slice_num_lowbits            : 11;
    } swreg3_picpar;
 
    RK_U32 swreg4_strm_rlc_base;
    RK_U32 swreg5_stream_len;
    RK_U32 swreg6_cabactbl_prob_base;
    RK_U32 swreg7_decout_base;
 
    struct {
        RK_U32    sw_y_virstride                  : 20;
        RK_U32    reverse0                        : 12;
    } swreg8_y_virstride;
 
    struct {
        RK_U32    sw_yuv_virstride                : 21;
        RK_U32    reverse                         : 11;
    } swreg9_yuv_virstride;
 
 
    //only for vp9
    struct {
        RK_U32    sw_vp9_cprheader_offset         : 16;
        RK_U32    reverse                         : 16;
    } swreg10_vp9_cprheader_offset;
 
    RK_U32 swreg11_vp9_referlast_base;
    RK_U32 swreg12_vp9_refergolden_base;
    RK_U32 swreg13_vp9_referalfter_base;
    RK_U32 swreg14_vp9_count_base;
    RK_U32 swreg15_vp9_segidlast_base;
    RK_U32 swreg16_vp9_segidcur_base;
 
    struct {
        RK_U32    sw_framewidth_last              : 16;
        RK_U32    sw_frameheight_last             : 16;
    } swreg17_vp9_frame_size_last;
 
    struct {
        RK_U32    sw_framewidth_golden            : 16;
        RK_U32    sw_frameheight_golden           : 16;
    } swreg18_vp9_frame_size_golden;
 
 
    struct {
        RK_U32    sw_framewidth_alfter            : 16;
        RK_U32    sw_frameheight_alfter           : 16;
    } swreg19_vp9_frame_size_altref;
 
 
    struct {
        RK_U32    sw_vp9segid_abs_delta                      : 1; //NOTE: only in reg#20, this bit is valid.
        RK_U32    sw_vp9segid_frame_qp_delta_en              : 1;
        RK_U32    sw_vp9segid_frame_qp_delta                 : 9;
        RK_U32    sw_vp9segid_frame_loopfitler_value_en      : 1;
        RK_U32    sw_vp9segid_frame_loopfilter_value         : 7;
        RK_U32    sw_vp9segid_referinfo_en                   : 1;
        RK_U32    sw_vp9segid_referinfo                      : 2;
        RK_U32    sw_vp9segid_frame_skip_en                  : 1;
        RK_U32    reverse                                    : 9;
    } swreg20_27_vp9_segid_grp[8];
 
 
    struct {
        RK_U32    sw_vp9_tx_mode                              : 3;
        RK_U32    sw_vp9_frame_reference_mode                 : 2;
        RK_U32    reserved                                    : 27;
    } swreg28_vp9_cprheader_config;
 
 
    struct {
        RK_U32    sw_vp9_lref_hor_scale                       : 16;
        RK_U32    sw_vp9_lref_ver_scale                       : 16;
    } swreg29_vp9_lref_scale;
 
    struct {
        RK_U32    sw_vp9_gref_hor_scale                       : 16;
        RK_U32    sw_vp9_gref_ver_scale                       : 16;
    } swreg30_vp9_gref_scale;
 
    struct {
        RK_U32    sw_vp9_aref_hor_scale                       : 16;
        RK_U32    sw_vp9_aref_ver_scale                       : 16;
    } swreg31_vp9_aref_scale;
 
    struct {
        RK_U32    sw_vp9_ref_deltas_lastframe                 : 28;
        RK_U32    reserve                                     : 4;
    } swreg32_vp9_ref_deltas_lastframe;
 
    struct {
        RK_U32    sw_vp9_mode_deltas_lastframe                : 14;
        RK_U32    reserve0                                    : 2;
        RK_U32    sw_segmentation_enable_lstframe             : 1;
        RK_U32    sw_vp9_last_show_frame                      : 1;
        RK_U32    sw_vp9_last_intra_only                      : 1;
        RK_U32    sw_vp9_last_widthheight_eqcur               : 1;
        RK_U32    sw_vp9_color_space_lastkeyframe             : 3;
        RK_U32    reserve1                                    : 9;
    } swreg33_vp9_info_lastframe;
 
    RK_U32 swreg34_vp9_intercmd_base;
 
    struct {
        RK_U32    sw_vp9_intercmd_num                         : 24;
        RK_U32    reserve                                     : 8;
    } swreg35_vp9_intercmd_num;
 
    struct {
        RK_U32    sw_vp9_lasttile_size                        : 24;
        RK_U32    reserve                                     : 8;
    } swreg36_vp9_lasttile_size;
 
    struct {
        RK_U32    sw_vp9_lastfy_hor_virstride                 : 9;
        RK_U32    reserve0                                    : 7;
        RK_U32    sw_vp9_lastfuv_hor_virstride                : 9;
        RK_U32    reserve1                                    : 7;
    } swreg37_vp9_lastf_hor_virstride;
 
    struct {
        RK_U32    sw_vp9_goldenfy_hor_virstride               : 9;
        RK_U32    reserve0                                    : 7;
        RK_U32    sw_vp9_goldenuv_hor_virstride               : 9;
        RK_U32    reserve1                                    : 7;
    } swreg38_vp9_goldenf_hor_virstride;
 
    struct {
        RK_U32    sw_vp9_altreffy_hor_virstride               : 9;
        RK_U32    reserve0                                    : 7;
        RK_U32    sw_vp9_altreffuv_hor_virstride              : 9;
        RK_U32    reserve1                                    : 7;
    } swreg39_vp9_altreff_hor_virstride;
 
    struct {
        RK_U32 sw_cur_poc                                     : 32;
    } swreg40_cur_poc;
 
    struct {
        RK_U32 reserve                                        : 3;
        RK_U32 sw_rlcwrite_base                               : 29;
    } swreg41_rlcwrite_base;
 
    struct {
        RK_U32 reserve                                        : 4;
        RK_U32 sw_pps_base                                    : 28;
    } swreg42_pps_base;
 
    struct {
        RK_U32 reserve                                        : 4;
        RK_U32 sw_rps_base                                    : 28;
    } swreg43_rps_base;
 
    struct {
        RK_U32 sw_strmd_error_e                               : 28;
        RK_U32 reserve                                        : 4;
    } swreg44_strmd_error_en;
 
    struct {
        RK_U32 vp9_error_info0                                : 32;
    } swreg45_vp9_error_info0;
 
    struct {
        RK_U32 sw_strmd_error_ctu_xoffset                     : 8;
        RK_U32 sw_strmd_error_ctu_yoffset                     : 8;
        RK_U32 sw_streamfifo_space2full                       : 7;
        RK_U32 reserve                                        : 1;
        RK_U32 sw_vp9_error_ctu0_en                           : 1;
    } swreg46_strmd_error_ctu;
 
    struct {
        RK_U32 sw_saowr_xoffet                                : 9;
        RK_U32 reserve                                        : 7;
        RK_U32 sw_saowr_yoffset                               : 10;
    } swreg47_sao_ctu_position;
 
    struct {
        RK_U32 sw_vp9_lastfy_virstride                        : 20;
        RK_U32 reserve                                        : 12;
    } swreg48_vp9_last_ystride;
 
    struct {
        RK_U32 sw_vp9_goldeny_virstride                       : 20;
        RK_U32 reserve                                        : 12;
    } swreg49_vp9_golden_ystride;
 
    struct {
        RK_U32 sw_vp9_altrefy_virstride                       : 20;
        RK_U32 reserve                                        : 12;
    } swreg50_vp9_altrefy_ystride;
 
    struct {
        RK_U32 sw_vp9_lastref_yuv_virstride                   : 21;
        RK_U32 reserve                                        : 11;
    } swreg51_vp9_lastref_yuvstride;
 
 
    RK_U32 swreg52_vp9_refcolmv_base;
 
    RK_U32 reg_not_use0[64 - 52 - 1];
 
    struct {
        RK_U32 sw_performance_cycle                           : 32;
    } swreg64_performance_cycle;
 
    struct {
        RK_U32 sw_axi_ddr_rdata                               : 32;
    } swreg65_axi_ddr_rdata;
 
    struct {
        RK_U32 sw_axi_ddr_wdata                               : 32;
    } swreg66_axi_ddr_wdata;
 
    struct {
        RK_U32 sw_busifd_resetn                               : 1;
        RK_U32 sw_cabac_resetn                                : 1;
        RK_U32 sw_dec_ctrl_resetn                             : 1;
        RK_U32 sw_transd_resetn                               : 1;
        RK_U32 sw_intra_resetn                                : 1;
        RK_U32 sw_inter_resetn                                : 1;
        RK_U32 sw_recon_resetn                                : 1;
        RK_U32 sw_filer_resetn                                : 1;
    } swreg67_fpgadebug_reset;
 
    struct {
        RK_U32 perf_cnt0_sel  : 6;
        RK_U32 reserve0       : 2;
        RK_U32 perf_cnt1_sel  : 6;
        RK_U32 reserve1       : 2;
        RK_U32 perf_cnt2_sel  : 6;
    } swreg68_performance_sel;
 
    struct {
        RK_U32 perf_cnt0 : 32;
    } swreg69_performance_cnt0;
 
    struct {
        RK_U32 perf_cnt1 : 32;
    } swreg70_performance_cnt1;
 
    struct {
        RK_U32 perf_cnt2 : 32;
    } swreg71_performance_cnt2;
 
    RK_U32 reg_not_use1[74 - 71 - 1];
 
    struct {
        RK_U32 sw_h264_cur_poc1 : 32;
    } swreg74_h264_cur_poc1;
 
    struct {
        RK_U32 vp9_error_info1 : 32;
    } swreg75_vp9_error_info1;
 
    struct {
        RK_U32 vp9_error_ctu1_x       : 6;
        RK_U32 reserve0               : 2;
        RK_U32 vp9_error_ctu1_y       : 6;
        RK_U32 reserve1               : 1;
        RK_U32 vp9_error_ctu1_en      : 1;
        RK_U32 reserve2               : 16;
    } swreg76_vp9_error_ctu1;
 
    RK_U32 reg_not_use2;
} VP9_REGS;
 
#endif