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") 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 #ifndef DRV_SC_SCALING_H 95 #define DRV_SC_SCALING_H 96 97 #include "UFO.h" 98 99 #ifdef DRV_SC_SCALING_C 100 #define INTERFACE 101 #else 102 #define INTERFACE extern 103 #endif 104 105 extern void MDrv_SC_set_fbl(void *pInstance, MS_BOOL bEn); //TODO 106 extern MS_BOOL MDrv_SC_get_fbl(void *pInstance); //TODO 107 108 #define HVMODE_HDE_VALIDATION(x) (((x) >= 1200) && ((x) <= 1360)) 109 110 111 #define DS_MUTEX 112 #define DS_MUTEX_DBG 0 113 114 115 #ifdef DRV_SC_SCALING_C 116 #define INTERFACE 117 INTERFACE MS_S32 _DS_MUTEX = -1; 118 #else 119 #define INTERFACE extern 120 INTERFACE MS_S32 _DS_MUTEX; 121 #endif 122 123 #define _DS_MUTEX_TIME_OUT MSOS_WAIT_FOREVER 124 125 #ifdef DS_MUTEX 126 #if(DS_MUTEX_DBG) 127 #define _DS_ENTRY(pInstance) \ 128 _XC_SEMAPHORE_ENTRY(pInstance,E_XC_ID_DS); \ 129 printf("0,==========================Prepare to get mutex\n"); \ 130 printf("[%s][%s][%06d]\n",__FILE__,__FUNCTION__,__LINE__); \ 131 if(!MsOS_ObtainMutex(_DS_MUTEX, _DS_MUTEX_TIME_OUT)) \ 132 { \ 133 printf("==========================\n"); \ 134 printf("[%s][%s][%06d] Mutex taking timeout\n",__FILE__,__FUNCTION__,__LINE__); \ 135 }\ 136 printf("[%s][%06d] DS mutex got\n",__FUNCTION__,__LINE__); 137 138 #define _DS_RETURN(pInstance) \ 139 printf("1,==========================\n"); \ 140 printf("[%s][%s][%06d] \n",__FILE__,__FUNCTION__,__LINE__); \ 141 MsOS_ReleaseMutex(_DS_MUTEX); \ 142 printf("==========================prepare to release semaphore\n"); \ 143 _XC_SEMAPHORE_RETURN(pInstance,E_XC_ID_DS); \ 144 printf("[%s][%06d] ds mutex released\n",__FUNCTION__,__LINE__); 145 //return _ret; 146 #else 147 #define _DS_ENTRY(pInstance) \ 148 _XC_SEMAPHORE_ENTRY(pInstance,E_XC_ID_DS); \ 149 if(!MsOS_ObtainMutex(_DS_MUTEX, _MLOAD_MUTEX_TIME_OUT)) \ 150 { \ 151 } 152 #define _DS_RETURN(pInstance) \ 153 MsOS_ReleaseMutex(_DS_MUTEX); \ 154 _XC_SEMAPHORE_RETURN(pInstance,E_XC_ID_DS); 155 //return _ret; 156 157 #endif 158 #else // #if not def DS_MUTEX 159 #define _DS_ENTRY() while(0) 160 #define _DS_RETURN() while(0) 161 #endif // #ifdef _DS_MUTEX 162 163 164 INTERFACE void MDrv_SC_SetPQHSDFlag(void *pInstance, MS_BOOL bEnable); 165 INTERFACE MS_BOOL MDrv_SC_GetPQHSDFlag(void *pInstance); 166 INTERFACE void MDrv_sc_set_capture_window(void *pInstance, SCALER_WIN eWindow); 167 INTERFACE void MDrv_SC_set_display_window(void *pInstance, SCALER_WIN eWindow); 168 INTERFACE void MDrv_SC_set_std_display_window(void *pInstance, SCALER_WIN eWindow); 169 INTERFACE void MDrv_SC_set_crop_window(void *pInstance, XC_InternalStatus *pSrcInfo, SCALER_WIN eWindow); 170 INTERFACE void MDrv_SC_set_prescaling_ratio(void *pInstance, INPUT_SOURCE_TYPE_t enInputSourceType, XC_InternalStatus *pSrcInfo, SCALER_WIN eWindow); 171 INTERFACE void MDrv_SC_set_postscaling_ratio(void *pInstance, XC_InternalStatus *pSrcInfo, SCALER_WIN eWindow); 172 INTERFACE void MDrv_SC_set_fetch_number_limit(void *pInstance, XC_InternalStatus *pSrcInfo, SCALER_WIN eWindow); 173 INTERFACE void MDrv_SC_set_frcm_fetch_number_limit(void *pInstance, XC_InternalStatus *pSrcInfo, SCALER_WIN eWindow); 174 INTERFACE void MDrv_SC_set_write_limit(void *pInstance, MS_PHY u32WritelimitAddrBase, SCALER_WIN eWindow); 175 INTERFACE void MDrv_SC_set_dual_write_limit(void *pInstance, MS_PHY u32WritelimitAddrBase, SCALER_WIN eWindow); 176 INTERFACE void MDrv_SC_set_opm_write_limit(void *pInstance, MS_BOOL bEnable, MS_BOOL bFlag, MS_PHY u32OPWlimitAddr, SCALER_WIN eWindow); 177 INTERFACE void MDrv_SC_set_dual_opm_write_limit(void *pInstance, MS_BOOL bEnable, MS_BOOL bFlag, MS_PHY u32OPWlimitAddr, SCALER_WIN eWindow); 178 INTERFACE void MDrv_SC_SetSkipWaitVsync(void *pInstance, MS_BOOL eWindow,MS_BOOL bIsSkipWaitVsyn); 179 INTERFACE MS_BOOL MDrv_SC_GetSkipWaitVsync(void *pInstance, MS_BOOL bScalerWin); 180 INTERFACE void MDrv_SC_SetCMAHeapID(void *pInstance, MS_U8 u8CMAHeapID,SCALER_WIN eWindow); 181 INTERFACE void MDrv_SC_sw_db(void *pInstance, P_SC_SWDB_INFO pDBreg, SCALER_WIN eWindow ); 182 INTERFACE void MDrv_SC_dual_sw_db(void *pInstance, P_SC_SWDB_INFO pMainDBreg, P_SC_SWDB_INFO pSubDBreg); 183 INTERFACE void MDrv_SC_set_shift_line(void *pInstance, MS_BOOL bFBL, MS_DEINTERLACE_MODE eDeInterlaceMode, SCALER_WIN eWindow); 184 INTERFACE void MDrv_SC_set_mirror(void *pInstance, MS_BOOL bEnable, SCALER_WIN eWindow); 185 INTERFACE MS_BOOL MDrv_XC_EnableMirrorModeEx(void *pInstance, MirrorMode_t eMirrorMode, SCALER_WIN eWindow); 186 INTERFACE void MDrv_SC_set_mirrorEx(void *pInstance, MirrorMode_t eMirrorMode, SCALER_WIN eWindow); 187 INTERFACE void MDrv_XC_init_fbn_win(void *pInstance, SCALER_WIN eWindow); 188 INTERFACE void MDrv_XC_VIP_Peaking_Setting(void *pInstance, SCALER_WIN eWindow); 189 INTERFACE void MDrv_SWDS_AddCmd(void *pInstance, P_SC_SWDB_INFO pDBreg, SCALER_WIN eWindow); 190 INTERFACE void MDrv_SWDS_Fire(void *pInstance, SCALER_WIN eWindow); 191 INTERFACE void MDrv_XC_DTVPatch(void *pInstance, SCALER_WIN eWindow); 192 INTERFACE MS_PHY MDrv_XC_Get_FRCM_W_BaseAddr(void *pInstance,MS_U8 u8id,SCALER_WIN eWindow); 193 194 INTERFACE void MDrv_XC_FilLineBuffer(void *pInstance, MS_BOOL bEnable, SCALER_WIN eWindow); 195 INTERFACE void MDrv_XC_SetFrameBufferAddress(void *pInstance, MS_PHY u32FBAddress, MS_PHY u32FBSize, SCALER_WIN eWindow); 196 INTERFACE void MDrv_XC_SetFRCMFrameBufferAddress(void *pInstance, MS_PHY u32FBAddress, MS_PHY u32FBSize, SCALER_WIN eWindow); 197 INTERFACE MS_BOOL MDrv_XC_SetDualFrameBufferAddress(void *pInstance, MS_PHY u32FBAddress, MS_PHY u32FBSize, SCALER_WIN eWindow); 198 INTERFACE MS_BOOL MDrv_XC_EnableMiuDualMode(void* pInstance, MS_BOOL bEnable, MS_U32 u32LeftFactor, MS_U32 u32RightFactor, SCALER_WIN eWindow); 199 INTERFACE void MDrv_XC_SetFrameBufferAddressSilently(void *pInstance, MS_PHY u32FBAddress, MS_PHY u32FBSize, SCALER_WIN eWindow); 200 INTERFACE void MDrv_XC_SetFRCMFrameBufferAddressSilently(void *pInstance, MS_PHY u32FBAddress, MS_PHY u32FBSize, SCALER_WIN eWindow); 201 INTERFACE MS_U8 MDrv_XC_TransFrameNumToFactor(void *pInstance, XC_FRAME_STORE_NUMBER eFrameStoreNumber, MS_BOOL bLinearMode, MS_BOOL bFieldPackingMode); 202 INTERFACE XC_FRAME_STORE_NUMBER MDrv_XC_TransFactorToFrameNum(void *pInstance, SCALER_WIN eWindow, MS_U8 u8FrameNumFactor); 203 INTERFACE XC_FRAME_STORE_NUMBER MDrv_XC_TransFactorToFRCMFrameNum(void *pInstance, SCALER_WIN eWindow, MS_U8 u8FrameNumFactor); 204 205 INTERFACE MS_BOOL MDrv_XC_GetHSizeChangeManuallyFlag(void *pInstance, SCALER_WIN eWindow); 206 207 INTERFACE MS_PHY MDrv_XC_GetIPMBase(void *pInstance, MS_U8 num, SCALER_WIN eWindow); 208 INTERFACE MS_U32 MDrv_XC_GetDNRBufSize(void *pInstance, SCALER_WIN eWindow); 209 INTERFACE void MDrv_XC_SetDNRBufSize(void *pInstance, MS_U32 u32DNRBufSize, SCALER_WIN eWindow); 210 INTERFACE MS_PHY MDrv_XC_GetDualIPMBase(void *pInstance, MS_U8 num, SCALER_WIN eWindow); 211 INTERFACE MS_U32 MDrv_XC_GetDualDNRBufSize(void *pInstance, SCALER_WIN eWindow); 212 INTERFACE void MDrv_XC_SetDualDNRBufSize(void *pInstance, MS_U32 u32DNRBufSize, SCALER_WIN eWindow); 213 INTERFACE void MDrv_SC_Set_pre_align_pixel(void *pInstance, MS_BOOL bEnable, MS_U16 pixels, SCALER_WIN eWindow); 214 INTERFACE void MDrv_SC_ClearScalingFactorForInternalCalib(void *pInstance); 215 INTERFACE void MDrv_SC_Enable_PreScaling(void *pInstance, MS_BOOL bHSDEnable, MS_BOOL bVSDEnable, SCALER_WIN eWindow); 216 INTERFACE void MDrv_SC_Enable_PostScaling(void *pInstance, MS_BOOL bHSPEnable, MS_BOOL bVSPEnable, SCALER_WIN eWindow); 217 INTERFACE void MDrv_SC_SetFullRangeCapture(void *pInstance, SCALER_WIN eWindow); 218 INTERFACE MS_BOOL MDrv_SC_GetScmiV1Speical4frame(void *pInstance, XC_FRAME_STORE_NUMBER enStoreNum); 219 INTERFACE XC_FRAME_STORE_NUMBER MDrv_XC_GetPQSuggestedFrameNum(void *pInstance, SCALER_WIN eWindow); 220 INTERFACE XC_FRAME_STORE_NUMBER MDrv_XC_GetPQSuggestedFRCMFrameNum(void *pInstance, SCALER_WIN eWindow); 221 INTERFACE MS_U32 MDrv_XC_GetAvailableSize(void *pInstance, SCALER_WIN eWindow, MS_U8 u8FBNum, MS_U32 u32InputSize); 222 223 #define MDrv_XC_IsRequestFrameBufferLessMode Hal_SC_Detect_RequestFBL_Mode 224 INTERFACE MS_BOOL MDrv_XC_IsRequestFrameBufferLessMode(void *pInstance); 225 INTERFACE E_APIXC_ReturnValue MDrv_XC_SetScalerMemoryRequest(void *pInstance, MS_BOOL bEnable, E_XC_MEMORY_REQUEST_TYPE eRequestType, SCALER_WIN eWindow); 226 INTERFACE MS_BOOL MDrv_XC_Set_MemFmtEx(void *pInstance, MS_XC_MEM_FMT eMemFmt, SCALER_WIN eWindow); 227 INTERFACE void MDrv_SC_Adjust_Prescaling_Ratio(void *pInstance, SCALER_WIN eWindow); 228 INTERFACE MS_U16 MDrv_SC_Cal_Skip_OPM_line(void *pInstance, SCALER_WIN eWindow, MS_U16 u16Src, MS_U16 u16Dst, XC_InternalStatus *pSrcInfo); 229 INTERFACE void MDrv_SC_Adjust_H_Crop(void *pInstance, SCALER_WIN eWindow); 230 INTERFACE void MDrv_SC_Adjust_Skip_OPM_line(void *pInstance, SCALER_WIN eWindow); 231 INTERFACE void MDrv_SC_Enable_LegacyMode(void *pInstance, MS_BOOL bEnable); 232 INTERFACE void MDrv_SC_SwitchIPMWriteBank(void *pInstance, MS_BOOL bEnable, E_XC_IPM_CONNECT_ID eIPMConnect); 233 INTERFACE void MDrv_SC_SwitchFRCMWriteBank(void *pInstance, MS_BOOL bEnable, E_XC_FRCMW_CONNECT_ID eFRCMConnect); 234 INTERFACE void MDrv_SC_set_2p_mode(void *pInstance, XC_SETWIN_INFO *pstXC_SetWin_Info, SCALER_WIN eWindow); 235 INTERFACE void MDrv_SC_set_frcm_cbcr_swap(void *pInstance, MS_BOOL bEnable, SCALER_WIN eWindow); 236 INTERFACE MS_BOOL MDrv_XC_MemControl_Switch_Method_By_Vcnt(void *pInstance, MS_BOOL bEnable, MS_U16 u16Vcnt); 237 INTERFACE MS_BOOL MDrv_XC_edclk_pd_control(void *pInstance, MS_BOOL bEnable, MS_U16 u16ControlStart, MS_U16 u16ControlEnd); 238 INTERFACE void Mdrv_SC_set_frcm_pre_align_pixel(void *pInstance, MS_BOOL bEnable, MS_U16 pixels, SCALER_WIN eWindow); 239 INTERFACE MS_BOOL MDrv_SC_setBwdConfig(void *pInstance, E_XC_BWD_CONFIG_TYPE eType, void *pstParam, SCALER_WIN eWindow); 240 INTERFACE MS_BOOL MDrv_XC_IsSupport2StepScaling(void); 241 INTERFACE void MDrv_XC_SetIsSupport2StepScalingFlag(MS_BOOL bEnable); 242 INTERFACE MS_BOOL MDrv_XC_GetPQPathStatus(void* pInstance, E_XC_PQ_Path_Type ePqPathType, MS_U16 u16Width, MS_U16 u16Height); 243 INTERFACE void MDrv_SC_SetForceWrite( EN_MUTE_TYPE muteType, MS_BOOL bIsSkipWaitVsyn); 244 INTERFACE MS_BOOL MDrv_SC_GetForceWrite( EN_MUTE_TYPE muteType); 245 INTERFACE void MDrv_XC_SetForceCurrentReadBank(void* pInstance, MS_BOOL bEnable, SCALER_WIN eWindow); 246 INTERFACE MS_BOOL MDrv_SC_CheckMuteStatusByRegister(void *pInstance, SCALER_WIN eWindow); 247 248 #undef INTERFACE 249 250 #endif /* DRV_SC_SCALING_H */ 251 252