mirror of
https://github.com/DigitalDevices/dddvb.git
synced 2023-10-10 13:37:43 +02:00
- simplify init_search_param() with new register access functions
- add stream id 0x80000000 to set streaming mode
This commit is contained in:
parent
611065f572
commit
b814026565
@ -853,45 +853,67 @@ static int stop(struct stv *state)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int init_search_param(struct stv *state)
|
static void set_pls(struct stv *state, u32 val)
|
||||||
{
|
{
|
||||||
u8 tmp;
|
if (val == state->cur_scrambling_code)
|
||||||
|
return;
|
||||||
|
write_reg(state, RSTV0910_P2_PLROOT0 + state->regoff,
|
||||||
|
val & 0xff);
|
||||||
|
write_reg(state, RSTV0910_P2_PLROOT1 + state->regoff,
|
||||||
|
(val >> 8) & 0xff);
|
||||||
|
write_reg(state, RSTV0910_P2_PLROOT2 + state->regoff,
|
||||||
|
(val >> 16) & 0x0f);
|
||||||
|
state->cur_scrambling_code = val;
|
||||||
|
}
|
||||||
|
|
||||||
read_reg(state, RSTV0910_P2_PDELCTRL1 + state->regoff, &tmp);
|
static void set_isi(struct stv *state, u32 isi)
|
||||||
tmp |= 0x20; // Filter_en (no effect if SIS=non-MIS
|
{
|
||||||
write_reg(state, RSTV0910_P2_PDELCTRL1 + state->regoff, tmp);
|
if (isi == NO_STREAM_ID_FILTER)
|
||||||
|
return;
|
||||||
|
if (isi == 0x80000000) {
|
||||||
|
set_field(FORCE_CONTINUOUS, 1);
|
||||||
|
set_field(TSOUT_NOSYNC, 1);
|
||||||
|
} else {
|
||||||
|
set_field(FILTER_EN, 1);
|
||||||
|
write_reg(state, RSTV0910_P2_ISIENTRY + state->regoff,
|
||||||
|
isi & 0xff);
|
||||||
|
write_reg(state, RSTV0910_P2_ISIBITENA + state->regoff, 0xff);
|
||||||
|
}
|
||||||
|
set_field(ALGOSWRST, 1);
|
||||||
|
set_field(ALGOSWRST, 0);
|
||||||
|
}
|
||||||
|
|
||||||
read_reg(state, RSTV0910_P2_PDELCTRL2 + state->regoff, &tmp);
|
static void set_stream_modes(struct stv *state, struct dtv_frontend_properties *p)
|
||||||
tmp &= ~0x02; // frame mode = 0
|
{
|
||||||
write_reg(state, RSTV0910_P2_PDELCTRL2 + state->regoff, tmp);
|
u32 scrambling_code = 1;
|
||||||
|
|
||||||
write_reg(state, RSTV0910_P2_UPLCCST0 + state->regoff, 0xe0);
|
set_isi(state, p->stream_id);
|
||||||
write_reg(state, RSTV0910_P2_ISIBITENA + state->regoff, 0x00);
|
|
||||||
|
|
||||||
read_reg(state, RSTV0910_P2_TSSTATEM + state->regoff, &tmp);
|
/* Backwards compatibility to API in CrazyCat tree.
|
||||||
tmp &= ~0x01; // nosync = 0, in case next signal is standard TS
|
* PRBS X root cannot be 0, so this should always work.
|
||||||
write_reg(state, RSTV0910_P2_TSSTATEM + state->regoff, tmp);
|
*/
|
||||||
|
if ((p->stream_id != NO_STREAM_ID_FILTER) &&
|
||||||
read_reg(state, RSTV0910_P2_TSCFGL + state->regoff, &tmp);
|
(p->stream_id & 0xfffff00))
|
||||||
tmp &= ~0x04; // embindvb = 0
|
scrambling_code = 0xfffff & (p->stream_id >> 8);
|
||||||
write_reg(state, RSTV0910_P2_TSCFGL + state->regoff, tmp);
|
/* p->pls is always gold code ! */
|
||||||
|
if (p->pls != NO_SCRAMBLING_CODE)
|
||||||
read_reg(state, RSTV0910_P2_TSINSDELH + state->regoff, &tmp);
|
scrambling_code = p->pls | 0x40000;
|
||||||
tmp &= ~0x80; // syncbyte = 0
|
set_pls(state, scrambling_code);
|
||||||
write_reg(state, RSTV0910_P2_TSINSDELH + state->regoff, tmp);
|
}
|
||||||
|
|
||||||
read_reg(state, RSTV0910_P2_TSINSDELM + state->regoff, &tmp);
|
|
||||||
tmp &= ~0x08; // token = 0
|
|
||||||
write_reg(state, RSTV0910_P2_TSINSDELM + state->regoff, tmp);
|
|
||||||
|
|
||||||
read_reg(state, RSTV0910_P2_TSDLYSET2 + state->regoff, &tmp);
|
|
||||||
tmp &= ~0x30; // hysteresis threshold = 0
|
|
||||||
write_reg(state, RSTV0910_P2_TSDLYSET2 + state->regoff, tmp);
|
|
||||||
|
|
||||||
read_reg(state, RSTV0910_P2_PDELCTRL0 + state->regoff, &tmp);
|
|
||||||
tmp = (tmp & ~0x30) | 0x10; // isi obs mode = 1, observe min ISI
|
|
||||||
write_reg(state, RSTV0910_P2_PDELCTRL0 + state->regoff, tmp);
|
|
||||||
|
|
||||||
|
static int init_search_param(struct stv *state, struct dtv_frontend_properties *p)
|
||||||
|
{
|
||||||
|
set_field(FORCE_CONTINUOUS, 0);
|
||||||
|
set_field(FRAME_MODE, 0);
|
||||||
|
set_field(FILTER_EN, 0);
|
||||||
|
set_field(TSOUT_NOSYNC, 0);
|
||||||
|
set_field(TSFIFO_EMBINDVB, 0);
|
||||||
|
set_field(TSDEL_SYNCBYTE, 0);
|
||||||
|
set_reg(UPLCCST0, 0xe0);
|
||||||
|
set_field(TSINS_TOKEN, 0);
|
||||||
|
set_field(HYSTERESIS_THRESHOLD, 0);
|
||||||
|
set_field(ISIOBS_MODE, 1);
|
||||||
|
set_stream_modes(state, p);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -974,7 +996,6 @@ static int start(struct stv *state, struct dtv_frontend_properties *p)
|
|||||||
s32 freq;
|
s32 freq;
|
||||||
u8 reg_dmdcfgmd;
|
u8 reg_dmdcfgmd;
|
||||||
u16 symb;
|
u16 symb;
|
||||||
u32 scrambling_code = 1;
|
|
||||||
|
|
||||||
if (p->symbol_rate < 100000 || p->symbol_rate > 70000000)
|
if (p->symbol_rate < 100000 || p->symbol_rate > 70000000)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
@ -986,32 +1007,7 @@ static int start(struct stv *state, struct dtv_frontend_properties *p)
|
|||||||
if (state->started)
|
if (state->started)
|
||||||
write_reg(state, RSTV0910_P2_DMDISTATE + state->regoff, 0x5C);
|
write_reg(state, RSTV0910_P2_DMDISTATE + state->regoff, 0x5C);
|
||||||
|
|
||||||
init_search_param(state);
|
init_search_param(state, p);
|
||||||
|
|
||||||
if (p->stream_id != NO_STREAM_ID_FILTER) {
|
|
||||||
/* Backwards compatibility to "crazy" API.
|
|
||||||
* PRBS X root cannot be 0, so this should always work.
|
|
||||||
*/
|
|
||||||
if (p->stream_id & 0xffffff00)
|
|
||||||
scrambling_code = p->stream_id >> 8;
|
|
||||||
write_reg(state, RSTV0910_P2_ISIENTRY + state->regoff,
|
|
||||||
p->stream_id & 0xff);
|
|
||||||
write_reg(state, RSTV0910_P2_ISIBITENA + state->regoff, 0xff);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* props->pls is always gold code ! */
|
|
||||||
if (p->pls != NO_SCRAMBLING_CODE)
|
|
||||||
scrambling_code = p->pls | 0x40000;
|
|
||||||
|
|
||||||
if (scrambling_code != state->cur_scrambling_code) {
|
|
||||||
write_reg(state, RSTV0910_P2_PLROOT0 + state->regoff,
|
|
||||||
scrambling_code & 0xff);
|
|
||||||
write_reg(state, RSTV0910_P2_PLROOT1 + state->regoff,
|
|
||||||
(scrambling_code >> 8) & 0xff);
|
|
||||||
write_reg(state, RSTV0910_P2_PLROOT2 + state->regoff,
|
|
||||||
(scrambling_code >> 16) & 0x0f);
|
|
||||||
state->cur_scrambling_code = scrambling_code;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (p->symbol_rate <= 1000000) { /*SR <=1Msps*/
|
if (p->symbol_rate <= 1000000) { /*SR <=1Msps*/
|
||||||
state->demod_timeout = 3000;
|
state->demod_timeout = 3000;
|
||||||
|
Loading…
Reference in New Issue
Block a user