📄 brooktree848.c
字号:
TTYPE_XXX, /* input type */ { 0x00, /* control byte for PLL */ 0x00, 0x00, 0x00 }, { 0x00, 0x00 }, /* band-switch crosspoints */ { 0x00, 0x00, 0x00,0x00} }, /* the band-switch values */ /* TEMIC_NTSC */ { "Temic NTSC", /* the 'name' */ TTYPE_NTSC, /* input type */ { TSA552x_SCONTROL, /* control byte for PLL */ TSA552x_SCONTROL, TSA552x_SCONTROL, 0x00 }, { 0x00, 0x00 }, /* band-switch crosspoints */ { 0x02, 0x04, 0x01, 0x00 } }, /* the band-switch values */ /* TEMIC_PAL */ { "Temic PAL", /* the 'name' */ TTYPE_PAL, /* input type */ { TSA552x_SCONTROL, /* control byte for PLL */ TSA552x_SCONTROL, TSA552x_SCONTROL, 0x00 }, { 0x00, 0x00 }, /* band-switch crosspoints */ { 0x02, 0x04, 0x01, 0x00 } }, /* the band-switch values */ /* TEMIC_SECAM */ { "Temic SECAM", /* the 'name' */ TTYPE_SECAM, /* input type */ { TSA552x_SCONTROL, /* control byte for PLL */ TSA552x_SCONTROL, TSA552x_SCONTROL, 0x00 }, { 0x00, 0x00 }, /* band-switch crosspoints */ { 0x02, 0x04, 0x01,0x00 } }, /* the band-switch values */ /* PHILIPS_NTSC */ { "Philips NTSC", /* the 'name' */ TTYPE_NTSC, /* input type */ { TSA552x_SCONTROL, /* control byte for PLL */ TSA552x_SCONTROL, TSA552x_SCONTROL, 0x00 }, { 0x00, 0x00 }, /* band-switch crosspoints */ { 0xa0, 0x90, 0x30, 0x00 } }, /* the band-switch values */ /* PHILIPS_PAL */ { "Philips PAL", /* the 'name' */ TTYPE_PAL, /* input type */ { TSA552x_FCONTROL, /* control byte for PLL */ TSA552x_FCONTROL, TSA552x_FCONTROL, TSA552x_RADIO }, { 0x00, 0x00 }, /* band-switch crosspoints */ { 0xa0, 0x90, 0x30, 0xa4 } }, /* the band-switch values */ /* PHILIPS_SECAM */ { "Philips SECAM", /* the 'name' */ TTYPE_SECAM, /* input type */ { TSA552x_SCONTROL, /* control byte for PLL */ TSA552x_SCONTROL, TSA552x_SCONTROL, TSA552x_RADIO }, { 0x00, 0x00 }, /* band-switch crosspoints */ { 0xa0, 0x90, 0x30,0xa4 } }, /* the band-switch values */ /* TEMIC_PAL I */ { "Temic PAL I", /* the 'name' */ TTYPE_PAL, /* input type */ { TSA552x_SCONTROL, /* control byte for PLL */ TSA552x_SCONTROL, TSA552x_SCONTROL, 0x00 }, { 0x00, 0x00 }, /* band-switch crosspoints */ { 0x02, 0x04, 0x01,0x00 } }, /* the band-switch values */ /* PHILIPS_PAL */ { "Philips PAL I", /* the 'name' */ TTYPE_PAL, /* input type */ { TSA552x_SCONTROL, /* control byte for PLL */ TSA552x_SCONTROL, TSA552x_SCONTROL, 0x00 }, { 0x00, 0x00 }, /* band-switch crosspoints */ { 0xa0, 0x90, 0x30,0x00 } }, /* the band-switch values */ /* PHILIPS_FR1236_NTSC */ { "Philips FR1236 NTSC FM", /* the 'name' */ TTYPE_NTSC, /* input type */ { TSA552x_SCONTROL, /* control byte for PLL */ TSA552x_SCONTROL, TSA552x_SCONTROL, TSA552x_RADIO }, { 0x00, 0x00 }, /* band-switch crosspoints */ { 0xa0, 0x90, 0x30,0xa4 } }, /* the band-switch values */ /* PHILIPS_FR1216_PAL */ { "Philips FR1216 PAL" , /* the 'name' */ TTYPE_PAL, /* input type */ { TSA552x_FCONTROL, /* control byte for PLL */ TSA552x_FCONTROL, TSA552x_FCONTROL, TSA552x_RADIO }, { 0x00, 0x00 }, /* band-switch crosspoints */ { 0xa0, 0x90, 0x30, 0xa4 } }, /* the band-switch values */ /* PHILIPS_FR1236_SECAM */ { "Philips FR1236 SECAM FM", /* the 'name' */ TTYPE_SECAM, /* input type */ { TSA552x_FCONTROL, /* control byte for PLL */ TSA552x_FCONTROL, TSA552x_FCONTROL, TSA552x_RADIO }, { 0x00, 0x00 }, /* band-switch crosspoints */ { 0xa0, 0x90, 0x30, 0xa4 } }, /* the band-switch values */ /* ALPS TSCH5 NTSC */ { "ALPS TSCH5", /* the 'name' */ TTYPE_NTSC, /* input type */ { TSCH5_FCONTROL, /* control byte for PLL */ TSCH5_FCONTROL, TSCH5_FCONTROL, 0x00 }, { 0x00, 0x00 }, /* band-switch crosspoints */ { 0x14, 0x12, 0x11, 0x00 } } /* the band-switch values */};/****************************************************************************** * card probe *//* * the recognized cards, used as indexes of several tables. * * if probeCard() fails to detect the proper card on boot you can * override it by setting the following define to the card you are using: *#define OVERRIDE_CARD <card type> * * where <card type> is one of the following card defines. */#define CARD_UNKNOWN 0#define CARD_MIRO 1#define CARD_HAUPPAUGE 2#define CARD_STB 3#define CARD_INTEL 4#define CARD_IMS_TURBO 5#define CARD_AVER_MEDIA 6#define CARD_OSPREY 7#define Bt848_MAX_CARD 8/* * the data for each type of card * * Note: * these entried MUST be kept in the order defined by the CARD_XXX defines! */static const struct CARDTYPE cards[] = { { CARD_UNKNOWN, /* the card id */ "Unknown", /* the 'name' */ NULL, /* the tuner */ 0, /* the tuner i2c address */ 0, /* dbx unknown */ 0, 0, /* EEProm unknown */ 0, /* EEProm unknown */ { 0, 0, 0, 0, 0 } }, { CARD_MIRO, /* the card id */ "Miro TV", /* the 'name' */ NULL, /* the tuner */ 0, /* the tuner i2c address */ 0, /* dbx unknown */ 0, 0, /* EEProm unknown */ 0, /* size unknown */ { 0x02, 0x01, 0x00, 0x0a, 1 } }, /* XXX ??? */ { CARD_HAUPPAUGE, /* the card id */ "Hauppauge WinCast/TV", /* the 'name' */ NULL, /* the tuner */ 0, /* the tuner i2c address */ 0, /* dbx is optional */ 0, PFC8582_WADDR, /* EEProm type */ (u_char)(256 / EEPROMBLOCKSIZE), /* 256 bytes */ { 0x00, 0x02, 0x01, 0x04, 1 } }, /* audio MUX values */ { CARD_STB, /* the card id */ "STB TV/PCI", /* the 'name' */ NULL, /* the tuner */ 0, /* the tuner i2c address */ 0, /* dbx is optional */ 0, X24C01_WADDR, /* EEProm type */ (u_char)(128 / EEPROMBLOCKSIZE), /* 128 bytes */ { 0x00, 0x01, 0x02, 0x02, 1 } }, /* audio MUX values */ { CARD_INTEL, /* the card id */ "Intel Smart Video III/VideoLogic Captivator PCI", /* the 'name' */ NULL, /* the tuner */ 0, /* the tuner i2c address */ 0, 0, 0, 0, { 0, 0, 0, 0, 0 } }, { CARD_IMS_TURBO, /* the card id */ "IMS TV Turbo", /* the 'name' */ NULL, /* the tuner */ 0, /* the tuner i2c address */ 0, /* dbx is optional */ 0, PFC8582_WADDR, /* EEProm type */ (u_char)(256 / EEPROMBLOCKSIZE), /* 256 bytes */ { 0x01, 0x02, 0x01, 0x00, 1 } }, /* audio MUX values */ { CARD_AVER_MEDIA, /* the card id */ "AVer Media TV/FM", /* the 'name' */ NULL, /* the tuner */ 0, /* the tuner i2c address */ 0, /* dbx is optional */ 0, 0, /* EEProm size */ 0, /* EEProm size */ { 0x0c, 0x00, 0x0b, 0x0b, 1 } }, /* audio MUX values */ { CARD_OSPREY, /* the card id */ "MMAC Osprey", /* the 'name' */ NULL, /* the tuner */ 0, /* the tuner i2c address */ 0, /* dbx is optional */ 0, PFC8582_WADDR, /* EEProm type */ (u_char)(256 / EEPROMBLOCKSIZE), /* 256 bytes */ { 0x0c, 0x00, 0x0b, 0x0b, 1 } }, /* audio MUX values */};struct bt848_card_sig bt848_card_signature[1]= { /* IMS TURBO TV : card 5 */ { 5,9, {00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 02, 00, 00, 00}}};/* debug utility for holding previous INT_STAT contents */#define STATUS_SUMstatic u_long status_sum = 0;/* * defines to make certain bit-fiddles understandable */#define FIFO_ENABLED BT848_DMA_CTL_FIFO_EN#define RISC_ENABLED BT848_DMA_CTL_RISC_EN#define FIFO_RISC_ENABLED (BT848_DMA_CTL_FIFO_EN | BT848_DMA_CTL_RISC_EN)#define FIFO_RISC_DISABLED 0#define ALL_INTS_DISABLED 0#define ALL_INTS_CLEARED 0xffffffff#define CAPTURE_OFF 0#define BIT_SEVEN_HIGH (1<<7)#define BIT_EIGHT_HIGH (1<<8)#define I2C_BITS (BT848_INT_RACK | BT848_INT_I2CDONE)#define TDEC_BITS (BT848_INT_FDSR | BT848_INT_FBUS)/* * misc. support routines. */static int signCard( bktr_ptr_t bktr, int offset, int count, u_char* sig );static void probeCard( bktr_ptr_t bktr, int verbose );static vm_offset_t get_bktr_mem( int unit, unsigned size );static int oformat_meteor_to_bt( u_long format );static u_int pixfmt_swap_flags( int pixfmt );/* * bt848 RISC programming routines. */#ifdef BT848_DUMPstatic int dump_bt848( bt848_ptr_t bt848 );#endifstatic void yuvpack_prog( bktr_ptr_t bktr, char i_flag, int cols, int rows, int interlace );static void yuv422_prog( bktr_ptr_t bktr, char i_flag, int cols, int rows, int interlace );static void yuv12_prog( bktr_ptr_t bktr, char i_flag, int cols, int rows, int interlace );static void rgb_prog( bktr_ptr_t bktr, char i_flag, int cols, int rows, int interlace );static void build_dma_prog( bktr_ptr_t bktr, char i_flag );static bool_t getline(bktr_reg_t *, int);static bool_t notclipped(bktr_reg_t * , int , int); static bool_t split(bktr_reg_t *, volatile u_long **, int, u_long, int, volatile u_char ** , int );/* * video & video capture specific routines. */static int video_open( bktr_ptr_t bktr );static int video_close( bktr_ptr_t bktr );static int video_ioctl( bktr_ptr_t bktr, int unit, int cmd, caddr_t arg, struct proc* pr );static void start_capture( bktr_ptr_t bktr, unsigned type );static void set_fps( bktr_ptr_t bktr, u_short fps );/* * tuner specific functions. */static int tuner_open( bktr_ptr_t bktr );static int tuner_close( bktr_ptr_t bktr );static int tuner_ioctl( bktr_ptr_t bktr, int unit, int cmd, caddr_t arg, struct proc* pr );static int tuner_getchnlset( struct bktr_chnlset *chnlset );static int tv_channel( bktr_ptr_t bktr, int channel );static int tv_freq( bktr_ptr_t bktr, int frequency );#if defined( TUNER_AFC )static int do_afc( bktr_ptr_t bktr, int addr, int frequency );#endif /* TUNER_AFC *//* * audio specific functions. */static int set_audio( bktr_ptr_t bktr, int mode );static void temp_mute( bktr_ptr_t bktr, int flag );static int set_BTSC( bktr_ptr_t bktr, int control );static void msp_autodetect( bktr_ptr_t bktr );static void msp_read_id( bktr_ptr_t bktr );static void msp_reset( bktr_ptr_t bktr );static unsigned int msp_read(bktr_ptr_t bktr, unsigned char dev, unsigned int addr);static void msp_write( bktr_ptr_t bktr, unsigned char dev, unsigned int addr, unsigned int data);/* * Remote Control Functions */static void remote_read(bktr_ptr_t bktr, struct bktr_remote *remote);/* * ioctls common to both video & tuner. */static int common_ioctl( bktr_ptr_t bktr, bt848_ptr_t bt848, int cmd, caddr_t arg );/* * i2c primitives */static int i2cWrite( bktr_ptr_t bktr, int addr, int byte1, int byte2 );static int i2cRead( bktr_ptr_t bktr, int addr );static int writeEEProm( bktr_ptr_t bktr, int offset, int count, u_char* data );static int readEEProm( bktr_ptr_t bktr, int offset, int count, u_char* data );#ifndef __FreeBSD__/* * i2c primatives for low level control of i2c bus. Added for MSP34xx control */static void i2c_start( bktr_ptr_t bktr);static void i2c_stop( bktr_ptr_t bktr);static int i2c_write_byte( bktr_ptr_t bktr, unsigned char data);static int i2c_read_byte( bktr_ptr_t bktr, unsigned char *data, int last );#endif#ifdef __FreeBSD__/* * the boot time probe routine. */static const char*bktr_probe( pcici_t tag, pcidi_t type ){ unsigned int rev = pci_conf_read( tag, PCIR_REVID) & 0x000000ff; switch (type) { case BROOKTREE_848_PCI_ID: if (rev == 0x12) return("BrookTree 848a"); else return("BrookTree 848"); case BROOKTREE_849_PCI_ID: return("BrookTree 849"); case BROOKTREE_878_PCI_ID: return("BrookTree 878"); case BROOKTREE_879_PCI_ID: return("BrookTree 879"); }; return ((char *)0);}#endif /* __FreeBSD__ *//* * the attach routine. */static voidbktr_attach( ATTACH_ARGS ){ bktr_ptr_t bktr;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -