saa7146.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. /*
  2. saa7146.h - definitions philips saa7146 based cards
  3. Copyright (C) 1999 Nathan Laredo (laredo@gnu.org)
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 2 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program; if not, write to the Free Software
  14. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  15. */
  16. #ifndef __SAA7146__
  17. #define __SAA7146__
  18. #define SAA7146_VERSION_CODE 0x000101
  19. #include <linux/types.h>
  20. #include <linux/wait.h>
  21. #include <linux/videodev.h>
  22. #ifndef O_NONCAP
  23. #define O_NONCAP O_TRUNC
  24. #endif
  25. #define MAX_GBUFFERS 2
  26. #define FBUF_SIZE 0x190000
  27. #ifdef __KERNEL__
  28. struct saa7146_window
  29. {
  30. int x, y;
  31. ushort width, height;
  32. ushort bpp, bpl;
  33. ushort swidth, sheight;
  34. short cropx, cropy;
  35. ushort cropwidth, cropheight;
  36. unsigned long vidadr;
  37. int color_fmt;
  38. ushort depth;
  39. };
  40. /* Per-open data for handling multiple opens on one device */
  41. struct device_open
  42. {
  43. int isopen;
  44. int noncapturing;
  45. struct saa7146 *dev;
  46. };
  47. #define MAX_OPENS 3
  48. struct saa7146
  49. {
  50. struct video_device video_dev;
  51. struct video_picture picture;
  52. struct video_audio audio_dev;
  53. struct video_info vidinfo;
  54. int user;
  55. int cap;
  56. int capuser;
  57. int irqstate; /* irq routine is state driven */
  58. int writemode;
  59. int playmode;
  60. unsigned int nr;
  61. unsigned long irq; /* IRQ used by SAA7146 card */
  62. unsigned short id;
  63. struct pci_dev *dev;
  64. unsigned char revision;
  65. unsigned char boardcfg[64]; /* 64 bytes of config from eeprom */
  66. unsigned long saa7146_adr; /* bus address of IO mem from PCI BIOS */
  67. struct saa7146_window win;
  68. unsigned char __iomem *saa7146_mem; /* pointer to mapped IO memory */
  69. struct device_open open_data[MAX_OPENS];
  70. #define MAX_MARKS 16
  71. /* for a/v sync */
  72. int endmark[MAX_MARKS], endmarkhead, endmarktail;
  73. u32 *dmaRPS1, *pageRPS1, *dmaRPS2, *pageRPS2, *dmavid1, *dmavid2,
  74. *dmavid3, *dmaa1in, *dmaa1out, *dmaa2in, *dmaa2out,
  75. *pagedebi, *pagevid1, *pagevid2, *pagevid3, *pagea1in,
  76. *pagea1out, *pagea2in, *pagea2out;
  77. wait_queue_head_t i2cq, debiq, audq, vidq;
  78. u8 *vidbuf, *audbuf, *osdbuf, *dmadebi;
  79. int audhead, vidhead, osdhead, audtail, vidtail, osdtail;
  80. spinlock_t lock; /* the device lock */
  81. };
  82. #endif
  83. #ifdef _ALPHA_SAA7146
  84. #define saawrite(dat,adr) writel((dat), saa->saa7146_adr+(adr))
  85. #define saaread(adr) readl(saa->saa7146_adr+(adr))
  86. #else
  87. #define saawrite(dat,adr) writel((dat), saa->saa7146_mem+(adr))
  88. #define saaread(adr) readl(saa->saa7146_mem+(adr))
  89. #endif
  90. #define saaand(dat,adr) saawrite((dat) & saaread(adr), adr)
  91. #define saaor(dat,adr) saawrite((dat) | saaread(adr), adr)
  92. #define saaaor(dat,mask,adr) saawrite((dat) | ((mask) & saaread(adr)), adr)
  93. /* bitmask of attached hardware found */
  94. #define SAA7146_UNKNOWN 0x00000000
  95. #define SAA7146_SAA7111 0x00000001
  96. #define SAA7146_SAA7121 0x00000002
  97. #define SAA7146_IBMMPEG 0x00000004
  98. #endif