Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[linux-dvb] Re: StartHWFilter in av7110.c



On Sat, 2004-02-21 at 10:18, Andreas Share wrote:
> i have some question about StartHWFilter. Can somebody explain me the
> funktion of "buf[1] = 16" from this routine?

it is the number of following 16 bit words of which the last 14 are
(value << 8) | mask in this case. However, this length field is not
evaluated in the firmware as far as i can see.

I wonder why there are always 20 words being written to the firmware.

Does the attached patch work?

Regards,
Andreas
Index: linux/drivers/media/dvb/ttpci/av7110.c
===================================================================
RCS file: /cvs/linuxtv/dvb-kernel/linux/drivers/media/dvb/ttpci/av7110.c,v
retrieving revision 1.112
diff -u -r1.112 av7110.c
--- linux/drivers/media/dvb/ttpci/av7110.c	10 Feb 2004 17:33:01 -0000	1.112
+++ linux/drivers/media/dvb/ttpci/av7110.c	21 Feb 2004 13:45:02 -0000
@@ -716,35 +716,39 @@
 {
 	struct dvb_demux_feed *dvbdmxfeed = dvbdmxfilter->feed;
 	struct av7110 *av7110 = (struct av7110 *) dvbdmxfeed->demux->priv;
-	u16 buf[20];
+	u16 buf[18];
 	int ret, i;
 	u16 handle;
-//	u16 mode=0x0320;
-	u16 mode=0xb96a;
 
 	DEB_EE(("av7110: %p\n", av7110));
 
-	if (dvbdmxfilter->type == DMX_TYPE_SEC) {
-		if (hw_sections) {
-			buf[4] = (dvbdmxfilter->filter.filter_value[0] << 8) |
-				dvbdmxfilter->maskandmode[0];
-			for (i = 3; i < 18; i++)
-				buf[i + 4 - 2] =
-					(dvbdmxfilter->filter.filter_value[i] << 8) |
-					dvbdmxfilter->maskandmode[i];
-			mode = 4;
-		}
-	} else if ((dvbdmxfeed->ts_type & TS_PACKET) &&
-		   !(dvbdmxfeed->ts_type & TS_PAYLOAD_ONLY)) {
-		av7110_p2t_init(&av7110->p2t_filter[dvbdmxfilter->index], dvbdmxfeed);
+	if ((dvbdmxfilter->type == DMX_TYPE_SEC) && (hw_sections)) {
+		/* section filter */
+		buf[0] = (COMTYPE_PID_FILTER << 8) + AddPIDFilter;
+		buf[1] = 16;
+		buf[2] = dvbdmxfeed->pid;
+		buf[3] = 0x0004;
+
+		buf[4] = (dvbdmxfilter->filter.filter_value[0] << 8) |
+			dvbdmxfilter->maskandmode[0];
+
+		for (i = 3; i < 16; i++)
+			buf[i + 2] =
+				(dvbdmxfilter->filter.filter_value[i] << 8) |
+				dvbdmxfilter->maskandmode[i];
+	} else {
+		/* ts filter */
+		buf[0] = (COMTYPE_PID_FILTER << 8) + AddPIDFilter;
+		buf[1] = 2;
+		buf[2] = dvbdmxfeed->pid;
+		buf[3] = 0xb96a;
+
+		if ((dvbdmxfeed->ts_type & TS_PACKET) &&
+			!(dvbdmxfeed->ts_type & TS_PAYLOAD_ONLY))
+			av7110_p2t_init(&av7110->p2t_filter[dvbdmxfilter->index], dvbdmxfeed);
 	}
 
-	buf[0] = (COMTYPE_PID_FILTER << 8) + AddPIDFilter;
-	buf[1] = 16;
-	buf[2] = dvbdmxfeed->pid;
-	buf[3] = mode;
-
-	ret = av7110_fw_request(av7110, buf, 20, &handle, 1);
+	ret = av7110_fw_request(av7110, buf, buf[1] + 2, &handle, 1);
 	if (ret < 0) {
 		printk("StartHWFilter error\n");
 		return ret;

Home | Main Index | Thread Index