Skip site navigation (1)Skip section navigation (2)
Date:      Tue,  9 Nov 2004 15:46:03 +0100 (CET)
From:      Simun Mikecin <sime@logos.hr>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/73717: Update port: multimedia/pvr250 Support Microtune 4049FM5
Message-ID:  <20041109144603.00F5E26D045@mail.logos.hr>
Resent-Message-ID: <200411091450.iA9EoNHA071396@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         73717
>Category:       ports
>Synopsis:       Update port: multimedia/pvr250 Support Microtune 4049FM5
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Tue Nov 09 14:50:23 GMT 2004
>Closed-Date:
>Last-Modified:
>Originator:     Simun Mikecin
>Release:        FreeBSD 5.3-STABLE i386
>Organization:
>Environment:
System: FreeBSD data.home.hr 5.3-STABLE FreeBSD 5.3-STABLE #0: Mon Nov 8 19:22:32 CET 2004 root@data.home.hr:/usr/obj/usr/src/sys/DATA i386


	
>Description:
	
        - Added support for Microtune 4049 FM5 tuner. This tuner supports
        both PAL and SECAM video standards. Users have to select their video
        standard using 'make config' to properly initialize this tuner. I
        tried it only on European PAL B/G/H.

        - Added patches to be able to compile on 5.3-STABLE

        - Added a 'make config' option for 12MBit/s encoding
        
>How-To-Repeat:
	
>Fix:

	

--- pvr250.shar begins here ---
# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	pvr250
#	pvr250/files
#	pvr250/files/patch-modules::cxm::cxm::Makefile
#	pvr250/files/patch-modules::cxm::cxm_iic::Makefile
#	pvr250/files/patch-cxm_i2c.c
#	pvr250/files/patch-cxm.h
#	pvr250/files/patch-cxm_eeprom.c
#	pvr250/files/patch-setchannel.c
#	pvr250/files/patch-cxm.c
#	pvr250/files/patch-setsize.c
#	pvr250/files/patch-cxm_tuner.c
#	pvr250/files/patch-cxm.4
#	pvr250/files/patch-cxm_extract_fw.c
#	pvr250/Makefile
#	pvr250/distinfo
#	pvr250/pkg-descr
#	pvr250/pkg-message
#	pvr250/pkg-plist
#
echo c - pvr250
mkdir -p pvr250 > /dev/null 2>&1
echo c - pvr250/files
mkdir -p pvr250/files > /dev/null 2>&1
echo x - pvr250/files/patch-modules::cxm::cxm::Makefile
sed 's/^X//' >pvr250/files/patch-modules::cxm::cxm::Makefile << 'END-of-pvr250/files/patch-modules::cxm::cxm::Makefile'
X--- modules/cxm/cxm/Makefile.orig	Fri Oct 15 20:53:47 2004
X+++ modules/cxm/cxm/Makefile	Fri Oct 15 20:55:03 2004
X@@ -3,5 +3,6 @@
X SRCS	= cxm.c cxm.h cxm_dec_fw.c cxm_enc_fw.c cxm_audio.c cxm_eeprom.c \
X 	  cxm_ir.c cxm_tuner.c cxm_video.c opt_cxm.h \
X 	  bus_if.h device_if.h iicbb_if.h pci_if.h vnode_if.h
X+CFLAGS+= -I../../.. ${FLAGS}
X 
X .include <bsd.kmod.mk>
END-of-pvr250/files/patch-modules::cxm::cxm::Makefile
echo x - pvr250/files/patch-modules::cxm::cxm_iic::Makefile
sed 's/^X//' >pvr250/files/patch-modules::cxm::cxm_iic::Makefile << 'END-of-pvr250/files/patch-modules::cxm::cxm_iic::Makefile'
X--- modules/cxm/cxm_iic/Makefile.orig	Fri Oct 15 20:55:23 2004
X+++ modules/cxm/cxm_iic/Makefile	Fri Oct 15 20:55:43 2004
X@@ -2,5 +2,6 @@
X KMOD	= cxm_iic
X SRCS	= cxm_i2c.c cxm.h \
X 	  opt_cxm.h bus_if.h device_if.h iicbb_if.h pci_if.h
X+CFLAGS  += -I../../.. ${FLAGS}
X 
X .include <bsd.kmod.mk>
END-of-pvr250/files/patch-modules::cxm::cxm_iic::Makefile
echo x - pvr250/files/patch-cxm_i2c.c
sed 's/^X//' >pvr250/files/patch-cxm_i2c.c << 'END-of-pvr250/files/patch-cxm_i2c.c'
X--- dev/cxm/cxm_i2c.c.orig	Sat Nov  6 13:24:40 2004
X+++ dev/cxm/cxm_i2c.c	Sat Nov  6 14:03:12 2004
X@@ -34,6 +34,9 @@
X  */
X 
X #include <sys/param.h>
X+#if __FreeBSD_version >= 503000
X+#include <sys/module.h>
X+#endif
X #include <sys/systm.h>
X #include <sys/malloc.h>
X #include <sys/conf.h>
END-of-pvr250/files/patch-cxm_i2c.c
echo x - pvr250/files/patch-cxm.h
sed 's/^X//' >pvr250/files/patch-cxm.h << 'END-of-pvr250/files/patch-cxm.h'
X--- dev/cxm/cxm.h.orig	Mon Nov  8 23:06:39 2004
X+++ dev/cxm/cxm.h	Mon Nov  8 23:10:56 2004
X@@ -33,6 +33,8 @@
X  * Header file for the Conexant MPEG-2 Codec driver.
X  */
X 
X+#include <sys/param.h>
X+
X #define bswap32(X) ntohl(X)
X 
X #define NUM_ELEMENTS(array) (sizeof(array) / sizeof(*array))
X@@ -250,7 +252,11 @@
X 
X 	enum cxm_source	source;
X 
X+#if __FreeBSD_version >= 502017
X+	struct cdev	*cxm_dev;	/* Device entry for /dev/cxmN */
X+#else
X 	dev_t           cxm_dev;	/* Device entry for /dev/cxmN */
X+#endif
X 
X 	int		is_opened;
X 	int		mpeg;
X@@ -503,8 +509,9 @@
X #define CXM_TUNER_LG_TPI8PSB01N       13
X #define CXM_TUNER_LG_TAPC_H701F       14
X #define CXM_TUNER_LG_TAPC_H001F       15
X+#define CXM_TUNER_MICROTUNE_4049_FM5  16
X 
X-#define CXM_TUNER_TYPES               16
X+#define CXM_TUNER_TYPES               17
X 
X #define CXM_TUNER_AFC_MASK           0x07
X 
X@@ -516,7 +523,7 @@
X 
X #define CXM_TUNER_PHASE_LOCKED       0x40
X 
X-#define CXM_TUNER_TV_SYSTEM_BG       0x01
X+#define CXM_TUNER_TV_SYSTEM_BGH      0x01
X #define CXM_TUNER_TV_SYSTEM_DK       0x02
X #define CXM_TUNER_TV_SYSTEM_I        0x04
X #define CXM_TUNER_TV_SYSTEM_MN       0x08
END-of-pvr250/files/patch-cxm.h
echo x - pvr250/files/patch-cxm_eeprom.c
sed 's/^X//' >pvr250/files/patch-cxm_eeprom.c << 'END-of-pvr250/files/patch-cxm_eeprom.c'
X--- dev/cxm/cxm_eeprom.c.orig	Sat Nov  6 13:24:40 2004
X+++ dev/cxm/cxm_eeprom.c	Sat Nov  6 14:05:23 2004
X@@ -254,6 +254,10 @@
X 			tuner_type = CXM_TUNER_PHILIPS_FM1246;
X 			break;
X 
X+		case 0x34: /* Microtune 4049 FM5 */
X+			tuner_type = CXM_TUNER_MICROTUNE_4049_FM5;
X+			break;
X+
X 		default:
X 			printf("%s: unknown tuner code %#x\n",
X 			       sc->name, tuner_code);
END-of-pvr250/files/patch-cxm_eeprom.c
echo x - pvr250/files/patch-setchannel.c
sed 's/^X//' >pvr250/files/patch-setchannel.c << 'END-of-pvr250/files/patch-setchannel.c'
X--- pvr250-1/setchannel.c.orig	Sat Oct 16 02:16:32 2004
X+++ pvr250-1/setchannel.c	Sat Nov  6 15:33:47 2004
X@@ -1,9 +1,15 @@
X #include <stdio.h>
X #include <fcntl.h>
X+#include <osreldate.h>
X #include <sys/types.h>
X #include <sys/ioctl.h>
X+#if __FreeBSD_version >= 502017
X+#include <dev/bktr/ioctl_bt848.h>
X+#include <dev/bktr/ioctl_meteor.h>
X+#else
X #include <machine/ioctl_bt848.h>
X #include <machine/ioctl_meteor.h>
X+#endif
X #include <unistd.h>
X 
X /****************************************************************************/
X@@ -74,9 +80,9 @@
X     exit (1);
X     }
X 
X-  tfd = open( "/dev/bktr0", O_RDONLY );
X+  tfd = open( "/dev/cxm0", O_RDONLY );
X   if ( tfd < 0 ) {
X-    perror( "open() of /dev/bktr0 failed." );
X+    perror( "open() of /dev/cxm0 failed." );
X     exit(1);
X   }
X 
END-of-pvr250/files/patch-setchannel.c
echo x - pvr250/files/patch-cxm.c
sed 's/^X//' >pvr250/files/patch-cxm.c << 'END-of-pvr250/files/patch-cxm.c'
X--- dev/cxm/cxm.c.orig	Sat Nov  6 13:24:40 2004
X+++ dev/cxm/cxm.c	Sat Nov  6 14:54:07 2004
X@@ -60,8 +60,16 @@
X #include <machine/clock.h>
X #include <machine/resource.h>
X 
X+#if __FreeBSD_version >= 503000
X+#include <sys/module.h>
X+#endif
X+#if __FreeBSD_version >= 502017
X+#include <dev/bktr/ioctl_meteor.h>
X+#include <dev/bktr/ioctl_bt848.h>
X+#else
X #include <machine/ioctl_meteor.h>
X #include <machine/ioctl_bt848.h>
X+#endif
X 
X #include <sys/bus.h>
X #include <sys/rman.h>
X@@ -253,7 +261,11 @@
X 	2,
X 	0,
X 	/* 9.52 Mb/s peak limit to keep bbdmux followed by mplex -f 8 happy */
X+#ifdef MAXBPS
X+	{ 0, 12000000, 12000000 },
X+#else
X 	{ 0, 9000000, 9520000 },
X+#endif
X 	{ 1, 15, 3},
X 	/*
X 	 * Spatial filter = Manual, Temporal filter = Manual
X@@ -274,7 +286,11 @@
X 	2,
X 	0,
X 	/* 9.52 Mb/s peak limit to keep bbdmux followed by mplex -f 8 happy */
X+#ifdef MAXBPS
X+	{ 0, 12000000, 12000000 },
X+#else
X 	{ 0, 9000000, 9520000 },
X+#endif
X 	{ 1, 12, 3},
X 	/*
X 	 * Spatial filter = Manual, Temporal filter = Manual
X@@ -2084,7 +2100,11 @@
X  * 
X  */
X int
X+#if __FreeBSD_version >= 502017
X+cxm_open( struct cdev *dev, int flags, int fmt, d_thread_t *td )
X+#else
X cxm_open( dev_t dev, int flags, int fmt, d_thread_t *td )
X+#endif
X {
X 	int		unit;
X 	struct cxm_softc *sc;
X@@ -2115,7 +2135,11 @@
X  * 
X  */
X int
X+#if __FreeBSD_version >= 502017
X+cxm_close( struct cdev *dev, int flags, int fmt, d_thread_t *td )
X+#else
X cxm_close( dev_t dev, int flags, int fmt, d_thread_t *td )
X+#endif
X {
X 	int		unit;
X 	struct cxm_softc *sc;
X@@ -2151,7 +2175,11 @@
X  * 
X  */
X int
X+#if __FreeBSD_version >= 502017
X+cxm_read( struct cdev *dev, struct uio *uio, int flag )
X+#else
X cxm_read( dev_t dev, struct uio *uio, int flag )
X+#endif
X {
X 	int		buffers_available;
X 	int		buffers_read;
X@@ -2245,7 +2273,11 @@
X  * 
X  */
X int
X+#if __FreeBSD_version >= 502017
X+cxm_ioctl( struct cdev *dev, unsigned long cmd, caddr_t arg,
X+#else
X cxm_ioctl( dev_t dev, unsigned long cmd, caddr_t arg,
X+#endif
X 	   int flag, d_thread_t *td )
X {
X 	int		brightness;
X@@ -2843,7 +2875,11 @@
X }
X 
X 
X+#if __FreeBSD_version >= 502017
X+int cxm_poll( struct cdev *dev, int events, d_thread_t *td)
X+#else
X int cxm_poll( dev_t dev, int events, d_thread_t *td)
X+#endif
X {
X 	int		revents;
X 	int		unit;
END-of-pvr250/files/patch-cxm.c
echo x - pvr250/files/patch-setsize.c
sed 's/^X//' >pvr250/files/patch-setsize.c << 'END-of-pvr250/files/patch-setsize.c'
X--- pvr250-1/setsize.c.orig	Sat Oct 16 02:16:32 2004
X+++ pvr250-1/setsize.c	Sat Nov  6 15:33:37 2004
X@@ -1,9 +1,15 @@
X #include <stdio.h>
X #include <fcntl.h>
X+#include <osreldate.h>
X #include <sys/types.h>
X #include <sys/ioctl.h>
X+#if __FreeBSD_version >= 502017
X+#include <dev/bktr/ioctl_bt848.h>
X+#include <dev/bktr/ioctl_meteor.h>
X+#else
X #include <machine/ioctl_bt848.h>
X #include <machine/ioctl_meteor.h>
X+#endif
X #include <unistd.h>
X #include <stdlib.h>
X 
X@@ -52,9 +58,9 @@
X   afc = -1;
X   status = 0;
X 
X-  tfd = open( "/dev/bktr0", O_RDONLY );
X+  tfd = open( "/dev/cxm0", O_RDONLY );
X   if ( tfd < 0 ) {
X-    perror( "open() of /dev/bktr0 failed." );
X+    perror( "open() of /dev/cxm0 failed." );
X     exit(1);
X   }
X 
END-of-pvr250/files/patch-setsize.c
echo x - pvr250/files/patch-cxm_tuner.c
sed 's/^X//' >pvr250/files/patch-cxm_tuner.c << 'END-of-pvr250/files/patch-cxm_tuner.c'
X--- dev/cxm/cxm_tuner.c.orig	Mon Nov  8 23:06:39 2004
X+++ dev/cxm/cxm_tuner.c	Mon Nov  8 23:12:43 2004
X@@ -102,44 +102,33 @@
X };
X 
X static const struct cxm_tuner_channels
X-bg_air_channels = {
X-	"B/G Broadcast",
X-	CXM_TUNER_TV_SYSTEM_BG,
X+bgh_air_channels = {
X+	"B/G/H Broadcast",
X+	CXM_TUNER_TV_SYSTEM_BGH,
X 	2,
X-	89,
X+	92,
X 	38900,
X-	{ { 82, 175250, 7000 },
X-	  { 80, 55250, 7000 },
X-	  { 79, 217250, 7000 },
X-	  { 77, 209250, 7000 },
X-	  { 76, 138250, 9000 },
X-	  { 75, 102250, 9000 },
X-	  { 73, 86250, 9000 },
X-	  { 72, 64250, 7500 },
X-	  { 70, 49750, 7500 },
X+	{ { 62, 588250, 7000 },
X 	  { 21, 471250, 8000 },
X-	  { 20, 210250, 8500 },
X-	  { 18, 192750, 8500 },
X-	  { 16, 175250, 8000 },
X-	  { 15, 82250, 8500 },
X-	  { 13, 53750, 8500 },
X+	  { 13, 245250, 7000 },
X 	  { 5, 175250, 7000 },
X 	  { 2, 48250, 7000 } }
X };
X 
X static const struct cxm_tuner_channels
X-bg_australia_channels = {
X-	"B/G Australia",
X-	CXM_TUNER_TV_SYSTEM_BG,
X+bh_australia_channels = {
X+	"B/H Australia",
X+	CXM_TUNER_TV_SYSTEM_BGH,
X 	1,
X 	83,
X 	38900,
X 	{ { 28, 527250, 7000 },
X-	  { 10, 209250, 7000 },
X 	  { 6, 175250, 7000 },
X 	  { 4, 95250, 7000 },
X-	  { 3, 86250, 7000 },
X-	  { 1, 57250, 7000 } }
X+	  { 3, 86250, 9000 },
X+	  { 2, 64250, 22000 },
X+	  { 1, 57250, 7000 },
X+	  { 0, 46250, 11000 } }
X };
X 
X static const struct cxm_tuner_channels
X@@ -193,7 +182,7 @@
X const struct cxm_tuner
X cxm_tuners[CXM_TUNER_TYPES] = {
X 	{ "Philips FI1216 MK2",
X-		CXM_TUNER_TV_SYSTEM_BG,
X+		CXM_TUNER_TV_SYSTEM_BGH,
X 		{ { 0 }, { 0 }, { 0 }, { 0 }, { 0 } },
X 		48250, 855250,
X 		{ { 450000, { 0x8e, 0x30 } },
X@@ -201,9 +190,9 @@
X 		  { 48250, { 0x8e, 0xa0 } } },
X 		0, 0,
X 		{ 0 },
X-		{ &bg_air_channels, NULL } },
X+		{ &bgh_air_channels, NULL } },
X 	{ "Philips FM1216",
X-		CXM_TUNER_TV_SYSTEM_BG,
X+		CXM_TUNER_TV_SYSTEM_BGH,
X 		{ { 0 }, { 0 }, { 0 }, { 0 }, { 0 } },
X 		48250, 855250,
X 		{ { 450000, { 0xce, 0x30 } },
X@@ -211,12 +200,12 @@
X 		  { 48250, { 0xce, 0xa0 } } },
X 		87500, 108000,
X 		{ 87500, { 0x88, 0xa5 } },
X-		{ &bg_air_channels, NULL } },
X+		{ &bgh_air_channels, NULL } },
X 	{ "Philips FQ1216ME",
X-		CXM_TUNER_TV_SYSTEM_BG | CXM_TUNER_TV_SYSTEM_DK
X+		CXM_TUNER_TV_SYSTEM_BGH | CXM_TUNER_TV_SYSTEM_DK
X 		| CXM_TUNER_TV_SYSTEM_I
X 		| CXM_TUNER_TV_SYSTEM_L | CXM_TUNER_TV_SYSTEM_L_PRIME,
X-		{ { CXM_TUNER_TV_SYSTEM_BG,      0x09 },
X+		{ { CXM_TUNER_TV_SYSTEM_BGH,      0x09 },
X 		  { CXM_TUNER_TV_SYSTEM_DK,      0x09 },
X 		  { CXM_TUNER_TV_SYSTEM_I,       0x01 },
X 		  { CXM_TUNER_TV_SYSTEM_L,       0x0b },
X@@ -227,7 +216,15 @@
X 		  { 48250, { 0x8e, 0xa0 } } },
X 		0, 0,
X 		{ 0 },
X+#ifdef PAL_BGH
X+		{ &bgh_air_channels, NULL } },
X+#elif defined(PAL_BH_AUSTRALIA)
X+		{ &bh_australia_channels, NULL } },
X+#elif defined(PAL_I)
X+		{ &i_air_channels, NULL } },
X+#else
X 		{ &l_air_channels, NULL } },
X+#endif
X 	{ "Philips FI1236 MK2",
X 		CXM_TUNER_TV_SYSTEM_MN,
X 		{ { 0 }, { 0 }, { 0 }, { 0 }, { 0 } },
X@@ -269,7 +266,7 @@
X 		{ 87500, { 0x88, 0xa5 } },
X 		{ &i_air_channels, NULL } },
X 	{ "Temic 4006 FH5",
X-		CXM_TUNER_TV_SYSTEM_BG,
X+		CXM_TUNER_TV_SYSTEM_BGH,
X 		{ { 0 }, { 0 }, { 0 }, { 0 }, { 0 } },
X 		48250, 855250,
X 		{ { 454000, { 0x8e, 0x30 } },
X@@ -277,9 +274,9 @@
X 		  { 48250, { 0x8e, 0xa0 } } },
X 		0, 0,
X 		{ 0 },
X-		{ &bg_air_channels, NULL } },
X+		{ &bgh_air_channels, NULL } },
X 	{ "Temic 4009 FR5",
X-		CXM_TUNER_TV_SYSTEM_BG,
X+		CXM_TUNER_TV_SYSTEM_BGH,
X 		{ { 0 }, { 0 }, { 0 }, { 0 }, { 0 } },
X 		48250, 855250,
X 		{ { 464000, { 0x8e, 0x30 } },
X@@ -287,7 +284,7 @@
X 		  { 48250, { 0x8e, 0xa0 } } },
X 		87500, 108100,
X 		{ 87500, { 0x88, 0xa5 } },
X-		{ &bg_air_channels, NULL } },
X+		{ &bgh_air_channels, NULL } },
X 	{ "Temic 4036 FY5",
X 		CXM_TUNER_TV_SYSTEM_MN,
X 		{ { 0 }, { 0 }, { 0 }, { 0 }, { 0 } },
X@@ -319,7 +316,7 @@
X 		{ 0 },
X 		{ &i_air_channels, NULL } },
X 	{ "LG Innotek TPI8PSB11D",
X-		CXM_TUNER_TV_SYSTEM_BG,
X+		CXM_TUNER_TV_SYSTEM_BGH,
X 		{ { 0 }, { 0 }, { 0 }, { 0 }, { 0 } },
X 		48250, 855250,
X 		{ { 450000, { 0x8e, 0x30 } },
X@@ -327,9 +324,9 @@
X 		  { 48250, { 0x8e, 0xa0 } } },
X 		0, 0,
X 		{ 0 },
X-		{ &bg_air_channels, NULL } },
X+		{ &bgh_air_channels, NULL } },
X 	{ "LG Innotek TPI8PSB01N",
X-		CXM_TUNER_TV_SYSTEM_BG,
X+		CXM_TUNER_TV_SYSTEM_BGH,
X 		{ { 0 }, { 0 }, { 0 }, { 0 }, { 0 } },
X 		48250, 855250,
X 		{ { 450000, { 0x8e, 0x30 } },
X@@ -337,7 +334,7 @@
X 		  { 48250, { 0x8e, 0xa0 } } },
X 		87500, 108000,
X 		{ 87500, { 0x88, 0xa5 } },
X-		{ &bg_air_channels, NULL } },
X+		{ &bgh_air_channels, NULL } },
X 	{ "LG Innotek TAPC-H701F",
X 		CXM_TUNER_TV_SYSTEM_MN,
X 		{ { 0 }, { 0 }, { 0 }, { 0 }, { 0 } },
X@@ -357,7 +354,31 @@
X 		  { 55250, { 0xce, 0x01 } } },
X 		76000, 108000,
X 		{ 76000, { 0x88, 0x04 } },
X-		{ &us_air_channels, &us_cable_channels } }
X+		{ &us_air_channels, &us_cable_channels } },
X+       { "Microtune 4049 FM5",
X+               CXM_TUNER_TV_SYSTEM_BGH | CXM_TUNER_TV_SYSTEM_DK
X+               | CXM_TUNER_TV_SYSTEM_I
X+               | CXM_TUNER_TV_SYSTEM_L | CXM_TUNER_TV_SYSTEM_L_PRIME,
X+               { { CXM_TUNER_TV_SYSTEM_BGH,      0x0c },
X+                 { CXM_TUNER_TV_SYSTEM_DK,      0x09 },
X+                 { CXM_TUNER_TV_SYSTEM_I,       0x05 },
X+                 { CXM_TUNER_TV_SYSTEM_L,       0x0a },
X+                 { CXM_TUNER_TV_SYSTEM_L_PRIME, 0x0b } },
X+               48250, 855250,
X+               { { 450000, { 0x8e, 0x30 } },
X+                 { 170000, { 0x8e, 0x90 } },
X+                 { 48250, { 0x8e, 0xa0 } } },
X+               0, 0,
X+               { 0 },
X+#ifdef PAL_BGH
X+               { &bgh_air_channels, NULL } }
X+#elif defined(PAL_BH_AUSTRALIA)
X+               { &bh_australia_channels, NULL } }
X+#elif defined(PAL_I)
X+               { &i_air_channels, NULL } }
X+#else
X+               { &l_air_channels, NULL } }
X+#endif
X };
X 
X 
X@@ -404,6 +425,31 @@
X 	return -1;
X }
X 
X+static void microtune_configure(struct cxm_softc *sc) {
X+  unsigned char buf[4];
X+  int rc;
X+  memset(buf,0,sizeof(buf));
X+#ifdef SECAM_L
X+  buf[1]=0x04;
X+#else
X+  buf[1]=0x10;
X+  buf[2]=0x20|0x40;
X+#endif
X+#if defined(PAL_BGH) || defined(PAL_BH_AUSTRALIA)
X+  buf[3]=0x01|0x08;
X+#elif defined(PAL_I)
X+  buf[3]=0x02|0x08;
X+#elif defined(SECAM_L)
X+  buf[3]=0x03|0x08;
X+#else
X+  buf[3]=0x03|0x0C;
X+#endif
X+  buf[1]|=0x40;
X+  buf[1]|=0x80;
X+  buf[2]|=0x10;
X+  if (4!=(rc=cxm_tuner_write(sc->iicbus,CXM_I2C_TUNER_IF,buf,4)))
X+    printf("%s: IIC I/O error: cxm_tuner_write returned %d (should be 4)\n",sc->name,rc);
X+}
X 
X int
X cxm_tuner_init( struct cxm_softc *sc )
X@@ -418,6 +464,8 @@
X 
X 	if (tuner_type < 0 || tuner_type >= NUM_ELEMENTS(cxm_tuners))
X 		return -1;
X+
X+	if (tuner_type == CXM_TUNER_MICROTUNE_4049_FM5) microtune_configure(sc);
X 
X 	sc->tuner = &cxm_tuners[tuner_type];
X 	sc->tuner_channels = sc->tuner->channels.cable
END-of-pvr250/files/patch-cxm_tuner.c
echo x - pvr250/files/patch-cxm.4
sed 's/^X//' >pvr250/files/patch-cxm.4 << 'END-of-pvr250/files/patch-cxm.4'
X--- pvr250-1/cxm.4.orig	Sat Oct 16 02:16:32 2004
X+++ pvr250-1/cxm.4	Sat Nov  6 15:26:52 2004
X@@ -44,6 +44,7 @@
X .Em LG Innotek TPI8PSB01N
X .Em LG Innotek TAPC-H701F
X .Em LG Innotek TAPC-H001F
X+.Em Microtune 4049 FM5
X .Ed
X .Sh EXAMPLES
X To access the video card, just use /dev/bktr0 (for FreeBSD 4.x) or
END-of-pvr250/files/patch-cxm.4
echo x - pvr250/files/patch-cxm_extract_fw.c
sed 's/^X//' >pvr250/files/patch-cxm_extract_fw.c << 'END-of-pvr250/files/patch-cxm_extract_fw.c'
X--- dev/cxm/cxm_extract_fw.c.orig	Sat Nov  6 15:27:42 2004
X+++ dev/cxm/cxm_extract_fw.c	Sat Nov  6 15:30:23 2004
X@@ -44,6 +44,7 @@
X #include <stdio.h>
X #include <stdlib.h>
X #include <string.h>
X+#include <unistd.h>
X #include <sys/types.h>
X #include <sys/mman.h>
X #include <sys/param.h>
X@@ -172,7 +173,7 @@
X 
X   for (ptr = start; ptr != end; ptr++) {
X     if ((end - ptr) >= sizeof (decoder_magic)
X-        && memcmp (ptr, decoder_magic, sizeof (decoder_magic)) == 0)
X+        && memcmp (ptr, decoder_magic, sizeof (decoder_magic)) == 0) {
X       if (! decoder_fw_saved) {
X         if (save_firmware ("cxm_dec_fw", ptr, end - ptr) < 0) {
X           fprintf (stderr, "%s: save_firmware failed\n", MyName);
X@@ -184,9 +185,10 @@
X         fprintf (stderr, "%s: multiple decoder images present\n", MyName);
X         exit (1);
X         }
X+      }
X 
X     if ((end - ptr) >= sizeof (encoder_magic)
X-        && memcmp (ptr, encoder_magic, sizeof (encoder_magic)) == 0)
X+        && memcmp (ptr, encoder_magic, sizeof (encoder_magic)) == 0) {
X       if (! encoder_fw_saved) {
X         if (save_firmware ("cxm_enc_fw", ptr, end - ptr) < 0) {
X           fprintf (stderr, "%s: save_firmware failed\n", MyName);
X@@ -198,6 +200,7 @@
X         fprintf (stderr, "%s: multiple encoder images present\n", MyName);
X         exit (1);
X         }
X+      }
X     }
X 
X   munmap ((caddr_t)start, (size_t)statbuf.st_size);
END-of-pvr250/files/patch-cxm_extract_fw.c
echo x - pvr250/Makefile
sed 's/^X//' >pvr250/Makefile << 'END-of-pvr250/Makefile'
X#
X# New ports collection makefile for:	pvr250
X# Date created:				10 October 2004
X# Whom:					Edwin Groothuis <edwin@mavetju.org>
X#
X# $FreeBSD: ports/multimedia/pvr250/Makefile,v 1.3 2004/10/16 00:43:02 edwin Exp $
X#
X
XPORTNAME=	pvr250
XPORTVERSION=	200408
XPORTREVISION=	2
XCATEGORIES=	multimedia
XMASTER_SITES=	http://www.mavetju.org/download/adopted/
XDISTFILES=	${CXMSHAR} hcwPVRP2.sys ${PVRTOOLS}.tar.gz
X
XMAINTAINER=	edwin@mavetju.org
XCOMMENT=	Hauppauge PVR-250/350 TV cards driver for the cxm device
X
XPVRTOOLS=	pvr250-1
XCXMSHAR=	cxm-200408.shar
X
XWRKSRC=		${WRKDIR}
XUSE_REINPLACE=	yes
X
XIGNOREFILES=	hcwPVRP2.sys
XRESTRICTED_FILES=	hcwPVRP2.sys
XRESTRICTED=	"This port uses a binary driver which is owned by Hauppauge"
XNO_PACKAGE=	${RESTRICTED}
XNO_CDROM=	${RESTRICTED}
X
XOPTIONS=	NTSC_US			"NTSC US Broadcast"	Off \
X		NTSC_US_CABLE		"NTSC US Cable" Off \
X		PAL_BGH			"PAL B/G/H Broadcast" On \
X		PAL_BH_AUSTRALIA	"PAL B/H Australia" Off \
X		PAL_DK			"PAL D/K Broadcast" Off \
X		PAL_I			"PAL I Broadcast" Off \
X		PAL_L			"PAL L Broadcast" Off \
X		SECAM_DK		"SECAM D/K Broadcast" Off \
X		SECAM_L			"SECAM L Broadcast" Off \
X		MAXBPS			"Use 12MBit/s instead od 9.52MBit/s maximum" On
X
XMAN4=		cxm.4
X
Xpre-everything::
X	@${ECHO_CMD} "Some tuners (for example the Philips FQ1216ME and Microtune 4049 FM5) supports multiple standards."
X	@${ECHO_CMD} "Use the following configuration screen (or 'make config') to choose your local  TV channel system if you have such a tuner."
X	@${ECHO_CMD} "At this moment only the Philips FQ1216M and Microtune 4049 FM5 are known to do this. If you don't have  one, just ignore it. If you have one, select one (1) entry."
X	@sleep 5
X
X.include <bsd.port.pre.mk>
X
X.if defined(WITH_NTSC_US)
XFLAGS+=	-DNTSC_US
X.endif
X.if defined(WITH_NTSC_US_CABLE)
XFLAGS+=	-DNTSC_US_CABLE
X.endif
X.if defined(WITH_PAL_BGH)
XFLAGS+=	-DPAL_BGH
X.endif
X.if defined(WITH_PAL_BH_AUSTRALIA)
XFLAGS+=	-DPAL_BH_AUSTRALIA
X.endif
X.if defined(WITH_PAL_DK)
XFLAGS+=	-DPAL_DK
X.endif
X.if defined(WITH_PAL_I)
XFLAGS+=	-DPAL_I
X.endif
X.if defined(WITH_PAL_L)
XFLAGS+=	-DPAL_L
X.endif
X.if defined(WITH_SECAM_DK)
XFLAGS+=	-DPAL_SECAM_DK
X.endif
X.if defined(WITH_SECAM_L)
XFLAGS+=	-DPAL_SECAM_L
X.endif
X.if defined(WITH_MAXBPS)
XFLAGS+=	-DMAXBPS
X.endif
X
X.if ${OSVERSION} < 500000
XMODULESDIR=	/modules
X.else
XMODULESDIR=	/boot/kernel
X.endif
XPLIST_SUB=	MODULESDIR=${MODULESDIR}
X
X.if !exists(${DISTDIR}/hcwPVRP2.sys)
XIGNORE=		You need the file hcwPVRP2.sys from the CD coming with the PVR-250/350 card. Please place this file in ${DISTDIR} and run make again.
X.endif
X
X.if !exists(/usr/src/sys/dev/iicbus/iicbb.c)
XIGNORE=		You need the kernel sources installed to build this module.
X.endif
X
Xpatch-iicbb:
X.if ${OSVERSION} < 500000
X	@if [ -z "`${GREP} cxm_iic /usr/src/sys/dev/iicbus/iicbb.c`" ]; then \
X	    ${PATCH} /usr/src/sys/dev/iicbus/iicbb.c ${WRKDIR}/dev/cxm/Patch.iicbb-fbsd4; \
X	    ${ECHO_CMD} "Patched /usr/src/sys/dev/iicbus/iicbb.c"; \
X	else \
X	    ${ECHO_CMD} "/usr/src/sys/dev/iicbus/iicbb.c was already patched"; \
X	fi
X.else
X	@if [ -z "`${GREP} cxm_iic /usr/src/sys/dev/iicbus/iicbb.c`" ]; then \
X	    ${PATCH} /usr/src/sys/dev/iicbus/iicbb.c ${WRKDIR}/dev/cxm/Patch.iicbb-fbsd5; \
X	    ${ECHO_CMD} "Patched /usr/src/sys/dev/iicbus/iicbb.c"; \
X	else \
X	    ${ECHO_CMD} "/usr/src/sys/dev/iicbus/iicbb.c was already patched"; \
X	fi
X.endif
X
Xdo-extract:
X	${MKDIR} ${WRKDIR}
X	cd ${WRKDIR}; \
X	${SH} ${DISTDIR}/${CXMSHAR}; \
X	${EXTRACT_CMD} ${EXTRACT_BEFORE_ARGS} ${_DISTDIR}/${PVRTOOLS}.tar.gz ${EXTRACT_AFTER_ARGS};
X
Xpost-patch:
X.if ${OSVERSION} > 500000
X	${REINPLACE_CMD} -e 's/bktr0/cxm0/' \
X		${WRKDIR}/${PVRTOOLS}/setchannel.c \
X		${WRKDIR}/${PVRTOOLS}/setsize.c
X.endif
X
Xdo-configure:
X	cd ${WRKDIR}/dev/cxm; \
X	${CC} -Wall -o cxm_extract_fw cxm_extract_fw.c; \
X	./cxm_extract_fw ${DISTDIR}/hcwPVRP2.sys
X
Xdo-build:
X	cd ${WRKDIR}/modules/cxm; ${MAKE} FLAGS="${FLAGS}"
X	cd ${WRKDIR}/${PVRTOOLS}; ${MAKE}
X
Xdo-install:
X	${INSTALL_DATA} ${WRKDIR}/modules/cxm/cxm/cxm.ko ${MODULESDIR}
X	${INSTALL_DATA} ${WRKDIR}/modules/cxm/cxm_iic/cxm_iic.ko ${MODULESDIR}
X	${INSTALL_MAN} ${WRKDIR}/${PVRTOOLS}/cxm.4 ${PREFIX}/man/man4/cxm.4
X	${INSTALL_PROGRAM} ${WRKDIR}/${PVRTOOLS}/setchannel ${PREFIX}/bin/pvr250-setchannel
X	${INSTALL_PROGRAM} ${WRKDIR}/${PVRTOOLS}/setsize ${PREFIX}/bin/pvr250-setsize
X.if ${OSVERSION} < 500000
X	cd /dev; \
X	./MAKEDEV bktr0
X.endif
X
Xpost-install:
X	@${CAT} ${PKGMESSAGE}
X
X.include <bsd.port.post.mk>
END-of-pvr250/Makefile
echo x - pvr250/distinfo
sed 's/^X//' >pvr250/distinfo << 'END-of-pvr250/distinfo'
XMD5 (cxm-200408.shar) = a0a766caafef8f93b9adb58d5034cf1c
XSIZE (cxm-200408.shar) = 181292
XMD5 (pvr250-1.tar.gz) = 2340e05199059745e80551ade27cb196
XSIZE (pvr250-1.tar.gz) = 95901
XMD5 (hcwPVRP2.sys) = IGNORE
END-of-pvr250/distinfo
echo x - pvr250/pkg-descr
sed 's/^X//' >pvr250/pkg-descr << 'END-of-pvr250/pkg-descr'
XThis port contains:
X
X- Drivers for the Conexant MPEG-2 Codec driver which can be found
X  on the Hauppauge PVR-250/350 TV cards.
X  These drivers are (c) John Wehle <john@feith.com>
X
X  On FreeBSD 4.x, the device used is /dev/bktr0.
X  On FreeBSD 5.x, the device used is /dev/cxm0
X
X  This driver has been successfully tested on:
X  - FreeBSD 4.10
X  - FreeBSD 5.2.1
X
X- Two simple programs to modify some ioctls on the card: set the
X  channel and set the window size.
X
XNote:
X
X- Note: the maintainer of this port has no inside knowledge of the
X  workings of this software. Please don't contact me about cards
X  which don't work. Please contact me about problems with the port,
X  with possible enhancements, with success stories.
END-of-pvr250/pkg-descr
echo x - pvr250/pkg-message
sed 's/^X//' >pvr250/pkg-message << 'END-of-pvr250/pkg-message'
XPVR-250/350 - Nearly done!
X
XIf you haven't patched /usr/src/sys/dev/iicbus/iicbb.c yet, and
Xrebuild a new kernel, and rebooted, these are the following steps:
X
X    - Run "make patch-iicbb". This will enable cxm to use the i2c bus.
X    - Add this to your kernel configuration file:
X	    DEVICE	iicbus
X	    DEVICE	iicbb
X    - Rebuild your kernel.
X    - Reboot.
X
XNext step is to load the drivers:
X    - Run "kldload cxm_iic"
X    - Run "kldload cxm"
X
XCheck your console (or /var/log/messages if you're running X) and
Xyou should see something like:
X
X    cxm0: <Conexant iTVC15 MPEG Coder> mem ... irq ... at device ... on pci ...
X    cxm_iic0: <Conexant iTVC15 / iTVC16 I2C cnotroller> on cxm0
X    iicbb0: <I2C bit-banging driver> on cxm_iic0
X    cxm0: Philips FI1236M K2 Tuner
X    cxm0: SAA7115 rev 1 video decoder
X    cxm0: MSP3435G-B6 audio decoder
X    cxm0: IR Remote
X
XTo test the card, either do "cat /dev/bktr0 > filename.mpg" (FreeBSD
X4.x) or "cat /dev/cxm0 > filename.mpg" (FreeBSD 5.x).
END-of-pvr250/pkg-message
echo x - pvr250/pkg-plist
sed 's/^X//' >pvr250/pkg-plist << 'END-of-pvr250/pkg-plist'
X@unexec rm %%MODULESDIR%%/cxm.ko
X@unexec rm %%MODULESDIR%%/cxm_iic.ko
Xbin/pvr250-setchannel
Xbin/pvr250-setsize
END-of-pvr250/pkg-plist
exit
--- pvr250.shar ends here ---


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20041109144603.00F5E26D045>