saa7146.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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. #ifndef O_NONCAP
  22. #define O_NONCAP O_TRUNC
  23. #endif
  24. #define MAX_GBUFFERS 2
  25. #define FBUF_SIZE 0x190000
  26. #ifdef __KERNEL__
  27. struct saa7146_window
  28. {
  29. int x, y;
  30. ushort width, height;
  31. ushort bpp, bpl;
  32. ushort swidth, sheight;
  33. short cropx, cropy;
  34. ushort cropwidth, cropheight;
  35. unsigned long vidadr;
  36. int color_fmt;
  37. ushort depth;
  38. };
  39. /* Per-open data for handling multiple opens on one device */
  40. struct device_open
  41. {
  42. int isopen;
  43. int noncapturing;
  44. struct saa7146 *dev;
  45. };
  46. #define MAX_OPENS 3
  47. struct saa7146
  48. {
  49. struct video_device video_dev;
  50. struct video_picture picture;
  51. struct video_audio audio_dev;
  52. struct video_info vidinfo;
  53. int user;
  54. int cap;
  55. int capuser;
  56. int irqstate; /* irq routine is state driven */
  57. int writemode;
  58. int playmode;
  59. unsigned int nr;
  60. unsigned long irq; /* IRQ used by SAA7146 card */
  61. unsigned short id;
  62. unsigned char revision;
  63. unsigned char boardcfg[64]; /* 64 bytes of config from eeprom */
  64. unsigned long saa7146_adr; /* bus address of IO mem from PCI BIOS */
  65. struct saa7146_window win;
  66. unsigned char __iomem *saa7146_mem; /* pointer to mapped IO memory */
  67. struct device_open open_data[MAX_OPENS];
  68. #define MAX_MARKS 16
  69. /* for a/v sync */
  70. int endmark[MAX_MARKS], endmarkhead, endmarktail;
  71. u32 *dmaRPS1, *pageRPS1, *dmaRPS2, *pageRPS2, *dmavid1, *dmavid2,
  72. *dmavid3, *dmaa1in, *dmaa1out, *dmaa2in, *dmaa2out,
  73. *pagedebi, *pagevid1, *pagevid2, *pagevid3, *pagea1in,
  74. *pagea1out, *pagea2in, *pagea2out;
  75. wait_queue_head_t i2cq, debiq, audq, vidq;
  76. u8 *vidbuf, *audbuf, *osdbuf, *dmadebi;
  77. int audhead, vidhead, osdhead, audtail, vidtail, osdtail;
  78. spinlock_t lock; /* the device lock */
  79. };
  80. #endif
  81. #ifdef _ALPHA_SAA7146
  82. #define saawrite(dat,adr) writel((dat), saa->saa7146_adr+(adr))
  83. #define saaread(adr) readl(saa->saa7146_adr+(adr))
  84. #else
  85. #define saawrite(dat,adr) writel((dat), saa->saa7146_mem+(adr))
  86. #define saaread(adr) readl(saa->saa7146_mem+(adr))
  87. #endif
  88. #define saaand(dat,adr) saawrite((dat) & saaread(adr), adr)
  89. #define saaor(dat,adr) saawrite((dat) | saaread(adr), adr)
  90. #define saaaor(dat,mask,adr) saawrite((dat) | ((mask) & saaread(adr)), adr)
  91. /* bitmask of attached hardware found */
  92. #define SAA7146_UNKNOWN 0x00000000
  93. #define SAA7146_SAA7111 0x00000001
  94. #define SAA7146_SAA7121 0x00000002
  95. #define SAA7146_IBMMPEG 0x00000004
  96. #endif