Exemplo n.º 1
0
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;
}
Exemplo n.º 2
0
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;
}
Exemplo n.º 3
0
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;
}
Exemplo n.º 4
0
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;
}
Exemplo n.º 5
0
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, &regData);
      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;
}
Exemplo n.º 6
0
MXL_STATUS MxL603_Ctrl_ProgramRegisters(UINT8 devId, PMXL603_REG_CTRL_INFO_T ctrlRegInfoPtr)
{
  MXL_STATUS status = MXL_TRUE;
  UINT16 i = 0;
  UINT8 tmp = 0;
  
  while (status == MXL_TRUE)
  {
    if ((ctrlRegInfoPtr[i].regAddr == 0) && (ctrlRegInfoPtr[i].mask == 0) && (ctrlRegInfoPtr[i].data == 0)) break;

    // Check if partial bits of register were updated
    if (ctrlRegInfoPtr[i].mask != 0xFF)  
    {
      status = MxLWare603_OEM_ReadRegister(devId,ctrlRegInfoPtr[i].regAddr, &tmp);
      if (status != MXL_TRUE) break;;
    }
    
    tmp &= (UINT8) ~ctrlRegInfoPtr[i].mask;
    tmp |= (UINT8) ctrlRegInfoPtr[i].data;

    status = MxLWare603_OEM_WriteRegister(devId,ctrlRegInfoPtr[i].regAddr, tmp);
    if (status != MXL_TRUE) break;

    i++;
  }

  return status;
}
Exemplo n.º 7
0
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;
}
Exemplo n.º 8
0
MXL_STATUS MxL603_Ctrl_WriteRegField(UINT8 devId, PMXL603_REG_CTRL_INFO_T ctrlRegInfoPtr)
{
  MXL_STATUS status = MXL_TRUE;
  UINT8 tmp = 0;
  
  if ((ctrlRegInfoPtr->regAddr == 0) && (ctrlRegInfoPtr->mask == 0) && (ctrlRegInfoPtr->data == 0))
    return MXL_FALSE;

  // Check if partial bits of register were updated
  if (ctrlRegInfoPtr->mask != 0xFF)  
  {
      status = MxLWare603_OEM_ReadRegister(devId, ctrlRegInfoPtr->regAddr, &tmp);
      if (status != MXL_TRUE) return status;
   }

  tmp &= (UINT8)~ctrlRegInfoPtr->mask;  // Clear the field that need to set value 
  tmp |= (UINT8)(ctrlRegInfoPtr->data & ctrlRegInfoPtr->mask); 

  status = MxLWare603_OEM_WriteRegister(devId, ctrlRegInfoPtr->regAddr, tmp);

  return status;
}
MXL_STATUS Ctrl_SetRfFreqLutTblReg(UINT8 devId, UINT32 FreqInHz, PMXL603_CHAN_DEPENDENT_FREQ_TABLE_T freqLutPtr)
{
  UINT8 status = MXL_TRUE;
  UINT8 idx = 0;
  UINT8 regSetData[MXL603_MAX_SPUR_REG_NUM] = {0, 0};
   
  if (freqLutPtr)
  {
    // Find and get default value firstly. 
    for (idx = 0; 0 != freqLutPtr->centerFreqHz; idx++, freqLutPtr++)
    {
      if (freqLutPtr->centerFreqHz == 1)  
      {
        // When center frequency is 1 means corresponding data is default value 
        regSetData[0] = freqLutPtr->reg_0xEA;
        regSetData[1] = freqLutPtr->reg_0xEB;
        break;
      } // end of if ((freqLutPtr->centerFreqHz -
    } // end of for (idx = 0;

    // Check in LUT
    for (idx = 0; 0 != freqLutPtr->centerFreqHz; idx++, freqLutPtr++)
    {
      if ((freqLutPtr->centerFreqHz - MXL603_SPUR_SHIFT_FREQ_WINDOW) <= FreqInHz &&
          (freqLutPtr->centerFreqHz + MXL603_SPUR_SHIFT_FREQ_WINDOW) >= FreqInHz)
      {
        regSetData[0] = freqLutPtr->reg_0xEA;
        regSetData[1] = freqLutPtr->reg_0xEB;
        break;
      } // end of if ((freqLutPtr->centerFreqHz -
    } // end of for (idx = 0;
  }

  // Program registers
  for (idx = 0; idx < MxL603_SPUR_REGISTER.SpurRegNum; idx++)
    status |= MxLWare603_OEM_WriteRegister(devId, MxL603_SPUR_REGISTER.SpurRegAddr[idx], regSetData[idx]);

  return(MXL_STATUS)status;
}