summaryrefslogtreecommitdiff
path: root/drivers/mxc/vpu-malone/Malone_Firmware/DecKLib/Control/DecKernelLibHWControl.h
blob: 4ef9b0f0b08e3130be5853de4e28ada44ec2955b (plain)
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
/***************************************************
  Copyright (c) 2015 Amphion Semiconductor Ltd
                All rights reserved.
 ***************************************************
 * The code contained herein is licensed under the GNU General Public
 * License. You may obtain a copy of the GNU General Public License
 * Version 2 or later at the following locations:
 *
 * http://www.opensource.org/licenses/gpl-license.html
 * http://www.gnu.org/copyleft/gpl.html
 ****************************************************

  Filename:        DecLibHWControl.h
  Description:

 **************************************************/

/////////////////////////////////////////////////////////////////////////////////
//  Header files
/////////////////////////////////////////////////////////////////////////////////

#ifndef _DECODER_LIB_HW_CONTROL_H_
#define _DECODER_LIB_HW_CONTROL_H_

#include "mvd_types.h"
#include "mvd_reg_map.h"
#include "DecKernelLib.h"

/////////////////////////////////////////////////////////////////////////////////
//  Global Macros
/////////////////////////////////////////////////////////////////////////////////

#define MALONE_HW_1 0                         /* Identifiers for the Malone units     */
#define MALONE_HW_2 1
#define MALONE_SW   DECODERLIB_MAX_MALONES    /* Sw Malone does not exist! Simply a   */
                                              /* control structure for carrying out   */
                                              /* commands which do not need a HW unit */
#define MALONE_SW_IRQ 0xdeaf
                                              
#define DECODERLIB_ISR_QU_SIZE          ( DECODERLIB_MAX_MALONES * 4 )
#define DECODERLIB_SECONDARY_ISR_EVENT  0x80000000
#define DECODERLIB_EVENT_MASK           0x7FFFFFFF

#define DECODERLIB_FORCEIRQ_BIT_SET( uVal )     (( uVal & 0x1 ) << 30 )
#define DECODERLIB_FORCEIRQ_BIT_GET( uVal )     (( uVal >> 30 ) & 0x1 )
#define DECODERLIB_FORCEDFEIRQ_BIT_SET( uVal )  (( uVal & 0x1 ) << 29 )
#define DECODERLIB_FORCEDFEIRQ_BIT_GET( uVal )  (( uVal >> 29 ) & 0x1 )                                              
                                              
/////////////////////////////////////////////////////////////////////////////////
//  Global Types
/////////////////////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////////
// Decoder Library HW State

typedef enum
{
  MALONE_INACTIVE  = 0,
  MALONE_ACTIVE,
  MALONE_BE_ACTIVE

} MALONE_STATE;

//////////////////////////////////////////////////////////////
// Decoder Library HW Control Context Info

typedef struct
{

  MALONE_STATE eState;
  u_int32      uStrID;

  u_int32      uForceFIQ;
  u_int32      uForceDFEFIQ;
  u_int32      uChipVer;                /* Hold "malone" version to be filled in from Malone HW register   */
  u_int32      uChipMnrVer;             /* Hold "malone" minor version to be filled in from Malone HW register   */
  u_int32      uChipSubVer;             /* Hold metal version to be filled in by higher level control      */
  u_int32      uHWFeatures;
  u_int32      uForceCacheFlush;        /* Cache reset issue workaround purpose for Kronos and Fusion RevA */
  u_int32      bPreparser;              /* Set TRUE to indicate a preparser is in place                    */
  u_int32      bCQ;                     /* Set TRUE to indicate a command queue is in place                */
  u_int32      bDCP;                    /* Set TRUE to indicate unit can operate in decoupled mode         */
  u_int32      uNumDBEs;                /* Indicates the number of decoupled back ends available           */
  u_int32      bFBC;                    /* Set TRUE to indicate Frame buffer Compression support           */
  u_int32      uRSBSize;
  u_int32      uMaloneID;
  u_int32      bPixIf;
  u_int32      bXBUS;

  u_int32      uCQProcType[DECODERLIB_MAX_CQ_PER_MALONE]; /* Specifies what type of processing each of the CQ units is doing */

  MALONE_STATE eDFEState;                                 /* If the front end of the HW is active in isolation - specifies state */
  u_int8       usDFEStrID;                                /* If the front end of the HW is active in isolation - specifies       */
                                                          /* which stream is assigned                                            */

  u_int32      uDmaMemSize;
  void       * pDmaMemArea;  
                                                          
  MvdHwRegMap     * msd_regp;
  MvdHwRegHifMap  * hif_regp;
  MvdHwRegSifMap  * sif_regp;
  MvdHwRegCtxMap  * ctx_regp;
  MvdHwReg        * rsb_regp;
  MvdHwRegRprMap  * rpr_regp;
  MvdHwRegSppMap  * spp_regp;
  MvdHwRegH264Map * avc_regp;
  MvdHwRegMp2dMap * mp2d_regp;
  MvdHwRegAvsdMap * avsd_regp;
  MvdHwRegAspdMap * aspd_regp;
  MvdHwRegVc1dMap * vc1d_regp;
  MvdHwRegAspdMap * jpgd_regp;
  MvdHwRegOn2dMap * on2d_regp;
  MvdHwRegRvidMap * rvid_regp;
  MvdHwRegHevcMap * hevc_regp;
  MvdHwRegBbdMap  * bbd_regp;
  MvdHwRegDbgMap  * dbg_regp;
  MvdHwRegCqMap   * cq_regp;
  MvdHwRegRC4Map  * rc4_regp;
  MvdHwRegDfeMap  * dfe_regp;
  MvdHwRegDbeMap  * dbe_regp[DECODERLIB_MAX_DBE_UNITS];

} MALONE_KERNEL_HW_SESSION, *pMALONE_KERNEL_HW_SESSION;

/////////////////////////////////////////////////////////////////////////////////
//  Global Function definitions
/////////////////////////////////////////////////////////////////////////////////


void mvd_kernel_hw_control_init ( DECODERLIB_KERNEL_CFG * pCfg );

////////////////////////////////////////////////////////////////////////////////////
//  FUNCTION:    mvd_kernel_hw_set_focus                                            //
//                                                                                //
//  DESCRIPTION: Changes focus to the selected Malone HW unit                     //
//                                                                                //
//  INPUTS:      uMaloneID - The ID of the Malone                                 //
//                                                                                //
//  OUTPUTS:     ppMVDHw   - Pointer to a HW session structure for the specified  //
//                           Malone                                               //
//                                                                                //
//  RETURNS:     None.                                                            //
//                                                                                //
//  NOTES:       Only makes sense in multi-malone configs                         //
//                                                                                //
//  CONTEXT:     This function may be called from any context                     //
//                                                                                //
////////////////////////////////////////////////////////////////////////////////////

void mvd_kernel_hw_set_focus ( u_int32 uMaloneID, pMALONE_KERNEL_HW_SESSION * ppMVDHw );

////////////////////////////////////////////////////////////////////////////////////
//  FUNCTION:    mvd_kernel_hw_init_handles                                       //
//                                                                                //
//  DESCRIPTION: Initialise the HW session handles                                //
//                                                                                //
//  INPUTS:      pCfg      - A pointer to the DecLib Config structure             //
//               bSoftInit - If set, the FW pointers get established - leave      //
//                           FALSE when restarting from a snapshot                //
//                                                                                //
//  OUTPUTS:     None.                                                            //
//                                                                                //
//  RETURNS:     None.                                                            //
//                                                                                //
//  NOTES:       None.                                                            //
//                                                                                //
//  CONTEXT:     This function must be called from non-interrupt context          //
//                                                                                //
////////////////////////////////////////////////////////////////////////////////////

void mvd_kernel_hw_init_handles ( DECODERLIB_KERNEL_CFG * pCfg,
                                  bool             bSoftInit );

#endif /* _DECODER_LIB_HW_CONTROL_H_ */

/* End of file */