2 saa7146.h - definitions philips saa7146 based cards
3 Copyright (C) 1999 Nathan Laredo (laredo@gnu.org)
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 #define SAA7146_VERSION_CODE 0x000101
25 #include <linux/types.h>
26 #include <linux/wait.h>
28 #include <linux/videodev.h>
31 #define O_NONCAP O_TRUNC
34 #define MAX_GBUFFERS 2
35 #define FBUF_SIZE 0x190000
44 ushort swidth
, sheight
;
46 ushort cropwidth
, cropheight
;
52 /* Per-open data for handling multiple opens on one device */
63 struct video_device video_dev
;
64 struct video_picture picture
;
65 struct video_audio audio_dev
;
66 struct video_info vidinfo
;
70 int irqstate
; /* irq routine is state driven */
74 unsigned long irq
; /* IRQ used by SAA7146 card */
77 unsigned char revision
;
78 unsigned char boardcfg
[64]; /* 64 bytes of config from eeprom */
79 unsigned long saa7146_adr
; /* bus address of IO mem from PCI BIOS */
80 struct saa7146_window win
;
81 unsigned char __iomem
*saa7146_mem
; /* pointer to mapped IO memory */
82 struct device_open open_data
[MAX_OPENS
];
85 int endmark
[MAX_MARKS
], endmarkhead
, endmarktail
;
86 u32
*dmaRPS1
, *pageRPS1
, *dmaRPS2
, *pageRPS2
, *dmavid1
, *dmavid2
,
87 *dmavid3
, *dmaa1in
, *dmaa1out
, *dmaa2in
, *dmaa2out
,
88 *pagedebi
, *pagevid1
, *pagevid2
, *pagevid3
, *pagea1in
,
89 *pagea1out
, *pagea2in
, *pagea2out
;
90 wait_queue_head_t i2cq
, debiq
, audq
, vidq
;
91 u8
*vidbuf
, *audbuf
, *osdbuf
, *dmadebi
;
92 int audhead
, vidhead
, osdhead
, audtail
, vidtail
, osdtail
;
93 spinlock_t lock
; /* the device lock */
98 #define saawrite(dat,adr) writel((dat), saa->saa7146_adr+(adr))
99 #define saaread(adr) readl(saa->saa7146_adr+(adr))
101 #define saawrite(dat,adr) writel((dat), saa->saa7146_mem+(adr))
102 #define saaread(adr) readl(saa->saa7146_mem+(adr))
105 #define saaand(dat,adr) saawrite((dat) & saaread(adr), adr)
106 #define saaor(dat,adr) saawrite((dat) | saaread(adr), adr)
107 #define saaaor(dat,mask,adr) saawrite((dat) | ((mask) & saaread(adr)), adr)
109 /* bitmask of attached hardware found */
110 #define SAA7146_UNKNOWN 0x00000000
111 #define SAA7146_SAA7111 0x00000001
112 #define SAA7146_SAA7121 0x00000002
113 #define SAA7146_IBMMPEG 0x00000004