[linux-dvb] [PATCH] Enable the BER/UNC counting for the stv0297 frontend

Oliver Endriss o.endriss at gmx.de
Tue Oct 31 06:57:55 CET 2006


e9hack wrote:
> Hi,
> 
> the attached patch enables/fixes the BER/UNC counting for the stv0297 frontend, which is used by the TT-C2300 DVB-C card.

> @@ -340,11 +343,13 @@ static int stv0297_read_ber(struct dvb_f
>        struct stv0297_state *state = fe->demodulator_priv;
>        u8 BER[3];
> 
>-       stv0297_writereg(state, 0xA0, 0x80);    // Start Counting bit errors for 4096 Bytes
>-       mdelay(25);             // Hopefully got 4096 Bytes
>        stv0297_readregs(state, 0xA0, BER, 3);
>-       mdelay(25);
>-       *ber = (BER[2] << 8 | BER[1]) / (8 * 4096);
>+       if (!(BER[0] & 0x80)) {
>+               state->last_ber = BER[2] << 8 | BER[1];
>+               stv0297_writereg_mask(state, 0xA0, 0x80, 0x80);
>+       }
>+       
>+       *ber = state->last_ber;

Hm - comparing the old code and the new one:
Is BER[] the bit error *counter* or the bit error *rate*?

If it is a counter there is something missing.


>@@ -375,9 +380,14 @@ static int stv0297_read_ucblocks(struct 
> static int stv0297_read_ucblocks(struct dvb_frontend *fe, u32 * ucblocks)
> {
>        struct stv0297_state *state = fe->demodulator_priv;
>+       
>+       stv0297_writereg_mask(state, 0xDF, 0x03, 0x03);
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
... set bits 0 and 1 ...
> 
>        *ucblocks = (stv0297_readreg(state, 0xD5) << 8)
>                | stv0297_readreg(state, 0xD4);
>+
>+       stv0297_writereg_mask(state, 0xDF, 0x03, 0x02);
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
... set bit 1, clear bit 0 ...
>+       stv0297_writereg_mask(state, 0xDF, 0x03, 0x01);
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
... clear bit 1, set bit 0 ...
> 
>        return 0;
> }

Looks suspicious to me. Is this correct?

Oliver

-- 
--------------------------------------------------------
VDR Remote Plugin 0.3.8 available at
http://www.escape-edv.de/endriss/vdr/
--------------------------------------------------------




More information about the linux-dvb mailing list