+RESULT eDVBFrontend::prepare_sat(const eDVBFrontendParametersSatellite &feparm)
+{
+ int res;
+ if (!m_sec)
+ {
+ eWarning("no SEC module active!");
+ return -ENOENT;
+ }
+ res = m_sec->prepare(*this, parm, feparm, 1 << m_fe);
+ if (!res)
+ {
+ eDebug("prepare_sat System %d Freq %d Pol %d SR %d INV %d FEC %d",
+ feparm.system,
+ feparm.frequency,
+ feparm.polarisation,
+ feparm.symbol_rate,
+ feparm.inversion,
+ feparm.fec);
+ parm_u_qpsk_symbol_rate = feparm.symbol_rate;
+ switch (feparm.inversion)
+ {
+ case eDVBFrontendParametersSatellite::Inversion::On:
+ parm_inversion = INVERSION_ON;
+ break;
+ case eDVBFrontendParametersSatellite::Inversion::Off:
+ parm_inversion = INVERSION_OFF;
+ break;
+ default:
+ case eDVBFrontendParametersSatellite::Inversion::Unknown:
+ parm_inversion = INVERSION_AUTO;
+ break;
+ }
+ if (feparm.system == eDVBFrontendParametersSatellite::System::DVB_S)
+ switch (feparm.fec)
+ {
+ case eDVBFrontendParametersSatellite::FEC::fNone:
+ parm_u_qpsk_fec_inner = FEC_NONE;
+ break;
+ case eDVBFrontendParametersSatellite::FEC::f1_2:
+ parm_u_qpsk_fec_inner = FEC_1_2;
+ break;
+ case eDVBFrontendParametersSatellite::FEC::f2_3:
+ parm_u_qpsk_fec_inner = FEC_2_3;
+ break;
+ case eDVBFrontendParametersSatellite::FEC::f3_4:
+ parm_u_qpsk_fec_inner = FEC_3_4;
+ break;
+ case eDVBFrontendParametersSatellite::FEC::f5_6:
+ parm_u_qpsk_fec_inner = FEC_5_6;
+ break;
+ case eDVBFrontendParametersSatellite::FEC::f7_8:
+ parm_u_qpsk_fec_inner = FEC_7_8;
+ break;
+ default:
+ eDebug("no valid fec for DVB-S set.. assume auto");
+ case eDVBFrontendParametersSatellite::FEC::fAuto:
+ parm_u_qpsk_fec_inner = FEC_AUTO;
+ break;
+ }
+#if HAVE_DVB_API_VERSION >= 3
+ else // DVB_S2
+ switch (feparm.fec)
+ {
+ case eDVBFrontendParametersSatellite::FEC::f1_2:
+ parm_u_qpsk_fec_inner = FEC_S2_1_2;
+ break;
+ case eDVBFrontendParametersSatellite::FEC::f2_3:
+ parm_u_qpsk_fec_inner = FEC_S2_2_3;
+ break;
+ case eDVBFrontendParametersSatellite::FEC::f3_4:
+ parm_u_qpsk_fec_inner = FEC_S2_3_4;
+ break;
+ case eDVBFrontendParametersSatellite::FEC::f3_5:
+ parm_u_qpsk_fec_inner = FEC_S2_3_5;
+ break;
+ case eDVBFrontendParametersSatellite::FEC::f4_5:
+ parm_u_qpsk_fec_inner = FEC_S2_4_5;
+ break;
+ case eDVBFrontendParametersSatellite::FEC::f5_6:
+ parm_u_qpsk_fec_inner = FEC_S2_5_6;
+ break;
+ case eDVBFrontendParametersSatellite::FEC::f7_8:
+ parm_u_qpsk_fec_inner = FEC_S2_7_8;
+ break;
+ case eDVBFrontendParametersSatellite::FEC::f8_9:
+ parm_u_qpsk_fec_inner = FEC_S2_8_9;
+ break;
+ case eDVBFrontendParametersSatellite::FEC::f9_10:
+ parm_u_qpsk_fec_inner = FEC_S2_9_10;
+ break;
+ default:
+ eDebug("no valid fec for DVB-S2 set.. abort !!");
+ return -EINVAL;
+ }
+#endif
+ // FIXME !!! get frequency range from tuner
+ if ( parm_frequency < 900000 || parm_frequency > 2200000 )
+ {
+ eDebug("%d mhz out of tuner range.. dont tune", parm_frequency/1000);
+ return -EINVAL;
+ }
+ eDebug("tuning to %d mhz", parm_frequency/1000);
+ }
+ return res;
+}
+
+RESULT eDVBFrontend::prepare_cable(const eDVBFrontendParametersCable &feparm)
+{
+ parm_frequency = feparm.frequency * 1000;
+ parm_u_qam_symbol_rate = feparm.symbol_rate;
+ switch (feparm.modulation)
+ {
+ case eDVBFrontendParametersCable::Modulation::QAM16:
+ parm_u_qam_modulation = QAM_16;
+ break;
+ case eDVBFrontendParametersCable::Modulation::QAM32:
+ parm_u_qam_modulation = QAM_32;
+ break;
+ case eDVBFrontendParametersCable::Modulation::QAM64:
+ parm_u_qam_modulation = QAM_64;
+ break;
+ case eDVBFrontendParametersCable::Modulation::QAM128:
+ parm_u_qam_modulation = QAM_128;
+ break;
+ case eDVBFrontendParametersCable::Modulation::QAM256:
+ parm_u_qam_modulation = QAM_256;
+ break;
+ default:
+ case eDVBFrontendParametersCable::Modulation::Auto:
+ parm_u_qam_modulation = QAM_AUTO;
+ break;
+ }
+ switch (feparm.inversion)
+ {
+ case eDVBFrontendParametersCable::Inversion::On:
+ parm_inversion = INVERSION_ON;
+ break;
+ case eDVBFrontendParametersCable::Inversion::Off:
+ parm_inversion = INVERSION_OFF;
+ break;
+ default:
+ case eDVBFrontendParametersCable::Inversion::Unknown:
+ parm_inversion = INVERSION_AUTO;
+ break;
+ }
+ switch (feparm.fec_inner)
+ {
+ case eDVBFrontendParametersCable::FEC::fNone:
+ parm_u_qam_fec_inner = FEC_NONE;
+ break;
+ case eDVBFrontendParametersCable::FEC::f1_2:
+ parm_u_qam_fec_inner = FEC_1_2;
+ break;
+ case eDVBFrontendParametersCable::FEC::f2_3:
+ parm_u_qam_fec_inner = FEC_2_3;
+ break;
+ case eDVBFrontendParametersCable::FEC::f3_4:
+ parm_u_qam_fec_inner = FEC_3_4;
+ break;
+ case eDVBFrontendParametersCable::FEC::f5_6:
+ parm_u_qam_fec_inner = FEC_5_6;
+ break;
+ case eDVBFrontendParametersCable::FEC::f7_8:
+ parm_u_qam_fec_inner = FEC_7_8;
+ break;
+#if HAVE_DVB_API_VERSION >= 3
+ case eDVBFrontendParametersCable::FEC::f8_9:
+ parm_u_qam_fec_inner = FEC_8_9;
+ break;
+#endif
+ default:
+ case eDVBFrontendParametersCable::FEC::fAuto:
+ parm_u_qam_fec_inner = FEC_AUTO;
+ break;
+ }
+ return 0;
+}
+
+RESULT eDVBFrontend::prepare_terrestrial(const eDVBFrontendParametersTerrestrial &feparm)
+{
+ parm_frequency = feparm.frequency;
+
+ switch (feparm.bandwidth)
+ {
+ case eDVBFrontendParametersTerrestrial::Bandwidth::Bw8MHz:
+ parm_u_ofdm_bandwidth = BANDWIDTH_8_MHZ;
+ break;
+ case eDVBFrontendParametersTerrestrial::Bandwidth::Bw7MHz:
+ parm_u_ofdm_bandwidth = BANDWIDTH_7_MHZ;
+ break;
+ case eDVBFrontendParametersTerrestrial::Bandwidth::Bw6MHz:
+ parm_u_ofdm_bandwidth = BANDWIDTH_6_MHZ;
+ break;
+ default:
+ case eDVBFrontendParametersTerrestrial::Bandwidth::BwAuto:
+ parm_u_ofdm_bandwidth = BANDWIDTH_AUTO;
+ break;
+ }
+ switch (feparm.code_rate_LP)
+ {
+ case eDVBFrontendParametersTerrestrial::FEC::f1_2:
+ parm_u_ofdm_code_rate_LP = FEC_1_2;
+ break;
+ case eDVBFrontendParametersTerrestrial::FEC::f2_3:
+ parm_u_ofdm_code_rate_LP = FEC_2_3;
+ break;
+ case eDVBFrontendParametersTerrestrial::FEC::f3_4:
+ parm_u_ofdm_code_rate_LP = FEC_3_4;
+ break;
+ case eDVBFrontendParametersTerrestrial::FEC::f5_6:
+ parm_u_ofdm_code_rate_LP = FEC_5_6;
+ break;
+ case eDVBFrontendParametersTerrestrial::FEC::f7_8:
+ parm_u_ofdm_code_rate_LP = FEC_7_8;
+ break;
+ default:
+ case eDVBFrontendParametersTerrestrial::FEC::fAuto:
+ parm_u_ofdm_code_rate_LP = FEC_AUTO;
+ break;
+ }
+ switch (feparm.code_rate_HP)
+ {
+ case eDVBFrontendParametersTerrestrial::FEC::f1_2:
+ parm_u_ofdm_code_rate_HP = FEC_1_2;
+ break;
+ case eDVBFrontendParametersTerrestrial::FEC::f2_3:
+ parm_u_ofdm_code_rate_HP = FEC_2_3;
+ break;
+ case eDVBFrontendParametersTerrestrial::FEC::f3_4:
+ parm_u_ofdm_code_rate_HP = FEC_3_4;
+ break;
+ case eDVBFrontendParametersTerrestrial::FEC::f5_6:
+ parm_u_ofdm_code_rate_HP = FEC_5_6;
+ break;
+ case eDVBFrontendParametersTerrestrial::FEC::f7_8:
+ parm_u_ofdm_code_rate_HP = FEC_7_8;
+ break;
+ default:
+ case eDVBFrontendParametersTerrestrial::FEC::fAuto:
+ parm_u_ofdm_code_rate_HP = FEC_AUTO;
+ break;
+ }
+ switch (feparm.modulation)
+ {
+ case eDVBFrontendParametersTerrestrial::Modulation::QPSK:
+ parm_u_ofdm_constellation = QPSK;
+ break;
+ case eDVBFrontendParametersTerrestrial::Modulation::QAM16:
+ parm_u_ofdm_constellation = QAM_16;
+ break;
+ case eDVBFrontendParametersTerrestrial::Modulation::QAM64:
+ parm_u_ofdm_constellation = QAM_64;
+ break;
+ default:
+ case eDVBFrontendParametersTerrestrial::Modulation::Auto:
+ parm_u_ofdm_constellation = QAM_AUTO;
+ break;
+ }
+ switch (feparm.transmission_mode)
+ {
+ case eDVBFrontendParametersTerrestrial::TransmissionMode::TM2k:
+ parm_u_ofdm_transmission_mode = TRANSMISSION_MODE_2K;
+ break;
+ case eDVBFrontendParametersTerrestrial::TransmissionMode::TM8k:
+ parm_u_ofdm_transmission_mode = TRANSMISSION_MODE_8K;
+ break;
+ default:
+ case eDVBFrontendParametersTerrestrial::TransmissionMode::TMAuto:
+ parm_u_ofdm_transmission_mode = TRANSMISSION_MODE_AUTO;
+ break;
+ }
+ switch (feparm.guard_interval)
+ {
+ case eDVBFrontendParametersTerrestrial::GuardInterval::GI_1_32:
+ parm_u_ofdm_guard_interval = GUARD_INTERVAL_1_32;
+ break;
+ case eDVBFrontendParametersTerrestrial::GuardInterval::GI_1_16:
+ parm_u_ofdm_guard_interval = GUARD_INTERVAL_1_16;
+ break;
+ case eDVBFrontendParametersTerrestrial::GuardInterval::GI_1_8:
+ parm_u_ofdm_guard_interval = GUARD_INTERVAL_1_8;
+ break;
+ case eDVBFrontendParametersTerrestrial::GuardInterval::GI_1_4:
+ parm_u_ofdm_guard_interval = GUARD_INTERVAL_1_4;
+ break;
+ default:
+ case eDVBFrontendParametersTerrestrial::GuardInterval::GI_Auto:
+ parm_u_ofdm_guard_interval = GUARD_INTERVAL_AUTO;
+ break;
+ }
+ switch (feparm.hierarchy)
+ {
+ case eDVBFrontendParametersTerrestrial::Hierarchy::HNone:
+ parm_u_ofdm_hierarchy_information = HIERARCHY_NONE;
+ break;
+ case eDVBFrontendParametersTerrestrial::Hierarchy::H1:
+ parm_u_ofdm_hierarchy_information = HIERARCHY_1;
+ break;
+ case eDVBFrontendParametersTerrestrial::Hierarchy::H2:
+ parm_u_ofdm_hierarchy_information = HIERARCHY_2;
+ break;
+ case eDVBFrontendParametersTerrestrial::Hierarchy::H4:
+ parm_u_ofdm_hierarchy_information = HIERARCHY_4;
+ break;
+ default:
+ case eDVBFrontendParametersTerrestrial::Hierarchy::HAuto:
+ parm_u_ofdm_hierarchy_information = HIERARCHY_AUTO;
+ break;
+ }
+ switch (feparm.inversion)
+ {
+ case eDVBFrontendParametersTerrestrial::Inversion::On:
+ parm_inversion = INVERSION_ON;
+ break;
+ case eDVBFrontendParametersTerrestrial::Inversion::Off:
+ parm_inversion = INVERSION_OFF;
+ break;
+ default:
+ case eDVBFrontendParametersTerrestrial::Inversion::Unknown:
+ parm_inversion = INVERSION_AUTO;
+ break;
+ }
+ return 0;
+}
+