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

add support for DVB-S2 scrambling code and ISI

This commit is contained in:
Ralph Metzler 2016-06-08 12:13:16 +02:00
parent 421adf6872
commit 8908df8098
7 changed files with 38 additions and 23 deletions

View File

@ -955,6 +955,7 @@ static int dvb_frontend_clear_cache(struct dvb_frontend *fe)
} }
c->stream_id = NO_STREAM_ID_FILTER; c->stream_id = NO_STREAM_ID_FILTER;
c->scrambling_code = NO_SCRAMBLING_CODE;
switch (c->delivery_system) { switch (c->delivery_system) {
case SYS_DVBS: case SYS_DVBS:
@ -1031,6 +1032,7 @@ static struct dtv_cmds_h dtv_cmds[DTV_MAX_COMMAND + 1] = {
_DTV_CMD(DTV_DVBT2_PLP_ID_LEGACY, 1, 0), _DTV_CMD(DTV_DVBT2_PLP_ID_LEGACY, 1, 0),
_DTV_CMD(DTV_LNA, 1, 0), _DTV_CMD(DTV_LNA, 1, 0),
_DTV_CMD(DTV_INPUT, 1, 0), _DTV_CMD(DTV_INPUT, 1, 0),
_DTV_CMD(DTV_SCRAMBLING_CODE, 1, 0),
/* Get */ /* Get */
_DTV_CMD(DTV_DISEQC_SLAVE_REPLY, 0, 1), _DTV_CMD(DTV_DISEQC_SLAVE_REPLY, 0, 1),
@ -1462,6 +1464,10 @@ static int dtv_property_process_get(struct dvb_frontend *fe,
tvp->u.buffer.len = 4; tvp->u.buffer.len = 4;
break; break;
case DTV_SCRAMBLING_CODE:
tvp->u.data = c->scrambling_code;
break;
/* Fill quality measures */ /* Fill quality measures */
case DTV_STAT_SIGNAL_STRENGTH: case DTV_STAT_SIGNAL_STRENGTH:
tvp->u.st = c->strength; tvp->u.st = c->strength;
@ -1901,6 +1907,10 @@ static int dtv_property_process_set(struct dvb_frontend *fe,
r = fe->ops.set_input(fe, c->input); r = fe->ops.set_input(fe, c->input);
break; break;
case DTV_SCRAMBLING_CODE:
c->scrambling_code = tvp->u.data;
break;
default: default:
return -EINVAL; return -EINVAL;
} }

View File

@ -397,6 +397,7 @@ struct dtv_frontend_properties {
u32 lna; u32 lna;
s32 input; s32 input;
u32 scrambling_code;
/* statistics data */ /* statistics data */
struct dtv_fe_stats strength; struct dtv_fe_stats strength;

View File

@ -1234,7 +1234,7 @@ static int set_parameters(struct dvb_frontend *fe)
fe->ops.tuner_ops.set_params(fe); fe->ops.tuner_ops.set_params(fe);
state->bandwidth = fe->dtv_property_cache.bandwidth_hz; state->bandwidth = fe->dtv_property_cache.bandwidth_hz;
state->bw = (fe->dtv_property_cache.bandwidth_hz + 999999) / 1000000; state->bw = (fe->dtv_property_cache.bandwidth_hz + 999999) / 1000000;
if (fe->dtv_property_cache.stream_id == 0xffffffff) { if (fe->dtv_property_cache.stream_id == NO_STREAM_ID_FILTER) {
state->DataSliceID = 0xffffffff; state->DataSliceID = 0xffffffff;
state->plp = 0xffffffff; state->plp = 0xffffffff;
} else { } else {
@ -1912,7 +1912,7 @@ static int get_fe_t2(struct cxd_state *state)
freeze_regst(state); freeze_regst(state);
readregst_unlocked(state, 0x20, 0x5c, ofdm, 5); readregst_unlocked(state, 0x20, 0x5c, ofdm, 5);
readregst_unlocked(state, 0x22, 0x5b, &modcod, 2); readregst_unlocked(state, 0x22, 0x5b, modcod, 2);
unfreeze_regst(state); unfreeze_regst(state);
switch (modcod[0] & 0x07) { switch (modcod[0] & 0x07) {

View File

@ -128,9 +128,7 @@ struct stv {
int isVCM; int isVCM;
u32 CurScramblingCode; u32 CurScramblingCode;
u32 ForceScramblingCode;
u32 ScramblingCode; u32 ScramblingCode;
u32 DefaultInputStreamID;
u32 LastBERNumerator; u32 LastBERNumerator;
u32 LastBERDenominator; u32 LastBERDenominator;
@ -964,7 +962,6 @@ static int Start(struct stv *state, struct dtv_frontend_properties *p)
u8 regDMDCFGMD; u8 regDMDCFGMD;
u16 symb; u16 symb;
u32 ScramblingCode; u32 ScramblingCode;
u32 InputStreamID;
if (p->symbol_rate < 100000 || p->symbol_rate > 70000000) if (p->symbol_rate < 100000 || p->symbol_rate > 70000000)
return -EINVAL; return -EINVAL;
@ -978,24 +975,26 @@ static int Start(struct stv *state, struct dtv_frontend_properties *p)
init_search_param(state); init_search_param(state);
#if 0 if (p->scrambling_code != NO_SCRAMBLING_CODE)
if (state->ForceScramblingCode != (u32) (-1) ) ScramblingCode = p->scrambling_code;
state->ScramblingCode = state->ForceScramblingCode; else
ScramblingCode = (state->ScramblingCode & 0xFF800000 ) ? DD_PLS_DEFAULT_ROOT : state->ScramblingCode; ScramblingCode = 1;
if (ScramblingCode != state->CurScramblingCode) { if (ScramblingCode != state->CurScramblingCode) {
write_reg(state, RSTV0910_P2_PLROOT0 + state->regoff, ScramblingCode & 0xff); write_reg(state, RSTV0910_P2_PLROOT0 + state->regoff,
write_reg(state, RSTV0910_P2_PLROOT1 + state->regoff, (ScramblingCode >> 8) & 0xff); ScramblingCode & 0xff);
write_reg(state, RSTV0910_P2_PLROOT2 + state->regoff, (ScramblingCode >> 16) & 0xff); write_reg(state, RSTV0910_P2_PLROOT1 + state->regoff,
(ScramblingCode >> 8) & 0xff);
write_reg(state, RSTV0910_P2_PLROOT2 + state->regoff,
(ScramblingCode >> 16) & 0x07);
state->CurScramblingCode = ScramblingCode; state->CurScramblingCode = ScramblingCode;
} }
InputStreamID = (p->stream_id != (u32) -1) ? p->stream_id : state->DefaultInputStreamID; if (p->stream_id != NO_STREAM_ID_FILTER) {
if (InputStreamID != (u32) -1) { write_reg(state, RSTV0910_P2_ISIENTRY + state->regoff, p->stream_id & 0xff);
write_reg(state, RSTV0910_P2_ISIENTRY + state->regoff, InputStreamID & 0xff);
write_reg(state, RSTV0910_P2_ISIBITENA + state->regoff, 0xff); write_reg(state, RSTV0910_P2_ISIBITENA + state->regoff, 0xff);
} }
#endif
if (p->symbol_rate <= 1000000) { /*SR <=1Msps*/ if (p->symbol_rate <= 1000000) { /*SR <=1Msps*/
state->DemodTimeout = 3000; state->DemodTimeout = 3000;
state->FecTimeout = 2000; state->FecTimeout = 2000;
@ -1346,7 +1345,6 @@ static int read_ber(struct dvb_frontend *fe, u32 *ber);
static int read_status(struct dvb_frontend *fe, fe_status_t *status) static int read_status(struct dvb_frontend *fe, fe_status_t *status)
{ {
struct stv *state = fe->demodulator_priv; struct stv *state = fe->demodulator_priv;
struct dtv_frontend_properties *p = &fe->dtv_property_cache;
u8 DmdState = 0; u8 DmdState = 0;
u8 DStatus = 0; u8 DStatus = 0;
enum ReceiveMode CurReceiveMode = Mode_None; enum ReceiveMode CurReceiveMode = Mode_None;
@ -1822,9 +1820,7 @@ struct dvb_frontend *stv0910_attach(struct i2c_adapter *i2c,
state->SearchRange = 16000000; state->SearchRange = 16000000;
state->DEMOD = 0x10; /* Inversion : Auto with reset to 0 */ state->DEMOD = 0x10; /* Inversion : Auto with reset to 0 */
state->ReceiveMode = Mode_None; state->ReceiveMode = Mode_None;
state->CurScramblingCode = (u32) -1; state->CurScramblingCode = NO_SCRAMBLING_CODE;
state->ForceScramblingCode = (u32) -1;
state->DefaultInputStreamID = (u32) -1;
base = match_base(i2c, cfg->adr); base = match_base(i2c, cfg->adr);
if (base) { if (base) {

View File

@ -618,7 +618,6 @@ static struct SLookup Gain_Channel_AGC_IIP3_LookUp[] = {
{ 1325 , 0xFF00 }, { 1325 , 0xFF00 },
}; };
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
static s32 TableLookup(struct SLookup *Table, int TableSize, u16 RegValue) static s32 TableLookup(struct SLookup *Table, int TableSize, u16 RegValue)
{ {

View File

@ -379,8 +379,9 @@ struct dvb_frontend_event {
#define DTV_STAT_TOTAL_BLOCK_COUNT 69 #define DTV_STAT_TOTAL_BLOCK_COUNT 69
#define DTV_INPUT 70 #define DTV_INPUT 70
#define DTV_SCRAMBLING_CODE 71
#define DTV_MAX_COMMAND DTV_INPUT #define DTV_MAX_COMMAND DTV_SCRAMBLING_CODE
typedef enum fe_pilot { typedef enum fe_pilot {
PILOT_ON, PILOT_ON,
@ -455,6 +456,7 @@ enum atscmh_rs_code_mode {
}; };
#define NO_STREAM_ID_FILTER (~0U) #define NO_STREAM_ID_FILTER (~0U)
#define NO_SCRAMBLING_CODE (~0U)
#define LNA_AUTO (~0U) #define LNA_AUTO (~0U)
struct dtv_cmds_h { struct dtv_cmds_h {

View File

@ -50,6 +50,11 @@ struct dvb_nsd_ts {
__u16 section_id; __u16 section_id;
}; };
struct dvb_ns_cap {
__u8 streams_max;
__u8 reserved[127];
};
#define NS_SET_NET _IOW('o', 192, struct dvb_ns_params) #define NS_SET_NET _IOW('o', 192, struct dvb_ns_params)
#define NS_START _IO('o', 193) #define NS_START _IO('o', 193)
#define NS_STOP _IO('o', 194) #define NS_STOP _IO('o', 194)
@ -66,4 +71,6 @@ struct dvb_nsd_ts {
#define NS_INSERT_PACKETS _IOW('o', 203, __u8) #define NS_INSERT_PACKETS _IOW('o', 203, __u8)
#define NS_SET_CI _IOW('o', 204, __u8) #define NS_SET_CI _IOW('o', 204, __u8)
#define NS_GET_CAP _IOR('o', 204, struct dvb_ns_cap))
#endif /*_UAPI_DVBNS_H_*/ #endif /*_UAPI_DVBNS_H_*/