MXL_STATUS MxLWare603_API_ReqDevVersionInfo(UINT8 devId, MXL603_VER_INFO_T* mxlDevVerInfoPtr) { UINT8 status = MXL_SUCCESS; UINT8 readBack = 0; UINT8 k = 0; MxL_DLL_DEBUG0("%s", "MxLWare603_API_ReqDevVersionInfo"); if (mxlDevVerInfoPtr) { status |= MxLWare603_OEM_ReadRegister(devId, CHIP_ID_REQ_REG, &readBack); mxlDevVerInfoPtr->chipId = (readBack & 0xFF); status |= MxLWare603_OEM_ReadRegister(devId, CHIP_VERSION_REQ_REG, &readBack); mxlDevVerInfoPtr->chipVersion = (readBack & 0xFF); MxL_DLL_DEBUG0("Chip ID = 0x%d, Version = 0x%d \n", mxlDevVerInfoPtr->chipId, mxlDevVerInfoPtr->chipVersion); // Get MxLWare version infromation for (k = 0; k < MXL603_VERSION_SIZE; k++) mxlDevVerInfoPtr->mxlwareVer[k] = MxLWare603DrvVersion[k]; } else status = MXL_INVALID_PARAMETER; return (MXL_STATUS)status; }
MXL_STATUS MxLWare603_API_CfgDevGPO(UINT8 devId, MXL603_GPO_STATE_E gpoState) { UINT8 status = MXL_SUCCESS; UINT8 regData = 0; MxL_DLL_DEBUG0("%s", "MxLWare603_API_CfgDevGPO"); switch(gpoState) { case MXL603_GPO_AUTO_CTRL: case MXL603_GPO_HIGH: case MXL603_GPO_LOW: status = MxLWare603_OEM_ReadRegister(devId, GPO_SETTING_REG, ®Data); if (MXL603_GPO_AUTO_CTRL == gpoState) regData &= 0xFE; else { regData &= 0xFC; regData |= (UINT8)(0x01 | (gpoState << 1)); } status |= MxLWare603_OEM_WriteRegister(devId, GPO_SETTING_REG, regData); break; default: status = MXL_INVALID_PARAMETER; } return (MXL_STATUS)status; }
MXL_STATUS MxLWare603_API_CfgDevPowerMode(UINT8 devId, MXL603_PWR_MODE_E powerMode) { UINT8 status = MXL_SUCCESS; MxL_DLL_DEBUG0("%s", "MxLWare603_API_CfgDevPowerMode"); switch(powerMode) { case MXL603_PWR_MODE_SLEEP: break; case MXL603_PWR_MODE_ACTIVE: status |= MxLWare603_OEM_WriteRegister(devId, TUNER_ENABLE_REG, MXL_ENABLE); status |= MxLWare603_OEM_WriteRegister(devId, START_TUNE_REG, MXL_ENABLE); break; case MXL603_PWR_MODE_STANDBY: status |= MxLWare603_OEM_WriteRegister(devId, START_TUNE_REG, MXL_DISABLE); status |= MxLWare603_OEM_WriteRegister(devId, TUNER_ENABLE_REG, MXL_DISABLE); break; default: status |= MXL_INVALID_PARAMETER; } return (MXL_STATUS)status; }
MXL_STATUS MxLWare603_API_CfgDevXtal(UINT8 devId, MXL603_XTAL_SET_CFG_T xtalCfg) { UINT8 status = MXL_SUCCESS; UINT8 control = 0; MxL_DLL_DEBUG0("%s", "MxLWare603_API_CfgDevXtal"); // XTAL freq and cap setting, Freq set is located at bit<5>, cap bit<4:0> // and XTAL clock out enable <0> if ((xtalCfg.xtalFreqSel == MXL603_XTAL_16MHz) || (xtalCfg.xtalFreqSel == MXL603_XTAL_24MHz)) { control = (UINT8)((xtalCfg.xtalFreqSel << 5) | (xtalCfg.xtalCap & 0x1F)); control |= (xtalCfg.clkOutEnable << 7); status = MxLWare603_OEM_WriteRegister(devId, XTAL_CAP_CTRL_REG, control); // XTAL frequency div 4 setting <1> control = (0x01 & (UINT8)xtalCfg.clkOutDiv); // XTAL sharing mode if (xtalCfg.XtalSharingMode == MXL_ENABLE) control |= 0x40; else control &= 0x01; // program Clock out div & Xtal sharing status |= MxLWare603_OEM_WriteRegister(devId, XTAL_ENABLE_DIV_REG, control); // Main regulator re-program if (MXL_ENABLE == xtalCfg.singleSupply_3_3V) status |= MxLWare603_OEM_WriteRegister(devId, MAIN_REG_AMP, 0x14); } else status |= MXL_INVALID_PARAMETER; return (MXL_STATUS)status; }
MXL_STATUS MxLWare603_API_CfgDevPowerMode(UINT32 devId, MXL603_PWR_MODE_E powerMode) { UINT8 status = MXL_SUCCESS; MxL_DLL_DEBUG0("%s", __FUNCTION__); switch(powerMode) { case MXL603_PWR_MODE_SLEEP: break; case MXL603_PWR_MODE_ACTIVE: status |= MxLWare603_OEM_WriteRegister(devId, TUNER_ENABLE_REG, MXL_ENABLE); status |= MxLWare603_OEM_WriteRegister(devId, START_TUNE_REG, MXL_ENABLE); // if (MXL_ENABLE == m_singleSupply_3_3V) // status |= MxLWare603_OEM_WriteRegister(devId, MAIN_REG_AMP, 0x14); break; case MXL603_PWR_MODE_STANDBY: status |= MxLWare603_OEM_WriteRegister(devId, START_TUNE_REG, MXL_DISABLE); status |= MxLWare603_OEM_WriteRegister(devId, TUNER_ENABLE_REG, MXL_DISABLE); break; default: status |= MXL_INVALID_PARAMETER; } return (MXL_STATUS)status; }
MXL_STATUS MxLWare603_API_CfgDevOverwriteDefaults(UINT32 devId, MXL_BOOL singleSupply_3_3V) { UINT8 status = MXL_SUCCESS; UINT8 readData = 0; MxL_DLL_DEBUG0("%s", __FUNCTION__); status |= MxL603_Ctrl_ProgramRegisters(devId, MxL603_OverwriteDefaults); status |= MxLWare603_OEM_WriteRegister(devId, 0x00, 0x01); status |= MxLWare603_OEM_ReadRegister(devId, 0x31, &readData); readData &= 0x2F; readData |= 0xD0; status |= MxLWare603_OEM_WriteRegister(devId, 0x31, readData); status |= MxLWare603_OEM_WriteRegister(devId, 0x00, 0x00); /* If Single supply 3.3v is used */ if (MXL_ENABLE == singleSupply_3_3V) status |= MxLWare603_OEM_WriteRegister(devId, MAIN_REG_AMP, 0x04); m_singleSupply_3_3V = singleSupply_3_3V; return (MXL_STATUS)status; }
MXL_STATUS MxLWare603_API_CfgDevSoftReset(UINT8 devId) { UINT8 status = MXL_SUCCESS; MxL_DLL_DEBUG0("%s", "MxLWare603_API_CfgDevSoftReset"); // Write 0xFF with 0 to reset tuner status = MxLWare603_OEM_WriteRegister(devId, AIC_RESET_REG, 0x00); return (MXL_STATUS)status; }
MXL_STATUS MxLWare603_API_ReqDevGPOStatus(UINT8 devId, MXL603_GPO_STATE_E* gpoStatusPtr) { UINT8 status = MXL_SUCCESS; UINT8 regData = 0; MxL_DLL_DEBUG0("%s", "MxLWare603_API_ReqDevGPOStatus"); if (gpoStatusPtr) { status = MxLWare603_OEM_ReadRegister(devId, GPO_SETTING_REG, ®Data); // GPO1 bit<1:0> if ((regData & 0x01) == 0) *gpoStatusPtr = MXL603_GPO_AUTO_CTRL; else *gpoStatusPtr = (MXL603_GPO_STATE_E)((regData & 0x02) >> 1); } else