Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 19 Mar 1997 08:15:56 -0500
From:      Michael Petry <petry@netwolf.NetMasters.com>
To:        multimedia@freebsd.org
Subject:   Changes for Audio control on the bt848 code 
Message-ID:  <199703191315.IAA00351@netwolf.NetMasters.com>

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

Attached are changes I've been running that give control of the audio mux.  
I'll send a secon note witht he changes to fxtv0.0.2 that provide crude 
channel tuning and audio source selection.

Things that are unresolved:
	The audio pops when changing because the audio needs to be muted during 
channel change.  This is best handled by the interrupt service routine to mute 
when it looses sync.

	The audio source is latched, but the video source gets reset on a window 
obscure/move.  I haven't tracked it much, but believe the capture restart and 
fxtv open/close are at the root.

diff -r /home/petry/tmp/src/sys/pci/brktree_reg.h ./brktree_reg.h
43a44,50
> #define BT848_DSTATUS_PRES     (1<<7)
> #define BT848_DSTATUS_HLOC     (1<<6)
> #define BT848_DSTATUS_FIELD    (1<<5)
> #define BT848_DSTATUS_NUML     (1<<4)
> #define BT848_DSTATUS_CSEL     (1<<3)
> #define BT848_DSTATUS_LOF      (1<<1)
> #define BT848_DSTATUS_COF      (1<<0)
87a95,115
> #define BT848_INT_RISCS		(0xf<<28)
> #define BT848_INT_RISC_EN	(1<<27)
> #define BT848_INT_RACK		(1<<25)
> #define BT848_INT_FIELD		(1<<24)
> #define BT848_INT_SCERR		(1<<19)
> #define BT848_INT_OCERR		(1<<18)
> #define BT848_INT_PABORT	(1<<17)
> #define BT848_INT_RIPERR	(1<<16)
> #define BT848_INT_PPERR		(1<<15)
> #define BT848_INT_FDSR		(1<<14)
> #define BT848_INT_FTRGT		(1<<13)
> #define BT848_INT_FBUS		(1<<12)
> #define BT848_INT_RISCI		(1<<11)
> #define BT848_INT_GPINT		(1<<9)
> #define BT848_INT_I2CDONE	(1<<8)
> #define BT848_INT_VPRES		(1<<5)
> #define BT848_INT_HLOCK		(1<<4)
> #define BT848_INT_OFLOW		(1<<3)
> #define BT848_INT_HSYNC		(1<<2)
> #define BT848_INT_VSYNC		(1<<1)
> #define BT848_INT_FMTCHG	(1<<0)
141a170,180
> #define AUDIO_TUNER		0x00	/* command for the audio routine */
> #define AUDIO_EXTERN		0x01	/* don't confuse them with bit */
> #define AUDIO_INTERN		0x02	/* settings */
> #define AUDIO_MUTE		0x80
> #define AUDIO_UNMUTE		0x81
>     u_char      audio_mux_select;	/* current mode of the audio */
>     u_char      audio_mute_state;	/* mute state of the audio */
>     u_char      audio_tuner_type;	/* brand of tuner */
> #define	TUNER_MIRO		1
> #define	TUNER_HAUPPAUGE		2
> #define	TUNER_STB		3
diff -r /home/petry/tmp/src/sys/pci/brooktree848.c ./brooktree848.c
245a246
> void bktr_audio( bktr_reg_t * bktr, int mode);
356c357,358
<  	        bt848[BKTR_CAP_CTL]  = bktr->bktr_cap_ctl;
---
> 		bt848[BKTR_CAP_CTL] = bktr->bktr_cap_ctl;
> 		bktr_audio(bktr, AUDIO_UNMUTE);
1294a1297,1298
> 	bktr_audio(bktr, AUDIO_UNMUTE);
> 
1331a1336,1337
> 	/* mute the audio by switching the mux */
> 	bktr_audio(bktr, AUDIO_MUTE);
1392a1399,1409
> /*
>  * The mux on the boards are driven by the GPIO output.  This table is
>  * is needed to map the from the PseudoTV to the different board types.
>  * The list is ordered as: TUNER, EXTERN1, EXTERN2, MUTE
>  *
>  * Two issues:
>  *	1)  Only the Hauppauge! has been tested, the others are guesses
>  *	based on the linux driver. 
>  *	2)  Since there is no "tuner type" that is auto detected, the
>  *	Hauppauge is currently hardcoded
>  */
1393a1411,1415
> u_char audiomuxs[][4] = {
> 	{ 0x02, 0x01, 0x00, 0x00 }, /* MIRO (guesses) */
> 	{ 0x00, 0x02, 0x03, 0x01 }, /* Hauppauge! */
> 	{ 0x00, 0x02, 0x03, 0x01 }, /* STB (guesses) */
> };
1394a1417,1467
> void
> bktr_audio (bktr_reg_t *bktr, int cmd)
> {
> 	volatile u_char		*bt848;
> 	volatile u_char		temp;
> 	volatile u_char		idx;
> 
> 	switch (cmd) {
> 	case AUDIO_TUNER:
> 	  bktr->audio_mux_select = 0;
> 	  break;
> 	case AUDIO_EXTERN:
> 	  bktr->audio_mux_select = 1;
> 	  break;
> 	case AUDIO_INTERN:
> 	  bktr->audio_mux_select = 2;
> 	  break;
> 	case AUDIO_MUTE:
> 	  bktr->audio_mute_state = TRUE;	/* set mute */
> 	  break;
> 	case AUDIO_UNMUTE:
> 	  bktr->audio_mute_state = FALSE;	/* clear mute */
> 	  break;
> 	default:
> 	  printf("bktr: audio cmd error %02x\n", cmd);
> 	  break;
> 	}
> 	bt848 =	 bktr->base;
> 	bt848[BKTR_GPIO_OUT_EN] = 0x0f;
> 	bt848[BKTR_GPIO_REG_INP] = 0x00;
> 
> 	if (bktr->audio_mute_state == TRUE) {
> 	  idx = 3;
> 	} else {
> 	  idx = bktr->audio_mux_select;
> 	}
> 
> 	/* Leave the upper bits of the GPIO port alone in case they control
> 	 * something like the dbx or teletext chips.  This doesn't guarantee
> 	 * success, but follows the rule of least astonishment.
> 	 */
> 
> 	temp = bt848[BKTR_GPIO_DATA] & ~7; /* mask off lower three bits */
> 	  
> 	/* !!!! Hardcode of Hauppauge! until audio_tune_type is autodetected */
> 
> 	bktr->audio_tuner_type = TUNER_HAUPPAUGE;
> 
> 	bt848[BKTR_GPIO_DATA] =
> 	  temp | audiomuxs[bktr->audio_tuner_type][idx];
> }
1479a1553,1555
> 			bktr_audio(bktr, AUDIO_MUTE);
> 			bktr_audio(bktr, AUDIO_EXTERN);
> 			bktr_audio(bktr, AUDIO_UNMUTE);
1488a1565,1567
> 			bktr_audio(bktr, AUDIO_MUTE);
> 			bktr_audio(bktr, AUDIO_TUNER);
> 			bktr_audio(bktr, AUDIO_UNMUTE);





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