Deleted Added
full compact
204c204,213
<
---
> 1.25 02/02/98 Takeshi Ohashi
> <ohashi@atohasi.mickey.ai.kyutech.ac.jp> submitted
> code to support bktr_read .
> Flemming Jacobsen <fj@schizo.dk.tfs.com>
> submitted code to support radio available with in
> some bt848 based cards;additionally, wrote code to
> correctly recognized his bt848 card.
> Roger Hardiman <roger@cs.strath.ac.uk> submitted
> various fixes to smooth out the microcode and made
> all modes consistent.
212d220
< #include "opt_devfs.h"
426c434
< { 525, 22, 480, 910, 135, 754, 640, 780, 30, 0x68, 0x5d, 0 },
---
> { 525, 26, 480, 910, 135, 754, 640, 780, 30, 0x68, 0x5d, 0 },
428c436
< { 525, 22, 480, 910, 135, 754, 640, 780, 30, 0x68, 0x5d, BT848_IFORM_X_XT0 },
---
> { 525, 26, 480, 910, 135, 754, 640, 780, 30, 0x68, 0x5d, BT848_IFORM_X_XT0 },
480a489,491
> { METEOR_GEO_YUV_12,
> { 0, METEOR_PIXTYPE_YUV_12, 2, { 0xff0000,0x00ff00,0x0000ff }, 1,1 }
> },
543a555,558
> #define PHILIPS_PAL_WADDR 0xc2
> #define PHILIPS_PAL_RADDR 0xc3
>
>
551a567,568
> #define TSA552x_RADIO (TSA552x_CB_MSB | \
> TSA552x_CB_T0)
552a570,573
> /* Add RADIO_OFFSET to the "frequency" to indicate that we want to tune */
> /* the radio (if present) not the TV tuner. */
> /* 20000 is equivalent to 20000MHz/16 = 1.25GHz - this area is unused. */
> #define RADIO_OFFSET 20000
553a575
>
655a678,679
> static void yuv12_prog( bktr_ptr_t bktr, char i_flag, int cols,
> int rows, int interlace );
862,865c886,887
< bktr->devfs_bktr_token = devfs_add_devswf(&bktr_cdevsw, unit,
< DV_CHR, 0, 0, 0444, "bktr%d", unit);
< bktr->devfs_tuner_token = devfs_add_devswf(&bktr_cdevsw, unit+16,
< DV_CHR, 0, 0, 0444, "tuner%d", unit);
---
> bktr->devfs_token = devfs_add_devswf(&bktr_cdevsw, unit,
> DV_CHR, 0, 0, 0644, "brooktree");
866a889
> #if __FreeBSD__ > 2
868a892
> #endif
923c947,949
< ((bktr_status & (BT848_INT_FTRGT |
---
> ((bktr_status &(BT848_INT_FBUS |
> BT848_INT_FTRGT |
> BT848_INT_FDSR |
928c954
< BT848_INT_SCERR)) != 0) ||
---
> BT848_INT_SCERR) ) != 0) ||
1071a1098
>
1342,1344d1368
< printf("btkr driver : use ioctl interface . read function not implemented \n");
< return( ENXIO );
<
1345a1370,1371
> bt848 = bktr->base;
>
1351a1378,1380
> bt848->cap_ctl = bktr->bktr_cap_ctl;
>
>
1360,1361c1389,1392
< /* Start capture */
< bt848 = bktr->base;
---
> /* capture one frame */
> start_capture(bktr, METEOR_SINGLE);
> /* wait for capture to complete */
> bt848->int_stat = ALL_INTS_CLEARED;
1363c1394,1398
< bt848->gpio_dma_ctl = FIFO_RISC_ENABLED;
---
> bt848->gpio_dma_ctl = bktr->capcontrol;
> bt848->int_mask = BT848_INT_MYSTERYBIT |
> BT848_INT_RISCI |
> BT848_INT_VSYNC |
> BT848_INT_FMTCHG;
1364a1400
>
1415a1452
>
1540a1578
> bktr->dma_prog_loaded = FALSE;
1550c1588,1589
< bt848->iform |= BT848_IFORM_F_NTSCM;
---
> bt848->iform |= BT848_IFORM_F_NTSCM |
> format_params[BT848_IFORM_F_NTSCM].iform_xtsel;
1560c1599,1600
< bt848->iform |= BT848_IFORM_F_PALBDGHI;
---
> bt848->iform |= BT848_IFORM_F_PALBDGHI |
> format_params[BT848_IFORM_F_PALBDGHI].iform_xtsel;
1574a1615
> bktr->dma_prog_loaded = FALSE;
1789d1829
< fp = &format_params[bktr->format_params];
1870,1927d1909
< temp = ((quad_t ) fp->htotal* (quad_t) fp->horizontal * 4096
< / fp->vertical / bktr->cols) - 4096;
< bt848->e_hscale_lo = temp & 0xff;
< bt848->o_hscale_lo = temp & 0xff;
< bt848->e_hscale_hi = (temp >> 8) & 0xff;
< bt848->o_hscale_hi = (temp >> 8) & 0xff;
<
< /* horizontal active */
< temp = bktr->cols;
< bt848->e_hactive_lo = temp & 0xff;
< bt848->o_hactive_lo = temp & 0xff;
< bt848->e_crop &= ~0x3;
< bt848->o_crop &= ~0x3;
< bt848->e_crop |= (temp >> 8) & 0x3;
< bt848->o_crop |= (temp >> 8) & 0x3;
<
< /* horizontal delay */
< temp = (fp->hdelay * bktr->cols) / fp->hactive;
< temp = temp + 2; /* why?? - rmt */
< temp = temp & 0x3fe;
< bt848->e_delay_lo = temp & 0xff;
< bt848->o_delay_lo = temp & 0xff;
< bt848->e_crop &= ~0xc;
< bt848->o_crop &= ~0xc;
< bt848->e_crop |= (temp >> 6) & 0xc;
< bt848->o_crop |= (temp >> 6) & 0xc;
<
< /* vertical scale */
< if (geo->oformat & METEOR_GEO_ODD_ONLY ||
< geo->oformat & METEOR_GEO_EVEN_ONLY)
< tmp_int = 65536 -
< ((fp->vactive * 256 / bktr->rows) - 512);
< else {
< tmp_int = 65536 -
< (((fp->vactive * 512) / bktr->rows) - 512);
< }
<
< tmp_int &= 0x1fff;
<
< bt848->e_vscale_lo = tmp_int & 0xff;
< bt848->o_vscale_lo = tmp_int & 0xff;
< bt848->e_vscale_hi &= ~0x1f;
< bt848->o_vscale_hi &= ~0x1f;
< bt848->e_vscale_hi |= (tmp_int >> 8) & 0x1f;
< bt848->o_vscale_hi |= (tmp_int >> 8) & 0x1f;
<
< /* vertical active */
< bt848->e_crop &= ~0x30;
< bt848->e_crop |= (fp->vactive >> 4) & 0x30;
< bt848->e_vactive_lo = fp->vactive & 0xff;
< bt848->o_crop &= ~0x30;
< bt848->o_crop |= (fp->vactive >> 4) & 0x30;
< bt848->o_vactive_lo = fp->vactive & 0xff;
<
< /* vertical delay */
< bt848->e_vdelay_lo = fp->vdelay;
< bt848->o_vdelay_lo = fp->vdelay;
<
2267a2250,2260
> /* Ioctl's for running the tuner device in radio mode */
> #if 0
> case RADIO_SETMODE: /* XXX Todo: implement me ... */
> break;
> case RADIO_GETFREQ; /* XXX Todo: implement me ... */
> break;
> #endif
> case RADIO_SETFREQ:
> /* The argument to this ioctl is NOT freq*16. It is
> ** freq*100.
> */
2268a2262,2295
> /* The radio in my stereo and the linear regression function
> ** in my HP48 have reached the conclusion that in order to
> ** set the radio tuner of the FM1216 to f MHz, the value to
> ** enter into the PLL is: f*20-407
> ** If anyone has the exact values from the spec. sheet
> ** please forward them -- fj@login.dknet.dk
> */
> temp=(int)*(unsigned long *)arg/5-407 +RADIO_OFFSET;
>
> #ifdef BKTR_RADIO_DEBUG
> printf("bktr%d: arg=%d temp=%d\n",unit,(int)*(unsigned long *)arg,temp);
> #endif
>
> #ifndef BKTR_RADIO_NOFREQCHECK
> /* According to the spec. sheet the band: 87.5MHz-108MHz */
> /* is supported. */
> if(temp<1343+RADIO_OFFSET || temp>1753+RADIO_OFFSET) {
> printf("bktr%d: Radio frequency out of range\n",unit);
> return(EINVAL);
> }
> #endif
> temp_mute( bktr, TRUE );
> temp = tv_freq( bktr, temp );
> temp_mute( bktr, FALSE );
> #ifdef BKTR_RADIO_DEBUG
> if(temp)
> printf("bktr%d: tv_freq returned: %d\n",unit,temp);
> #endif
> if ( temp < 0 )
> return( EINVAL );
> *(unsigned long *)arg = temp;
> break;
>
>
2669d2695
< if (interlace == 2 && rows < 320 ) target_buffer += pitch;
2670a2697
>
2708c2735
< *dma_prog++ = OP_SYNC | 0xC << 24 | 1 << 24 | BKTR_VRE;
---
> *dma_prog++ = OP_SYNC | 1 << 24 | BKTR_VRE;
2711c2738
< *dma_prog++ = OP_JUMP | 0xC << 24;
---
> *dma_prog++ = OP_JUMP;
2717c2744
< *dma_prog++ = OP_SYNC | 1 << 24 | 1 << 20 | BKTR_VRO;
---
> *dma_prog++ = OP_SYNC | 1 << 24 | BKTR_VRO;
2728c2755
< *dma_prog++ = OP_JUMP | 0xc << 24 ;
---
> *dma_prog++ = OP_JUMP; ;
2734,2737d2760
< if (rows < 320 )
< target_buffer = buffer ;
< else
< target_buffer = buffer + pitch;
2738a2762,2763
> target_buffer = buffer + pitch;
>
2848c2873
< *dma_prog++ = OP_SYNC | 0xC << 24 | BKTR_VRE;
---
> *dma_prog++ = OP_SYNC | 1 << 24 | BKTR_VRE;
2857c2882
< *dma_prog++ = OP_SYNC | 0xC << 24 | BKTR_VRO;
---
> *dma_prog++ = OP_SYNC | 1 << 24 | BKTR_VRO;
2864,2865c2889,2890
< /* sync vre */
< *dma_prog++ = OP_SYNC | BKTR_VRE;
---
> /* sync vro */
> *dma_prog++ = OP_SYNC | 1 << 24 | 1 << 15 | BKTR_VRO;
2892c2917
< *dma_prog++ = OP_SYNC | 1 << 24 | BKTR_VRE;
---
> *dma_prog++ = OP_SYNC | 1 << 24 | 1 << 15 | BKTR_VRE;
2951c2976
< t1 = target_buffer;
---
> t1 = buffer;
2957c2982
< for (i = 0; i < (rows/interlace ) - 1; i++) {
---
> for (i = 0; i < (rows/interlace ) ; i++) {
2968c2993
< *dma_prog++ = OP_SYNC | 0xC << 24 | 1 << 24 | BKTR_VRE; /*sync vre*/
---
> *dma_prog++ = OP_SYNC | 1 << 24 | BKTR_VRE; /*sync vre*/
2971c2996
< *dma_prog++ = OP_JUMP | 0xc << 24;
---
> *dma_prog++ = OP_JUMP ;
2976c3001
< *dma_prog++ = OP_SYNC | 0xC << 24 | 1 << 24 | BKTR_VRO; /*sync vre*/
---
> *dma_prog++ = OP_SYNC | 1 << 24 | BKTR_VRO; /*sync vre*/
2984c3009
< *dma_prog++ = OP_SYNC | 1 << 15 | BKTR_VRO;
---
> *dma_prog++ = OP_SYNC | 1 << 24 | 1 << 15 | BKTR_VRO;
2997c3022
< t1 = target_buffer + cols/2;
---
> t1 = buffer + cols/2;
3001c3026
< for (i = 0; i < (rows/interlace ) - 1; i++) {
---
> for (i = 0; i < (rows/interlace ) ; i++) {
3011c3036
< *dma_prog++ = OP_SYNC | 1 << 24 | BKTR_VRE;
---
> *dma_prog++ = OP_SYNC | 1 << 24 | 1 << 15 | BKTR_VRE;
3026c3051
< int i, k;
---
> int i;
3072,3074d3096
< if (i_flag > 2)
< k = 1;
< else k = 0;
3076c3098
< for (i = 0; i < (rows/interlace )/2 - k; i++) {
---
> for (i = 0; i < (rows/interlace )/2 ; i++) {
3092c3114
< *dma_prog++ = OP_SYNC | 1 << 24 | BKTR_VRO; /*sync vro*/
---
> *dma_prog++ = OP_SYNC | 1 << 24 | BKTR_VRE; /*sync vre*/
3094,3096c3116,3118
<
< *dma_prog++ = OP_JUMP ;
< *dma_prog++ = (u_long ) vtophys(bktr->dma_prog);
---
>
> *dma_prog++ = OP_JUMP;
> *dma_prog++ = (u_long ) vtophys(bktr->dma_prog);
3100c3122
< *dma_prog++ = OP_SYNC | 1 << 24 | BKTR_VRE; /*sync vre*/
---
> *dma_prog++ = OP_SYNC | 1 << 24 | BKTR_VRO; /*sync vro*/
3102,3104c3124,3126
<
< *dma_prog++ = OP_JUMP ;
< *dma_prog++ = (u_long ) vtophys(bktr->dma_prog);
---
>
> *dma_prog++ = OP_JUMP;
> *dma_prog++ = (u_long ) vtophys(bktr->dma_prog);
3110c3132
< *dma_prog++ = OP_JUMP | 0xC << 24;
---
> *dma_prog++ = OP_JUMP ;
3120,3121c3142,3143
< t1 = target_buffer + cols/2;
< *dma_prog++ = OP_SYNC | 1 << 24 | BKTR_FM3;
---
> t1 = buffer + cols/2;
> *dma_prog++ = OP_SYNC | 1 << 15 | BKTR_FM3;
3143c3165
< *dma_prog++ = OP_JUMP | 0xC << 24;
---
> *dma_prog++ = OP_JUMP;
3157a3180,3182
> int tmp_int;
> unsigned int temp;
> struct format_params *fp;
3158a3184
>
3159a3186,3187
> fp = &format_params[bktr->format_params];
>
3165a3194,3254
> /* set video parameters */
> temp = ((quad_t ) fp->htotal* (quad_t) fp->horizontal * 4096
> / fp->vertical / bktr->cols) - 4096;
> bt848->e_hscale_lo = temp & 0xff;
> bt848->o_hscale_lo = temp & 0xff;
> bt848->e_hscale_hi = (temp >> 8) & 0xff;
> bt848->o_hscale_hi = (temp >> 8) & 0xff;
>
> /* horizontal active */
> temp = bktr->cols;
> bt848->e_hactive_lo = temp & 0xff;
> bt848->o_hactive_lo = temp & 0xff;
> bt848->e_crop &= ~0x3;
> bt848->o_crop &= ~0x3;
> bt848->e_crop |= (temp >> 8) & 0x3;
> bt848->o_crop |= (temp >> 8) & 0x3;
>
> /* horizontal delay */
> temp = (fp->hdelay * bktr->cols) / fp->hactive;
> temp = temp & 0x3fe;
> bt848->e_delay_lo = temp & 0xff;
> bt848->o_delay_lo = temp & 0xff;
> bt848->e_crop &= ~0xc;
> bt848->o_crop &= ~0xc;
> bt848->e_crop |= (temp >> 6) & 0xc;
> bt848->o_crop |= (temp >> 6) & 0xc;
>
> /* vertical scale */
>
> if (bktr->flags & METEOR_ONLY_ODD_FIELDS ||
> bktr->flags & METEOR_ONLY_EVEN_FIELDS)
> tmp_int = 65536 -
> (((fp->vactive * 256 + (bktr->rows/2)) / bktr->rows) - 512);
> else {
> tmp_int = 65536 -
> (((fp->vactive * 512 + (bktr->rows / 2)) / bktr->rows) - 512);
> }
>
> tmp_int &= 0x1fff;
> bt848->e_vscale_lo = tmp_int & 0xff;
> bt848->o_vscale_lo = tmp_int & 0xff;
> bt848->e_vscale_hi &= ~0x1f;
> bt848->o_vscale_hi &= ~0x1f;
> bt848->e_vscale_hi |= (tmp_int >> 8) & 0x1f;
> bt848->o_vscale_hi |= (tmp_int >> 8) & 0x1f;
>
>
> /* vertical active */
> bt848->e_crop &= ~0x30;
> bt848->e_crop |= (fp->vactive >> 4) & 0x30;
> bt848->e_vactive_lo = fp->vactive & 0xff;
> bt848->o_crop &= ~0x30;
> bt848->o_crop |= (fp->vactive >> 4) & 0x30;
> bt848->o_vactive_lo = fp->vactive & 0xff;
>
> /* vertical delay */
> bt848->e_vdelay_lo = fp->vdelay;
> bt848->o_vdelay_lo = fp->vdelay;
>
> /* end of video params */
>
3754,3755c3843,3847
< 0x00, /* PLL write address */
< 0x00, /* control byte for PLL */
---
> 0x00, /* PLL write address */
> { 0x00, /* control byte for PLL */
> 0x00,
> 0x00,
> 0x00 },
3757c3849
< { 0x00, 0x00, 0x00 } }, /* the band-switch values */
---
> { 0x00, 0x00, 0x00,0x00} }, /* the band-switch values */
3763c3855,3858
< TSA552x_SCONTROL, /* control byte for PLL */
---
> { TSA552x_SCONTROL, /* control byte for PLL */
> TSA552x_SCONTROL,
> TSA552x_SCONTROL,
> 0x00 },
3765c3860
< { 0x02, 0x04, 0x01 } }, /* the band-switch values */
---
> { 0x02, 0x04, 0x01, 0x00 } }, /* the band-switch values */
3771c3866,3869
< TSA552x_SCONTROL, /* control byte for PLL */
---
> { TSA552x_SCONTROL, /* control byte for PLL */
> TSA552x_SCONTROL,
> TSA552x_SCONTROL,
> 0x00 },
3773c3871
< { 0x02, 0x04, 0x01 } }, /* the band-switch values */
---
> { 0x02, 0x04, 0x01, 0x00 } }, /* the band-switch values */
3779c3877,3880
< TSA552x_SCONTROL, /* control byte for PLL */
---
> { TSA552x_SCONTROL, /* control byte for PLL */
> TSA552x_SCONTROL,
> TSA552x_SCONTROL,
> 0x00 },
3781c3882
< { 0x02, 0x04, 0x01 } }, /* the band-switch values */
---
> { 0x02, 0x04, 0x01,0x00 } }, /* the band-switch values */
3787c3888,3891
< TSA552x_SCONTROL, /* control byte for PLL */
---
> { TSA552x_SCONTROL, /* control byte for PLL */
> TSA552x_SCONTROL,
> TSA552x_SCONTROL,
> 0x00 },
3789c3893
< { 0xa0, 0x90, 0x30 } }, /* the band-switch values */
---
> { 0xa0, 0x90, 0x30, 0x00 } }, /* the band-switch values */
3794,3795c3898,3902
< 0x00, /* PLL write address */
< TSA552x_SCONTROL, /* control byte for PLL */
---
> PHILIPS_PAL_WADDR, /* PLL write address */
> { TSA552x_FCONTROL, /* control byte for PLL */
> TSA552x_FCONTROL,
> TSA552x_FCONTROL,
> TSA552x_RADIO },
3797c3904,3909
< { 0xa0, 0x90, 0x30 } }, /* the band-switch values */
---
> { 0xa0, 0x90, 0x30, 0xa5 } }, /* the band-switch values */
> /* Radio: (for FM1216)
> ** 0xa4 sets radiomode
> ** bit0 - AFC
> ** bit1 - Mono
> ** bit3 - Mute */
3803c3915,3918
< TSA552x_SCONTROL, /* control byte for PLL */
---
> { TSA552x_SCONTROL, /* control byte for PLL */
> TSA552x_SCONTROL,
> TSA552x_SCONTROL,
> 0x00 },
3805c3920
< { 0xa0, 0x90, 0x30 } }, /* the band-switch values */
---
> { 0xa0, 0x90, 0x30,0x00 } }, /* the band-switch values */
3811c3926,3929
< TSA552x_SCONTROL, /* control byte for PLL */
---
> { TSA552x_SCONTROL, /* control byte for PLL */
> TSA552x_SCONTROL,
> TSA552x_SCONTROL,
> 0x00 },
3813c3931
< { 0x02, 0x04, 0x01 } }, /* the band-switch values */
---
> { 0x02, 0x04, 0x01,0x00 } }, /* the band-switch values */
3818,3819c3936,3940
< 0x00, /* PLL write address */
< TSA552x_SCONTROL, /* control byte for PLL */
---
> TEMIC_PALI_WADDR, /* PLL write address */
> { TSA552x_SCONTROL, /* control byte for PLL */
> TSA552x_SCONTROL,
> TSA552x_SCONTROL,
> 0x00 },
3821c3942
< { 0xa0, 0x90, 0x30 } }, /* the band-switch values */
---
> { 0xa0, 0x90, 0x30,0x00 } }, /* the band-switch values */
3827c3948,3951
< TSA552x_SCONTROL, /* control byte for PLL */
---
> { TSA552x_SCONTROL, /* control byte for PLL */
> TSA552x_SCONTROL,
> TSA552x_SCONTROL,
> 0x00},
3829c3953
< { 0xa0, 0x90, 0x30 } }, /* the band-switch values */
---
> { 0xa0, 0x90, 0x30,0x00 } }, /* the band-switch values */
4315c4439
< band = tuner->bandAddrs[ 0 ];
---
> N = 0;
4317c4441
< band = tuner->bandAddrs[ 1 ];
---
> N = 1;
4319c4443
< band = tuner->bandAddrs[ 2 ];
---
> N = 2;
4320a4445,4449
> if(frequency > RADIO_OFFSET) {
> N=3;
> frequency -= RADIO_OFFSET;
> }
>
4322,4323c4451,4455
< addr = tuner->pllAddr;
< control = tuner->pllControl;
---
> addr = tuner->pllAddr;
> control = tuner->pllControl[ N ];
> band = tuner->bandAddrs[ N ];
> if(!(band && control)) /* Don't try to set un- */
> return(-1); /* supported modes. */
4324a4457
>