status = UpdateRegs(state, EP1, EP3); if (status < 0) break;
status = UpdateReg(state, EB13); if (status < 0) break;
state->m_Regs[EB4] |= 0x20; /* LO_ForceSrce = 1 */
status = UpdateReg(state, EB4); if (status < 0) break;
state->m_Regs[EB7] |= 0x20; /* CAL_ForceSrce = 1 */
status = UpdateReg(state, EB7); if (status < 0) break;
state->m_Regs[EB14] = 0; /* RFC_Cprog = 0 */
status = UpdateReg(state, EB14); if (status < 0) break;
state->m_Regs[EB20] &= ~0x20; /* ForceLock = 0; */
status = UpdateReg(state, EB20); if (status < 0) break;
state->m_Regs[EP4] |= 0x03; /* CAL_Mode = 3 */
status = UpdateRegs(state, EP4, EP5); if (status < 0) break;
status = CalcCalPLL(state, freq); if (status < 0) break;
status = CalcMainPLL(state, freq + 1000000); if (status < 0) break;
msleep(5);
status = UpdateReg(state, EP2); if (status < 0) break;
status = UpdateReg(state, EP1); if (status < 0) break;
status = UpdateReg(state, EP2); if (status < 0) break;
status = UpdateReg(state, EP1); if (status < 0) break;
state->m_Regs[EB4] &= ~0x20; /* LO_ForceSrce = 0 */
status = UpdateReg(state, EB4); if (status < 0) break;
state->m_Regs[EB7] &= ~0x20; /* CAL_ForceSrce = 0 */
status = UpdateReg(state, EB7); if (status < 0) break;
msleep(10);
state->m_Regs[EB20] |= 0x20; /* ForceLock = 1; */
status = UpdateReg(state, EB20); if (status < 0) break;
msleep(60);
state->m_Regs[EP4] &= ~0x03; /* CAL_Mode = 0 */
state->m_Regs[EP3] &= ~0x40; /* SM_LT = 0 */
state->m_Regs[EB18] &= ~0x03; /* AGC1_Gain = 0 */
status = UpdateReg(state, EB18); if (status < 0) break;
status = UpdateRegs(state, EP3, EP4); if (status < 0) break;
status = UpdateReg(state, EP1); if (status < 0) break;
status = ReadExtented(state, Regs); if (status < 0) break;
*pCprog = Regs[EB14];
} while (0); return status;
}
staticint RFTrackingFiltersInit(struct tda_state *state,
u8 RFBand)
{ int status = 0;
staticint PowerScanInit(struct tda_state *state)
{ int status = 0; do {
state->m_Regs[EP3] = (state->m_Regs[EP3] & ~0x1F) | 0x12;
state->m_Regs[EP4] = (state->m_Regs[EP4] & ~0x1F); /* If level = 0, Cal mode = 0 */
status = UpdateRegs(state, EP3, EP4); if (status < 0) break;
state->m_Regs[EB18] = (state->m_Regs[EB18] & ~0x03); /* AGC 1 Gain = 0 */
status = UpdateReg(state, EB18); if (status < 0) break;
state->m_Regs[EB21] = (state->m_Regs[EB21] & ~0x03); /* AGC 2 Gain = 0 (Datasheet = 3) */
state->m_Regs[EB23] = (state->m_Regs[EB23] | 0x06); /* ForceLP_Fc2_En = 1, LPFc[2] = 1 */
status = UpdateRegs(state, EB21, EB23); if (status < 0) break;
} while (0); return status;
}
staticint CalcRFFilterCurve(struct tda_state *state)
{ int status = 0; do {
msleep(200); /* Temperature stabilisation */
status = PowerScanInit(state); if (status < 0) break;
status = RFTrackingFiltersInit(state, 0); if (status < 0) break;
status = RFTrackingFiltersInit(state, 1); if (status < 0) break;
status = RFTrackingFiltersInit(state, 2); if (status < 0) break;
status = RFTrackingFiltersInit(state, 3); if (status < 0) break;
status = RFTrackingFiltersInit(state, 4); if (status < 0) break;
status = RFTrackingFiltersInit(state, 5); if (status < 0) break;
status = RFTrackingFiltersInit(state, 6); if (status < 0) break;
status = ThermometerRead(state, &state->m_TMValue_RFCal); /* also switches off Cal mode !!! */ if (status < 0) break;
} while (0);
/* AGC1 gain setup */
state->m_Regs[EB17] = 0x00;
status = UpdateReg(state, EB17); if (status < 0) break;
state->m_Regs[EB17] = 0x03;
status = UpdateReg(state, EB17); if (status < 0) break;
state->m_Regs[EB17] = 0x43;
status = UpdateReg(state, EB17); if (status < 0) break;
state->m_Regs[EB17] = 0x4C;
status = UpdateReg(state, EB17); if (status < 0) break;
/* IRC Cal Low band */
state->m_Regs[EP3] = 0x1F;
state->m_Regs[EP4] = 0x66;
state->m_Regs[EP5] = 0x81;
state->m_Regs[CPD] = 0xCC;
state->m_Regs[CD1] = 0x6C;
state->m_Regs[CD2] = 0x00;
state->m_Regs[CD3] = 0x00;
state->m_Regs[MPD] = 0xC5;
state->m_Regs[MD1] = 0x77;
state->m_Regs[MD2] = 0x08;
state->m_Regs[MD3] = 0x00;
status = UpdateRegs(state, EP2, MD3); /* diff between sw and datasheet (ep3-md3) */ if (status < 0) break;
#if0
state->m_Regs[EB4] = 0x61; /* missing in sw */
status = UpdateReg(state, EB4); if (status < 0) break;
msleep(1);
state->m_Regs[EB4] = 0x41;
status = UpdateReg(state, EB4); if (status < 0) break; #endif
msleep(5);
status = UpdateReg(state, EP1); if (status < 0) break;
msleep(5);
state->m_Regs[EP5] = 0x85;
state->m_Regs[CPD] = 0xCB;
state->m_Regs[CD1] = 0x66;
state->m_Regs[CD2] = 0x70;
status = UpdateRegs(state, EP3, CD3); if (status < 0) break;
msleep(5);
status = UpdateReg(state, EP2); if (status < 0) break;
msleep(30);
/* IRC Cal mid band */
state->m_Regs[EP5] = 0x82;
state->m_Regs[CPD] = 0xA8;
state->m_Regs[CD2] = 0x00;
state->m_Regs[MPD] = 0xA1; /* Datasheet = 0xA9 */
state->m_Regs[MD1] = 0x73;
state->m_Regs[MD2] = 0x1A;
status = UpdateRegs(state, EP3, MD3); if (status < 0) break;
msleep(5);
status = UpdateReg(state, EP1); if (status < 0) break;
msleep(5);
state->m_Regs[EP5] = 0x86;
state->m_Regs[CPD] = 0xA8;
state->m_Regs[CD1] = 0x66;
state->m_Regs[CD2] = 0xA0;
status = UpdateRegs(state, EP3, CD3); if (status < 0) break;
msleep(5);
status = UpdateReg(state, EP2); if (status < 0) break;
msleep(30);
/* IRC Cal high band */
state->m_Regs[EP5] = 0x83;
state->m_Regs[CPD] = 0x98;
state->m_Regs[CD1] = 0x65;
state->m_Regs[CD2] = 0x00;
state->m_Regs[MPD] = 0x91; /* Datasheet = 0x91 */
state->m_Regs[MD1] = 0x71;
state->m_Regs[MD2] = 0xCD;
status = UpdateRegs(state, EP3, MD3); if (status < 0) break;
msleep(5);
status = UpdateReg(state, EP1); if (status < 0) break;
msleep(5);
state->m_Regs[EP5] = 0x87;
state->m_Regs[CD1] = 0x65;
state->m_Regs[CD2] = 0x50;
status = UpdateRegs(state, EP3, CD3); if (status < 0) break;
msleep(5);
status = UpdateReg(state, EP2); if (status < 0) break;
msleep(30);
/* Back to normal */
state->m_Regs[EP4] = 0x64;
status = UpdateReg(state, EP4); if (status < 0) break;
status = UpdateReg(state, EP1); if (status < 0) break;
} while (0); return status;
}
staticint InitCal(struct tda_state *state)
{ int status = 0;
do {
status = FixedContentsI2CUpdate(state); if (status < 0) break;
status = CalcRFFilterCurve(state); if (status < 0) break;
status = StandBy(state); if (status < 0) break; /* m_bInitDone = true; */
} while (0); return status;
};
staticint RFTrackingFiltersCorrection(struct tda_state *state,
u32 Frequency)
{ int status = 0;
s32 Cprog_table;
u8 RFBand;
u8 dCoverdT;
/* TODO Temperature compensation. There is definitely a scale factor */ /* missing in the datasheet, so leave it out for now. */
state->m_Regs[EB14] = Capprox;
status = UpdateReg(state, EB14); if (status < 0) break;
} while (0); return status;
}
staticint ChannelConfiguration(struct tda_state *state,
u32 Frequency, int Standard)
{
s32 IntermediateFrequency = m_StandardTable[Standard].m_IFFrequency; int status = 0;
switch (delsys) { case SYS_DVBT: case SYS_DVBT2: switch (bw) { case6000000:
Standard = HF_DVBT_6MHZ; break; case7000000:
Standard = HF_DVBT_7MHZ; break; case8000000:
Standard = HF_DVBT_8MHZ; break; default: return -EINVAL;
} break; case SYS_DVBC_ANNEX_A: case SYS_DVBC_ANNEX_C: if (bw <= 6000000)
Standard = HF_DVBC_6MHZ; elseif (bw <= 7000000)
Standard = HF_DVBC_7MHZ; else
Standard = HF_DVBC_8MHZ; break; default: return -EINVAL;
} do {
status = RFTrackingFiltersCorrection(state, state->m_Frequency); if (status < 0) break;
status = ChannelConfiguration(state, state->m_Frequency,
Standard); if (status < 0) break;
msleep(state->m_SettlingTime); /* Allow AGC's to settle down */
} while (0); return status;
}
#if0 staticint GetSignalStrength(s32 *pSignalStrength, u32 RFAgc, u32 IFAgc)
{ if (IFAgc < 500) { /* Scale this from 0 to 50000 */
*pSignalStrength = IFAgc * 100;
} else { /* Scale range 500-1500 to 50000-80000 */
*pSignalStrength = 50000 + (IFAgc - 500) * 30;
}
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.5Angebot
(Wie Sie bei der Firma Beratungs- und Dienstleistungen beauftragen können 2026-06-05)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.