Wednesday, May 22nd 2013, 4:04am UTC+1
You are not logged in.
Dear visitor, welcome to Linux VDR/DVB форум. If this is your first visit here, please read the Help. It explains how this page works. You must be registered before you can use all the page's features. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.
This post has been edited 2 times, last edit by "dimka_9" (Jan 14th 2010, 8:16pm)

|
|
Source code |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
igor@useri:/xxx/xxx/xxx/s2-liplianin$ hg diff
diff -r 8c8997d531c6 linux/drivers/media/dvb/frontends/stb0899_drv.c
--- a/linux/drivers/media/dvb/frontends/stb0899_drv.c Tue Sep 07 03:17:20 2010 +0300
+++ b/linux/drivers/media/dvb/frontends/stb0899_drv.c Wed Sep 08 19:40:09 2010 +0300
@@ -962,6 +962,8 @@
return res;
}
+#define MIN_STRENGTH_DVBS 0
+#define MAX_STRENGTH_DVBS 680
static int stb0899_read_signal_strength(struct dvb_frontend *fe, u16 *strength)
{
struct stb0899_state *state = fe->demodulator_priv;
@@ -981,6 +983,15 @@
*strength = stb0899_table_lookup(stb0899_dvbsrf_tab, ARRAY_SIZE(stb0899_dvbsrf_tab) - 1, val);
*strength += 750;
+
+ if (*strength < MIN_STRENGTH_DVBS)
+ *strength = 0;
+ else if (*strength > MAX_STRENGTH_DVBS)
+ *strength = 0xffff;
+ else
+ *strength = (*strength - MIN_STRENGTH_DVBS) * 0xffff
+ / (MAX_STRENGTH_DVBS - MIN_STRENGTH_DVBS);
+
dprintk(state->verbose, FE_DEBUG, 1, "AGCIQVALUE = 0x%02x, C = %d * 0.1 dBm",
val & 0xff, *strength);
}
@@ -993,6 +1004,7 @@
*strength = stb0899_table_lookup(stb0899_dvbs2rf_tab, ARRAY_SIZE(stb0899_dvbs2rf_tab) - 1, val);
*strength += 750;
+ *strength = *strength << 4;
dprintk(state->verbose, FE_DEBUG, 1, "IF_AGC_GAIN = 0x%04x, C = %d * 0.1 dBm",
val & 0x3fff, *strength);
}
@@ -1005,6 +1017,10 @@
return 0;
}
+#define MIN_SNR_DVBS 0
+#define MAX_SNR_DVBS 200
+#define MIN_SNR_DVBS2 10
+#define MAX_SNR_DVBS2 70
static int stb0899_read_snr(struct dvb_frontend *fe, u16 *snr)
{
struct stb0899_state *state = fe->demodulator_priv;
@@ -1025,6 +1041,15 @@
val = MAKEWORD16(buf[0], buf[1]);
*snr = stb0899_table_lookup(stb0899_cn_tab, ARRAY_SIZE(stb0899_cn_tab) - 1, val);
+
+ if (*snr < MIN_SNR_DVBS)
+ *snr = 0;
+ else if (*snr > MAX_SNR_DVBS)
+ *snr = 0xffff;
+ else
+ *snr = (*snr - MIN_SNR_DVBS) * 0xffff
+ / (MAX_SNR_DVBS - MIN_SNR_DVBS);
+
dprintk(state->verbose, FE_DEBUG, 1, "NIR = 0x%02x%02x = %u, C/N = %d * 0.1 dBm\n",
buf[0], buf[1], val, *snr);
}
@@ -1049,6 +1074,15 @@
val = (quantn - estn) / 10;
}
*snr = val;
+
+ if (*snr < MIN_SNR_DVBS2)
+ *snr = 0;
+ else if (*snr > MAX_SNR_DVBS2)
+ *snr = 0xffff;
+ else
+ *snr = (*snr - MIN_SNR_DVBS2) * 0xffff
+ / (MAX_SNR_DVBS2 - MIN_SNR_DVBS2);
+
dprintk(state->verbose, FE_DEBUG, 1, "Es/N0 quant = %d (%d) estimate = %u (%d), C/N = %d * 0.1 dBm",
quant, quantn, est, estn, val);
}
|
