summaryrefslogtreecommitdiff
path: root/linux/drivers/media/dvb
diff options
context:
space:
mode:
authorPatrick Boettcher <devnull@localhost>2004-09-20 15:26:36 +0000
committerPatrick Boettcher <devnull@localhost>2004-09-20 15:26:36 +0000
commitf81e5554d91ce28da5a7c83c3a12772da8782f5f (patch)
tree565b3bb2dd5e46aaca7436d1aa4a7e158c71c220 /linux/drivers/media/dvb
parent0c68f2871259818657693bdf2d82ac92bd70600e (diff)
downloadmediapointer-dvb-s2-f81e5554d91ce28da5a7c83c3a12772da8782f5f.tar.gz
mediapointer-dvb-s2-f81e5554d91ce28da5a7c83c3a12772da8782f5f.tar.bz2
- read unc, ber, signal strength
- corrected FEC_2_3 handling - debug methods
Diffstat (limited to 'linux/drivers/media/dvb')
-rw-r--r--linux/drivers/media/dvb/frontends/dib3000mb.c156
-rw-r--r--linux/drivers/media/dvb/frontends/dib3000mb.h18
2 files changed, 118 insertions, 56 deletions
diff --git a/linux/drivers/media/dvb/frontends/dib3000mb.c b/linux/drivers/media/dvb/frontends/dib3000mb.c
index afb90ad95..4ee48a516 100644
--- a/linux/drivers/media/dvb/frontends/dib3000mb.c
+++ b/linux/drivers/media/dvb/frontends/dib3000mb.c
@@ -36,19 +36,21 @@
/* debug */
#ifdef CONFIG_DVB_DIBCOM_DEBUG
-#define dprintk_new(level,args...) \
+#define dprintk(level,args...) \
do { if ((debug & level)) { printk(args); } } while (0)
static int debug;
module_param(debug, int, 0x644);
-MODULE_PARM_DESC(debug, "set debugging level (1=info,2=xfer,4=alotmore (|-able)).");
+MODULE_PARM_DESC(debug, "set debugging level (1=info,2=xfer,4=alotmore,8=setfe,16=getfe (|-able)).");
#else
-#define dprintk_new(args...)
+#define dprintk(args...) do { } while (0);
#endif
-#define deb_info(args...) dprintk_new(0x01,args)
-#define deb_xfer(args...) dprintk_new(0x02,args)
-#define deb_alot(args...) dprintk_new(0x04,args)
+#define deb_info(args...) dprintk(0x01,args)
+#define deb_xfer(args...) dprintk(0x02,args)
+#define deb_alot(args...) dprintk(0x04,args)
+#define deb_setf(args...) dprintk(0x08,args)
+#define deb_getf(args...) dprintk(0x10,args)
/* Version information */
#define DRIVER_VERSION "0.1"
@@ -172,56 +174,56 @@ static int dib3000mb_get_frontend(struct dib3000mb_state *state,
||
((inv_test2 == 0) && (inv_test1==1 || inv_test1==2));
- deb_info("inversion %d %d, %d\n",inv_test2,inv_test1, fep->inversion);
+ deb_getf("inversion %d %d, %d\n",inv_test2,inv_test1, fep->inversion);
switch ((tps_val = rd(DIB3000MB_REG_TPS_QAM))) {
case DIB3000MB_QAM_QPSK:
- deb_info("QPSK ");
+ deb_getf("QPSK ");
ofdm->constellation = QPSK;
break;
case DIB3000MB_QAM_QAM16:
- deb_info("QAM16 ");
+ deb_getf("QAM16 ");
ofdm->constellation = QAM_16;
break;
case DIB3000MB_QAM_QAM64:
- deb_info("QAM64 ");
+ deb_getf("QAM64 ");
ofdm->constellation = QAM_64;
break;
default:
err("Unexpected constellation returned by TPS (%d)",tps_val);
break;
}
- deb_info("TPS: %d\n",tps_val);
+ deb_getf("TPS: %d\n",tps_val);
if (rd(DIB3000MB_REG_TPS_HRCH)) {
- deb_info("HRCH ON\n");
+ deb_getf("HRCH ON\n");
tps_val = rd(DIB3000MB_REG_TPS_CODE_RATE_LP);
cr = &ofdm->code_rate_LP;
ofdm->code_rate_HP = FEC_NONE;
switch ((tps_val = rd(DIB3000MB_REG_TPS_VIT_ALPHA))) {
case DIB3000MB_VIT_ALPHA_OFF:
- deb_info("HIERARCHY_NONE ");
+ deb_getf("HIERARCHY_NONE ");
ofdm->hierarchy_information = HIERARCHY_NONE;
break;
case DIB3000MB_VIT_ALPHA_1:
- deb_info("HIERARCHY_1 ");
+ deb_getf("HIERARCHY_1 ");
ofdm->hierarchy_information = HIERARCHY_1;
break;
case DIB3000MB_VIT_ALPHA_2:
- deb_info("HIERARCHY_2 ");
+ deb_getf("HIERARCHY_2 ");
ofdm->hierarchy_information = HIERARCHY_2;
break;
case DIB3000MB_VIT_ALPHA_4:
- deb_info("HIERARCHY_4 ");
+ deb_getf("HIERARCHY_4 ");
ofdm->hierarchy_information = HIERARCHY_4;
break;
default:
err("Unexpected ALPHA value returned by TPS (%d)",tps_val);
}
- deb_info("TPS: %d\n",tps_val);
+ deb_getf("TPS: %d\n",tps_val);
} else {
- deb_info("HRCH OFF\n");
+ deb_getf("HRCH OFF\n");
tps_val = rd(DIB3000MB_REG_TPS_CODE_RATE_HP);
cr = &ofdm->code_rate_HP;
ofdm->code_rate_LP = FEC_NONE;
@@ -230,67 +232,67 @@ static int dib3000mb_get_frontend(struct dib3000mb_state *state,
switch (tps_val) {
case DIB3000MB_FEC_1_2:
- deb_info("FEC_1_2 ");
+ deb_getf("FEC_1_2 ");
*cr = FEC_1_2;
break;
case DIB3000MB_FEC_2_3:
- deb_info("FEC_2_3 ");
+ deb_getf("FEC_2_3 ");
*cr = FEC_2_3;
break;
case DIB3000MB_FEC_3_4:
- deb_info("FEC_3_4 ");
+ deb_getf("FEC_3_4 ");
*cr = FEC_3_4;
break;
case DIB3000MB_FEC_5_6:
- deb_info("FEC_5_6 ");
+ deb_getf("FEC_5_6 ");
*cr = FEC_4_5;
break;
case DIB3000MB_FEC_7_8:
- deb_info("FEC_7_8 ");
+ deb_getf("FEC_7_8 ");
*cr = FEC_7_8;
break;
default:
err("Unexpected FEC returned by TPS (%d)",tps_val);
break;
}
- deb_info("TPS: %d\n",tps_val);
+ deb_getf("TPS: %d\n",tps_val);
switch ((tps_val = rd(DIB3000MB_REG_TPS_GUARD_TIME))) {
case DIB3000MB_GUARD_TIME_1_32:
- deb_info("GUARD_INTERVAL_1_32 ");
+ deb_getf("GUARD_INTERVAL_1_32 ");
ofdm->guard_interval = GUARD_INTERVAL_1_32;
break;
case DIB3000MB_GUARD_TIME_1_16:
- deb_info("GUARD_INTERVAL_1_16 ");
+ deb_getf("GUARD_INTERVAL_1_16 ");
ofdm->guard_interval = GUARD_INTERVAL_1_16;
break;
case DIB3000MB_GUARD_TIME_1_8:
- deb_info("GUARD_INTERVAL_1_8 ");
+ deb_getf("GUARD_INTERVAL_1_8 ");
ofdm->guard_interval = GUARD_INTERVAL_1_8;
break;
case DIB3000MB_GUARD_TIME_1_4:
- deb_info("GUARD_INTERVAL_1_4 ");
+ deb_getf("GUARD_INTERVAL_1_4 ");
ofdm->guard_interval = GUARD_INTERVAL_1_4;
break;
default:
err("Unexpected Guard Time returned by TPS (%d)",tps_val);
break;
}
- deb_info("TPS: %d\n",tps_val);
+ deb_getf("TPS: %d\n",tps_val);
switch ((tps_val = rd(DIB3000MB_REG_TPS_FFT))) {
case DIB3000MB_FFT_2K:
- deb_info("TRANSMISSION_MODE_2K ");
+ deb_getf("TRANSMISSION_MODE_2K ");
ofdm->transmission_mode = TRANSMISSION_MODE_2K;
break;
case DIB3000MB_FFT_8K:
- deb_info("TRANSMISSION_MODE_8K ");
+ deb_getf("TRANSMISSION_MODE_8K ");
ofdm->transmission_mode = TRANSMISSION_MODE_8K;
break;
default:
err("unexpected transmission mode return by TPS (%d)",tps_val);
}
- deb_info("TPS: %d\n",tps_val);
+ deb_getf("TPS: %d\n",tps_val);
return 0;
}
@@ -307,18 +309,18 @@ static int dib3000mb_fe_read_search_status(struct dib3000mb_state *state)
if (irq & 0x02) {
if (rd(DIB3000MB_REG_LOCK2_VALUE) & 0x01) {
if (dib3000mb_get_frontend(state,&fep) == 0) {
- deb_info("reading tuning data from frontend succeeded.\n");
+ deb_setf("reading tuning data from frontend succeeded.\n");
return dib3000mb_set_frontend(state,&fep,0) == 0;
} else {
- deb_info("reading tuning data failed -> tuning failed.\n");
+ deb_setf("reading tuning data failed -> tuning failed.\n");
return 0;
}
} else {
- deb_info("AS IRQ was pending, but LOCK2 was not & 0x01.\n");
+ deb_setf("AS IRQ was pending, but LOCK2 was not & 0x01.\n");
return 0;
}
} else if (irq & 0x01) {
- deb_info("Autosearch failed.\n");
+ deb_setf("Autosearch failed.\n");
return 0;
}
@@ -329,7 +331,7 @@ static int dib3000mb_set_frontend(struct dib3000mb_state *state,
struct dvb_frontend_parameters *fep, int tuner)
{
struct dvb_ofdm_parameters *ofdm = &fep->u.ofdm;
- fe_code_rate_t fe_cr;
+ fe_code_rate_t fe_cr = FEC_NONE;
int search_state,seq;
if (tuner) {
@@ -342,17 +344,21 @@ static int dib3000mb_set_frontend(struct dib3000mb_state *state,
wr(DIB3000MB_REG_TUNER,
DIB3000MB_DEACTIVATE_TUNER_XFER( DIB3000MB_TUNER_ADDR_DEFAULT ) );
+ deb_setf("bandwidth: ");
switch (ofdm->bandwidth) {
case BANDWIDTH_8_MHZ:
case BANDWIDTH_AUTO:
+ deb_setf("8 MHz\n");
wr_foreach(dib3000mb_reg_timing_freq,dib3000mb_timing_freq[2]);
wr_foreach(dib3000mb_reg_bandwidth,dib3000mb_bandwidth_8mhz);
break;
case BANDWIDTH_7_MHZ:
+ deb_setf("7 MHz\n");
wr_foreach(dib3000mb_reg_timing_freq,dib3000mb_timing_freq[1]);
wr_foreach(dib3000mb_reg_bandwidth,dib3000mb_bandwidth_7mhz);
break;
case BANDWIDTH_6_MHZ:
+ deb_setf("6 MHz\n");
wr_foreach(dib3000mb_reg_timing_freq,dib3000mb_timing_freq[0]);
wr_foreach(dib3000mb_reg_bandwidth,dib3000mb_bandwidth_6mhz);
break;
@@ -364,60 +370,78 @@ static int dib3000mb_set_frontend(struct dib3000mb_state *state,
}
wr(DIB3000MB_REG_LOCK1_MASK,DIB3000MB_LOCK1_SEARCH_4);
+ deb_setf("transmission mode: ");
switch (ofdm->transmission_mode) {
case TRANSMISSION_MODE_2K:
+ deb_setf("2k\n");
wr(DIB3000MB_REG_FFT,DIB3000MB_FFT_2K);
break;
case TRANSMISSION_MODE_8K:
+ deb_setf("8k\n");
wr(DIB3000MB_REG_FFT,DIB3000MB_FFT_8K);
break;
case TRANSMISSION_MODE_AUTO:
+ deb_setf("auto\n");
wr(DIB3000MB_REG_FFT,DIB3000MB_FFT_AUTO);
break;
default:
return -EINVAL;
}
+ deb_setf("guard: ");
switch (ofdm->guard_interval) {
case GUARD_INTERVAL_1_32:
+ deb_setf("1_32\n");
wr(DIB3000MB_REG_GUARD_TIME,DIB3000MB_GUARD_TIME_1_32);
break;
case GUARD_INTERVAL_1_16:
+ deb_setf("1_16\n");
wr(DIB3000MB_REG_GUARD_TIME,DIB3000MB_GUARD_TIME_1_16);
break;
case GUARD_INTERVAL_1_8:
+ deb_setf("1_8\n");
wr(DIB3000MB_REG_GUARD_TIME,DIB3000MB_GUARD_TIME_1_8);
break;
case GUARD_INTERVAL_1_4:
+ deb_setf("1_4\n");
wr(DIB3000MB_REG_GUARD_TIME,DIB3000MB_GUARD_TIME_1_4);
break;
case GUARD_INTERVAL_AUTO:
+ deb_setf("auto\n");
wr(DIB3000MB_REG_GUARD_TIME,DIB3000MB_GUARD_TIME_AUTO);
break;
default:
return -EINVAL;
}
+ deb_setf("invsersion: ");
switch (fep->inversion) {
case INVERSION_OFF:
+ deb_setf("on\n");
wr(DIB3000MB_REG_DDS_INV,DIB3000MB_DDS_INV_OFF);
break;
case INVERSION_AUTO:
+ deb_setf("auto ");
case INVERSION_ON:
+ deb_setf("on\n");
wr(DIB3000MB_REG_DDS_INV,DIB3000MB_DDS_INV_ON);
break;
default:
return -EINVAL;
}
+ deb_setf("constellation: ");
switch (ofdm->constellation) {
case QPSK:
+ deb_setf("qpsk\n");
wr(DIB3000MB_REG_QAM,DIB3000MB_QAM_QPSK);
break;
case QAM_16:
+ deb_setf("qam16\n");
wr(DIB3000MB_REG_QAM,DIB3000MB_QAM_QAM16);
break;
case QAM_64:
+ deb_setf("qam64\n");
wr(DIB3000MB_REG_QAM,DIB3000MB_QAM_QAM64);
break;
case QAM_AUTO:
@@ -425,53 +449,68 @@ static int dib3000mb_set_frontend(struct dib3000mb_state *state,
default:
return -EINVAL;
}
-
+ deb_setf("hierachy: ");
switch (ofdm->hierarchy_information) {
case HIERARCHY_NONE:
+ deb_setf("none ");
case HIERARCHY_1:
+ deb_setf("alpha=1\n");
wr(DIB3000MB_REG_VIT_ALPHA,DIB3000MB_VIT_ALPHA_1);
break;
case HIERARCHY_2:
+ deb_setf("alpha=2\n");
wr(DIB3000MB_REG_VIT_ALPHA,DIB3000MB_VIT_ALPHA_2);
break;
case HIERARCHY_4:
+ deb_setf("alpha=4\n");
wr(DIB3000MB_REG_VIT_ALPHA,DIB3000MB_VIT_ALPHA_4);
break;
case HIERARCHY_AUTO:
+ deb_setf("alpha=auto\n");
wr(DIB3000MB_REG_VIT_ALPHA,DIB3000MB_VIT_ALPHA_AUTO);
break;
default:
return -EINVAL;
}
+ deb_setf("hierarchy: ");
if (ofdm->hierarchy_information == HIERARCHY_NONE) {
+ deb_setf("none\n");
wr(DIB3000MB_REG_VIT_HRCH,DIB3000MB_VIT_HRCH_OFF);
wr(DIB3000MB_REG_VIT_HP,DIB3000MB_VIT_HP);
fe_cr = ofdm->code_rate_HP;
- } else {
+ } else if (ofdm->hierarchy_information != HIERARCHY_AUTO) {
+ deb_setf("on\n");
wr(DIB3000MB_REG_VIT_HRCH,DIB3000MB_VIT_HRCH_ON);
wr(DIB3000MB_REG_VIT_HP,DIB3000MB_VIT_LP);
fe_cr = ofdm->code_rate_LP;
}
-
+ deb_setf("fec: ");
switch (fe_cr) {
case FEC_1_2:
+ deb_setf("1_2\n");
wr(DIB3000MB_REG_VIT_CODE_RATE,DIB3000MB_FEC_1_2);
break;
case FEC_2_3:
+ deb_setf("2_3\n");
wr(DIB3000MB_REG_VIT_CODE_RATE,DIB3000MB_FEC_2_3);
break;
case FEC_3_4:
+ deb_setf("3_4\n");
wr(DIB3000MB_REG_VIT_CODE_RATE,DIB3000MB_FEC_3_4);
break;
case FEC_5_6:
+ deb_setf("5_6\n");
wr(DIB3000MB_REG_VIT_CODE_RATE,DIB3000MB_FEC_5_6);
break;
case FEC_7_8:
+ deb_setf("7_8\n");
wr(DIB3000MB_REG_VIT_CODE_RATE,DIB3000MB_FEC_7_8);
break;
case FEC_NONE:
+ deb_setf("none ");
case FEC_AUTO:
+ deb_setf("auto\n");
break;
default:
return -EINVAL;
@@ -482,7 +521,7 @@ static int dib3000mb_set_frontend(struct dib3000mb_state *state,
[ofdm->guard_interval == GUARD_INTERVAL_AUTO]
[fep->inversion == INVERSION_AUTO];
- deb_info("seq? %d\n",seq);
+ deb_setf("seq? %d\n",seq);
wr(DIB3000MB_REG_SEQ,seq);
@@ -522,7 +561,7 @@ static int dib3000mb_set_frontend(struct dib3000mb_state *state,
fe_cr == FEC_AUTO ||
fep->inversion == INVERSION_AUTO) {
- deb_info("autosearch enabled.\n");
+ deb_setf("autosearch enabled.\n");
wr(DIB3000MB_REG_ISI,DIB3000MB_ISI_INHIBIT);
@@ -630,6 +669,13 @@ static int dib3000mb_read_status(struct dib3000mb_state *state,fe_status_t *stat
deb_info("actual status is %2x\n",*stat);
+ deb_getf("tps %x %x %x %x %x\n",
+ rd(DIB3000MB_REG_TPS_1),
+ rd(DIB3000MB_REG_TPS_2),
+ rd(DIB3000MB_REG_TPS_3),
+ rd(DIB3000MB_REG_TPS_4),
+ rd(DIB3000MB_REG_TPS_5));
+
deb_info("autoval: tps: %d, qam: %d, hrch: %d, alpha: %d, hp: %d, lp: %d, guard: %d, fft: %d cell: %d\n",
rd(DIB3000MB_REG_TPS_LOCK),
rd(DIB3000MB_REG_TPS_QAM),
@@ -648,14 +694,28 @@ static int dib3000mb_read_status(struct dib3000mb_state *state,fe_status_t *stat
static int dib3000mb_read_ber(struct dib3000mb_state *state,u32 *ber)
{
*ber =
- (((rd(DIB3000MB_REG_BER_MSB) << 16) & 0x1f) | rd(DIB3000MB_REG_BER_LSB) ) /
- 100000000;
+ (((rd(DIB3000MB_REG_BER_MSB) & 0x1f) << 16) | rd(DIB3000MB_REG_BER_LSB) );
+ return 0;
+}
+
+static int dib3000mb_read_signal_strength(struct dib3000mb_state *state, u16 *strength)
+{
+ *strength = rd(DIB3000MB_REG_SIGNAL_POWER);
+ return 0;
+}
+
+static int dib3000mb_read_snr(struct dib3000mb_state *state,u16 *snr)
+{
+// int sigpow = rd(DIB3000MB_REG_SIGNAL_POWER);
+// u32 icipow = ((rd(DIB3000MB_REG_NOISE_POWER_MSB) & 0xff) << 16) |
+// rd(DIB3000MB_REG_NOISE_POWER_LSB);
+// if (sigpow > 0)
return 0;
}
-static int dib3000mb_signal_strength(struct dib3000mb_state *state, u16 *strength)
+static int dib3000mb_read_unc_blocks(struct dib3000mb_state *state,u32 *unc)
{
-// *stength = DIB3000MB_REG_SIGNAL_POWER
+ *unc = rd(DIB3000MB_REG_UNC);
return 0;
}
@@ -687,15 +747,17 @@ static int dib3000mb_ioctl (struct dvb_frontend *fe, unsigned int cmd, void *arg
case FE_READ_SIGNAL_STRENGTH:
deb_info("FE_READ_SIG_STRENGTH\n");
- ret = dib3000mb_signal_strength(state,(u16 *) arg);
+ ret = dib3000mb_read_signal_strength(state,(u16 *) arg);
break;
case FE_READ_SNR:
deb_info("FE_READ_SNR\n");
+ ret = dib3000mb_read_snr(state,(u16 *) arg);
break;
case FE_READ_UNCORRECTED_BLOCKS:
deb_info("FE_READ_UNCORRECTED_BLOCKS\n");
+ ret = dib3000mb_read_unc_blocks(state,(u32 *) arg);
break;
case FE_SET_FRONTEND:
diff --git a/linux/drivers/media/dvb/frontends/dib3000mb.h b/linux/drivers/media/dvb/frontends/dib3000mb.h
index c191845ae..ef97ebf31 100644
--- a/linux/drivers/media/dvb/frontends/dib3000mb.h
+++ b/linux/drivers/media/dvb/frontends/dib3000mb.h
@@ -350,13 +350,13 @@ static u16 dib3000mb_bandwidth_8mhz[] =
/* vit code rate */
#define DIB3000MB_REG_VIT_CODE_RATE ( 129)
-/* forward error correction code rates */
-#define DIB3000MB_FEC_1_2 ( 0)
-#define DIB3000MB_FEC_2_3 ( 1)
-#define DIB3000MB_FEC_3_4 ( 2)
-#define DIB3000MB_FEC_4_5 ( 3)
-#define DIB3000MB_FEC_5_6 ( 4)
-#define DIB3000MB_FEC_7_8 ( 5)
+/* forward error correction code rates TODO check these values */
+#define DIB3000MB_FEC_1_2 ( 1)
+#define DIB3000MB_FEC_2_3 ( 2)
+#define DIB3000MB_FEC_3_4 ( 3)
+#define DIB3000MB_FEC_4_5 ( 4)
+#define DIB3000MB_FEC_5_6 ( 5)
+#define DIB3000MB_FEC_7_8 ( 6)
/* vit select hp */
#define DIB3000MB_REG_VIT_HP ( 130)
@@ -627,8 +627,8 @@ static u16 dib3000mb_filter_coeffs[] = {
/* packet error rate (uncorrected TS packets) (16) */
#define DIB3000MB_REG_PACKET_ERROR_RATE ( 417)
-/* packet error count (16) */
-#define DIB3000MB_REG_PACKET_ERROR_COUNT ( 420)
+/* uncorrected packet count (16) */
+#define DIB3000MB_REG_UNC ( 420)
/* viterbi locked (1) */
#define DIB3000MB_REG_VIT_LCK ( 421)