Paste number 23544: diagn. patch

Paste number 23544: diagn. patch
Pasted by: schorpp
When:8 years, 4 months ago
Share:Tweet this! | http://paste.lisp.org/+I60
Channel:None
Paste contents:
Raw Source | XML | Display As
--- ves1820.c 2006-07-25 05:36:01.000000000 +0200
+++ ves1820.c	2006-08-01 23:15:16.000000000 +0200
@@ -240,26 +240,36 @@
 static int ves1820_read_status(struct dvb_frontend* fe, fe_status_t* status)
 {
 	struct ves1820_state* state = fe->demodulator_priv;
-	int sync;
-
+	u8 sync = ves1820_readreg(state, 0x11);
+	u8 vagc = ves1820_readreg(state, 0x17);
+	u8 mse = ves1820_readreg(state, 0x18);
+	u8 pwmref = ves1820_readreg(state, 0x34);
+	s8 vafc = ves1820_readreg(state, 0x19);
 	*status = 0;
-	sync = ves1820_readreg(state, 0x11);
-
-	if (sync & 1)
+	
+	if (sync & 1) {
 		*status |= FE_HAS_SIGNAL;
+		*status |= FE_HAS_VITERBI;
+	}
 
 	if (sync & 2)
 		*status |= FE_HAS_CARRIER;
 
-	if (sync & 2)	/* XXX FIXME! */
-		*status |= FE_HAS_VITERBI;
-
 	if (sync & 4)
 		*status |= FE_HAS_SYNC;
 
 	if (sync & 8)
 		*status |= FE_HAS_LOCK;
 
+	if (verbose) {
+		printk("\n ves1820: Verbose Status: \n");
+		if (sync & 64) printk("ves1820: NODVB The framing of the Stream is not DVB compliant! \n");
+		printk("ves1820: VAFC %d \n", vafc);
+		printk("ves1820: VAGC 0x%02x \n", vagc);
+		printk("ves1820: PWMREF 0x%02x \n", pwmref);
+		printk("ves1820: MSE 0x%02x \n", mse);
+		printk("ves1820: BER-RANGE %d \n", !(sync >> 4));
+	}
 	return 0;
 }
 
@@ -313,11 +323,8 @@
 static int ves1820_get_frontend(struct dvb_frontend* fe, struct dvb_frontend_parameters *p)
 {
 	struct ves1820_state* state = fe->demodulator_priv;
-	int sync;
-	s8 afc = 0;
-
-	sync = ves1820_readreg(state, 0x11);
-	afc = ves1820_readreg(state, 0x19);
+	u8 sync = ves1820_readreg(state, 0x11);
+	s8 afc = ves1820_readreg(state, 0x19);
 	if (verbose) {
 		/* AFC only valid when carrier has been recovered */
 		printk(sync & 2 ? "ves1820: AFC (%d) %dHz\n" :
@@ -387,11 +394,14 @@
 	state->pwm = pwm;
 
 	/* check if the demod is there */
-	if ((ves1820_readreg(state, 0x1a) & 0xf0) != 0x70)
+	u8 id = ves1820_readreg(state, 0x1a);
+	if ((id & 0xf0) != 0x70)
 		goto error;
-
-	if (verbose)
+	else
+	if (verbose) {
+		printk("ves1820: Detected Chip Version 0x%02x\n", id);
 		printk("ves1820: pwm=0x%02x\n", state->pwm);
+	}
 
 	state->ops.info.symbol_rate_min = (state->config->xin / 2) / 64;      /* SACLK/64 == (XIN/2)/64 */
 	state->ops.info.symbol_rate_max = (state->config->xin / 2) / 4;       /* SACLK/4 */

This paste has no annotations.

Colorize as:
Show Line Numbers

Lisppaste pastes can be made by anyone at any time. Imagine a fearsomely comprehensive disclaimer of liability. Now fear, comprehensively.