Revert "complete rebuild of frontend cmds"

This reverts commit 20509db8e5.


Origin commit data
------------------
Branch: ni/coolstream
Commit: c6a6138008
Author: vanhofen <vanhofen@gmx.de>
Date: 2020-10-29 (Thu, 29 Oct 2020)



------------------
This commit was generated by Migit
This commit is contained in:
vanhofen
2020-10-29 21:05:52 +01:00
parent 8a85801e91
commit d313d73f97

View File

@@ -54,7 +54,122 @@ extern int zapit_debug;
#define WEST 1
#define USALS
#define FE_MAX_PROPS 13
#define CLEAR 0
// Common properties
#define FREQUENCY 1
#define MODULATION 2
#define INVERSION 3
// common to S/S2/C
#define SYMBOL_RATE 4
#define DELIVERY_SYSTEM 5
#define INNER_FEC 6
// DVB-S/S2 specific
#define PILOTS 7
#define ROLLOFF 8
// DVB-S2X specific
#define MIS 9
// DVB-T specific
#define BANDWIDTH 4
#define CODE_RATE_HP 6
#define CODE_RATE_LP 7
#define TRANSMISSION_MODE 8
#define GUARD_INTERVAL 9
#define HIERARCHY 10
// DVB-T2 specific
#define PLP_ID 11
#define FE_COMMON_PROPS 2
#define FE_DVBS_PROPS 6
#define FE_DVBS2_PROPS 8
#define FE_DVBS2X_PROPS 9
#define FE_DVBC_PROPS 6
#define FE_DVBT_PROPS 10
#define FE_DVBT2_PROPS 11
/* stolen from dvb.c from vlc */
static const struct dtv_property dvbs_cmdargs[] = {
{ DTV_CLEAR, {0,0,0}, { 0 }, 0 },
{ DTV_FREQUENCY, {} , { 0 }, 0 },
{ DTV_MODULATION, {} , { QPSK }, 0 },
{ DTV_INVERSION, {} , { INVERSION_AUTO }, 0 },
{ DTV_SYMBOL_RATE, {} , { 27500000 }, 0 },
{ DTV_DELIVERY_SYSTEM, {} , { SYS_DVBS }, 0 },
{ DTV_INNER_FEC, {} , { FEC_AUTO }, 0 },
{ DTV_TUNE, {} , { 0 }, 0 }
};
static const struct dtv_property dvbs2_cmdargs[] = {
{ DTV_CLEAR, {0,0,0}, { 0 }, 0 },
{ DTV_FREQUENCY, {} , { 0 }, 0 },
{ DTV_MODULATION, {} , { PSK_8 }, 0 },
{ DTV_INVERSION, {} , { INVERSION_AUTO }, 0 },
{ DTV_SYMBOL_RATE, {} , { 27500000 }, 0 },
{ DTV_DELIVERY_SYSTEM, {} , { SYS_DVBS2 }, 0 },
{ DTV_INNER_FEC, {} , { FEC_AUTO }, 0 },
{ DTV_PILOT, {} , { PILOT_AUTO }, 0 },
{ DTV_ROLLOFF, {} , { ROLLOFF_AUTO }, 0 },
{ DTV_TUNE, {} , { 0 }, 0 }
};
static const struct dtv_property dvbs2x_cmdargs[] = {
{ DTV_CLEAR, {0,0,0}, { 0 }, 0 },
{ DTV_FREQUENCY, {} , { 0 }, 0 },
{ DTV_MODULATION, {} , { PSK_8 }, 0 },
{ DTV_INVERSION, {} , { INVERSION_AUTO }, 0 },
{ DTV_SYMBOL_RATE, {} , { 27500000 }, 0 },
{ DTV_DELIVERY_SYSTEM, {} , { SYS_DVBS2 }, 0 },
{ DTV_INNER_FEC, {} , { FEC_AUTO }, 0 },
{ DTV_PILOT, {} , { PILOT_AUTO }, 0 },
{ DTV_ROLLOFF, {} , { ROLLOFF_AUTO }, 0 },
{ DTV_STREAM_ID, {} , { NO_STREAM_ID_FILTER }, 0 },
{ DTV_TUNE, {} , { 0 }, 0 }
};
static const struct dtv_property dvbc_cmdargs[] = {
{ DTV_CLEAR, {0,0,0}, { 0 }, 0 },
{ DTV_FREQUENCY, {} , { 0 }, 0 },
{ DTV_MODULATION, {} , { QAM_AUTO }, 0 },
{ DTV_INVERSION, {} , { INVERSION_AUTO }, 0 },
{ DTV_SYMBOL_RATE, {} , { 27500000 }, 0 },
{ DTV_DELIVERY_SYSTEM, {} , { SYS_DVBC_ANNEX_AC }, 0 },
{ DTV_INNER_FEC, {} , { FEC_AUTO }, 0 },
{ DTV_TUNE, {} , { 0 }, 0 }
};
static const struct dtv_property dvbt_cmdargs[] = {
{ DTV_CLEAR, {0,0,0}, { 0 }, 0 },
{ DTV_FREQUENCY, {} , { 0 }, 0 },
{ DTV_MODULATION, {} , { QAM_AUTO }, 0 },
{ DTV_INVERSION, {} , { INVERSION_AUTO }, 0 },
{ DTV_BANDWIDTH_HZ, {} , { 8000000 }, 0 },
{ DTV_DELIVERY_SYSTEM, {} , { SYS_DVBT }, 0 },
{ DTV_CODE_RATE_HP, {} , { FEC_AUTO }, 0 },
{ DTV_CODE_RATE_LP, {} , { FEC_AUTO }, 0 },
{ DTV_TRANSMISSION_MODE,{} , { TRANSMISSION_MODE_AUTO }, 0 },
{ DTV_GUARD_INTERVAL, {} , { GUARD_INTERVAL_AUTO }, 0 },
{ DTV_HIERARCHY, {} , { HIERARCHY_AUTO }, 0 },
{ DTV_TUNE, {} , { 0 }, 0 }
};
static const struct dtv_property dvbt2_cmdargs[] = {
{ DTV_CLEAR, {0,0,0}, { 0 }, 0 },
{ DTV_FREQUENCY, {} , { 0 }, 0 },
{ DTV_MODULATION, {} , { QAM_AUTO }, 0 },
{ DTV_INVERSION, {} , { INVERSION_AUTO }, 0 },
{ DTV_BANDWIDTH_HZ, {} , { 8000000 }, 0 },
{ DTV_DELIVERY_SYSTEM, {} , { SYS_DVBT2 }, 0 },
{ DTV_CODE_RATE_HP, {} , { FEC_AUTO }, 0 },
{ DTV_CODE_RATE_LP, {} , { FEC_AUTO }, 0 },
{ DTV_TRANSMISSION_MODE,{} , { TRANSMISSION_MODE_AUTO }, 0 },
{ DTV_GUARD_INTERVAL, {} , { GUARD_INTERVAL_AUTO }, 0 },
{ DTV_HIERARCHY, {} , { HIERARCHY_AUTO }, 0 },
#if defined DTV_STREAM_ID
{ DTV_STREAM_ID, {} , { NO_STREAM_ID_FILTER }, 0 },
#elif defined DTV_DVBT2_PLP_ID
{ DTV_DVBT2_PLP_ID, {} , { NO_STREAM_ID_FILTER }, 0 },
#endif
{ DTV_TUNE, {} , { 0 }, 0 }
};
#define diff(x,y) (max(x,y) - min(x,y))
@@ -1468,123 +1583,135 @@ bool CFrontend::buildProperties(const FrontendParameters *feparams, struct dtv_p
break;
default:
INFO("[fe%d/%d] DEMOD: unknown FEC: %d\n", adapter, fenumber, fec_inner);
/* fall through */
/* fall through */
case FEC_AUTO:
fec = FEC_AUTO;
break;
}
switch(feparams->pilot)
{
case ZPILOT_ON:
pilot = PILOT_ON;
break;
case ZPILOT_OFF:
pilot = PILOT_OFF;
break;
case ZPILOT_AUTO:
default:
pilot = PILOT_AUTO;
break;
case ZPILOT_ON:
pilot = PILOT_ON;
break;
case ZPILOT_OFF:
pilot = PILOT_OFF;
break;
case ZPILOT_AUTO:
default:
pilot = PILOT_AUTO;
break;
}
struct dtv_property p[FE_MAX_PROPS];
int nrOfProps = 0;
switch (feparams->delsys)
{
case DVB_S:
case DVB_S2:
case DVB_S2X:
cmdseq.props = p;
cmdseq.num = 0;
p[cmdseq.num].cmd = DTV_CLEAR, cmdseq.num++;
p[cmdseq.num].cmd = DTV_DELIVERY_SYSTEM, p[cmdseq.num].u.data = getFEDeliverySystem(feparams->delsys), cmdseq.num++;
if (config.diseqcType == DISEQC_UNICABLE)
p[cmdseq.num].cmd = DTV_FREQUENCY,
p[cmdseq.num].u.data = sendEN50494TuningCommand(feparams->frequency, currentToneMode == SEC_TONE_ON,
currentVoltage == SEC_VOLTAGE_18, !!config.uni_lnb), cmdseq.num++;
else if (config.diseqcType == DISEQC_UNICABLE2)
p[cmdseq.num].cmd = DTV_FREQUENCY,
p[cmdseq.num].u.data = sendEN50607TuningCommand(feparams->frequency, currentToneMode == SEC_TONE_ON,
currentVoltage == SEC_VOLTAGE_18, config.uni_lnb), cmdseq.num++;
else
p[cmdseq.num].cmd = DTV_FREQUENCY, p[cmdseq.num].u.data = feparams->frequency, cmdseq.num++;
p[cmdseq.num].cmd = DTV_MODULATION, p[cmdseq.num].u.data = feparams->modulation, cmdseq.num++;
p[cmdseq.num].cmd = DTV_SYMBOL_RATE, p[cmdseq.num].u.data = feparams->symbol_rate, cmdseq.num++;
p[cmdseq.num].cmd = DTV_INNER_FEC, p[cmdseq.num].u.data = fec, cmdseq.num++;
p[cmdseq.num].cmd = DTV_INVERSION, p[cmdseq.num].u.data = feparams->inversion, cmdseq.num++;
if (feparams->delsys == DVB_S2 || feparams->delsys == DVB_S2X)
{
p[cmdseq.num].cmd = DTV_ROLLOFF, p[cmdseq.num].u.data = feparams->rolloff, cmdseq.num++;
p[cmdseq.num].cmd = DTV_PILOT, p[cmdseq.num].u.data = pilot, cmdseq.num++;
if (can_multistream)
{
p[cmdseq.num].cmd = DTV_STREAM_ID, p[cmdseq.num].u.data = feparams->plp_id | (feparams->pls_code << 8) | (feparams->pls_mode << 26), cmdseq.num++;
nrOfProps = FE_DVBS2X_PROPS;
memcpy(cmdseq.props, dvbs2x_cmdargs, sizeof(dvbs2x_cmdargs));
cmdseq.props[MIS].u.data = feparams->plp_id | (feparams->pls_code << 8) | (feparams->pls_mode << 26);
}
p[cmdseq.num].cmd = DTV_TUNE, cmdseq.num++;
else
{
nrOfProps = FE_DVBS2_PROPS;
memcpy(cmdseq.props, dvbs2_cmdargs, sizeof(dvbs2_cmdargs));
}
cmdseq.props[MODULATION].u.data = feparams->modulation;
cmdseq.props[ROLLOFF].u.data = feparams->rolloff;
cmdseq.props[PILOTS].u.data = pilot;
}
else
{
p[cmdseq.num].cmd = DTV_TUNE, cmdseq.num++;
memcpy(cmdseq.props, dvbs_cmdargs, sizeof(dvbs_cmdargs));
nrOfProps = FE_DVBS_PROPS;
}
cmdseq.props[FREQUENCY].u.data = feparams->frequency;
cmdseq.props[SYMBOL_RATE].u.data = feparams->symbol_rate;
cmdseq.props[INNER_FEC].u.data = fec; /*_inner*/ ;
if (can_multistream)
INFO("[fe%d/%d] tuner pilot %d (feparams %d) streamid (%d/%d/%d)\n", adapter, fenumber, pilot, feparams->pilot, feparams->plp_id, feparams->pls_code, feparams->pls_mode );
else
INFO("[fe%d/%d] tuner pilot %d (feparams %d)\n", adapter, fenumber, pilot, feparams->pilot);
break;
case DVB_C:
cmdseq.props = p;
cmdseq.num = 0;
p[cmdseq.num].cmd = DTV_CLEAR, cmdseq.num++;
p[cmdseq.num].cmd = DTV_DELIVERY_SYSTEM, p[cmdseq.num].u.data = getFEDeliverySystem(feparams->delsys), cmdseq.num++;
p[cmdseq.num].cmd = DTV_FREQUENCY, p[cmdseq.num].u.data = feparams->frequency, cmdseq.num++;
p[cmdseq.num].cmd = DTV_MODULATION, p[cmdseq.num].u.data = feparams->modulation, cmdseq.num++;
p[cmdseq.num].cmd = DTV_SYMBOL_RATE, p[cmdseq.num].u.data = feparams->symbol_rate, cmdseq.num++;
p[cmdseq.num].cmd = DTV_INNER_FEC, p[cmdseq.num].u.data = fec_inner, cmdseq.num++;
p[cmdseq.num].cmd = DTV_INVERSION, p[cmdseq.num].u.data = feparams->inversion, cmdseq.num++;
p[cmdseq.num].cmd = DTV_TUNE, cmdseq.num++;
memcpy(cmdseq.props, dvbc_cmdargs, sizeof(dvbc_cmdargs));
nrOfProps = FE_DVBC_PROPS;
cmdseq.props[FREQUENCY].u.data = feparams->frequency;
cmdseq.props[MODULATION].u.data = feparams->modulation;
cmdseq.props[SYMBOL_RATE].u.data = feparams->symbol_rate;
cmdseq.props[INNER_FEC].u.data = fec_inner;
break;
case DVB_T:
case DVB_T2:
case DTMB:
cmdseq.props = p;
cmdseq.num = 0;
p[cmdseq.num].cmd = DTV_CLEAR, cmdseq.num++;
p[cmdseq.num].cmd = DTV_DELIVERY_SYSTEM, p[cmdseq.num].u.data = getFEDeliverySystem(feparams->delsys), cmdseq.num++;
p[cmdseq.num].cmd = DTV_FREQUENCY, p[cmdseq.num].u.data = feparams->frequency, cmdseq.num++;
p[cmdseq.num].cmd = DTV_CODE_RATE_LP, p[cmdseq.num].u.data = feparams->code_rate_LP, cmdseq.num++;
p[cmdseq.num].cmd = DTV_CODE_RATE_HP, p[cmdseq.num].u.data = feparams->code_rate_HP, cmdseq.num++;
p[cmdseq.num].cmd = DTV_MODULATION, p[cmdseq.num].u.data = feparams->modulation, cmdseq.num++;
p[cmdseq.num].cmd = DTV_TRANSMISSION_MODE, p[cmdseq.num].u.data = feparams->transmission_mode, cmdseq.num++;
p[cmdseq.num].cmd = DTV_GUARD_INTERVAL, p[cmdseq.num].u.data = feparams->guard_interval, cmdseq.num++;
p[cmdseq.num].cmd = DTV_HIERARCHY, p[cmdseq.num].u.data = feparams->hierarchy, cmdseq.num++;
p[cmdseq.num].cmd = DTV_BANDWIDTH_HZ, p[cmdseq.num].u.data = getFEBandwidth(feparams->bandwidth), cmdseq.num++;
p[cmdseq.num].cmd = DTV_INVERSION, p[cmdseq.num].u.data = feparams->inversion, cmdseq.num++;
if (can_multistream)
{
#if defined DTV_STREAM_ID
p[cmdseq.num].cmd = DTV_STREAM_ID , p[cmdseq.num].u.data = feparams->plp_id, cmdseq.num++;
#elif defined DTV_DVBT2_PLP_ID
p[cmdseq.num].cmd = DTV_DVBT2_PLP_ID , p[cmdseq.num].u.data = feparams->plp_id, cmdseq.num++;
#endif
}
p[cmdseq.num].cmd = DTV_TUNE, cmdseq.num++;
memcpy(cmdseq.props, dvbt_cmdargs, sizeof(dvbt_cmdargs));
nrOfProps = FE_DVBT_PROPS;
cmdseq.props[FREQUENCY].u.data = feparams->frequency;
cmdseq.props[MODULATION].u.data = feparams->modulation;
cmdseq.props[INVERSION].u.data = feparams->inversion;
cmdseq.props[CODE_RATE_HP].u.data = feparams->code_rate_HP;
cmdseq.props[CODE_RATE_LP].u.data = feparams->code_rate_LP;
cmdseq.props[TRANSMISSION_MODE].u.data = feparams->transmission_mode;
cmdseq.props[GUARD_INTERVAL].u.data = feparams->guard_interval;
cmdseq.props[HIERARCHY].u.data = feparams->hierarchy;
cmdseq.props[DELIVERY_SYSTEM].u.data = getFEDeliverySystem(feparams->delsys);
cmdseq.props[BANDWIDTH].u.data = getFEBandwidth(feparams->bandwidth);
break;
case DVB_T2:
memcpy(cmdseq.props, dvbt2_cmdargs, sizeof(dvbt2_cmdargs));
nrOfProps = FE_DVBT2_PROPS;
cmdseq.props[FREQUENCY].u.data = feparams->frequency;
cmdseq.props[MODULATION].u.data = feparams->modulation;
cmdseq.props[INVERSION].u.data = feparams->inversion;
cmdseq.props[CODE_RATE_HP].u.data = feparams->code_rate_HP;
cmdseq.props[CODE_RATE_LP].u.data = feparams->code_rate_LP;
cmdseq.props[TRANSMISSION_MODE].u.data = feparams->transmission_mode;
cmdseq.props[GUARD_INTERVAL].u.data = feparams->guard_interval;
cmdseq.props[HIERARCHY].u.data = feparams->hierarchy;
cmdseq.props[DELIVERY_SYSTEM].u.data = getFEDeliverySystem(feparams->delsys);
cmdseq.props[BANDWIDTH].u.data = getFEBandwidth(feparams->bandwidth);
cmdseq.props[PLP_ID].u.data = feparams->plp_id;
break;
default:
INFO("[fe%d/%d] unknown frontend type, exiting\n", adapter, fenumber);
return false;
}
if (config.diseqcType == DISEQC_UNICABLE)
cmdseq.props[FREQUENCY].u.data = sendEN50494TuningCommand(feparams->frequency,
currentToneMode == SEC_TONE_ON,
currentVoltage == SEC_VOLTAGE_18,
!!config.uni_lnb);
if (config.diseqcType == DISEQC_UNICABLE2)
cmdseq.props[FREQUENCY].u.data = sendEN50607TuningCommand(feparams->frequency,
currentToneMode == SEC_TONE_ON,
currentVoltage == SEC_VOLTAGE_18,
config.uni_lnb);
cmdseq.num += nrOfProps;
return true;
}
int CFrontend::setFrontend(const FrontendParameters *feparams, bool nowait)
{
struct dtv_property cmdargs[FE_COMMON_PROPS + FE_DVBT2_PROPS]; // WARNING: increase when needed more space
struct dtv_properties cmdseq;
#ifdef PEDANTIC_VALGRIND_SETUP
memset(&cmdargs, 0, sizeof(cmdargs));
memset(&cmdseq, 0, sizeof(cmdseq));
#endif
cmdseq.num = FE_COMMON_PROPS;
cmdseq.props = cmdargs;
tuned = false;
struct dvb_frontend_event ev;