bktr_core.c (32926) | bktr_core.c (33025) |
---|---|
1/* BT848 1.24 Driver for Brooktree's Bt848 based cards. 2 The Brooktree BT848 Driver driver is based upon Mark Tinguely and 3 Jim Lowe's driver for the Matrox Meteor PCI card . The 4 Philips SAA 7116 and SAA 7196 are very different chipsets than 5 the BT848. For starters, the BT848 is a one chipset solution and 6 it incorporates a RISC engine to control the DMA transfers -- 7 that is it the actual dma process is control by a program which 8 resides in the hosts memory also the register definitions between --- 187 unchanged lines hidden (view full) --- 196 doing CAP_SINGLEs, and in dual-field capture, don't 197 capture fields for different frames 1981.22 11/08/97 Randall Hopper <rhh@ct.picker.com> 199 Fixes for packed 24bpp - FIFO alignment 2001.23 11/17/97 Amancio <hasty@star-gate.com> 201 Added yuv support mpeg encoding 2021.24 12/27/97 Jonathan Hanna <pangolin@rogers.wave.ca> 203 Patch to support Philips FR1236MK2 tuner | 1/* BT848 1.24 Driver for Brooktree's Bt848 based cards. 2 The Brooktree BT848 Driver driver is based upon Mark Tinguely and 3 Jim Lowe's driver for the Matrox Meteor PCI card . The 4 Philips SAA 7116 and SAA 7196 are very different chipsets than 5 the BT848. For starters, the BT848 is a one chipset solution and 6 it incorporates a RISC engine to control the DMA transfers -- 7 that is it the actual dma process is control by a program which 8 resides in the hosts memory also the register definitions between --- 187 unchanged lines hidden (view full) --- 196 doing CAP_SINGLEs, and in dual-field capture, don't 197 capture fields for different frames 1981.22 11/08/97 Randall Hopper <rhh@ct.picker.com> 199 Fixes for packed 24bpp - FIFO alignment 2001.23 11/17/97 Amancio <hasty@star-gate.com> 201 Added yuv support mpeg encoding 2021.24 12/27/97 Jonathan Hanna <pangolin@rogers.wave.ca> 203 Patch to support Philips FR1236MK2 tuner |
204 | 2041.25 02/02/98 Takeshi Ohashi 205 <ohashi@atohasi.mickey.ai.kyutech.ac.jp> submitted 206 code to support bktr_read . 207 Flemming Jacobsen <fj@schizo.dk.tfs.com> 208 submitted code to support radio available with in 209 some bt848 based cards;additionally, wrote code to 210 correctly recognized his bt848 card. 211 Roger Hardiman <roger@cs.strath.ac.uk> submitted 212 various fixes to smooth out the microcode and made 213 all modes consistent. |
205*/ 206 207#define DDB(x) x 208#define DEB(x) 209 210#ifdef __FreeBSD__ 211#include "bktr.h" | 214*/ 215 216#define DDB(x) x 217#define DEB(x) 218 219#ifdef __FreeBSD__ 220#include "bktr.h" |
212#include "opt_devfs.h" | |
213#include "pci.h" 214#endif /* __FreeBSD__ */ 215 216#if !defined(__FreeBSD__) || (NBKTR > 0 && NPCI > 0) 217 218#include <sys/param.h> 219#include <sys/systm.h> 220#include <sys/conf.h> --- 197 unchanged lines hidden (view full) --- 418#endif 419 420/* 421 * Parameters describing size of transmitted image. 422 */ 423 424static struct format_params format_params[] = { 425/* # define BT848_IFORM_F_AUTO (0x0) - don't matter. */ | 221#include "pci.h" 222#endif /* __FreeBSD__ */ 223 224#if !defined(__FreeBSD__) || (NBKTR > 0 && NPCI > 0) 225 226#include <sys/param.h> 227#include <sys/systm.h> 228#include <sys/conf.h> --- 197 unchanged lines hidden (view full) --- 426#endif 427 428/* 429 * Parameters describing size of transmitted image. 430 */ 431 432static struct format_params format_params[] = { 433/* # define BT848_IFORM_F_AUTO (0x0) - don't matter. */ |
426 { 525, 22, 480, 910, 135, 754, 640, 780, 30, 0x68, 0x5d, 0 }, | 434 { 525, 26, 480, 910, 135, 754, 640, 780, 30, 0x68, 0x5d, 0 }, |
427/* # define BT848_IFORM_F_NTSCM (0x1) */ | 435/* # define BT848_IFORM_F_NTSCM (0x1) */ |
428 { 525, 22, 480, 910, 135, 754, 640, 780, 30, 0x68, 0x5d, BT848_IFORM_X_XT0 }, | 436 { 525, 26, 480, 910, 135, 754, 640, 780, 30, 0x68, 0x5d, BT848_IFORM_X_XT0 }, |
429/* # define BT848_IFORM_F_NTSCJ (0x2) */ 430 { 525, 22, 480, 910, 135, 754, 640, 780, 30, 0x68, 0x5d, BT848_IFORM_X_XT0 }, 431/* # define BT848_IFORM_F_PALBDGHI (0x3) */ 432 { 625, 32, 576, 1135, 186, 922, 768, 944, 25, 0x7f, 0x72, BT848_IFORM_X_XT1 }, 433/* # define BT848_IFORM_F_PALM (0x4) */ 434 { 525, 22, 480, 910, 135, 754, 640, 780, 30, 0x68, 0x5d, BT848_IFORM_X_XT0 }, 435/*{ 625, 32, 576, 910, 186, 922, 640, 780, 25, 0x68, 0x5d, BT848_IFORM_X_XT0 }, */ 436/* # define BT848_IFORM_F_PALN (0x5) */ --- 36 unchanged lines hidden (view full) --- 473 * Table of Meteor-supported Pixel Formats (for SETGEO compatibility) 474 */ 475 476/* FIXME: Also add YUV_422 and YUV_PACKED as well */ 477static struct { 478 u_long meteor_format; 479 struct meteor_pixfmt public; 480} meteor_pixfmt_table[] = { | 437/* # define BT848_IFORM_F_NTSCJ (0x2) */ 438 { 525, 22, 480, 910, 135, 754, 640, 780, 30, 0x68, 0x5d, BT848_IFORM_X_XT0 }, 439/* # define BT848_IFORM_F_PALBDGHI (0x3) */ 440 { 625, 32, 576, 1135, 186, 922, 768, 944, 25, 0x7f, 0x72, BT848_IFORM_X_XT1 }, 441/* # define BT848_IFORM_F_PALM (0x4) */ 442 { 525, 22, 480, 910, 135, 754, 640, 780, 30, 0x68, 0x5d, BT848_IFORM_X_XT0 }, 443/*{ 625, 32, 576, 910, 186, 922, 640, 780, 25, 0x68, 0x5d, BT848_IFORM_X_XT0 }, */ 444/* # define BT848_IFORM_F_PALN (0x5) */ --- 36 unchanged lines hidden (view full) --- 481 * Table of Meteor-supported Pixel Formats (for SETGEO compatibility) 482 */ 483 484/* FIXME: Also add YUV_422 and YUV_PACKED as well */ 485static struct { 486 u_long meteor_format; 487 struct meteor_pixfmt public; 488} meteor_pixfmt_table[] = { |
489 { METEOR_GEO_YUV_12, 490 { 0, METEOR_PIXTYPE_YUV_12, 2, { 0xff0000,0x00ff00,0x0000ff }, 1,1 } 491 }, |
|
481 482 /* FIXME: Should byte swap flag be on for this one; negative in drvr? */ 483 { METEOR_GEO_YUV_422, 484 { 0, METEOR_PIXTYPE_YUV, 2, { 0xff0000,0x00ff00,0x0000ff }, 1,1 } 485 }, 486 { METEOR_GEO_YUV_PACKED, 487 { 0, METEOR_PIXTYPE_YUV_PACKED, 2, { 0xff0000,0x00ff00,0x0000ff }, 0,1 } 488 }, --- 47 unchanged lines hidden (view full) --- 536/* PLL on a the Philips FR1236MK2 tuner */ 537#define PHILIPS_FR1236_NTSC_WADDR 0xc2 538#define PHILIPS_FR1236_NTSC_RADDR 0xc3 539 540/* guaranteed address for any TSA5522/3 (PLL on all(?) tuners) */ 541#define TSA552x_WADDR 0xc2 542#define TSA552x_RADDR 0xc3 543 | 492 493 /* FIXME: Should byte swap flag be on for this one; negative in drvr? */ 494 { METEOR_GEO_YUV_422, 495 { 0, METEOR_PIXTYPE_YUV, 2, { 0xff0000,0x00ff00,0x0000ff }, 1,1 } 496 }, 497 { METEOR_GEO_YUV_PACKED, 498 { 0, METEOR_PIXTYPE_YUV_PACKED, 2, { 0xff0000,0x00ff00,0x0000ff }, 0,1 } 499 }, --- 47 unchanged lines hidden (view full) --- 547/* PLL on a the Philips FR1236MK2 tuner */ 548#define PHILIPS_FR1236_NTSC_WADDR 0xc2 549#define PHILIPS_FR1236_NTSC_RADDR 0xc3 550 551/* guaranteed address for any TSA5522/3 (PLL on all(?) tuners) */ 552#define TSA552x_WADDR 0xc2 553#define TSA552x_RADDR 0xc3 554 |
555#define PHILIPS_PAL_WADDR 0xc2 556#define PHILIPS_PAL_RADDR 0xc3 557 558 |
|
544#define TSA552x_CB_MSB (0x80) 545#define TSA552x_CB_CP (1<<6) 546#define TSA552x_CB_T2 (1<<5) 547#define TSA552x_CB_T1 (1<<4) 548#define TSA552x_CB_T0 (1<<3) 549#define TSA552x_CB_RSA (1<<2) 550#define TSA552x_CB_RSB (1<<1) 551#define TSA552x_CB_OS (1<<0) | 559#define TSA552x_CB_MSB (0x80) 560#define TSA552x_CB_CP (1<<6) 561#define TSA552x_CB_T2 (1<<5) 562#define TSA552x_CB_T1 (1<<4) 563#define TSA552x_CB_T0 (1<<3) 564#define TSA552x_CB_RSA (1<<2) 565#define TSA552x_CB_RSB (1<<1) 566#define TSA552x_CB_OS (1<<0) |
567#define TSA552x_RADIO (TSA552x_CB_MSB | \ 568 TSA552x_CB_T0) |
|
552 | 569 |
570/* Add RADIO_OFFSET to the "frequency" to indicate that we want to tune */ 571/* the radio (if present) not the TV tuner. */ 572/* 20000 is equivalent to 20000MHz/16 = 1.25GHz - this area is unused. */ 573#define RADIO_OFFSET 20000 |
|
553 | 574 |
575 |
|
554/* address of BTSC/SAP decoder chip */ 555#define TDA9850_WADDR 0xb6 556#define TDA9850_RADDR 0xb7 557 558/* address of MSP3400C chip */ 559#define MSP3400C_WADDR 0x80 560#define MSP3400C_RADDR 0x81 561 --- 86 unchanged lines hidden (view full) --- 648#ifdef BT848_DUMP 649static int dump_bt848( bt848_ptr_t bt848 ); 650#endif 651 652static void yuvpack_prog( bktr_ptr_t bktr, char i_flag, int cols, 653 int rows, int interlace ); 654static void yuv422_prog( bktr_ptr_t bktr, char i_flag, int cols, 655 int rows, int interlace ); | 576/* address of BTSC/SAP decoder chip */ 577#define TDA9850_WADDR 0xb6 578#define TDA9850_RADDR 0xb7 579 580/* address of MSP3400C chip */ 581#define MSP3400C_WADDR 0x80 582#define MSP3400C_RADDR 0x81 583 --- 86 unchanged lines hidden (view full) --- 670#ifdef BT848_DUMP 671static int dump_bt848( bt848_ptr_t bt848 ); 672#endif 673 674static void yuvpack_prog( bktr_ptr_t bktr, char i_flag, int cols, 675 int rows, int interlace ); 676static void yuv422_prog( bktr_ptr_t bktr, char i_flag, int cols, 677 int rows, int interlace ); |
678static void yuv12_prog( bktr_ptr_t bktr, char i_flag, int cols, 679 int rows, int interlace ); |
|
656static void rgb_prog( bktr_ptr_t bktr, char i_flag, int cols, 657 int rows, int interlace ); 658static void build_dma_prog( bktr_ptr_t bktr, char i_flag ); 659 660static bool_t getline(bktr_reg_t *, int); 661static bool_t notclipped(bktr_reg_t * , int , int); 662static bool_t split(bktr_reg_t *, volatile u_long **, int, u_long, int, 663 volatile u_char ** , int ); --- 190 unchanged lines hidden (view full) --- 854 bktr->tuner.channel = 0; 855 bktr->tuner.chnlset = DEFAULT_CHNLSET; 856 bktr->audio_mux_select = 0; 857 bktr->audio_mute_state = FALSE; 858 859 probeCard( bktr, TRUE ); 860 861#ifdef DEVFS | 680static void rgb_prog( bktr_ptr_t bktr, char i_flag, int cols, 681 int rows, int interlace ); 682static void build_dma_prog( bktr_ptr_t bktr, char i_flag ); 683 684static bool_t getline(bktr_reg_t *, int); 685static bool_t notclipped(bktr_reg_t * , int , int); 686static bool_t split(bktr_reg_t *, volatile u_long **, int, u_long, int, 687 volatile u_char ** , int ); --- 190 unchanged lines hidden (view full) --- 878 bktr->tuner.channel = 0; 879 bktr->tuner.chnlset = DEFAULT_CHNLSET; 880 bktr->audio_mux_select = 0; 881 bktr->audio_mute_state = FALSE; 882 883 probeCard( bktr, TRUE ); 884 885#ifdef DEVFS |
862 bktr->devfs_bktr_token = devfs_add_devswf(&bktr_cdevsw, unit, 863 DV_CHR, 0, 0, 0444, "bktr%d", unit); 864 bktr->devfs_tuner_token = devfs_add_devswf(&bktr_cdevsw, unit+16, 865 DV_CHR, 0, 0, 0444, "tuner%d", unit); | 886 bktr->devfs_token = devfs_add_devswf(&bktr_cdevsw, unit, 887 DV_CHR, 0, 0, 0644, "brooktree"); |
866#endif /* DEVFS */ | 888#endif /* DEVFS */ |
889#if __FreeBSD__ > 2 |
|
867 fun = pci_conf_read(tag, PCI_COMMAND_STATUS_REG); 868 pci_conf_write(tag, PCI_COMMAND_STATUS_REG, fun | 4); | 890 fun = pci_conf_read(tag, PCI_COMMAND_STATUS_REG); 891 pci_conf_write(tag, PCI_COMMAND_STATUS_REG, fun | 4); |
892#endif |
|
869 870} 871 872 873/* 874 * interrupt handling routine complete bktr_read() if using interrupts. 875 */ 876static void --- 38 unchanged lines hidden (view full) --- 915 status_sum |= (bktr_status & ~(BT848_INT_RSV0|BT848_INT_RSV1)); 916 status_sum |= ((dstatus & (BT848_DSTATUS_COF|BT848_DSTATUS_LOF)) << 6); 917#endif /* STATUS_SUM */ 918 /* printf( " STATUS %x %x %x \n", 919 dstatus, bktr_status, bt848->risc_count ); 920 */ 921 /* if risc was disabled re-start process again */ 922 if ( !(bktr_status & BT848_INT_RISC_EN) || | 893 894} 895 896 897/* 898 * interrupt handling routine complete bktr_read() if using interrupts. 899 */ 900static void --- 38 unchanged lines hidden (view full) --- 939 status_sum |= (bktr_status & ~(BT848_INT_RSV0|BT848_INT_RSV1)); 940 status_sum |= ((dstatus & (BT848_DSTATUS_COF|BT848_DSTATUS_LOF)) << 6); 941#endif /* STATUS_SUM */ 942 /* printf( " STATUS %x %x %x \n", 943 dstatus, bktr_status, bt848->risc_count ); 944 */ 945 /* if risc was disabled re-start process again */ 946 if ( !(bktr_status & BT848_INT_RISC_EN) || |
923 ((bktr_status & (BT848_INT_FTRGT | | 947 ((bktr_status &(BT848_INT_FBUS | 948 BT848_INT_FTRGT | 949 BT848_INT_FDSR | |
924 BT848_INT_PPERR | 925 BT848_INT_RIPERR | 926 BT848_INT_PABORT | 927 BT848_INT_OCERR | | 950 BT848_INT_PPERR | 951 BT848_INT_RIPERR | 952 BT848_INT_PABORT | 953 BT848_INT_OCERR | |
928 BT848_INT_SCERR)) != 0) || | 954 BT848_INT_SCERR) ) != 0) || |
929 ((bt848->tdec == 0) && (bktr_status & TDEC_BITS)) ) { 930 931 u_short tdec_save = bt848->tdec; 932 933 bt848->gpio_dma_ctl = FIFO_RISC_DISABLED; 934 935 bt848->int_mask = ALL_INTS_DISABLED; 936 --- 127 unchanged lines hidden (view full) --- 1064 bt848->gpio_dma_ctl = FIFO_ENABLED; 1065 wakeup((caddr_t)bktr); 1066 } 1067 1068 /* 1069 * If the user requested to be notified via signal, 1070 * let them know the frame is complete. 1071 */ | 955 ((bt848->tdec == 0) && (bktr_status & TDEC_BITS)) ) { 956 957 u_short tdec_save = bt848->tdec; 958 959 bt848->gpio_dma_ctl = FIFO_RISC_DISABLED; 960 961 bt848->int_mask = ALL_INTS_DISABLED; 962 --- 127 unchanged lines hidden (view full) --- 1090 bt848->gpio_dma_ctl = FIFO_ENABLED; 1091 wakeup((caddr_t)bktr); 1092 } 1093 1094 /* 1095 * If the user requested to be notified via signal, 1096 * let them know the frame is complete. 1097 */ |
1098 |
|
1072 if (bktr->proc && !(bktr->signal & METEOR_SIG_MODE_MASK)) 1073 psignal( bktr->proc, 1074 bktr->signal&(~METEOR_SIG_MODE_MASK) ); 1075 1076 /* 1077 * Reset the want flags if in continuous or 1078 * synchronous capture mode. 1079 */ --- 254 unchanged lines hidden (view full) --- 1334 1335 if (MINOR(minor(dev)) > 0) 1336 return( ENXIO ); 1337 1338 unit = UNIT(minor(dev)); 1339 if (unit >= NBKTR) /* unit out of range */ 1340 return( ENXIO ); 1341 | 1099 if (bktr->proc && !(bktr->signal & METEOR_SIG_MODE_MASK)) 1100 psignal( bktr->proc, 1101 bktr->signal&(~METEOR_SIG_MODE_MASK) ); 1102 1103 /* 1104 * Reset the want flags if in continuous or 1105 * synchronous capture mode. 1106 */ --- 254 unchanged lines hidden (view full) --- 1361 1362 if (MINOR(minor(dev)) > 0) 1363 return( ENXIO ); 1364 1365 unit = UNIT(minor(dev)); 1366 if (unit >= NBKTR) /* unit out of range */ 1367 return( ENXIO ); 1368 |
1342 printf("btkr driver : use ioctl interface . read function not implemented \n"); 1343 return( ENXIO ); 1344 | |
1345 bktr = &(brooktree[unit]); | 1369 bktr = &(brooktree[unit]); |
1370 bt848 = bktr->base; 1371 |
|
1346 if (bktr->bigbuf == 0) /* no frame buffer allocated (ioctl failed) */ 1347 return( ENOMEM ); 1348 1349 if (bktr->flags & METEOR_CAP_MASK) 1350 return( EIO ); /* already capturing */ 1351 | 1372 if (bktr->bigbuf == 0) /* no frame buffer allocated (ioctl failed) */ 1373 return( ENOMEM ); 1374 1375 if (bktr->flags & METEOR_CAP_MASK) 1376 return( EIO ); /* already capturing */ 1377 |
1378 bt848->cap_ctl = bktr->bktr_cap_ctl; 1379 1380 |
|
1352 count = bktr->rows * bktr->cols * 1353 pixfmt_table[ bktr->pixfmt ].public.Bpp; 1354 1355 if ((int) uio->uio_iov->iov_len < count) 1356 return( EINVAL ); 1357 1358 bktr->flags &= ~(METEOR_CAP_MASK | METEOR_WANT_MASK); 1359 | 1381 count = bktr->rows * bktr->cols * 1382 pixfmt_table[ bktr->pixfmt ].public.Bpp; 1383 1384 if ((int) uio->uio_iov->iov_len < count) 1385 return( EINVAL ); 1386 1387 bktr->flags &= ~(METEOR_CAP_MASK | METEOR_WANT_MASK); 1388 |
1360 /* Start capture */ 1361 bt848 = bktr->base; | 1389 /* capture one frame */ 1390 start_capture(bktr, METEOR_SINGLE); 1391 /* wait for capture to complete */ 1392 bt848->int_stat = ALL_INTS_CLEARED; |
1362 bt848->gpio_dma_ctl = FIFO_ENABLED; | 1393 bt848->gpio_dma_ctl = FIFO_ENABLED; |
1363 bt848->gpio_dma_ctl = FIFO_RISC_ENABLED; | 1394 bt848->gpio_dma_ctl = bktr->capcontrol; 1395 bt848->int_mask = BT848_INT_MYSTERYBIT | 1396 BT848_INT_RISCI | 1397 BT848_INT_VSYNC | 1398 BT848_INT_FMTCHG; |
1364 | 1399 |
1400 |
|
1365 status = tsleep((caddr_t)bktr, BKTRPRI, "captur", 0); 1366 if (!status) /* successful capture */ 1367 status = uiomove((caddr_t)bktr->bigbuf, count, uio); 1368 else 1369 printf ("bktr%d: read: tsleep error %d\n", unit, status); 1370 1371 bktr->flags &= ~(METEOR_SINGLE | METEOR_WANT_MASK); 1372 --- 35 unchanged lines hidden (view full) --- 1408 1409 case TUNER_DEV: 1410 return( tuner_ioctl( bktr, unit, cmd, arg, pr ) ); 1411 } 1412 1413 return( ENXIO ); 1414} 1415 | 1401 status = tsleep((caddr_t)bktr, BKTRPRI, "captur", 0); 1402 if (!status) /* successful capture */ 1403 status = uiomove((caddr_t)bktr->bigbuf, count, uio); 1404 else 1405 printf ("bktr%d: read: tsleep error %d\n", unit, status); 1406 1407 bktr->flags &= ~(METEOR_SINGLE | METEOR_WANT_MASK); 1408 --- 35 unchanged lines hidden (view full) --- 1444 1445 case TUNER_DEV: 1446 return( tuner_ioctl( bktr, unit, cmd, arg, pr ) ); 1447 } 1448 1449 return( ENXIO ); 1450} 1451 |
1452 |
|
1416/* 1417 * video ioctls 1418 */ 1419static int 1420video_ioctl( bktr_ptr_t bktr, int unit, int cmd, caddr_t arg, struct proc* pr ) 1421{ 1422 int tmp_int; 1423 bt848_ptr_t bt848; --- 109 unchanged lines hidden (view full) --- 1533 bktr->flags = (bktr->flags & ~METEOR_FORM_MASK) | 1534 METEOR_PAL; 1535 bt848->adelay = format_params[temp].adelay; 1536 bt848->bdelay = format_params[temp].bdelay; 1537 bktr->format_params = temp; 1538 break; 1539 1540 } | 1453/* 1454 * video ioctls 1455 */ 1456static int 1457video_ioctl( bktr_ptr_t bktr, int unit, int cmd, caddr_t arg, struct proc* pr ) 1458{ 1459 int tmp_int; 1460 bt848_ptr_t bt848; --- 109 unchanged lines hidden (view full) --- 1570 bktr->flags = (bktr->flags & ~METEOR_FORM_MASK) | 1571 METEOR_PAL; 1572 bt848->adelay = format_params[temp].adelay; 1573 bt848->bdelay = format_params[temp].bdelay; 1574 bktr->format_params = temp; 1575 break; 1576 1577 } |
1578 bktr->dma_prog_loaded = FALSE; |
|
1541 break; 1542 1543 case METEORSFMT: /* set input format */ 1544 switch(*(unsigned long *)arg & METEOR_FORM_MASK ) { 1545 case 0: /* default */ 1546 case METEOR_FMT_NTSC: 1547 bktr->flags = (bktr->flags & ~METEOR_FORM_MASK) | 1548 METEOR_NTSC; 1549 bt848->iform &= ~BT848_IFORM_FORMAT; | 1579 break; 1580 1581 case METEORSFMT: /* set input format */ 1582 switch(*(unsigned long *)arg & METEOR_FORM_MASK ) { 1583 case 0: /* default */ 1584 case METEOR_FMT_NTSC: 1585 bktr->flags = (bktr->flags & ~METEOR_FORM_MASK) | 1586 METEOR_NTSC; 1587 bt848->iform &= ~BT848_IFORM_FORMAT; |
1550 bt848->iform |= BT848_IFORM_F_NTSCM; | 1588 bt848->iform |= BT848_IFORM_F_NTSCM | 1589 format_params[BT848_IFORM_F_NTSCM].iform_xtsel; |
1551 bt848->adelay = 0x68; 1552 bt848->bdelay = 0x5d; 1553 bktr->format_params = BT848_IFORM_F_NTSCM; 1554 break; 1555 1556 case METEOR_FMT_PAL: 1557 bktr->flags = (bktr->flags & ~METEOR_FORM_MASK) | 1558 METEOR_PAL; 1559 bt848->iform &= ~BT848_IFORM_FORMAT; | 1590 bt848->adelay = 0x68; 1591 bt848->bdelay = 0x5d; 1592 bktr->format_params = BT848_IFORM_F_NTSCM; 1593 break; 1594 1595 case METEOR_FMT_PAL: 1596 bktr->flags = (bktr->flags & ~METEOR_FORM_MASK) | 1597 METEOR_PAL; 1598 bt848->iform &= ~BT848_IFORM_FORMAT; |
1560 bt848->iform |= BT848_IFORM_F_PALBDGHI; | 1599 bt848->iform |= BT848_IFORM_F_PALBDGHI | 1600 format_params[BT848_IFORM_F_PALBDGHI].iform_xtsel; |
1561 bt848->adelay = 0x7f; 1562 bt848->bdelay = 0x72; 1563 bktr->format_params = BT848_IFORM_F_PALBDGHI; 1564 break; 1565 1566 case METEOR_FMT_AUTOMODE: 1567 bktr->flags = (bktr->flags & ~METEOR_FORM_MASK) | 1568 METEOR_AUTOMODE; 1569 bt848->iform &= ~BT848_IFORM_FORMAT; 1570 break; 1571 1572 default: 1573 return( EINVAL ); 1574 } | 1601 bt848->adelay = 0x7f; 1602 bt848->bdelay = 0x72; 1603 bktr->format_params = BT848_IFORM_F_PALBDGHI; 1604 break; 1605 1606 case METEOR_FMT_AUTOMODE: 1607 bktr->flags = (bktr->flags & ~METEOR_FORM_MASK) | 1608 METEOR_AUTOMODE; 1609 bt848->iform &= ~BT848_IFORM_FORMAT; 1610 break; 1611 1612 default: 1613 return( EINVAL ); 1614 } |
1615 bktr->dma_prog_loaded = FALSE; |
|
1575 break; 1576 1577 case METEORGFMT: /* get input format */ 1578 *(u_long *)arg = bktr->flags & METEOR_FORM_MASK; 1579 break; 1580 1581 1582 case BT848GFMT: /* get input format */ --- 198 unchanged lines hidden (view full) --- 1781 1782 case METEORSETGEO: 1783 /* can't change parameters while capturing */ 1784 if (bktr->flags & METEOR_CAP_MASK) 1785 return( EBUSY ); 1786 1787 1788 geo = (struct meteor_geomet *) arg; | 1616 break; 1617 1618 case METEORGFMT: /* get input format */ 1619 *(u_long *)arg = bktr->flags & METEOR_FORM_MASK; 1620 break; 1621 1622 1623 case BT848GFMT: /* get input format */ --- 198 unchanged lines hidden (view full) --- 1822 1823 case METEORSETGEO: 1824 /* can't change parameters while capturing */ 1825 if (bktr->flags & METEOR_CAP_MASK) 1826 return( EBUSY ); 1827 1828 1829 geo = (struct meteor_geomet *) arg; |
1789 fp = &format_params[bktr->format_params]; | |
1790 1791 error = 0; 1792 /* Either even or odd, if even & odd, then these a zero */ 1793 if ((geo->oformat & METEOR_GEO_ODD_ONLY) && 1794 (geo->oformat & METEOR_GEO_EVEN_ONLY)) { 1795 printf( "bktr%d: ioctl: Geometry odd or even only.\n", 1796 unit); 1797 return( EINVAL ); --- 64 unchanged lines hidden (view full) --- 1862 1863 if (error) 1864 return error; 1865 1866 bktr->rows = geo->rows; 1867 bktr->cols = geo->columns; 1868 bktr->frames = geo->frames; 1869 | 1830 1831 error = 0; 1832 /* Either even or odd, if even & odd, then these a zero */ 1833 if ((geo->oformat & METEOR_GEO_ODD_ONLY) && 1834 (geo->oformat & METEOR_GEO_EVEN_ONLY)) { 1835 printf( "bktr%d: ioctl: Geometry odd or even only.\n", 1836 unit); 1837 return( EINVAL ); --- 64 unchanged lines hidden (view full) --- 1902 1903 if (error) 1904 return error; 1905 1906 bktr->rows = geo->rows; 1907 bktr->cols = geo->columns; 1908 bktr->frames = geo->frames; 1909 |
1870 temp = ((quad_t ) fp->htotal* (quad_t) fp->horizontal * 4096 1871 / fp->vertical / bktr->cols) - 4096; 1872 bt848->e_hscale_lo = temp & 0xff; 1873 bt848->o_hscale_lo = temp & 0xff; 1874 bt848->e_hscale_hi = (temp >> 8) & 0xff; 1875 bt848->o_hscale_hi = (temp >> 8) & 0xff; 1876 1877 /* horizontal active */ 1878 temp = bktr->cols; 1879 bt848->e_hactive_lo = temp & 0xff; 1880 bt848->o_hactive_lo = temp & 0xff; 1881 bt848->e_crop &= ~0x3; 1882 bt848->o_crop &= ~0x3; 1883 bt848->e_crop |= (temp >> 8) & 0x3; 1884 bt848->o_crop |= (temp >> 8) & 0x3; 1885 1886 /* horizontal delay */ 1887 temp = (fp->hdelay * bktr->cols) / fp->hactive; 1888 temp = temp + 2; /* why?? - rmt */ 1889 temp = temp & 0x3fe; 1890 bt848->e_delay_lo = temp & 0xff; 1891 bt848->o_delay_lo = temp & 0xff; 1892 bt848->e_crop &= ~0xc; 1893 bt848->o_crop &= ~0xc; 1894 bt848->e_crop |= (temp >> 6) & 0xc; 1895 bt848->o_crop |= (temp >> 6) & 0xc; 1896 1897 /* vertical scale */ 1898 if (geo->oformat & METEOR_GEO_ODD_ONLY || 1899 geo->oformat & METEOR_GEO_EVEN_ONLY) 1900 tmp_int = 65536 - 1901 ((fp->vactive * 256 / bktr->rows) - 512); 1902 else { 1903 tmp_int = 65536 - 1904 (((fp->vactive * 512) / bktr->rows) - 512); 1905 } 1906 1907 tmp_int &= 0x1fff; 1908 1909 bt848->e_vscale_lo = tmp_int & 0xff; 1910 bt848->o_vscale_lo = tmp_int & 0xff; 1911 bt848->e_vscale_hi &= ~0x1f; 1912 bt848->o_vscale_hi &= ~0x1f; 1913 bt848->e_vscale_hi |= (tmp_int >> 8) & 0x1f; 1914 bt848->o_vscale_hi |= (tmp_int >> 8) & 0x1f; 1915 1916 /* vertical active */ 1917 bt848->e_crop &= ~0x30; 1918 bt848->e_crop |= (fp->vactive >> 4) & 0x30; 1919 bt848->e_vactive_lo = fp->vactive & 0xff; 1920 bt848->o_crop &= ~0x30; 1921 bt848->o_crop |= (fp->vactive >> 4) & 0x30; 1922 bt848->o_vactive_lo = fp->vactive & 0xff; 1923 1924 /* vertical delay */ 1925 bt848->e_vdelay_lo = fp->vdelay; 1926 bt848->o_vdelay_lo = fp->vdelay; 1927 | |
1928 /* Pixel format (if in meteor pixfmt compatibility mode) */ 1929 if ( bktr->pixfmt_compat ) { 1930 bktr->format = METEOR_GEO_YUV_422; 1931 switch (geo->oformat & METEOR_GEO_OUTPUT_MASK) { 1932 case 0: /* default */ 1933 case METEOR_GEO_RGB16: 1934 bktr->format = METEOR_GEO_RGB16; 1935 break; --- 324 unchanged lines hidden (view full) --- 2260 2261 case BT848_SIGNATURE: 2262 offset = (((struct eeProm *)arg)->offset); 2263 count = (((struct eeProm *)arg)->count); 2264 buf = &(((struct eeProm *)arg)->bytes[ 0 ]); 2265 if ( signCard( bktr, offset, count, buf ) < 0 ) 2266 return( EIO ); 2267 break; | 1910 /* Pixel format (if in meteor pixfmt compatibility mode) */ 1911 if ( bktr->pixfmt_compat ) { 1912 bktr->format = METEOR_GEO_YUV_422; 1913 switch (geo->oformat & METEOR_GEO_OUTPUT_MASK) { 1914 case 0: /* default */ 1915 case METEOR_GEO_RGB16: 1916 bktr->format = METEOR_GEO_RGB16; 1917 break; --- 324 unchanged lines hidden (view full) --- 2242 2243 case BT848_SIGNATURE: 2244 offset = (((struct eeProm *)arg)->offset); 2245 count = (((struct eeProm *)arg)->count); 2246 buf = &(((struct eeProm *)arg)->bytes[ 0 ]); 2247 if ( signCard( bktr, offset, count, buf ) < 0 ) 2248 return( EIO ); 2249 break; |
2250 /* Ioctl's for running the tuner device in radio mode */ 2251#if 0 2252 case RADIO_SETMODE: /* XXX Todo: implement me ... */ 2253 break; 2254 case RADIO_GETFREQ; /* XXX Todo: implement me ... */ 2255 break; 2256#endif 2257 case RADIO_SETFREQ: 2258 /* The argument to this ioctl is NOT freq*16. It is 2259 ** freq*100. 2260 */ |
|
2268 | 2261 |
2262 /* The radio in my stereo and the linear regression function 2263 ** in my HP48 have reached the conclusion that in order to 2264 ** set the radio tuner of the FM1216 to f MHz, the value to 2265 ** enter into the PLL is: f*20-407 2266 ** If anyone has the exact values from the spec. sheet 2267 ** please forward them -- fj@login.dknet.dk 2268 */ 2269 temp=(int)*(unsigned long *)arg/5-407 +RADIO_OFFSET; 2270 2271#ifdef BKTR_RADIO_DEBUG 2272 printf("bktr%d: arg=%d temp=%d\n",unit,(int)*(unsigned long *)arg,temp); 2273#endif 2274 2275#ifndef BKTR_RADIO_NOFREQCHECK 2276 /* According to the spec. sheet the band: 87.5MHz-108MHz */ 2277 /* is supported. */ 2278 if(temp<1343+RADIO_OFFSET || temp>1753+RADIO_OFFSET) { 2279 printf("bktr%d: Radio frequency out of range\n",unit); 2280 return(EINVAL); 2281 } 2282#endif 2283 temp_mute( bktr, TRUE ); 2284 temp = tv_freq( bktr, temp ); 2285 temp_mute( bktr, FALSE ); 2286#ifdef BKTR_RADIO_DEBUG 2287 if(temp) 2288 printf("bktr%d: tv_freq returned: %d\n",unit,temp); 2289#endif 2290 if ( temp < 0 ) 2291 return( EINVAL ); 2292 *(unsigned long *)arg = temp; 2293 break; 2294 2295 |
|
2269 default: 2270 return common_ioctl( bktr, bt848, cmd, arg ); 2271 } 2272 2273 return( 0 ); 2274} 2275 2276 --- 384 unchanged lines hidden (view full) --- 2661 pitch = bktr->video.width; 2662 } 2663 else { 2664 target_buffer = (u_long) vtophys(bktr->bigbuf); 2665 pitch = cols*Bpp; 2666 } 2667 2668 buffer = target_buffer; | 2296 default: 2297 return common_ioctl( bktr, bt848, cmd, arg ); 2298 } 2299 2300 return( 0 ); 2301} 2302 2303 --- 384 unchanged lines hidden (view full) --- 2688 pitch = bktr->video.width; 2689 } 2690 else { 2691 target_buffer = (u_long) vtophys(bktr->bigbuf); 2692 pitch = cols*Bpp; 2693 } 2694 2695 buffer = target_buffer; |
2669 if (interlace == 2 && rows < 320 ) target_buffer += pitch; | |
2670 | 2696 |
2697 |
|
2671 /* contruct sync : for video packet format */ 2672 *dma_prog++ = OP_SYNC | 1 << 15 | BKTR_FM1; 2673 2674 /* sync, mode indicator packed data */ 2675 *dma_prog++ = 0; /* NULL WORD */ 2676 width = cols; 2677 for (i = 0; i < (rows/interlace); i++) { 2678 target = target_buffer; --- 21 unchanged lines hidden (view full) --- 2700 2701 target_buffer += interlace * pitch; 2702 2703 } 2704 2705 switch (i_flag) { 2706 case 1: 2707 /* sync vre */ | 2698 /* contruct sync : for video packet format */ 2699 *dma_prog++ = OP_SYNC | 1 << 15 | BKTR_FM1; 2700 2701 /* sync, mode indicator packed data */ 2702 *dma_prog++ = 0; /* NULL WORD */ 2703 width = cols; 2704 for (i = 0; i < (rows/interlace); i++) { 2705 target = target_buffer; --- 21 unchanged lines hidden (view full) --- 2727 2728 target_buffer += interlace * pitch; 2729 2730 } 2731 2732 switch (i_flag) { 2733 case 1: 2734 /* sync vre */ |
2708 *dma_prog++ = OP_SYNC | 0xC << 24 | 1 << 24 | BKTR_VRE; | 2735 *dma_prog++ = OP_SYNC | 1 << 24 | BKTR_VRE; |
2709 *dma_prog++ = 0; /* NULL WORD */ 2710 | 2736 *dma_prog++ = 0; /* NULL WORD */ 2737 |
2711 *dma_prog++ = OP_JUMP | 0xC << 24; | 2738 *dma_prog++ = OP_JUMP; |
2712 *dma_prog++ = (u_long ) vtophys(bktr->dma_prog); 2713 return; 2714 2715 case 2: 2716 /* sync vro */ | 2739 *dma_prog++ = (u_long ) vtophys(bktr->dma_prog); 2740 return; 2741 2742 case 2: 2743 /* sync vro */ |
2717 *dma_prog++ = OP_SYNC | 1 << 24 | 1 << 20 | BKTR_VRO; | 2744 *dma_prog++ = OP_SYNC | 1 << 24 | BKTR_VRO; |
2718 *dma_prog++ = 0; /* NULL WORD */ 2719 2720 *dma_prog++ = OP_JUMP; 2721 *dma_prog++ = (u_long ) vtophys(bktr->dma_prog); 2722 return; 2723 2724 case 3: 2725 /* sync vro */ 2726 *dma_prog++ = OP_SYNC | 1 << 24 | 1 << 15 | BKTR_VRO; 2727 *dma_prog++ = 0; /* NULL WORD */ | 2745 *dma_prog++ = 0; /* NULL WORD */ 2746 2747 *dma_prog++ = OP_JUMP; 2748 *dma_prog++ = (u_long ) vtophys(bktr->dma_prog); 2749 return; 2750 2751 case 3: 2752 /* sync vro */ 2753 *dma_prog++ = OP_SYNC | 1 << 24 | 1 << 15 | BKTR_VRO; 2754 *dma_prog++ = 0; /* NULL WORD */ |
2728 *dma_prog++ = OP_JUMP | 0xc << 24 ; | 2755 *dma_prog++ = OP_JUMP; ; |
2729 *dma_prog = (u_long ) vtophys(bktr->odd_dma_prog); 2730 break; 2731 } 2732 2733 if (interlace == 2) { | 2756 *dma_prog = (u_long ) vtophys(bktr->odd_dma_prog); 2757 break; 2758 } 2759 2760 if (interlace == 2) { |
2734 if (rows < 320 ) 2735 target_buffer = buffer ; 2736 else 2737 target_buffer = buffer + pitch; | |
2738 | 2761 |
2762 target_buffer = buffer + pitch; 2763 |
|
2739 dma_prog = (u_long *) bktr->odd_dma_prog; 2740 2741 2742 /* sync vre IRQ bit */ 2743 *dma_prog++ = OP_SYNC | 1 << 15 | BKTR_FM1; 2744 *dma_prog++ = 0; /* NULL WORD */ 2745 width = cols; 2746 for (i = 0; i < (rows/interlace); i++) { --- 93 unchanged lines hidden (view full) --- 2840 *dma_prog++ = inst3; 2841 *dma_prog++ = target_buffer + b; 2842 target_buffer += interlace*(cols * 2); 2843 } 2844 2845 switch (i_flag) { 2846 case 1: 2847 /* sync vre */ | 2764 dma_prog = (u_long *) bktr->odd_dma_prog; 2765 2766 2767 /* sync vre IRQ bit */ 2768 *dma_prog++ = OP_SYNC | 1 << 15 | BKTR_FM1; 2769 *dma_prog++ = 0; /* NULL WORD */ 2770 width = cols; 2771 for (i = 0; i < (rows/interlace); i++) { --- 93 unchanged lines hidden (view full) --- 2865 *dma_prog++ = inst3; 2866 *dma_prog++ = target_buffer + b; 2867 target_buffer += interlace*(cols * 2); 2868 } 2869 2870 switch (i_flag) { 2871 case 1: 2872 /* sync vre */ |
2848 *dma_prog++ = OP_SYNC | 0xC << 24 | BKTR_VRE; | 2873 *dma_prog++ = OP_SYNC | 1 << 24 | BKTR_VRE; |
2849 *dma_prog++ = 0; /* NULL WORD */ 2850 2851 *dma_prog++ = OP_JUMP; 2852 *dma_prog++ = (u_long ) vtophys(bktr->dma_prog); 2853 return; 2854 2855 case 2: 2856 /* sync vro */ | 2874 *dma_prog++ = 0; /* NULL WORD */ 2875 2876 *dma_prog++ = OP_JUMP; 2877 *dma_prog++ = (u_long ) vtophys(bktr->dma_prog); 2878 return; 2879 2880 case 2: 2881 /* sync vro */ |
2857 *dma_prog++ = OP_SYNC | 0xC << 24 | BKTR_VRO; | 2882 *dma_prog++ = OP_SYNC | 1 << 24 | BKTR_VRO; |
2858 *dma_prog++ = 0; /* NULL WORD */ 2859 *dma_prog++ = OP_JUMP; 2860 *dma_prog++ = (u_long ) vtophys(bktr->dma_prog); 2861 return; 2862 2863 case 3: | 2883 *dma_prog++ = 0; /* NULL WORD */ 2884 *dma_prog++ = OP_JUMP; 2885 *dma_prog++ = (u_long ) vtophys(bktr->dma_prog); 2886 return; 2887 2888 case 3: |
2864 /* sync vre */ 2865 *dma_prog++ = OP_SYNC | BKTR_VRE; | 2889 /* sync vro */ 2890 *dma_prog++ = OP_SYNC | 1 << 24 | 1 << 15 | BKTR_VRO; |
2866 *dma_prog++ = 0; /* NULL WORD */ 2867 *dma_prog++ = OP_JUMP ; 2868 *dma_prog = (u_long ) vtophys(bktr->odd_dma_prog); 2869 break; 2870 } 2871 2872 if (interlace == 2) { 2873 --- 10 unchanged lines hidden (view full) --- 2884 *dma_prog++ = target_buffer; 2885 *dma_prog++ = inst3; 2886 *dma_prog++ = target_buffer + b; 2887 target_buffer += interlace * ( cols*2); 2888 } 2889 } 2890 2891 /* sync vro IRQ bit */ | 2891 *dma_prog++ = 0; /* NULL WORD */ 2892 *dma_prog++ = OP_JUMP ; 2893 *dma_prog = (u_long ) vtophys(bktr->odd_dma_prog); 2894 break; 2895 } 2896 2897 if (interlace == 2) { 2898 --- 10 unchanged lines hidden (view full) --- 2909 *dma_prog++ = target_buffer; 2910 *dma_prog++ = inst3; 2911 *dma_prog++ = target_buffer + b; 2912 target_buffer += interlace * ( cols*2); 2913 } 2914 } 2915 2916 /* sync vro IRQ bit */ |
2892 *dma_prog++ = OP_SYNC | 1 << 24 | BKTR_VRE; | 2917 *dma_prog++ = OP_SYNC | 1 << 24 | 1 << 15 | BKTR_VRE; |
2893 *dma_prog++ = 0; /* NULL WORD */ 2894 *dma_prog++ = OP_JUMP ; 2895 *dma_prog++ = (u_long ) vtophys(bktr->dma_prog); 2896 2897 *dma_prog++ = OP_JUMP; 2898 *dma_prog++ = (u_long ) vtophys(bktr->dma_prog); 2899 *dma_prog++ = 0; /* NULL WORD */ 2900} --- 42 unchanged lines hidden (view full) --- 2943 inst = OP_WRITE123 | OP_SOL | OP_EOL | (cols); 2944 if (bktr->video.addr) 2945 target_buffer = (u_long) bktr->video.addr; 2946 else 2947 target_buffer = (u_long) vtophys(bktr->bigbuf); 2948 2949 buffer = target_buffer; 2950 | 2918 *dma_prog++ = 0; /* NULL WORD */ 2919 *dma_prog++ = OP_JUMP ; 2920 *dma_prog++ = (u_long ) vtophys(bktr->dma_prog); 2921 2922 *dma_prog++ = OP_JUMP; 2923 *dma_prog++ = (u_long ) vtophys(bktr->dma_prog); 2924 *dma_prog++ = 0; /* NULL WORD */ 2925} --- 42 unchanged lines hidden (view full) --- 2968 inst = OP_WRITE123 | OP_SOL | OP_EOL | (cols); 2969 if (bktr->video.addr) 2970 target_buffer = (u_long) bktr->video.addr; 2971 else 2972 target_buffer = (u_long) vtophys(bktr->bigbuf); 2973 2974 buffer = target_buffer; 2975 |
2951 t1 = target_buffer; | 2976 t1 = buffer; |
2952 2953 /* contruct sync : for video packet format */ 2954 *dma_prog++ = OP_SYNC | 1 << 15 | BKTR_FM3; /*sync, mode indicator packed data*/ 2955 *dma_prog++ = 0; /* NULL WORD */ 2956 | 2977 2978 /* contruct sync : for video packet format */ 2979 *dma_prog++ = OP_SYNC | 1 << 15 | BKTR_FM3; /*sync, mode indicator packed data*/ 2980 *dma_prog++ = 0; /* NULL WORD */ 2981 |
2957 for (i = 0; i < (rows/interlace ) - 1; i++) { | 2982 for (i = 0; i < (rows/interlace ) ; i++) { |
2958 *dma_prog++ = inst; 2959 *dma_prog++ = cols/2 | cols/2 << 16; 2960 *dma_prog++ = target_buffer; 2961 *dma_prog++ = t1 + (cols*rows) + i*cols/2 * interlace; 2962 *dma_prog++ = t1 + (cols*rows) + (cols*rows/2) + i*cols/2 * interlace; 2963 target_buffer += interlace*cols; 2964 } 2965 2966 switch (i_flag) { 2967 case 1: | 2983 *dma_prog++ = inst; 2984 *dma_prog++ = cols/2 | cols/2 << 16; 2985 *dma_prog++ = target_buffer; 2986 *dma_prog++ = t1 + (cols*rows) + i*cols/2 * interlace; 2987 *dma_prog++ = t1 + (cols*rows) + (cols*rows/2) + i*cols/2 * interlace; 2988 target_buffer += interlace*cols; 2989 } 2990 2991 switch (i_flag) { 2992 case 1: |
2968 *dma_prog++ = OP_SYNC | 0xC << 24 | 1 << 24 | BKTR_VRE; /*sync vre*/ | 2993 *dma_prog++ = OP_SYNC | 1 << 24 | BKTR_VRE; /*sync vre*/ |
2969 *dma_prog++ = 0; /* NULL WORD */ 2970 | 2994 *dma_prog++ = 0; /* NULL WORD */ 2995 |
2971 *dma_prog++ = OP_JUMP | 0xc << 24; | 2996 *dma_prog++ = OP_JUMP ; |
2972 *dma_prog++ = (u_long ) vtophys(bktr->dma_prog); 2973 return; 2974 2975 case 2: | 2997 *dma_prog++ = (u_long ) vtophys(bktr->dma_prog); 2998 return; 2999 3000 case 2: |
2976 *dma_prog++ = OP_SYNC | 0xC << 24 | 1 << 24 | BKTR_VRO; /*sync vre*/ | 3001 *dma_prog++ = OP_SYNC | 1 << 24 | BKTR_VRO; /*sync vre*/ |
2977 *dma_prog++ = 0; /* NULL WORD */ 2978 2979 *dma_prog++ = OP_JUMP; 2980 *dma_prog++ = (u_long ) vtophys(bktr->dma_prog); 2981 return; 2982 2983 case 3: | 3002 *dma_prog++ = 0; /* NULL WORD */ 3003 3004 *dma_prog++ = OP_JUMP; 3005 *dma_prog++ = (u_long ) vtophys(bktr->dma_prog); 3006 return; 3007 3008 case 3: |
2984 *dma_prog++ = OP_SYNC | 1 << 15 | BKTR_VRO; | 3009 *dma_prog++ = OP_SYNC | 1 << 24 | 1 << 15 | BKTR_VRO; |
2985 *dma_prog++ = 0; /* NULL WORD */ 2986 2987 *dma_prog++ = OP_JUMP ; 2988 *dma_prog = (u_long ) vtophys(bktr->odd_dma_prog); 2989 break; 2990 } 2991 2992 if (interlace == 2) { 2993 2994 dma_prog = (u_long * ) bktr->odd_dma_prog; 2995 2996 target_buffer = (u_long) buffer + cols; | 3010 *dma_prog++ = 0; /* NULL WORD */ 3011 3012 *dma_prog++ = OP_JUMP ; 3013 *dma_prog = (u_long ) vtophys(bktr->odd_dma_prog); 3014 break; 3015 } 3016 3017 if (interlace == 2) { 3018 3019 dma_prog = (u_long * ) bktr->odd_dma_prog; 3020 3021 target_buffer = (u_long) buffer + cols; |
2997 t1 = target_buffer + cols/2; | 3022 t1 = buffer + cols/2; |
2998 *dma_prog++ = OP_SYNC | 1 << 15 | BKTR_FM3; 2999 *dma_prog++ = 0; /* NULL WORD */ 3000 | 3023 *dma_prog++ = OP_SYNC | 1 << 15 | BKTR_FM3; 3024 *dma_prog++ = 0; /* NULL WORD */ 3025 |
3001 for (i = 0; i < (rows/interlace ) - 1; i++) { | 3026 for (i = 0; i < (rows/interlace ) ; i++) { |
3002 *dma_prog++ = inst; 3003 *dma_prog++ = cols/2 | cols/2 << 16; 3004 *dma_prog++ = target_buffer; 3005 *dma_prog++ = t1 + (cols*rows) + i*cols/2 * interlace; 3006 *dma_prog++ = t1 + (cols*rows) + (cols*rows/2) + i*cols/2 * interlace; 3007 target_buffer += interlace*cols; 3008 } 3009 } 3010 | 3027 *dma_prog++ = inst; 3028 *dma_prog++ = cols/2 | cols/2 << 16; 3029 *dma_prog++ = target_buffer; 3030 *dma_prog++ = t1 + (cols*rows) + i*cols/2 * interlace; 3031 *dma_prog++ = t1 + (cols*rows) + (cols*rows/2) + i*cols/2 * interlace; 3032 target_buffer += interlace*cols; 3033 } 3034 } 3035 |
3011 *dma_prog++ = OP_SYNC | 1 << 24 | BKTR_VRE; | 3036 *dma_prog++ = OP_SYNC | 1 << 24 | 1 << 15 | BKTR_VRE; |
3012 *dma_prog++ = 0; /* NULL WORD */ 3013 *dma_prog++ = OP_JUMP ; 3014 *dma_prog++ = (u_long ) vtophys(bktr->dma_prog) ; 3015 *dma_prog++ = 0; /* NULL WORD */ 3016} 3017 3018 3019/* 3020 * 3021 */ 3022static void 3023yuv12_prog( bktr_ptr_t bktr, char i_flag, 3024 int cols, int rows, int interlace ){ 3025 | 3037 *dma_prog++ = 0; /* NULL WORD */ 3038 *dma_prog++ = OP_JUMP ; 3039 *dma_prog++ = (u_long ) vtophys(bktr->dma_prog) ; 3040 *dma_prog++ = 0; /* NULL WORD */ 3041} 3042 3043 3044/* 3045 * 3046 */ 3047static void 3048yuv12_prog( bktr_ptr_t bktr, char i_flag, 3049 int cols, int rows, int interlace ){ 3050 |
3026 int i, k; | 3051 int i; |
3027 volatile unsigned int inst; 3028 volatile unsigned int inst1; 3029 volatile u_long target_buffer, t1, buffer; 3030 bt848_ptr_t bt848; 3031 volatile u_long *dma_prog; 3032 struct meteor_pixfmt_internal *pf_int = &pixfmt_table[ bktr->pixfmt ]; 3033 3034 bt848 = bktr->base; --- 29 unchanged lines hidden (view full) --- 3064 else 3065 target_buffer = (u_long) vtophys(bktr->bigbuf); 3066 3067 buffer = target_buffer; 3068 t1 = buffer; 3069 3070 *dma_prog++ = OP_SYNC | 1 << 15 | BKTR_FM3; /*sync, mode indicator packed data*/ 3071 *dma_prog++ = 0; /* NULL WORD */ | 3052 volatile unsigned int inst; 3053 volatile unsigned int inst1; 3054 volatile u_long target_buffer, t1, buffer; 3055 bt848_ptr_t bt848; 3056 volatile u_long *dma_prog; 3057 struct meteor_pixfmt_internal *pf_int = &pixfmt_table[ bktr->pixfmt ]; 3058 3059 bt848 = bktr->base; --- 29 unchanged lines hidden (view full) --- 3089 else 3090 target_buffer = (u_long) vtophys(bktr->bigbuf); 3091 3092 buffer = target_buffer; 3093 t1 = buffer; 3094 3095 *dma_prog++ = OP_SYNC | 1 << 15 | BKTR_FM3; /*sync, mode indicator packed data*/ 3096 *dma_prog++ = 0; /* NULL WORD */ |
3072 if (i_flag > 2) 3073 k = 1; 3074 else k = 0; | |
3075 | 3097 |
3076 for (i = 0; i < (rows/interlace )/2 - k; i++) { | 3098 for (i = 0; i < (rows/interlace )/2 ; i++) { |
3077 *dma_prog++ = inst; 3078 *dma_prog++ = cols/2 | (cols/2 << 16); 3079 *dma_prog++ = target_buffer; 3080 *dma_prog++ = t1 + (cols*rows) + i*cols/2 * interlace; 3081 *dma_prog++ = t1 + (cols*rows) + (cols*rows/4) + i*cols/2 * interlace; 3082 target_buffer += interlace*cols; 3083 *dma_prog++ = inst1; 3084 *dma_prog++ = cols/2 | (cols/2 << 16); 3085 *dma_prog++ = target_buffer; 3086 target_buffer += interlace*cols; 3087 3088 } 3089 3090 switch (i_flag) { 3091 case 1: | 3099 *dma_prog++ = inst; 3100 *dma_prog++ = cols/2 | (cols/2 << 16); 3101 *dma_prog++ = target_buffer; 3102 *dma_prog++ = t1 + (cols*rows) + i*cols/2 * interlace; 3103 *dma_prog++ = t1 + (cols*rows) + (cols*rows/4) + i*cols/2 * interlace; 3104 target_buffer += interlace*cols; 3105 *dma_prog++ = inst1; 3106 *dma_prog++ = cols/2 | (cols/2 << 16); 3107 *dma_prog++ = target_buffer; 3108 target_buffer += interlace*cols; 3109 3110 } 3111 3112 switch (i_flag) { 3113 case 1: |
3092 *dma_prog++ = OP_SYNC | 1 << 24 | BKTR_VRO; /*sync vro*/ | 3114 *dma_prog++ = OP_SYNC | 1 << 24 | BKTR_VRE; /*sync vre*/ |
3093 *dma_prog++ = 0; /* NULL WORD */ | 3115 *dma_prog++ = 0; /* NULL WORD */ |
3094 3095 *dma_prog++ = OP_JUMP ; 3096 *dma_prog++ = (u_long ) vtophys(bktr->dma_prog); | 3116 3117 *dma_prog++ = OP_JUMP; 3118 *dma_prog++ = (u_long ) vtophys(bktr->dma_prog); |
3097 return; 3098 3099 case 2: | 3119 return; 3120 3121 case 2: |
3100 *dma_prog++ = OP_SYNC | 1 << 24 | BKTR_VRE; /*sync vre*/ | 3122 *dma_prog++ = OP_SYNC | 1 << 24 | BKTR_VRO; /*sync vro*/ |
3101 *dma_prog++ = 0; /* NULL WORD */ | 3123 *dma_prog++ = 0; /* NULL WORD */ |
3102 3103 *dma_prog++ = OP_JUMP ; 3104 *dma_prog++ = (u_long ) vtophys(bktr->dma_prog); | 3124 3125 *dma_prog++ = OP_JUMP; 3126 *dma_prog++ = (u_long ) vtophys(bktr->dma_prog); |
3105 return; 3106 3107 case 3: 3108 *dma_prog++ = OP_SYNC | 1 << 24 | 1 << 15 | BKTR_VRO; 3109 *dma_prog++ = 0; /* NULL WORD */ | 3127 return; 3128 3129 case 3: 3130 *dma_prog++ = OP_SYNC | 1 << 24 | 1 << 15 | BKTR_VRO; 3131 *dma_prog++ = 0; /* NULL WORD */ |
3110 *dma_prog++ = OP_JUMP | 0xC << 24; | 3132 *dma_prog++ = OP_JUMP ; |
3111 *dma_prog = (u_long ) vtophys(bktr->odd_dma_prog); 3112 break; 3113 } 3114 3115 if (interlace == 2) { 3116 3117 dma_prog = (u_long * ) bktr->odd_dma_prog; 3118 3119 target_buffer = (u_long) buffer + cols; | 3133 *dma_prog = (u_long ) vtophys(bktr->odd_dma_prog); 3134 break; 3135 } 3136 3137 if (interlace == 2) { 3138 3139 dma_prog = (u_long * ) bktr->odd_dma_prog; 3140 3141 target_buffer = (u_long) buffer + cols; |
3120 t1 = target_buffer + cols/2; 3121 *dma_prog++ = OP_SYNC | 1 << 24 | BKTR_FM3; | 3142 t1 = buffer + cols/2; 3143 *dma_prog++ = OP_SYNC | 1 << 15 | BKTR_FM3; |
3122 *dma_prog++ = 0; /* NULL WORD */ 3123 3124 for (i = 0; i < ((rows/interlace )/2 ) ; i++) { 3125 *dma_prog++ = inst; 3126 *dma_prog++ = cols/2 | (cols/2 << 16); 3127 *dma_prog++ = target_buffer; 3128 *dma_prog++ = t1 + (cols*rows) + i*cols/2 * interlace; 3129 *dma_prog++ = t1 + (cols*rows) + (cols*rows/4) + i*cols/2 * interlace; --- 5 unchanged lines hidden (view full) --- 3135 3136 } 3137 3138 3139 } 3140 3141 *dma_prog++ = OP_SYNC | 1 << 24 | 1 << 15 | BKTR_VRE; 3142 *dma_prog++ = 0; /* NULL WORD */ | 3144 *dma_prog++ = 0; /* NULL WORD */ 3145 3146 for (i = 0; i < ((rows/interlace )/2 ) ; i++) { 3147 *dma_prog++ = inst; 3148 *dma_prog++ = cols/2 | (cols/2 << 16); 3149 *dma_prog++ = target_buffer; 3150 *dma_prog++ = t1 + (cols*rows) + i*cols/2 * interlace; 3151 *dma_prog++ = t1 + (cols*rows) + (cols*rows/4) + i*cols/2 * interlace; --- 5 unchanged lines hidden (view full) --- 3157 3158 } 3159 3160 3161 } 3162 3163 *dma_prog++ = OP_SYNC | 1 << 24 | 1 << 15 | BKTR_VRE; 3164 *dma_prog++ = 0; /* NULL WORD */ |
3143 *dma_prog++ = OP_JUMP | 0xC << 24; | 3165 *dma_prog++ = OP_JUMP; |
3144 *dma_prog++ = (u_long ) vtophys(bktr->dma_prog); 3145 *dma_prog++ = 0; /* NULL WORD */ 3146} 3147 3148 3149 3150/* 3151 * 3152 */ 3153static void 3154build_dma_prog( bktr_ptr_t bktr, char i_flag ) 3155{ 3156 int rows, cols, interlace; 3157 bt848_ptr_t bt848; | 3166 *dma_prog++ = (u_long ) vtophys(bktr->dma_prog); 3167 *dma_prog++ = 0; /* NULL WORD */ 3168} 3169 3170 3171 3172/* 3173 * 3174 */ 3175static void 3176build_dma_prog( bktr_ptr_t bktr, char i_flag ) 3177{ 3178 int rows, cols, interlace; 3179 bt848_ptr_t bt848; |
3180 int tmp_int; 3181 unsigned int temp; 3182 struct format_params *fp; |
|
3158 struct meteor_pixfmt_internal *pf_int = &pixfmt_table[ bktr->pixfmt ]; | 3183 struct meteor_pixfmt_internal *pf_int = &pixfmt_table[ bktr->pixfmt ]; |
3184 |
|
3159 | 3185 |
3186 fp = &format_params[bktr->format_params]; 3187 |
|
3160 bt848 = bktr->base; 3161 bt848->int_mask = ALL_INTS_DISABLED; 3162 3163 /* disable FIFO & RISC, leave other bits alone */ 3164 bt848->gpio_dma_ctl &= ~FIFO_RISC_ENABLED; 3165 | 3188 bt848 = bktr->base; 3189 bt848->int_mask = ALL_INTS_DISABLED; 3190 3191 /* disable FIFO & RISC, leave other bits alone */ 3192 bt848->gpio_dma_ctl &= ~FIFO_RISC_ENABLED; 3193 |
3194 /* set video parameters */ 3195 temp = ((quad_t ) fp->htotal* (quad_t) fp->horizontal * 4096 3196 / fp->vertical / bktr->cols) - 4096; 3197 bt848->e_hscale_lo = temp & 0xff; 3198 bt848->o_hscale_lo = temp & 0xff; 3199 bt848->e_hscale_hi = (temp >> 8) & 0xff; 3200 bt848->o_hscale_hi = (temp >> 8) & 0xff; 3201 3202 /* horizontal active */ 3203 temp = bktr->cols; 3204 bt848->e_hactive_lo = temp & 0xff; 3205 bt848->o_hactive_lo = temp & 0xff; 3206 bt848->e_crop &= ~0x3; 3207 bt848->o_crop &= ~0x3; 3208 bt848->e_crop |= (temp >> 8) & 0x3; 3209 bt848->o_crop |= (temp >> 8) & 0x3; 3210 3211 /* horizontal delay */ 3212 temp = (fp->hdelay * bktr->cols) / fp->hactive; 3213 temp = temp & 0x3fe; 3214 bt848->e_delay_lo = temp & 0xff; 3215 bt848->o_delay_lo = temp & 0xff; 3216 bt848->e_crop &= ~0xc; 3217 bt848->o_crop &= ~0xc; 3218 bt848->e_crop |= (temp >> 6) & 0xc; 3219 bt848->o_crop |= (temp >> 6) & 0xc; 3220 3221 /* vertical scale */ 3222 3223 if (bktr->flags & METEOR_ONLY_ODD_FIELDS || 3224 bktr->flags & METEOR_ONLY_EVEN_FIELDS) 3225 tmp_int = 65536 - 3226 (((fp->vactive * 256 + (bktr->rows/2)) / bktr->rows) - 512); 3227 else { 3228 tmp_int = 65536 - 3229 (((fp->vactive * 512 + (bktr->rows / 2)) / bktr->rows) - 512); 3230 } 3231 3232 tmp_int &= 0x1fff; 3233 bt848->e_vscale_lo = tmp_int & 0xff; 3234 bt848->o_vscale_lo = tmp_int & 0xff; 3235 bt848->e_vscale_hi &= ~0x1f; 3236 bt848->o_vscale_hi &= ~0x1f; 3237 bt848->e_vscale_hi |= (tmp_int >> 8) & 0x1f; 3238 bt848->o_vscale_hi |= (tmp_int >> 8) & 0x1f; 3239 3240 3241 /* vertical active */ 3242 bt848->e_crop &= ~0x30; 3243 bt848->e_crop |= (fp->vactive >> 4) & 0x30; 3244 bt848->e_vactive_lo = fp->vactive & 0xff; 3245 bt848->o_crop &= ~0x30; 3246 bt848->o_crop |= (fp->vactive >> 4) & 0x30; 3247 bt848->o_vactive_lo = fp->vactive & 0xff; 3248 3249 /* vertical delay */ 3250 bt848->e_vdelay_lo = fp->vdelay; 3251 bt848->o_vdelay_lo = fp->vdelay; 3252 3253 /* end of video params */ 3254 |
|
3166 /* capture control */ 3167 switch (i_flag) { 3168 case 1: 3169 bktr->bktr_cap_ctl = 3170 (BT848_CAP_CTL_DITH_FRAME | BT848_CAP_CTL_EVEN); 3171 bt848->e_vscale_hi &= ~0x20; 3172 bt848->o_vscale_hi &= ~0x20; 3173 interlace = 1; --- 572 unchanged lines hidden (view full) --- 3746 u_char bandAddrs[ 3 ]; 3747}; 3748 */ 3749const struct TUNER tuners[] = { 3750/* XXX FIXME: fill in the band-switch crosspoints */ 3751 /* NO_TUNER */ 3752 { "<none>", /* the 'name' */ 3753 TTYPE_XXX, /* input type */ | 3255 /* capture control */ 3256 switch (i_flag) { 3257 case 1: 3258 bktr->bktr_cap_ctl = 3259 (BT848_CAP_CTL_DITH_FRAME | BT848_CAP_CTL_EVEN); 3260 bt848->e_vscale_hi &= ~0x20; 3261 bt848->o_vscale_hi &= ~0x20; 3262 interlace = 1; --- 572 unchanged lines hidden (view full) --- 3835 u_char bandAddrs[ 3 ]; 3836}; 3837 */ 3838const struct TUNER tuners[] = { 3839/* XXX FIXME: fill in the band-switch crosspoints */ 3840 /* NO_TUNER */ 3841 { "<none>", /* the 'name' */ 3842 TTYPE_XXX, /* input type */ |
3754 0x00, /* PLL write address */ 3755 0x00, /* control byte for PLL */ | 3843 0x00, /* PLL write address */ 3844 { 0x00, /* control byte for PLL */ 3845 0x00, 3846 0x00, 3847 0x00 }, |
3756 { 0x00, 0x00 }, /* band-switch crosspoints */ | 3848 { 0x00, 0x00 }, /* band-switch crosspoints */ |
3757 { 0x00, 0x00, 0x00 } }, /* the band-switch values */ | 3849 { 0x00, 0x00, 0x00,0x00} }, /* the band-switch values */ |
3758 3759 /* TEMIC_NTSC */ 3760 { "Temic NTSC", /* the 'name' */ 3761 TTYPE_NTSC, /* input type */ 3762 TEMIC_NTSC_WADDR, /* PLL write address */ | 3850 3851 /* TEMIC_NTSC */ 3852 { "Temic NTSC", /* the 'name' */ 3853 TTYPE_NTSC, /* input type */ 3854 TEMIC_NTSC_WADDR, /* PLL write address */ |
3763 TSA552x_SCONTROL, /* control byte for PLL */ | 3855 { TSA552x_SCONTROL, /* control byte for PLL */ 3856 TSA552x_SCONTROL, 3857 TSA552x_SCONTROL, 3858 0x00 }, |
3764 { 0x00, 0x00 }, /* band-switch crosspoints */ | 3859 { 0x00, 0x00 }, /* band-switch crosspoints */ |
3765 { 0x02, 0x04, 0x01 } }, /* the band-switch values */ | 3860 { 0x02, 0x04, 0x01, 0x00 } }, /* the band-switch values */ |
3766 3767 /* TEMIC_PAL */ 3768 { "Temic PAL", /* the 'name' */ 3769 TTYPE_PAL, /* input type */ 3770 TEMIC_PALI_WADDR, /* PLL write address */ | 3861 3862 /* TEMIC_PAL */ 3863 { "Temic PAL", /* the 'name' */ 3864 TTYPE_PAL, /* input type */ 3865 TEMIC_PALI_WADDR, /* PLL write address */ |
3771 TSA552x_SCONTROL, /* control byte for PLL */ | 3866 { TSA552x_SCONTROL, /* control byte for PLL */ 3867 TSA552x_SCONTROL, 3868 TSA552x_SCONTROL, 3869 0x00 }, |
3772 { 0x00, 0x00 }, /* band-switch crosspoints */ | 3870 { 0x00, 0x00 }, /* band-switch crosspoints */ |
3773 { 0x02, 0x04, 0x01 } }, /* the band-switch values */ | 3871 { 0x02, 0x04, 0x01, 0x00 } }, /* the band-switch values */ |
3774 3775 /* TEMIC_SECAM */ 3776 { "Temic SECAM", /* the 'name' */ 3777 TTYPE_SECAM, /* input type */ 3778 0x00, /* PLL write address */ | 3872 3873 /* TEMIC_SECAM */ 3874 { "Temic SECAM", /* the 'name' */ 3875 TTYPE_SECAM, /* input type */ 3876 0x00, /* PLL write address */ |
3779 TSA552x_SCONTROL, /* control byte for PLL */ | 3877 { TSA552x_SCONTROL, /* control byte for PLL */ 3878 TSA552x_SCONTROL, 3879 TSA552x_SCONTROL, 3880 0x00 }, |
3780 { 0x00, 0x00 }, /* band-switch crosspoints */ | 3881 { 0x00, 0x00 }, /* band-switch crosspoints */ |
3781 { 0x02, 0x04, 0x01 } }, /* the band-switch values */ | 3882 { 0x02, 0x04, 0x01,0x00 } }, /* the band-switch values */ |
3782 3783 /* PHILIPS_NTSC */ 3784 { "Philips NTSC", /* the 'name' */ 3785 TTYPE_NTSC, /* input type */ 3786 PHILIPS_NTSC_WADDR, /* PLL write address */ | 3883 3884 /* PHILIPS_NTSC */ 3885 { "Philips NTSC", /* the 'name' */ 3886 TTYPE_NTSC, /* input type */ 3887 PHILIPS_NTSC_WADDR, /* PLL write address */ |
3787 TSA552x_SCONTROL, /* control byte for PLL */ | 3888 { TSA552x_SCONTROL, /* control byte for PLL */ 3889 TSA552x_SCONTROL, 3890 TSA552x_SCONTROL, 3891 0x00 }, |
3788 { 0x00, 0x00 }, /* band-switch crosspoints */ | 3892 { 0x00, 0x00 }, /* band-switch crosspoints */ |
3789 { 0xa0, 0x90, 0x30 } }, /* the band-switch values */ | 3893 { 0xa0, 0x90, 0x30, 0x00 } }, /* the band-switch values */ |
3790 3791 /* PHILIPS_PAL */ 3792 { "Philips PAL", /* the 'name' */ 3793 TTYPE_PAL, /* input type */ | 3894 3895 /* PHILIPS_PAL */ 3896 { "Philips PAL", /* the 'name' */ 3897 TTYPE_PAL, /* input type */ |
3794 0x00, /* PLL write address */ 3795 TSA552x_SCONTROL, /* control byte for PLL */ | 3898 PHILIPS_PAL_WADDR, /* PLL write address */ 3899 { TSA552x_FCONTROL, /* control byte for PLL */ 3900 TSA552x_FCONTROL, 3901 TSA552x_FCONTROL, 3902 TSA552x_RADIO }, |
3796 { 0x00, 0x00 }, /* band-switch crosspoints */ | 3903 { 0x00, 0x00 }, /* band-switch crosspoints */ |
3797 { 0xa0, 0x90, 0x30 } }, /* the band-switch values */ | 3904 { 0xa0, 0x90, 0x30, 0xa5 } }, /* the band-switch values */ 3905 /* Radio: (for FM1216) 3906 ** 0xa4 sets radiomode 3907 ** bit0 - AFC 3908 ** bit1 - Mono 3909 ** bit3 - Mute */ |
3798 3799 /* PHILIPS_SECAM */ 3800 { "Philips SECAM", /* the 'name' */ 3801 TTYPE_SECAM, /* input type */ 3802 0x00, /* PLL write address */ | 3910 3911 /* PHILIPS_SECAM */ 3912 { "Philips SECAM", /* the 'name' */ 3913 TTYPE_SECAM, /* input type */ 3914 0x00, /* PLL write address */ |
3803 TSA552x_SCONTROL, /* control byte for PLL */ | 3915 { TSA552x_SCONTROL, /* control byte for PLL */ 3916 TSA552x_SCONTROL, 3917 TSA552x_SCONTROL, 3918 0x00 }, |
3804 { 0x00, 0x00 }, /* band-switch crosspoints */ | 3919 { 0x00, 0x00 }, /* band-switch crosspoints */ |
3805 { 0xa0, 0x90, 0x30 } }, /* the band-switch values */ | 3920 { 0xa0, 0x90, 0x30,0x00 } }, /* the band-switch values */ |
3806 3807 /* TEMIC_PAL I */ 3808 { "Temic PAL I", /* the 'name' */ 3809 TTYPE_PAL, /* input type */ 3810 TEMIC_PALI_WADDR, /* PLL write address */ | 3921 3922 /* TEMIC_PAL I */ 3923 { "Temic PAL I", /* the 'name' */ 3924 TTYPE_PAL, /* input type */ 3925 TEMIC_PALI_WADDR, /* PLL write address */ |
3811 TSA552x_SCONTROL, /* control byte for PLL */ | 3926 { TSA552x_SCONTROL, /* control byte for PLL */ 3927 TSA552x_SCONTROL, 3928 TSA552x_SCONTROL, 3929 0x00 }, |
3812 { 0x00, 0x00 }, /* band-switch crosspoints */ | 3930 { 0x00, 0x00 }, /* band-switch crosspoints */ |
3813 { 0x02, 0x04, 0x01 } }, /* the band-switch values */ | 3931 { 0x02, 0x04, 0x01,0x00 } }, /* the band-switch values */ |
3814 3815 /* PHILIPS_PAL */ 3816 { "Philips PAL I", /* the 'name' */ 3817 TTYPE_PAL, /* input type */ | 3932 3933 /* PHILIPS_PAL */ 3934 { "Philips PAL I", /* the 'name' */ 3935 TTYPE_PAL, /* input type */ |
3818 0x00, /* PLL write address */ 3819 TSA552x_SCONTROL, /* control byte for PLL */ | 3936 TEMIC_PALI_WADDR, /* PLL write address */ 3937 { TSA552x_SCONTROL, /* control byte for PLL */ 3938 TSA552x_SCONTROL, 3939 TSA552x_SCONTROL, 3940 0x00 }, |
3820 { 0x00, 0x00 }, /* band-switch crosspoints */ | 3941 { 0x00, 0x00 }, /* band-switch crosspoints */ |
3821 { 0xa0, 0x90, 0x30 } }, /* the band-switch values */ | 3942 { 0xa0, 0x90, 0x30,0x00 } }, /* the band-switch values */ |
3822 3823 /* PHILIPS_FR1236_NTSC */ 3824 { "Philips FR1236 NTSC FM", /* the 'name' */ 3825 TTYPE_NTSC, /* input type */ 3826 PHILIPS_FR1236_NTSC_WADDR, /* PLL write address */ | 3943 3944 /* PHILIPS_FR1236_NTSC */ 3945 { "Philips FR1236 NTSC FM", /* the 'name' */ 3946 TTYPE_NTSC, /* input type */ 3947 PHILIPS_FR1236_NTSC_WADDR, /* PLL write address */ |
3827 TSA552x_SCONTROL, /* control byte for PLL */ | 3948 { TSA552x_SCONTROL, /* control byte for PLL */ 3949 TSA552x_SCONTROL, 3950 TSA552x_SCONTROL, 3951 0x00}, |
3828 { 0x00, 0x00 }, /* band-switch crosspoints */ | 3952 { 0x00, 0x00 }, /* band-switch crosspoints */ |
3829 { 0xa0, 0x90, 0x30 } }, /* the band-switch values */ | 3953 { 0xa0, 0x90, 0x30,0x00 } }, /* the band-switch values */ |
3830}; 3831 3832 3833/* 3834 * get a signature of the card 3835 * read all 128 possible i2c read addresses from 0x01 thru 0xff 3836 * build a bit array with a 1 bit for each i2c device that responds 3837 * --- 469 unchanged lines hidden (view full) --- 4307 if ( tuner == NULL ) 4308 return( -1 ); 4309 4310 /* 4311 * select the band based on frequency 4312 * XXX FIXME: get the cross-over points from the tuner struct 4313 */ 4314 if ( frequency < (160 * FREQFACTOR) ) | 3954}; 3955 3956 3957/* 3958 * get a signature of the card 3959 * read all 128 possible i2c read addresses from 0x01 thru 0xff 3960 * build a bit array with a 1 bit for each i2c device that responds 3961 * --- 469 unchanged lines hidden (view full) --- 4431 if ( tuner == NULL ) 4432 return( -1 ); 4433 4434 /* 4435 * select the band based on frequency 4436 * XXX FIXME: get the cross-over points from the tuner struct 4437 */ 4438 if ( frequency < (160 * FREQFACTOR) ) |
4315 band = tuner->bandAddrs[ 0 ]; | 4439 N = 0; |
4316 else if ( frequency < (454 * FREQFACTOR) ) | 4440 else if ( frequency < (454 * FREQFACTOR) ) |
4317 band = tuner->bandAddrs[ 1 ]; | 4441 N = 1; |
4318 else | 4442 else |
4319 band = tuner->bandAddrs[ 2 ]; | 4443 N = 2; |
4320 | 4444 |
4445 if(frequency > RADIO_OFFSET) { 4446 N=3; 4447 frequency -= RADIO_OFFSET; 4448 } 4449 |
|
4321 /* set the address of the PLL */ | 4450 /* set the address of the PLL */ |
4322 addr = tuner->pllAddr; 4323 control = tuner->pllControl; | 4451 addr = tuner->pllAddr; 4452 control = tuner->pllControl[ N ]; 4453 band = tuner->bandAddrs[ N ]; 4454 if(!(band && control)) /* Don't try to set un- */ 4455 return(-1); /* supported modes. */ |
4324 | 4456 |
4457 |
|
4325 /* 4326 * N = 16 * { fRF(pc) + fIF(pc) } 4327 * where: 4328 * pc is picture carrier, fRF & fIF are in mHz 4329 * 4330 * frequency was passed in as mHz * 16 4331 */ 4332#if defined( TEST_TUNER_AFC ) --- 266 unchanged lines hidden --- | 4458 /* 4459 * N = 16 * { fRF(pc) + fIF(pc) } 4460 * where: 4461 * pc is picture carrier, fRF & fIF are in mHz 4462 * 4463 * frequency was passed in as mHz * 16 4464 */ 4465#if defined( TEST_TUNER_AFC ) --- 266 unchanged lines hidden --- |