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) 2006-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 _HAL_DMD_COMMON_H_ 95 #define _HAL_DMD_COMMON_H_ 96 97 #define MBRegBase 0x112600UL //Demod MailBox 98 #define VDMcuBase 0x103400UL //DmdMCU51 (40-4F) 99 #define DMDMcuBase 0x103480UL 100 #define XDMIU_REG_BASE 0x1d00 101 #define BACKEND_REG_BASE 0x1f00 102 #define TOP_REG_BASE 0x2000 103 #define TDP_REG_BASE 0x2100 104 #define FDP_REG_BASE 0x2200 105 #define ISDBT_FDPE_REG_BASE 0x1600 106 #define FEC_REG_BASE 0x2300 107 #define TDF_REG_BASE 0x2800 108 #define TDFE_REG_BASE 0x2900 109 #define TDFE2_REG_BASE 0x2a00 110 #define DTOP_REG_BASE 0x2e00 111 #define T2TDP_REG_BASE 0x3000 112 #define T2FDP_REG_BASE 0x3100 113 #define T2FEC_REG_BASE 0x3300 114 #define DVBTM_REG_BASE 0x3400 115 #define T2L1_REG_BASE 0x2b00 116 #define T2SNR_REG_BASE 0x2c00 117 #define T2DJB_REG_BASE 0x2d00 118 119 #define REG_CMD_CTRL MBRegBase + 0x1C 120 #define REG_DTA_CTRL MBRegBase + 0x1D 121 #define REG_CMD_ADDR MBRegBase + 0x1E 122 #define REG_CMD_DATA MBRegBase + 0x1F 123 124 #define _REG_START REG_CMD_CTRL 125 #define _REG_END REG_CMD_CTRL 126 #define _REG_DRQ REG_DTA_CTRL 127 #define _REG_FSM REG_CMD_CTRL 128 #define _REG_ERR REG_DTA_CTRL 129 130 #define _BIT_START ((BIT_(1))) 131 #define _BIT_END ((BIT_(0))) 132 #define _BIT_DRQ ((BIT_(0))) 133 #define _BIT_FSM ((BIT_(3))) 134 #define _BIT_ERR ((BIT_(7))) 135 136 typedef struct _s_MDRV_DMD_INTERFACE_FUNCTION 137 { 138 MS_BOOL (*MDrv_DMD_WriteReg)(MS_U32 u32Reg, MS_U8 u8Value); 139 MS_BOOL (*MDrv_DMD_ReadReg)(MS_U32 u32Reg, MS_U8 *u8Value); 140 MS_BOOL (*MDrv_DMD_WriteRegs)(MS_U32 u32Reg, MS_U8 *u8Value, MS_U8 u8Length); 141 MS_BOOL (*MDrv_DMD_I2C_Channel_Change)(MS_U8 ch_num); 142 MS_BOOL (*MDrv_DMD_I2C_Channel_Set)(MS_U8 ch_num); 143 float (*Log10Approx)(float flt_x); 144 }s_MDRV_DMD_INTERFACE_FUNCTION; 145 146 147 148 MS_BOOL HAL_DMD_RegInit (void); 149 MS_U8 HAL_DMD_RIU_ReadByte(MS_U32 u32Addr); 150 MS_U8 HAL_DMD_RIU_ReadRegBit(MS_U32 u32Addr, MS_U8 u8Mask); 151 MS_U16 HAL_DMD_RIU_Read2Byte(MS_U32 u32Addr); 152 void HAL_DMD_RIU_WriteByte(MS_U32 u32Addr, MS_U8 u8Value); 153 void HAL_DMD_RIU_WriteRegBit(MS_U32 u32Addr, MS_BOOL bEnable, MS_U8 u8Mask); 154 void HAL_DMD_RIU_WriteByteMask(MS_U32 u32Addr, MS_U8 u8Value, MS_U8 u8Mask); 155 void HAL_DMD_RIU_Write2Byte(MS_U32 u32Addr, MS_U16 u16Value); 156 157 //waiting add 158 MS_BOOL HAL_DMD_IFAGC_RegRead(MS_U8 *ifagc_reg, MS_U8 *ifagc_reg_lsb, MS_U16 *ifagc_err); 159 /* 160 MS_BOOL HAL_DMD_GetRFLevel(float *fRFPowerDbmResult, float fRFPowerDbm, MS_U8 u8SarValue, 161 DMD_RFAGC_SSI *pRfagcSsi, MS_U16 u16RfagcSsi_Size, 162 DMD_IFAGC_SSI *pIfagcSsi_HiRef, MS_U16 u16IfagcSsi_HiRef_Size, 163 DMD_IFAGC_SSI *pIfagcSsi_LoRef, MS_U16 u16IfagcSsi_LoRef_Size, 164 DMD_IFAGC_ERR *pIfagcErr_LoRef, MS_U16 u16IfagcErr_LoRef_Size, 165 DMD_IFAGC_ERR *pIfagcErr_HiRef, MS_U16 u16IfagcErr_HiRef_Size); 166 */ 167 void HAL_DMD_GetNordigSSI(float fPrel, MS_U16 *strength); 168 void HAL_DMD_IFAGC_TS_Tristate(MS_BOOL bEnable); 169 void HAL_DMD_TS1_Tristate(MS_BOOL bEnable); 170 MS_BOOL HAL_DMD_TS_GetClockRate(float *fTS_CLK); 171 void HAL_DMD_RFAGC_Tristate(MS_BOOL bEnable); 172 void HAL_DMD_IFAGC_Tristate(MS_BOOL bEnable); 173 MS_BOOL HAL_DMD_ADC_IQ_Switch(MS_U8 u8ADCIQMode, MS_U8 u8PadSel, MS_BOOL bPGAEnable, MS_U8 u8PGAGain); 174 MS_BOOL HAL_DMD_TSO_Clk_Control(MS_U8 *u8cmd_array); 175 //float Log10Approx(float flt_x); 176 MS_U8 HAL_DMD_IIC_ReadByte(MS_U16 u16SlaveAddr, MS_U32 u32Addr, MS_U8 *pu8Data); 177 MS_U8 HAL_DMD_IIC_WriteByte(MS_U16 u16SlaveAddr, MS_U32 u32Addr, MS_U8 u8Data); 178 MS_U8 HAL_DMD_IIC_WriteBytes(MS_U16 u16SlaveAddr, MS_U32 u32Addr, MS_U8 *u8Data, MS_U8 u8Len); 179 MS_BOOL HAL_DMD_I2C_Channel_Change(MS_U16 u16SlaveAddr, MS_U8 ch_num); 180 MS_BOOL HAL_DMD_I2C_Channel_Set(MS_U16 u16SlaveAddr, MS_U8 ch_num); 181 #endif 182 183