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 //////////////////////////////////////////////////////////////////////////////// 79 // 80 // Copyright (c) 2008-2009 MStar Semiconductor, Inc. 81 // All rights reserved. 82 // 83 // Unless otherwise stipulated in writing, any and all information contained 84 // herein regardless in any format shall remain the sole proprietary of 85 // MStar Semiconductor Inc. and be kept in strict confidence 86 // (!��MStar Confidential Information!�L) by the recipient. 87 // Any unauthorized act including without limitation unauthorized disclosure, 88 // copying, use, reproduction, sale, distribution, modification, disassembling, 89 // reverse engineering and compiling of the contents of MStar Confidential 90 // Information is unlawful and strictly prohibited. MStar hereby reserves the 91 // rights to any and all damages, losses, costs and expenses resulting therefrom. 92 // 93 //////////////////////////////////////////////////////////////////////////////// 94 //============================================================================== 95 #ifndef MHAL_ACE_H 96 #define MHAL_ACE_H 97 98 /// Define XC ACE device number 99 typedef enum 100 { 101 XC_ACE_DEVICE0 = 0, 102 XC_ACE_MAX_DEVICE_NUM 103 } XC_ACE_DEVICE_NUM; 104 105 #define XC_ACE_SUPPORT_DEVICE_NUM XC_ACE_MAX_DEVICE_NUM 106 107 typedef enum 108 { 109 E_HALACE_DEVICE0_XC_BANK_OFFSET = 0, 110 } ACE_HAL_DEVICE_XC_BANK_OFFSET; 111 112 void Hal_ACE_DMS(void* pInstance, MS_BOOL bScalerWin, MS_BOOL bisATV ); 113 void Hal_ACE_GetColorMatrix(void* pInstance, MS_BOOL bScalerWin, MS_U16* pu16Matrix); 114 void Hal_ACE_SetColorMatrix(void* pInstance, MS_BOOL bScalerWin, MS_U16* pu16Matrix); 115 MS_BOOL Hal_ACE_SetIHC(void* pInstance, MS_BOOL bScalerWin, XC_ACE_IHC_COLOR_TYPE eIHC, MS_U8 u8Val); 116 MS_BOOL Hal_ACE_SetICC(void* pInstance, MS_BOOL bScalerWin, XC_ACE_ICC_COLOR_TYPE eICC, MS_U8 u8Val); 117 MS_BOOL Hal_ACE_SetIBC(void* pInstance, MS_BOOL bScalerWin, XC_ACE_IBC_COLOR_TYPE eIBC, MS_U8 u8Val); 118 119 void Hal_ACE_PatchDTGColorChecker(void* pInstance, MS_U8 u8Mode); 120 void Hal_ACE_SetSlopValue(void* pInstance, MS_BOOL bScalerWin, MS_U8 u8SlopValue); 121 void Hal_ACE_SetFCC_En(void* pInstance, MS_BOOL bScalerWin, MS_U8 u8Reg, MS_BOOL bEn); 122 void Hal_ACE_SetFCC_Cb(void* pInstance, MS_U8 u8Reg, MS_U8 u8value); 123 void Hal_ACE_init_riu_base(MS_VIRT ptr_riu_base); 124 void Hal_ACE_SetSharpness(void* pInstance, MS_BOOL bScalerWin, MS_U8 u8Sharpness); 125 void Hal_ACE_SetSkipWaitVsync(void* pInstance, MS_BOOL bIsMainSkipWaitVsyn,MS_BOOL bIsSubSkipWaitVsyn); 126 MS_BOOL Hal_ACE_GetSkipWaitVsync(void* pInstance, MS_BOOL bScalerWin); 127 128 void Hal_ACE_SetBrightness(void* pInstance, MS_BOOL bScalerWin, MS_U8 u8RedBrightness, MS_U8 u8GreenBrightness, MS_U8 u8BlueBrightness ); 129 void Hal_ACE_SetBrightnessPrecise(void* pInstance, MS_BOOL bScalerWin, MS_U16 u16RedBrightness, MS_U16 u16GreenBrightness, MS_U16 u16BlueBrightness); 130 void Hal_ACE_GetBrightness(void* pInstance, MS_BOOL bScalerWin, MS_U8* u8RedBrightness, MS_U8* u8GreenBrightness, MS_U8* u8BlueBrightness); 131 void Hal_ACE_SetPostRGBGain(void* pInstance, MS_BOOL bScalerWin, MS_U16 u8RedGain, MS_U16 u8GreenGain, MS_U16 u8BlueGain); 132 void Hal_ACE_SetPostRGBOffset(void* pInstance, MS_BOOL bScalerWin, MS_U16 u16RedOffset, MS_U16 u16GreenOffset, MS_U16 u16BlueOffset); 133 void Hal_ACE_SetPostRGBGainOffsetTogether(void* pInstance, MS_BOOL bScalerWin, 134 MS_U16 u16RedGain, MS_U16 u16GreenGain, MS_U16 u16BlueGain, 135 MS_U16 u16RedOffset, MS_U16 u16GreenOffset, MS_U16 u16BlueOffset); 136 void Hal_ACE_Set_IHC_SRAM(void* pInstance, MS_U16 *pBuf, MS_U8 u8SRAM_Idx, MS_U16 u16Cnt); 137 void Hal_ACE_Set_ICC_SRAM(void* pInstance, MS_U16 *pBuf, MS_U16 u16Cnt); 138 void Hal_ACE_Write_Color_Matrix_Burst(void* pInstance, MS_BOOL bWindow, MS_U16* psMatrix ); 139 MS_BOOL Hal_ACE_Is_Support_MLoad(void* pInstance); 140 141 void Hal_ACE_MWESetWin(void* pInstance, MS_U16 u16hstart, MS_U16 u16hend, MS_U16 u16vstart, MS_U16 u16vend); 142 void Hal_ACE_MWEEnable(void* pInstance, MS_BOOL ben, MS_BOOL bLoadFromTable); 143 void Hal_ACE_MWESetBorder(void* pInstance, MS_BOOL bScalerWin, MS_U16 u16color, MS_U16 u16_l, MS_U16 u16_r, MS_U16 u16_t, MS_U16 u16_d); 144 void Hal_ACE_MWECloneVisualEffect(void* pInstance); 145 void Hal_ACE_3DClonePQMap(void* pInstance, XC_ACE_WEAVETYPE enWeaveType); 146 147 MS_U8 Hal_ACE_DNR_GetMotion(void* pInstance); 148 MS_U8 Hal_ACE_DNR_GetCoringThreshold(void* pInstance, MS_BOOL bScalerWin); 149 MS_U8 Hal_ACE_DNR_GetSharpnessAdjust(void* pInstance, MS_BOOL bScalerWin); 150 MS_U8 Hal_ACE_DNR_GetGuassin_SNR_Threshold(void* pInstance, MS_BOOL bScalerWin); 151 152 153 void Hal_ACE_DNR_SetCoringThreshold(void* pInstance, MS_BOOL bScalerWin, MS_U16 u16val); 154 void Hal_ACE_DNR_SetSharpnessAdjust(void* pInstance, MS_BOOL bScalerWin, MS_U16 u16val); 155 void Hal_ACE_DNR_SetNM_V(void* pInstance, MS_BOOL bScalerWin, MS_U16 u16val); 156 void Hal_ACE_DNR_SetGNR_0(void* pInstance, MS_BOOL bScalerWin, MS_U16 u16val); 157 void Hal_ACE_DNR_SetGNR_1(void* pInstance, MS_BOOL bScalerWin, MS_U16 u16val); 158 void Hal_ACE_DNR_SetCP(void* pInstance, MS_BOOL bScalerWin, MS_U16 u16val); 159 void Hal_ACE_DNR_SetDP(void* pInstance, MS_BOOL bScalerWin, MS_U16 u16val); 160 void Hal_ACE_DNR_SetNM_H_0(void* pInstance, MS_BOOL bScalerWin, MS_U16 u16val); 161 void Hal_ACE_DNR_SetNM_H_1(void* pInstance, MS_BOOL bScalerWin, MS_U16 u16val); 162 void Hal_ACE_DNR_SetGray_Ground_Gain(void* pInstance, MS_U16 u16val); 163 void Hal_ACE_DNR_SetGray_Ground_En(void* pInstance, MS_BOOL bScalerWin, MS_U16 u16val); 164 void Hal_ACE_DNR_SetSC_Coring(void* pInstance, MS_BOOL bScalerWin, MS_U16 u16val); 165 void Hal_ACE_DNR_SetSpikeNR_0(void* pInstance, MS_U16 u16val); 166 void Hal_ACE_DNR_SetSpikeNR_1(void* pInstance, MS_U16 u16val); 167 void Hal_ACE_DNR_SetSNR_NM(void* pInstance, MS_U16 u16val); 168 void Hal_ACE_DNR_SetBank_Coring(void* pInstance, MS_BOOL bScalerWin, MS_U16 u16val); 169 void Hal_ACE_DNR_SetGuassin_SNR_Threshold(void* pInstance, MS_BOOL bScalerWin, MS_U16 u16val); 170 void Hal_ACE_DNR_SetNRTbl_Y(void* pInstance, MS_U8 u8Idx, MS_U16 u16val); 171 void Hal_ACE_DNR_SetNRTbl_C(void* pInstance, MS_U8 u8Idx, MS_U16 u16val); 172 void HAL_ACE_Set_RBChannelOffset(void* pInstance, MS_BOOL bScalerWin, MS_BOOL bEnable); 173 void Hal_ACE_Set_Device_Bank_Offset(void); 174 175 // Function in mdrv_xc_menuload.c 176 typedef enum 177 { 178 E_MLOAD_UNSUPPORTED = 0, 179 E_MLOAD_DISABLED = 1, 180 E_MLOAD_ENABLED = 2, 181 }MLOAD_TYPE; 182 183 typedef enum 184 { 185 E_MLG_UNSUPPORTED = 0, 186 E_MLG_DISABLED = 1, 187 E_MLG_ENABLED = 2, 188 }MLG_TYPE; 189 190 extern MS_BOOL MApi_XC_MLoad_Fire(void *pInstance, MS_BOOL bImmediate); 191 extern MS_BOOL MApi_XC_MLoad_WriteCmd(void *pInstance, MS_U32 u32Addr, MS_U16 u16Data, MS_U16 u16Mask); 192 extern MS_BOOL MApi_XC_MLoad_WriteCmds_And_Fire(void *pInstance, MS_U32 *pu32Addr, MS_U16 *pu16Data, MS_U16 *pu16Mask, MS_U16 u16CmdCnt); 193 extern MS_BOOL MApi_XC_MLoad_WriteCmd_And_Fire(void *pInstance, MS_U32 u32Addr, MS_U16 u16Data, MS_U16 u16Mask); 194 extern MLOAD_TYPE MApi_XC_MLoad_GetStatus_U2(void *pInstance); 195 196 extern MS_S32 _MLOAD_MUTEX; 197 198 #define MLOAD_MUTEX 199 #define MLOAD_MUTEX_DBG 0 200 201 #ifdef MLOAD_MUTEX 202 #if(MLOAD_MUTEX_DBG) 203 #define _MLOAD_ENTRY() \ 204 printf("1,==========================\n"); \ 205 printf("[%s][%s][%06d]\n",__FILE__,__FUNCTION__,__LINE__); \ 206 if(!MsOS_ObtainMutex(_MLOAD_MUTEX, MSOS_WAIT_FOREVER)) \ 207 { \ 208 printf("==========================\n"); \ 209 printf("[%s][%s][%06d] Mutex taking timeout\n",__FILE__,__FUNCTION__,__LINE__); \ 210 } 211 #define _MLOAD_RETURN() \ 212 printf("0,==========================\n"); \ 213 printf("[%s][%s][%06d] \n",__FILE__,__FUNCTION__,__LINE__); \ 214 MsOS_ReleaseMutex(_MLOAD_MUTEX); 215 //return _ret; 216 #else 217 #define _MLOAD_ENTRY() \ 218 if(!MsOS_ObtainMutex(_MLOAD_MUTEX, MSOS_WAIT_FOREVER)) \ 219 { \ 220 } 221 #define _MLOAD_RETURN() MsOS_ReleaseMutex(_MLOAD_MUTEX); 222 //return _ret; 223 #endif 224 #else // #if not def MLOAD_MUTEX 225 #define _MLOAD_ENTRY() while(0) 226 #define _MLOAD_RETURN() while(0) 227 #endif // #ifdef _MLOAD_MUTEX 228 229 #endif 230 231 232