1
0
mirror of https://github.com/DigitalDevices/dddvb.git synced 2023-10-10 13:37:43 +02:00

add more delivery systems for M4

This commit is contained in:
Ralph Metzler 2018-09-28 00:28:18 +02:00
parent 0fa1f815c5
commit dc45a08c10
3 changed files with 101 additions and 29 deletions

View File

@ -46,7 +46,6 @@ static int stop(struct dvb_frontend *fe)
{ {
struct m4 *state = fe->demodulator_priv; struct m4 *state = fe->demodulator_priv;
struct mci_command cmd; struct mci_command cmd;
struct mci_base *mci_base = state->mci.base;
if (!state->started) if (!state->started)
return -1; return -1;
@ -62,8 +61,6 @@ static int stop(struct dvb_frontend *fe)
static int search_s2(struct dvb_frontend *fe) static int search_s2(struct dvb_frontend *fe)
{ {
struct m4 *state = fe->demodulator_priv; struct m4 *state = fe->demodulator_priv;
struct mci_base *mci_base = state->mci.base;
struct m4_base *m4_base = (struct m4_base *) mci_base;
struct dtv_frontend_properties *p = &fe->dtv_property_cache; struct dtv_frontend_properties *p = &fe->dtv_property_cache;
struct mci_command cmd; struct mci_command cmd;
int stat; int stat;
@ -72,11 +69,12 @@ static int search_s2(struct dvb_frontend *fe)
cmd.command = MCI_CMD_SEARCH_DVBS; cmd.command = MCI_CMD_SEARCH_DVBS;
cmd.dvbs2_search.flags = 3; cmd.dvbs2_search.flags = 3;
cmd.dvbs2_search.s2_modulation_mask = 3; cmd.dvbs2_search.s2_modulation_mask = 3;
cmd.dvbs2_search.retry = 2; cmd.dvbs2_search.retry = 0;
cmd.dvbs2_search.frequency = p->frequency * 1000; cmd.dvbs2_search.frequency = p->frequency * 1000;
cmd.dvbs2_search.symbol_rate = p->symbol_rate; cmd.dvbs2_search.symbol_rate = p->symbol_rate;
cmd.dvbs2_search.scrambling_sequence_index = 0; //p->scrambling_sequence_index; cmd.dvbs2_search.scrambling_sequence_index = 0; //p->scrambling_sequence_index;
cmd.dvbs2_search.input_stream_id = p->stream_id; if (p->stream_id != NO_STREAM_ID_FILTER)
cmd.dvbs2_search.input_stream_id = p->stream_id;
cmd.tuner = state->mci.nr; cmd.tuner = state->mci.nr;
cmd.demod = state->mci.tuner; cmd.demod = state->mci.tuner;
cmd.output = state->mci.nr; cmd.output = state->mci.nr;
@ -90,8 +88,6 @@ static int search_s2(struct dvb_frontend *fe)
static int search_c(struct dvb_frontend *fe) static int search_c(struct dvb_frontend *fe)
{ {
struct m4 *state = fe->demodulator_priv; struct m4 *state = fe->demodulator_priv;
struct mci_base *mci_base = state->mci.base;
struct m4_base *m4_base = (struct m4_base *) mci_base;
struct dtv_frontend_properties *p = &fe->dtv_property_cache; struct dtv_frontend_properties *p = &fe->dtv_property_cache;
struct mci_command cmd; struct mci_command cmd;
int stat; int stat;
@ -109,7 +105,7 @@ static int search_c(struct dvb_frontend *fe)
cmd.dvbc_search.bandwidth = MCI_BANDWIDTH_8MHZ; cmd.dvbc_search.bandwidth = MCI_BANDWIDTH_8MHZ;
break; break;
} }
cmd.dvbc_search.retry = 2; cmd.dvbc_search.retry = 0;
cmd.dvbc_search.frequency = p->frequency; cmd.dvbc_search.frequency = p->frequency;
cmd.tuner = state->mci.tuner; cmd.tuner = state->mci.tuner;
cmd.demod = state->mci.demod; cmd.demod = state->mci.demod;
@ -124,8 +120,6 @@ static int search_c(struct dvb_frontend *fe)
static int search_t(struct dvb_frontend *fe) static int search_t(struct dvb_frontend *fe)
{ {
struct m4 *state = fe->demodulator_priv; struct m4 *state = fe->demodulator_priv;
struct mci_base *mci_base = state->mci.base;
struct m4_base *m4_base = (struct m4_base *) mci_base;
struct dtv_frontend_properties *p = &fe->dtv_property_cache; struct dtv_frontend_properties *p = &fe->dtv_property_cache;
struct mci_command cmd; struct mci_command cmd;
int stat; int stat;
@ -146,7 +140,7 @@ static int search_t(struct dvb_frontend *fe)
cmd.dvbt_search.bandwidth = MCI_BANDWIDTH_8MHZ; cmd.dvbt_search.bandwidth = MCI_BANDWIDTH_8MHZ;
break; break;
} }
cmd.dvbt_search.retry = 2; cmd.dvbt_search.retry = 0;
cmd.dvbt_search.frequency = p->frequency; cmd.dvbt_search.frequency = p->frequency;
cmd.tuner = state->mci.tuner; cmd.tuner = state->mci.tuner;
cmd.demod = state->mci.demod; cmd.demod = state->mci.demod;
@ -158,15 +152,85 @@ static int search_t(struct dvb_frontend *fe)
return stat; return stat;
} }
static int search_t2(struct dvb_frontend *fe) static int search_isdbs(struct dvb_frontend *fe)
{
struct m4 *state = fe->demodulator_priv;
struct dtv_frontend_properties *p = &fe->dtv_property_cache;
struct mci_command cmd;
int stat;
memset(&cmd, 0, sizeof(cmd));
cmd.command = MCI_CMD_SEARCH_ISDBS;
cmd.isdbs_search.retry = 0;
if (p->stream_id != NO_STREAM_ID_FILTER) {
cmd.isdbs_search.flags = (p->stream_id & 0xffff0000) ? 0 : 1;
cmd.isdbs_search.tsid = p->stream_id;
}
cmd.isdbs_search.frequency = p->frequency * 1000;
cmd.tuner = state->mci.nr;
cmd.demod = state->mci.tuner;
cmd.output = state->mci.nr;
stat = ddb_mci_cmd(&state->mci, &cmd, NULL);
if (stat)
stop(fe);
return stat;
}
static int search_isdbc(struct dvb_frontend *fe)
{
struct m4 *state = fe->demodulator_priv;
struct dtv_frontend_properties *p = &fe->dtv_property_cache;
struct mci_command cmd;
int stat;
memset(&cmd, 0, sizeof(cmd));
cmd.command = MCI_CMD_SEARCH_ISDBC;
cmd.isdbc_search.retry = 0;
if (p->stream_id != NO_STREAM_ID_FILTER) {
cmd.isdbc_search.flags = (p->stream_id & 0xffff0000) ? 0 : 1;
cmd.isdbc_search.tsid = p->stream_id;
cmd.isdbc_search.onid = (p->stream_id & 0x10000) >> 16;
}
cmd.isdbc_search.bandwidth = MCI_BANDWIDTH_6MHZ;
cmd.isdbc_search.frequency = p->frequency;
cmd.demod = state->mci.tuner;
cmd.output = state->mci.nr;
stat = ddb_mci_cmd(&state->mci, &cmd, NULL);
if (stat)
stop(fe);
return stat;
}
static int search_j83b(struct dvb_frontend *fe)
{
struct m4 *state = fe->demodulator_priv;
struct dtv_frontend_properties *p = &fe->dtv_property_cache;
struct mci_command cmd;
int stat;
memset(&cmd, 0, sizeof(cmd));
cmd.command = MCI_CMD_SEARCH_J83B;
cmd.j83b_search.flags = 0;
cmd.j83b_search.retry = 0;
cmd.j83b_search.bandwidth = MCI_BANDWIDTH_6MHZ;
cmd.j83b_search.frequency = p->frequency;
cmd.demod = state->mci.tuner;
cmd.output = state->mci.nr;
stat = ddb_mci_cmd(&state->mci, &cmd, NULL);
if (stat)
stop(fe);
return stat;
}
static int search_t2(struct dvb_frontend *fe)
{ {
struct m4 *state = fe->demodulator_priv; struct m4 *state = fe->demodulator_priv;
struct mci_base *mci_base = state->mci.base;
struct m4_base *m4_base = (struct m4_base *) mci_base;
struct dtv_frontend_properties *p = &fe->dtv_property_cache; struct dtv_frontend_properties *p = &fe->dtv_property_cache;
struct mci_command cmd; struct mci_command cmd;
int stat; int stat;
u32 flags = 0;
memset(&cmd, 0, sizeof(cmd)); memset(&cmd, 0, sizeof(cmd));
cmd.command = MCI_CMD_SEARCH_DVBT2; cmd.command = MCI_CMD_SEARCH_DVBT2;
@ -187,7 +251,7 @@ static int search_t2(struct dvb_frontend *fe)
cmd.dvbt_search.bandwidth = MCI_BANDWIDTH_8MHZ; cmd.dvbt_search.bandwidth = MCI_BANDWIDTH_8MHZ;
break; break;
} }
cmd.dvbt2_search.retry = 2; cmd.dvbt2_search.retry = 0;
cmd.dvbt2_search.frequency = p->frequency; cmd.dvbt2_search.frequency = p->frequency;
if (p->stream_id != NO_STREAM_ID_FILTER) { if (p->stream_id != NO_STREAM_ID_FILTER) {
cmd.dvbt2_search.plp = p->stream_id & 0xff; cmd.dvbt2_search.plp = p->stream_id & 0xff;
@ -207,12 +271,9 @@ static int search_t2(struct dvb_frontend *fe)
static int search_c2(struct dvb_frontend *fe) static int search_c2(struct dvb_frontend *fe)
{ {
struct m4 *state = fe->demodulator_priv; struct m4 *state = fe->demodulator_priv;
struct mci_base *mci_base = state->mci.base;
struct m4_base *m4_base = (struct m4_base *) mci_base;
struct dtv_frontend_properties *p = &fe->dtv_property_cache; struct dtv_frontend_properties *p = &fe->dtv_property_cache;
struct mci_command cmd; struct mci_command cmd;
int stat; int stat;
u32 flags = 0;
memset(&cmd, 0, sizeof(cmd)); memset(&cmd, 0, sizeof(cmd));
cmd.command = MCI_CMD_SEARCH_DVBC2; cmd.command = MCI_CMD_SEARCH_DVBC2;
@ -224,7 +285,7 @@ static int search_c2(struct dvb_frontend *fe)
cmd.dvbc2_search.bandwidth = MCI_BANDWIDTH_8MHZ; cmd.dvbc2_search.bandwidth = MCI_BANDWIDTH_8MHZ;
break; break;
} }
cmd.dvbc2_search.retry = 2; cmd.dvbc2_search.retry = 0;
cmd.dvbc2_search.frequency = p->frequency; cmd.dvbc2_search.frequency = p->frequency;
if (p->stream_id != NO_STREAM_ID_FILTER) { if (p->stream_id != NO_STREAM_ID_FILTER) {
cmd.dvbc2_search.plp = p->stream_id & 0xff; cmd.dvbc2_search.plp = p->stream_id & 0xff;
@ -243,12 +304,9 @@ static int search_c2(struct dvb_frontend *fe)
static int search_isdbt(struct dvb_frontend *fe) static int search_isdbt(struct dvb_frontend *fe)
{ {
struct m4 *state = fe->demodulator_priv; struct m4 *state = fe->demodulator_priv;
struct mci_base *mci_base = state->mci.base;
struct m4_base *m4_base = (struct m4_base *) mci_base;
struct dtv_frontend_properties *p = &fe->dtv_property_cache; struct dtv_frontend_properties *p = &fe->dtv_property_cache;
struct mci_command cmd; struct mci_command cmd;
int stat; int stat;
u32 flags = 0;
memset(&cmd, 0, sizeof(cmd)); memset(&cmd, 0, sizeof(cmd));
cmd.command = MCI_CMD_SEARCH_ISDBT; cmd.command = MCI_CMD_SEARCH_ISDBT;
@ -263,7 +321,7 @@ static int search_isdbt(struct dvb_frontend *fe)
cmd.isdbt_search.bandwidth = MCI_BANDWIDTH_6MHZ; cmd.isdbt_search.bandwidth = MCI_BANDWIDTH_6MHZ;
break; break;
} }
cmd.isdbt_search.retry = 2; cmd.isdbt_search.retry = 0;
cmd.isdbt_search.frequency = p->frequency; cmd.isdbt_search.frequency = p->frequency;
cmd.tuner = state->mci.tuner; cmd.tuner = state->mci.tuner;
cmd.demod = state->mci.demod; cmd.demod = state->mci.demod;
@ -296,6 +354,9 @@ static int set_parameters(struct dvb_frontend *fe)
case SYS_DVBC_ANNEX_A: case SYS_DVBC_ANNEX_A:
res = search_c(fe); res = search_c(fe);
break; break;
case SYS_DVBC_ANNEX_B:
res = search_j83b(fe);
break;
case SYS_DVBT: case SYS_DVBT:
state->iq_constellation_tap = 5; state->iq_constellation_tap = 5;
res = search_t(fe); res = search_t(fe);
@ -309,6 +370,13 @@ static int set_parameters(struct dvb_frontend *fe)
case SYS_ISDBT: case SYS_ISDBT:
res = search_isdbt(fe); res = search_isdbt(fe);
break; break;
case SYS_ISDBS:
res = search_isdbs(fe);
break;
case SYS_DVBC_ANNEX_C:
case SYS_ISDBC:
res = search_isdbc(fe);
break;
default: default:
return -EINVAL; return -EINVAL;
} }
@ -329,7 +397,9 @@ static int read_status(struct dvb_frontend *fe, enum fe_status *status)
if (stat) if (stat)
return stat; return stat;
*status = 0x00; *status = 0x00;
ddb_mci_get_info(&state->mci); stat = ddb_mci_get_info(&state->mci);
if (stat)
return stat;
ddb_mci_get_strength(fe); ddb_mci_get_strength(fe);
if (res.status == MCI_DEMOD_WAIT_SIGNAL) if (res.status == MCI_DEMOD_WAIT_SIGNAL)
*status = 0x01; *status = 0x01;
@ -397,8 +467,10 @@ static int get_frontend(struct dvb_frontend *fe, struct dtv_frontend_properties
} }
static struct dvb_frontend_ops m4_ops = { static struct dvb_frontend_ops m4_ops = {
.delsys = { SYS_DVBC_ANNEX_A, SYS_DVBT, SYS_DVBT2, SYS_DVBC2, SYS_ISDBT, .delsys = { SYS_DVBC_ANNEX_A, SYS_DVBC_ANNEX_B, SYS_DVBC_ANNEX_C,
SYS_DVBS, SYS_DVBS2, }, SYS_ISDBC, SYS_DVBC2,
SYS_DVBT, SYS_DVBT2, SYS_ISDBT,
SYS_DVBS, SYS_DVBS2, SYS_ISDBS, },
.info = { .info = {
.name = "M4", .name = "M4",
.frequency_min = 950000, /* DVB-T: 47125000 */ .frequency_min = 950000, /* DVB-T: 47125000 */

View File

@ -285,7 +285,7 @@ struct mci_command {
u8 rsvd1; u8 rsvd1;
u8 retry; u8 retry;
u32 frequency; u32 frequency;
} j83b_Search; } j83b_search;
struct { struct {
u8 tap; u8 tap;

View File

@ -55,7 +55,7 @@
* Maximum number of Delivery systems per frontend. It * Maximum number of Delivery systems per frontend. It
* should be smaller or equal to 32 * should be smaller or equal to 32
*/ */
#define MAX_DELSYS 8 #define MAX_DELSYS 16
/** /**
* struct dvb_frontend_tune_settings - parameters to adjust frontend tuning * struct dvb_frontend_tune_settings - parameters to adjust frontend tuning