2 * ngene.h: nGene PCIe bridge driver
4 * Copyright (C) 2005-2007 Micronas
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * version 2 only, as published by the Free Software Foundation.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21 * Or, point your browser to http://www.gnu.org/copyleft/gpl.html
27 #include <linux/types.h>
28 #include <linux/sched.h>
29 #include <linux/interrupt.h>
30 #include <linux/i2c.h>
32 #include <linux/scatterlist.h>
34 #include <linux/dvb/frontend.h>
38 #include "dvb_demux.h"
39 #include "dvb_frontend.h"
40 #include "dvb_ringbuffer.h"
42 #define DEVICE_NAME "ngene"
44 #define NGENE_VID 0x18c3
45 #define NGENE_PID 0x0720
48 #define VIDEO_CAP_AVC 128
49 #define VIDEO_CAP_H264 128
50 #define VIDEO_CAP_VC1 256
51 #define VIDEO_CAP_WMV9 256
52 #define VIDEO_CAP_MPEG4 512
56 STREAM_VIDEOIN1
= 0, /* ITU656 or TS Input */
58 STREAM_AUDIOIN1
, /* I2S or SPI Input */
65 SMODE_AUDIO_SPDIF
= 0x20,
67 SMODE_TRANSPORT_STREAM
= 0x08,
68 SMODE_AUDIO_CAPTURE
= 0x04,
69 SMODE_VBI_CAPTURE
= 0x02,
70 SMODE_VIDEO_CAPTURE
= 0x01
73 enum STREAM_FLAG_BITS
{
74 SFLAG_CHROMA_FORMAT_2COMP
= 0x01, /* Chroma Format : 2's complement */
75 SFLAG_CHROMA_FORMAT_OFFSET
= 0x00, /* Chroma Format : Binary offset */
76 SFLAG_ORDER_LUMA_CHROMA
= 0x02, /* Byte order: Y,Cb,Y,Cr */
77 SFLAG_ORDER_CHROMA_LUMA
= 0x00, /* Byte order: Cb,Y,Cr,Y */
78 SFLAG_COLORBAR
= 0x04, /* Select colorbar */
81 #define PROGRAM_ROM 0x0000
82 #define PROGRAM_SRAM 0x1000
83 #define PERIPHERALS0 0x8000
84 #define PERIPHERALS1 0x9000
85 #define SHARED_BUFFER 0xC000
87 #define HOST_TO_NGENE (SHARED_BUFFER+0x0000)
88 #define NGENE_TO_HOST (SHARED_BUFFER+0x0100)
89 #define NGENE_COMMAND (SHARED_BUFFER+0x0200)
90 #define NGENE_COMMAND_HI (SHARED_BUFFER+0x0204)
91 #define NGENE_STATUS (SHARED_BUFFER+0x0208)
92 #define NGENE_STATUS_HI (SHARED_BUFFER+0x020C)
93 #define NGENE_EVENT (SHARED_BUFFER+0x0210)
94 #define NGENE_EVENT_HI (SHARED_BUFFER+0x0214)
95 #define VARIABLES (SHARED_BUFFER+0x0210)
97 #define NGENE_INT_COUNTS (SHARED_BUFFER+0x0260)
98 #define NGENE_INT_ENABLE (SHARED_BUFFER+0x0264)
99 #define NGENE_VBI_LINE_COUNT (SHARED_BUFFER+0x0268)
101 #define BUFFER_GP_XMIT (SHARED_BUFFER+0x0800)
102 #define BUFFER_GP_RECV (SHARED_BUFFER+0x0900)
103 #define EEPROM_AREA (SHARED_BUFFER+0x0A00)
105 #define SG_V_IN_1 (SHARED_BUFFER+0x0A80)
106 #define SG_VBI_1 (SHARED_BUFFER+0x0B00)
107 #define SG_A_IN_1 (SHARED_BUFFER+0x0B80)
108 #define SG_V_IN_2 (SHARED_BUFFER+0x0C00)
109 #define SG_VBI_2 (SHARED_BUFFER+0x0C80)
110 #define SG_A_IN_2 (SHARED_BUFFER+0x0D00)
111 #define SG_V_OUT (SHARED_BUFFER+0x0D80)
112 #define SG_A_OUT2 (SHARED_BUFFER+0x0E00)
114 #define DATA_A_IN_1 (SHARED_BUFFER+0x0E80)
115 #define DATA_A_IN_2 (SHARED_BUFFER+0x0F00)
116 #define DATA_A_OUT (SHARED_BUFFER+0x0F80)
117 #define DATA_V_IN_1 (SHARED_BUFFER+0x1000)
118 #define DATA_V_IN_2 (SHARED_BUFFER+0x2000)
119 #define DATA_V_OUT (SHARED_BUFFER+0x3000)
121 #define DATA_FIFO_AREA (SHARED_BUFFER+0x1000)
123 #define TIMESTAMPS 0xA000
124 #define SCRATCHPAD 0xA080
125 #define FORCE_INT 0xA088
126 #define FORCE_NMI 0xA090
127 #define INT_STATUS 0xA0A0
129 #define DEV_VER 0x9004
131 #define FW_DEBUG_DEFAULT (PROGRAM_SRAM+0x00FF)
139 } __attribute__ ((__packed__
));
141 struct SHARED_MEMORY
{
154 u8 pad1
[0xc260 - 0xc218];
161 u8 pad2
[0xd000 - 0xc268];
163 } __attribute__ ((__packed__
));
165 struct BUFFER_STREAM_RESULTS
{
166 u32 Clock
; /* Stream time in 100ns units */
167 u16 RemainingLines
; /* Remaining lines in this field.
168 0 for complete field */
169 u8 FieldCount
; /* Video field number */
170 u8 Flags
; /* Bit 7 = Done, Bit 6 = seen, Bit 5 = overflow,
172 u16 BlockCount
; /* Audio block count (unused) */
175 } __attribute__ ((__packed__
));
177 struct HW_SCATTER_GATHER_ELEMENT
{
181 } __attribute__ ((__packed__
));
183 struct BUFFER_HEADER
{
185 struct BUFFER_STREAM_RESULTS SR
;
187 u32 Number_of_entries_1
;
189 u64 Address_of_first_entry_1
;
191 u32 Number_of_entries_2
;
193 u64 Address_of_first_entry_2
;
194 } __attribute__ ((__packed__
));
196 struct EVENT_BUFFER
{
203 } __attribute__ ((__packed__
));
205 /* Firmware commands. */
209 CMD_FWLOAD_PREPARE
= 0x01,
210 CMD_FWLOAD_FINISH
= 0x02,
212 CMD_I2C_WRITE
= 0x04,
214 CMD_I2C_WRITE_NOSTOP
= 0x05,
215 CMD_I2C_CONTINUE_WRITE
= 0x06,
216 CMD_I2C_CONTINUE_WRITE_NOSTOP
= 0x07,
218 CMD_DEBUG_OUTPUT
= 0x09,
221 CMD_CONFIGURE_BUFFER
= 0x11,
222 CMD_CONFIGURE_FREE_BUFFER
= 0x12,
225 CMD_SPI_WRITE
= 0x14,
228 CMD_MEM_WRITE
= 0x21,
230 CMD_SFR_WRITE
= 0x23,
231 CMD_IRAM_READ
= 0x24,
232 CMD_IRAM_WRITE
= 0x25,
233 CMD_SET_GPIO_PIN
= 0x26,
234 CMD_SET_GPIO_INT
= 0x27,
235 CMD_CONFIGURE_UART
= 0x28,
236 CMD_WRITE_UART
= 0x29,
248 } __attribute__ ((__packed__
));
250 struct FW_I2C_WRITE
{
251 struct FW_HEADER hdr
;
254 } __attribute__ ((__packed__
));
256 struct FW_I2C_CONTINUE_WRITE
{
257 struct FW_HEADER hdr
;
259 } __attribute__ ((__packed__
));
262 struct FW_HEADER hdr
;
264 u8 Data
[252]; /* followed by two bytes of read data count */
265 } __attribute__ ((__packed__
));
267 struct FW_SPI_WRITE
{
268 struct FW_HEADER hdr
;
271 } __attribute__ ((__packed__
));
274 struct FW_HEADER hdr
;
276 u8 Data
[252]; /* followed by two bytes of read data count */
277 } __attribute__ ((__packed__
));
279 struct FW_FWLOAD_PREPARE
{
280 struct FW_HEADER hdr
;
281 } __attribute__ ((__packed__
));
283 struct FW_FWLOAD_FINISH
{
284 struct FW_HEADER hdr
;
285 u16 Address
; /* address of final block */
287 } __attribute__ ((__packed__
));
290 * Meaning of FW_STREAM_CONTROL::Mode bits:
291 * Bit 7: Loopback PEXin to PEXout using TVOut channel
293 * Bit 5: Audio select; 0=I2S, 1=SPDIF
295 * Bit 3: Enable transport stream
296 * Bit 2: Enable audio capture
297 * Bit 1: Enable ITU-Video VBI capture
298 * Bit 0: Enable ITU-Video capture
300 * Meaning of FW_STREAM_CONTROL::Control bits (see UVI1_CTL)
301 * Bit 7: continuous capture
302 * Bit 6: capture one field
303 * Bit 5: capture one frame
305 * Bit 3: starting field; 0=odd, 1=even
306 * Bit 2: sample size; 0=8-bit, 1=10-bit
307 * Bit 1: data format; 0=UYVY, 1=YUY2
308 * Bit 0: resets buffer pointers
312 SMODE_LOOPBACK
= 0x80,
314 _SMODE_AUDIO_SPDIF
= 0x20,
315 _SMODE_AVSYNC
= 0x10,
316 _SMODE_TRANSPORT_STREAM
= 0x08,
317 _SMODE_AUDIO_CAPTURE
= 0x04,
318 _SMODE_VBI_CAPTURE
= 0x02,
319 _SMODE_VIDEO_CAPTURE
= 0x01
323 /* Meaning of FW_STREAM_CONTROL::Stream bits:
324 * Bit 3: Audio sample count: 0 = relative, 1 = absolute
325 * Bit 2: color bar select; 1=color bars, 0=CV3 decoder
326 * Bits 1-0: stream select, UVI1, UVI2, TVOUT
329 struct FW_STREAM_CONTROL
{
330 struct FW_HEADER hdr
;
331 u8 Stream
; /* Stream number (UVI1, UVI2, TVOUT) */
332 u8 Control
; /* Value written to UVI1_CTL */
333 u8 Mode
; /* Controls clock source */
334 u8 SetupDataLen
; /* Length of setup data, MSB=1 write
336 u16 CaptureBlockCount
; /* Blocks (a 256 Bytes) to capture per buffer
338 u64 Buffer_Address
; /* Address of first buffer header */
339 u16 BytesPerVideoLine
;
340 u16 MaxLinesPerField
;
341 u16 MinLinesPerField
;
344 u16 MaxVBILinesPerField
;
345 u16 MinVBILinesPerField
;
346 u16 SetupDataAddr
; /* ngene relative address of setup data */
347 u8 SetupData
[32]; /* setup data */
348 } __attribute__((__packed__
));
350 #define AUDIO_BLOCK_SIZE 256
351 #define TS_BLOCK_SIZE 256
354 struct FW_HEADER hdr
;
356 } __attribute__ ((__packed__
));
358 struct FW_MEM_WRITE
{
359 struct FW_HEADER hdr
;
362 } __attribute__ ((__packed__
));
364 struct FW_SFR_IRAM_READ
{
365 struct FW_HEADER hdr
;
367 } __attribute__ ((__packed__
));
369 struct FW_SFR_IRAM_WRITE
{
370 struct FW_HEADER hdr
;
373 } __attribute__ ((__packed__
));
375 struct FW_SET_GPIO_PIN
{
376 struct FW_HEADER hdr
;
378 } __attribute__ ((__packed__
));
380 struct FW_SET_GPIO_INT
{
381 struct FW_HEADER hdr
;
383 } __attribute__ ((__packed__
));
385 struct FW_SET_DEBUGMODE
{
386 struct FW_HEADER hdr
;
388 } __attribute__ ((__packed__
));
390 struct FW_CONFIGURE_BUFFERS
{
391 struct FW_HEADER hdr
;
393 } __attribute__ ((__packed__
));
395 enum _BUFFER_CONFIGS
{
396 /* 4k UVI1, 4k UVI2, 2k AUD1, 2k AUD2 (standard usage) */
397 BUFFER_CONFIG_4422
= 0,
398 /* 3k UVI1, 3k UVI2, 3k AUD1, 3k AUD2 (4x TS input usage) */
399 BUFFER_CONFIG_3333
= 1,
400 /* 8k UVI1, 0k UVI2, 2k AUD1, 2k I2SOut (HDTV decoder usage) */
401 BUFFER_CONFIG_8022
= 2,
402 BUFFER_CONFIG_FW17
= 255, /* Use new FW 17 command */
405 struct FW_CONFIGURE_FREE_BUFFERS
{
406 struct FW_HEADER hdr
;
407 u8 UVI1_BufferLength
;
408 u8 UVI2_BufferLength
;
410 u8 AUD1_BufferLength
;
411 u8 AUD2_BufferLength
;
413 } __attribute__ ((__packed__
));
415 struct FW_CONFIGURE_UART
{
416 struct FW_HEADER hdr
;
418 } __attribute__ ((__packed__
));
421 _UART_BAUDRATE_19200
= 0,
422 _UART_BAUDRATE_9600
= 1,
423 _UART_BAUDRATE_4800
= 2,
424 _UART_BAUDRATE_2400
= 3,
425 _UART_RX_ENABLE
= 0x40,
426 _UART_TX_ENABLE
= 0x80,
429 struct FW_WRITE_UART
{
430 struct FW_HEADER hdr
;
432 } __attribute__ ((__packed__
));
435 struct ngene_command
{
441 struct FW_HEADER hdr
;
442 struct FW_I2C_WRITE I2CWrite
;
443 struct FW_I2C_CONTINUE_WRITE I2CContinueWrite
;
444 struct FW_I2C_READ I2CRead
;
445 struct FW_STREAM_CONTROL StreamControl
;
446 struct FW_FWLOAD_PREPARE FWLoadPrepare
;
447 struct FW_FWLOAD_FINISH FWLoadFinish
;
448 struct FW_MEM_READ MemoryRead
;
449 struct FW_MEM_WRITE MemoryWrite
;
450 struct FW_SFR_IRAM_READ SfrIramRead
;
451 struct FW_SFR_IRAM_WRITE SfrIramWrite
;
452 struct FW_SPI_WRITE SPIWrite
;
453 struct FW_SPI_READ SPIRead
;
454 struct FW_SET_GPIO_PIN SetGpioPin
;
455 struct FW_SET_GPIO_INT SetGpioInt
;
456 struct FW_SET_DEBUGMODE SetDebugMode
;
457 struct FW_CONFIGURE_BUFFERS ConfigureBuffers
;
458 struct FW_CONFIGURE_FREE_BUFFERS ConfigureFreeBuffers
;
459 struct FW_CONFIGURE_UART ConfigureUart
;
460 struct FW_WRITE_UART WriteUart
;
462 } __attribute__ ((__packed__
));
464 #define NGENE_INTERFACE_VERSION 0x103
465 #define MAX_VIDEO_BUFFER_SIZE (417792) /* 288*1440 rounded up to next page */
466 #define MAX_AUDIO_BUFFER_SIZE (8192) /* Gives room for about 23msec@48KHz */
467 #define MAX_VBI_BUFFER_SIZE (28672) /* 1144*18 rounded up to next page */
468 #define MAX_TS_BUFFER_SIZE (98304) /* 512*188 rounded up to next page */
469 #define MAX_HDTV_BUFFER_SIZE (2080768) /* 541*1920*2 rounded up to next page
470 Max: (1920x1080i60) */
472 #define OVERFLOW_BUFFER_SIZE (8192)
474 #define RING_SIZE_VIDEO 4
475 #define RING_SIZE_AUDIO 8
476 #define RING_SIZE_TS 8
478 #define NUM_SCATTER_GATHER_ENTRIES 8
480 #define MAX_DMA_LENGTH (((MAX_VIDEO_BUFFER_SIZE + MAX_VBI_BUFFER_SIZE) * \
481 RING_SIZE_VIDEO * 2) + \
482 (MAX_AUDIO_BUFFER_SIZE * RING_SIZE_AUDIO * 2) + \
483 (MAX_TS_BUFFER_SIZE * RING_SIZE_TS * 4) + \
484 (RING_SIZE_VIDEO * PAGE_SIZE * 2) + \
485 (RING_SIZE_AUDIO * PAGE_SIZE * 2) + \
486 (RING_SIZE_TS * PAGE_SIZE * 4) + \
487 8 * PAGE_SIZE + OVERFLOW_BUFFER_SIZE + PAGE_SIZE)
489 #define EVENT_QUEUE_SIZE 16
491 /* Gathers the current state of a single channel. */
493 struct SBufferHeader
{
494 struct BUFFER_HEADER ngeneBuffer
; /* Physical descriptor */
495 struct SBufferHeader
*Next
;
497 struct HW_SCATTER_GATHER_ELEMENT
*scList1
;
499 struct HW_SCATTER_GATHER_ELEMENT
*scList2
;
502 /* Sizeof SBufferHeader aligned to next 64 Bit boundary (hw restriction) */
503 #define SIZEOF_SBufferHeader ((sizeof(struct SBufferHeader) + 63) & ~63)
519 struct SRingBufferDescriptor
{
520 struct SBufferHeader
*Head
; /* Points to first buffer in ring buffer
522 u64 PAHead
; /* Physical address of first buffer */
523 u32 MemSize
; /* Memory size of allocated ring buffers
524 (needed for freeing) */
525 u32 NumBuffers
; /* Number of buffers in the ring */
526 u32 Buffer1Length
; /* Allocated length of Buffer 1 */
527 u32 Buffer2Length
; /* Allocated length of Buffer 2 */
528 void *SCListMem
; /* Memory to hold scatter gather lists for this
530 u64 PASCListMem
; /* Physical address .. */
531 u32 SCListMemSize
; /* Size of this memory */
534 enum STREAMMODEFLAGS
{
535 StreamMode_NONE
= 0, /* Stream not used */
536 StreamMode_ANALOG
= 1, /* Analog: Stream 0,1 = Video, 2,3 = Audio */
537 StreamMode_TSIN
= 2, /* Transport stream input (all) */
538 StreamMode_HDTV
= 4, /* HDTV: Maximum 1920x1080p30,1920x1080i60
540 StreamMode_TSOUT
= 8, /* Transport stream output (only stream 3) */
544 enum BufferExchangeFlags
{
545 BEF_EVEN_FIELD
= 0x00000001,
546 BEF_CONTINUATION
= 0x00000002,
547 BEF_MORE_DATA
= 0x00000004,
548 BEF_OVERFLOW
= 0x00000008,
549 DF_SWAP32
= 0x00010000,
552 typedef void *(IBufferExchange
)(void *, void *, u32
, u32
, u32
);
554 struct MICI_STREAMINFO
{
555 IBufferExchange
*pExchange
;
556 IBufferExchange
*pExchangeVBI
; /* Secondary (VBI, ancillary) */
562 u16 nBytesPerLineVideo
;
564 u16 nBytesPerLineVBI
;
565 u32 CaptureLength
; /* Used for audio and transport stream */
568 /****************************************************************************/
569 /* STRUCTS ******************************************************************/
570 /****************************************************************************/
572 /* sound hardware definition */
573 #define MIXER_ADDR_TVTUNER 0
574 #define MIXER_ADDR_LAST 0
576 struct ngene_channel
;
578 /*struct sound chip*/
581 struct ngene_channel
*chan
;
582 struct snd_card
*card
;
584 struct snd_pcm_substream
*substream
;
588 spinlock_t mixer_lock
;
590 int mixer_volume
[MIXER_ADDR_LAST
+ 1][2];
591 int capture_source
[MIXER_ADDR_LAST
+ 1][2];
595 struct ngene_overlay
{
598 enum v4l2_field field
;
599 struct v4l2_clip
*clips
;
604 struct ngene_tvnorm
{
607 u16 swidth
, sheight
; /* scaled standard width, height */
613 struct ngene_channel
*ch
;
614 enum v4l2_priority prio
;
618 struct videobuf_queue vbuf_q
;
619 struct videobuf_queue vbi
;
623 enum v4l2_buf_type type
;
624 const struct ngene_format
*fmt
;
626 const struct ngene_format
*ovfmt
;
627 struct ngene_overlay ov
;
631 struct ngene_channel
{
632 struct device device
;
633 struct i2c_adapter i2c_adapter
;
640 struct dvb_frontend
*fe
;
641 struct dmxdev dmxdev
;
642 struct dvb_demux demux
;
643 struct dmx_frontend hw_frontend
;
644 struct dmx_frontend mem_frontend
;
646 struct video_device
*v4l_dev
;
647 struct tasklet_struct demux_tasklet
;
649 struct SBufferHeader
*nextBuffer
;
651 enum HWSTATE HWState
;
655 IBufferExchange
*pBufferExchange
;
656 IBufferExchange
*pBufferExchange2
;
658 spinlock_t state_lock
;
662 u16 nBytesPerVBILine
;
666 struct SRingBufferDescriptor RingBuffer
;
667 struct SRingBufferDescriptor TSRingBuffer
;
668 struct SRingBufferDescriptor TSIdleBuffer
;
675 int (*set_tone
)(struct dvb_frontend
*, fe_sec_tone_mode_t
);
678 /* stuff from analog driver */
681 struct mychip
*mychip
;
682 struct snd_card
*soundcard
;
687 int soundbuffisallocated
;
694 struct ngene_tvnorm
*tvnorms
;
700 struct v4l2_prio_state prio
;
701 struct ngene_vopen init
;
703 struct v4l2_framebuffer fbuf
;
704 struct ngene_buffer
*screen
; /* overlay */
705 struct list_head capture
; /* video capture queue */
707 struct semaphore reslock
;
715 typedef void (rx_cb_t
)(struct ngene
*, u32
, u8
);
716 typedef void (tx_cb_t
)(struct ngene
*, u32
);
720 struct pci_dev
*pci_dev
;
721 unsigned char *iomem
;
723 /*struct i2c_adapter i2c_adapter;*/
726 u32 fw_interface_version
;
729 bool cmd_timeout_workaround
;
733 void *OverflowBuffer
;
734 dma_addr_t PAOverflowBuffer
;
735 void *FWInterfaceBuffer
;
736 dma_addr_t PAFWInterfaceBuffer
;
740 struct EVENT_BUFFER EventQueue
[EVENT_QUEUE_SIZE
];
741 int EventQueueOverflowCount
;
742 int EventQueueOverflowFlag
;
743 struct tasklet_struct event_tasklet
;
744 struct EVENT_BUFFER
*EventBuffer
;
745 int EventQueueWriteIndex
;
746 int EventQueueReadIndex
;
748 wait_queue_head_t cmd_wq
;
750 struct semaphore cmd_mutex
;
751 struct semaphore stream_mutex
;
752 struct semaphore pll_mutex
;
753 struct semaphore i2c_switch_mutex
;
754 int i2c_current_channel
;
758 struct dvb_adapter adapter
[MAX_STREAM
];
759 struct dvb_adapter
*first_adapter
; /* "one_adapter" modprobe opt */
760 struct ngene_channel channel
[MAX_STREAM
];
762 struct ngene_info
*card_info
;
764 tx_cb_t
*TxEventNotify
;
765 rx_cb_t
*RxEventNotify
;
767 wait_queue_head_t tx_wq
;
768 wait_queue_head_t rx_wq
;
769 #define UART_RBUF_LEN 4096
770 u8 uart_rbuf
[UART_RBUF_LEN
];
771 int uart_rp
, uart_wp
;
774 #define TSOUT_BUF_SIZE (512*188*8)
775 struct dvb_ringbuffer tsout_rbuf
;
778 #define AIN_BUF_SIZE (128*1024)
779 struct dvb_ringbuffer ain_rbuf
;
783 #define VIN_BUF_SIZE (4*1920*1080)
784 struct dvb_ringbuffer vin_rbuf
;
786 unsigned long exp_val
;
793 #define NGENE_TERRATEC 1
794 #define NGENE_SIDEWINDER 2
795 #define NGENE_RACER 3
796 #define NGENE_VIPER 4
797 #define NGENE_PYTHON 5
798 #define NGENE_VBOX_V1 6
799 #define NGENE_VBOX_V2 7
805 int io_type
[MAX_STREAM
];
806 #define NGENE_IO_NONE 0
807 #define NGENE_IO_TV 1
808 #define NGENE_IO_HDTV 2
809 #define NGENE_IO_TSIN 4
810 #define NGENE_IO_TSOUT 8
811 #define NGENE_IO_AIN 16
814 void *tuner_config
[4];
816 int (*demod_attach
[4])(struct ngene_channel
*);
817 int (*tuner_attach
[4])(struct ngene_channel
*);
828 int (*gate_ctrl
)(struct dvb_frontend
*, int);
829 int (*switch_ctrl
)(struct ngene_channel
*, int, int);
835 int fourcc
; /* video4linux 2 */
836 int btformat
; /* BT848_COLOR_FMT_* */
838 int btswap
; /* BT848_COLOR_CTL_* */
839 int depth
; /* bit/pixel */
841 int hshift
, vshift
; /* for planar modes */
845 #define RESOURCE_OVERLAY 1
846 #define RESOURCE_VIDEO 2
847 #define RESOURCE_VBI 4
849 struct ngene_buffer
{
850 /* common v4l buffer stuff -- must be first */
851 struct videobuf_buffer vb
;
854 const struct ngene_format
*fmt
;
862 /* Provided by ngene-core.c */
863 int __devinit
ngene_probe(struct pci_dev
*pci_dev
,
864 const struct pci_device_id
*id
);
865 void __devexit
ngene_remove(struct pci_dev
*pdev
);
866 int ngene_command(struct ngene
*dev
, struct ngene_command
*com
);
867 int ngene_command_gpio_set(struct ngene
*dev
, u8 select
, u8 level
);
868 void set_transfer(struct ngene_channel
*chan
, int state
);
869 void FillTSBuffer(void *Buffer
, int Length
, u32 Flags
);
871 /* Provided by ngene-i2c.c */
872 int ngene_i2c_init(struct ngene
*dev
, int dev_nr
);
874 /* Provided by ngene-dvb.c */
875 void *tsout_exchange(void *priv
, void *buf
, u32 len
, u32 clock
, u32 flags
);
876 void *tsin_exchange(void *priv
, void *buf
, u32 len
, u32 clock
, u32 flags
);
877 int ngene_start_feed(struct dvb_demux_feed
*dvbdmxfeed
);
878 int ngene_stop_feed(struct dvb_demux_feed
*dvbdmxfeed
);
879 int my_dvb_dmx_ts_card_init(struct dvb_demux
*dvbdemux
, char *id
,
880 int (*start_feed
)(struct dvb_demux_feed
*),
881 int (*stop_feed
)(struct dvb_demux_feed
*),
883 int my_dvb_dmxdev_ts_card_init(struct dmxdev
*dmxdev
,
884 struct dvb_demux
*dvbdemux
,
885 struct dmx_frontend
*hw_frontend
,
886 struct dmx_frontend
*mem_frontend
,
887 struct dvb_adapter
*dvb_adapter
);