xref: /utopia/UTPA2-700.0.x/modules/xc/hal/kano/xc/include/mhal_menuload.h (revision 53ee8cc121a030b8d368113ac3e966b4705770ef)
1 //<MStar Software>
2 //******************************************************************************
3 // MStar Software
4 // Copyright (c) 2010 - 2012 MStar Semiconductor, Inc. All rights reserved.
5 // All software, firmware and related documentation herein ("MStar Software") are
6 // intellectual property of MStar Semiconductor, Inc. ("MStar") and protected by
7 // law, including, but not limited to, copyright law and international treaties.
8 // Any use, modification, reproduction, retransmission, or republication of all
9 // or part of MStar Software is expressly prohibited, unless prior written
10 // permission has been granted by MStar.
11 //
12 // By accessing, browsing and/or using MStar Software, you acknowledge that you
13 // have read, understood, and agree, to be bound by below terms ("Terms") and to
14 // comply with all applicable laws and regulations:
15 //
16 // 1. MStar shall retain any and all right, ownership and interest to MStar
17 //    Software and any modification/derivatives thereof.
18 //    No right, ownership, or interest to MStar Software and any
19 //    modification/derivatives thereof is transferred to you under Terms.
20 //
21 // 2. You understand that MStar Software might include, incorporate or be
22 //    supplied together with third party`s software and the use of MStar
23 //    Software may require additional licenses from third parties.
24 //    Therefore, you hereby agree it is your sole responsibility to separately
25 //    obtain any and all third party right and license necessary for your use of
26 //    such third party`s software.
27 //
28 // 3. MStar Software and any modification/derivatives thereof shall be deemed as
29 //    MStar`s confidential information and you agree to keep MStar`s
30 //    confidential information in strictest confidence and not disclose to any
31 //    third party.
32 //
33 // 4. MStar Software is provided on an "AS IS" basis without warranties of any
34 //    kind. Any warranties are hereby expressly disclaimed by MStar, including
35 //    without limitation, any warranties of merchantability, non-infringement of
36 //    intellectual property rights, fitness for a particular purpose, error free
37 //    and in conformity with any international standard.  You agree to waive any
38 //    claim against MStar for any loss, damage, cost or expense that you may
39 //    incur related to your use of MStar Software.
40 //    In no event shall MStar be liable for any direct, indirect, incidental or
41 //    consequential damages, including without limitation, lost of profit or
42 //    revenues, lost or damage of data, and unauthorized system use.
43 //    You agree that this Section 4 shall still apply without being affected
44 //    even if MStar Software has been modified by MStar in accordance with your
45 //    request or instruction for your use, except otherwise agreed by both
46 //    parties in writing.
47 //
48 // 5. If requested, MStar may from time to time provide technical supports or
49 //    services in relation with MStar Software to you for your use of
50 //    MStar Software in conjunction with your or your customer`s product
51 //    ("Services").
52 //    You understand and agree that, except otherwise agreed by both parties in
53 //    writing, Services are provided on an "AS IS" basis and the warranty
54 //    disclaimer set forth in Section 4 above shall apply.
55 //
56 // 6. Nothing contained herein shall be construed as by implication, estoppels
57 //    or otherwise:
58 //    (a) conferring any license or right to use MStar name, trademark, service
59 //        mark, symbol or any other identification;
60 //    (b) obligating MStar or any of its affiliates to furnish any person,
61 //        including without limitation, you and your customers, any assistance
62 //        of any kind whatsoever, or any information; or
63 //    (c) conferring any license or right under any intellectual property right.
64 //
65 // 7. These terms shall be governed by and construed in accordance with the laws
66 //    of Taiwan, R.O.C., excluding its conflict of law rules.
67 //    Any and all dispute arising out hereof or related hereto shall be finally
68 //    settled by arbitration referred to the Chinese Arbitration Association,
69 //    Taipei in accordance with the ROC Arbitration Law and the Arbitration
70 //    Rules of the Association by three (3) arbitrators appointed in accordance
71 //    with the said Rules.
72 //    The place of arbitration shall be in Taipei, Taiwan and the language shall
73 //    be English.
74 //    The arbitration award shall be final and binding to both parties.
75 //
76 //******************************************************************************
77 //<MStar Software>
78 // All rights reserved.
79 //
80 // Unless otherwise stipulated in writing, any and all information contained
81 // herein regardless in any format shall remain the sole proprietary of
82 // MStar Semiconductor Inc. and be kept in strict confidence
83 // (��MStar Confidential Information��) by the recipient.
84 // Any unauthorized act including without limitation unauthorized disclosure,
85 // copying, use, reproduction, sale, distribution, modification, disassembling,
86 // reverse engineering and compiling of the contents of MStar Confidential
87 // Information is unlawful and strictly prohibited. MStar hereby reserves the
88 // rights to any and all damages, losses, costs and expenses resulting therefrom.
89 //
90 ////////////////////////////////////////////////////////////////////////////////
91 #ifndef MHAL_MENULOAD_H
92 #define MHAL_MENULOAD_H
93 
94 //Select the source to trigger menuload
95 #define TRIG_SRC_FE_VFDE        0
96 #define TRIG_SRC_RE_VSYNC       1
97 #define TRIG_SRC_FE_VSYNC       2
98 #define TRIG_SRC_DELAY_LINE     3
99 
100 #define OPM_LOCK_INIT_STATE     0
101 #define OPM_LOCK_FE_VSYNC       1
102 #define OPM_LOCK_TRAIN_TRIG_P   2
103 #define OPM_LOCK_DS             3
104 
105 #define  MS_MLOAD_CMD_ALIGN     4
106 #define  MS_MLOAD_REG_LEN       0x04 // how many data in one MIU request
107 #define  MS_MLOAD_CMD_LEN       BYTE_PER_WORD
108 #define  MS_MLOAD_MEM_BASE_UNIT BYTE_PER_WORD
109 #define  MS_MLOAD_BUS_WIDTH     (16)
110 #define  MS_MLOAD_MAX_CMD_CNT   192
111 #define  MS_MLOAD_NULL_CMD      0xFF010000
112 #define  MS_MLOAD_DUMMY_CMD_CNT(x)  ((x+0x0003)&~0x0003)
113 #define  MS_MLOAD_END_CMD(x) (0x1F020000 | (MS_MLOAD_REG_LEN) | (_XC_Device_Offset[psXCInstPri->u32DeviceID] << 24))
114 #define  MS_MLOAD_MIU_BUS_SEL   0x00
115 
116 #define  MS_MLOAD_CMD_LEN_64BITS 8 //8 bytes
117 #define  MS_MLOAD_NULL_CMD_SPREAD_MODE    (((MS_U64)0x13FF<<23)|((MS_U64)0x01<<16)|((MS_U64)0x0000))  //0x00000009FF810000
118 #define  MS_MLOAD_END_CMD_SPREAD_MODE(x)   ( ((MS_U64)0x0000<<48) | (((MS_U64)0x131F<<23)|((MS_U64)0x02<<16)|((MS_U64)0x0000)) | (MS_MLOAD_REG_LEN) ) //(0x000000098F820000 | (MS_MLOAD_REG_LEN)) = 0x000000098F820004
119 #define  MS_MLOAD_END_CMD_DEV1_SPREAD_MODE(x)   ( ((MS_U64)0x0000<<48) | (((MS_U64)0x139F<<23)|((MS_U64)0x02<<16)|((MS_U64)0x0000)) | (MS_MLOAD_REG_LEN) ) //(0x000000098F820000 | (MS_MLOAD_REG_LEN)) = 0x000000098F820004
120 
121 #define  MS_MLG_REG_LEN         0x40 // how many data in one MIU request
122 #define  MS_MLG_CMD_LEN         BYTE_PER_WORD
123 #define  MS_MLG_MEM_BASE_UNIT   BYTE_PER_WORD
124 
125 typedef struct
126 {
127     union
128     {
129         struct
130         {
131         	MS_U16 u16Data;
132         	MS_U8 u8Addr;
133         	MS_U8 u8Bank;
134         };
135         MS_U32 u32Cmd;
136     };
137 }MS_MLoad_Data;
138 
139 typedef struct
140 {
141     union
142     {
143         struct
144         {
145         	MS_U16 u16Data;
146         	MS_U8  u8Addr; //addr 0 ~ 0x7F
147         	MS_U8  u8Bank; //subbank 0 ~ 0xFF
148         	MS_U32 u32NoUse;
149         };
150         MS_U64 u64Cmd;
151     };
152 }MS_MLoad_Data_64Bits_SubBank;
153 
154 #ifdef MLG_1024 // Gamma_1024
155 typedef struct
156 {
157     MS_U64 BData0 : 12;     //0
158     MS_U64 BData1 : 12;
159     MS_U64 BData2 : 12;
160     MS_U64 GData0 : 12;
161     MS_U64 GData1 : 12;
162     MS_U64 GData2_L : 4;      //63
163 
164     MS_U64 GData2_H : 8;      //64
165     MS_U64 RData0 : 12;
166     MS_U64 RData1 : 12;
167     MS_U64 RData2 : 12;
168     MS_U64 Dummy0 :20;      //127
169 
170     MS_U64 Dummy1 : 16 ;       //128
171     MS_U64 BEnable : 1 ;
172     MS_U64 GEnable : 1 ;
173     MS_U64 REnable : 1 ;
174     MS_U64 Dummy2 :45;      //191
175 
176     MS_U64 Dummy3;      //192~255
177 } MS_SC_MLG_TBL;
178 #else // Gamma_256 or not support MLG case
179 typedef struct
180 {
181     MS_U16 u16B;
182     MS_U16 u16G;
183     MS_U16 u16R;
184     MS_U16 u16Enable;
185     MS_U16 u16Dummy[4];
186 } MS_SC_MLG_TBL;
187 #endif
188 
189 typedef enum
190 {
191     MLOAD_TRIGGER_BY_OP_SYNC=0,
192     MLOAD_TRIGGER_BY_IP_MAIN_SYNC=1,
193     MLOAD_TRIGGER_BY_IP_SUB_SYNC=2,
194     MLOAD_TRIGGER_BY_SW=3,
195     MLOAD_TRIGGER_MAX,
196 }MLoad_Trigger_Sync;
197 
198 typedef enum
199 {
200     MLoad_WD_Timer_Reset_DMA = 0,
201     MLoad_WD_Timer_Reset_MIU = 1,
202     MLoad_WD_Timer_Reset_ALL = 3,
203     MLoad_WD_Timer_Reset_MAX,
204 }MLoad_WD_Timer_Reset_Type;
205 
206 MS_U16 Hal_XC_MLoad_get_status(void *pInstance);
207 void Hal_XC_MLoad_set_on_off(void *pInstance, MS_BOOL bEn);
208 void Hal_XC_MLoad_set_len(void *pInstance, MS_U16 u16Len);
209 void Hal_XC_MLoad_set_depth(void *pInstance, MS_U16 u16depth);
210 void Hal_XC_MLoad_set_miusel(void *pInstance, MS_U8 u8MIUSel);
211 MS_U8 Hal_XC_MLoad_get_miusel(void *pInstance);
212 void Hal_XC_MLoad_set_base_addr(void *pInstance, MS_PHY u32addr);
213 void Hal_XC_MLoad_set_trigger_timing(void *pInstance, MS_U16 u16sel);
214 void Hal_XC_MLoad_set_opm_lock(void *pInstance, MS_U16 u16sel);
215 void Hal_XC_MLoad_set_trigger_delay(void *pInstance, MS_U16 u16delay);
216 void Hal_XC_MLoad_set_trig_p(void *pInstance, MS_U16 u16train, MS_U16 u16disp);
217 MS_BOOL Hal_XC_MLoad_get_trig_p(void *pInstance, MS_U16 *pu16Train, MS_U16 *pu16Disp);
218 void Hal_XC_MLoad_Set_riu(void *pInstance, MS_BOOL bEn);
219 MS_BOOL Hal_XC_MLoad_GetCaps(void *pInstance);
220 void Hal_XC_MLoad_set_riu_cs(void *pInstance, MS_BOOL bEn);
221 #define Hal_XC_MLoad_set_opm_arbiter_bypass(args...)
222 #define Hal_XC_MLoad_set_miu_bus_sel(args...)
223 #define Hal_XC_MLoad_enable_watch_dog(args...)
224 #define Hal_XC_MLoad_set_watch_dog_time_delay(args...)
225 #define Hal_XC_MLoad_enable_watch_dog_reset(args...)
226 
227 
228 MS_BOOL Hal_XC_MLG_GetCaps(void *pInstance);
229 MS_U16 Hal_XC_MLG_get_status(void *pInstance);
230 #define Hal_XC_MLG_set_on_off(args...)
231 #define Hal_XC_MLG_set_len(args...)
232 #define Hal_XC_MLG_set_depth(args...)
233 #define Hal_XC_MLG_set_base_addr(args...)
234 #define Hal_XC_MLG_set_trigger_timing(args...)
235 #define Hal_XC_MLG_set_trigger_delay(args...)
236 #define Hal_XC_MLG_set_init_addr(args...)
237 
238 void Hal_XC_MLoad_Enable_64BITS_COMMAND(void *pInstance,MS_BOOL bEn);
239 void Hal_XC_MLoad_Enable_64BITS_SPREAD_MODE(void *pInstance,MS_BOOL bEn);
240 void Hal_XC_MLoad_Command_Format_initial(void *pInstance);
241 void Hal_XC_MLoad_Set_64Bits_MIU_Bus_Sel(void *pInstance);
242 MS_U64 Hal_XC_MLoad_Gen_64bits_spreadMode(void *pInstance,MS_U32 u32Addr, MS_U16 u16Data, MS_U16 u16Mask);
243 MS_U64 Hal_XC_MLoad_Gen_64bits_spreadMode_NonXC(void *pInstance,MS_U32 u32Bank,MS_U32 u32Addr, MS_U16 u16Data, MS_U16 u16Mask);
244 MS_BOOL Hal_XC_MLoad_parsing_64bits_spreadMode_NonXC(void *pInstance,MS_U64 u64Cmd, MS_U32 *u32Addr, MS_U16 *u16Data);
245 MS_U64 Hal_XC_MLoad_Gen_64bits_subBankMode(void *pInstance,MS_U32 u32Addr, MS_U16 u16Data, MS_U16 u16Mask);
246 MS_U32 Hal_XC_MLoad_Gen_32bits_subBankMode(void *pInstance,MS_U32 u32Addr, MS_U16 u16Data, MS_U16 u16Mask);
247 MS_BOOL Hal_XC_MLoad_parsing_32bits_subBankMode(void *pInstance, MS_U32 u32MloadData, MS_U32 *pu32Addr, MS_U16 *pu16Data);
248 MS_U16 Hal_XC_MLoad_Get_Depth(void *pInstance, MS_U16 u16CmdCnt);
249 
250 void Hal_XC_MLoad_set_trigger_sync(void *pInstance, MLoad_Trigger_Sync eTriggerSync);
251 void Hal_SC_ControlMloadTrig(void *pInstance);
252 void Hal_XC_MLoad_set_BitMask(void *pInstance,MS_BOOL enable);
253 #endif
254 
255