ad1889.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. #ifndef _AD1889_H_
  2. #define _AD1889_H_
  3. #define AD_DSWSMC 0x00 /* DMA input wave/syn mixer control */
  4. #define AD_DSRAMC 0x02 /* DMA output resamp/ADC mixer control */
  5. #define AD_DSWADA 0x04 /* DMA input wave attenuation */
  6. #define AD_DSSYDA 0x06 /* DMA input syn attentuation */
  7. #define AD_DSWAS 0x08 /* wave input sample rate */
  8. #define AD_DSRES 0x0a /* resampler output sample rate */
  9. #define AD_DSCCS 0x0c /* chip control/status */
  10. #define AD_DMARESBA 0x40 /* RES base addr */
  11. #define AD_DMARESCA 0x44 /* RES current addr */
  12. #define AD_DMARESBC 0x48 /* RES base cnt */
  13. #define AD_DMARESCC 0x4c /* RES current count */
  14. #define AD_DMAADCBA 0x50 /* ADC */
  15. #define AD_DMAADCCA 0x54
  16. #define AD_DMAADCBC 0x58
  17. #define AD_DMAADCCC 0x5c
  18. #define AD_DMASYNBA 0x60 /* SYN */
  19. #define AD_DMASYNCA 0x64
  20. #define AD_DMASYNBC 0x68
  21. #define AD_DMASYNCC 0x6c
  22. #define AD_DMAWAVBA 0x70 /* WAV */
  23. #define AD_DMAWAVCA 0x74
  24. #define AD_DMAWAVBC 0x78
  25. #define AD_DMAWAVCC 0x7c
  26. #define AD_DMARESICC 0x80 /* RES interrupt current count */
  27. #define AD_DMARESIBC 0x84 /* RES interrupt base count */
  28. #define AD_DMAADCICC 0x88 /* ADC interrupt current count */
  29. #define AD_DMAADCIBC 0x8c /* ADC interrupt base count */
  30. #define AD_DMASYNICC 0x90 /* SYN interrupt current count */
  31. #define AD_DMASYNIBC 0x94 /* SYN interrupt base count */
  32. #define AD_DMAWAVICC 0x98 /* WAV interrupt current count */
  33. #define AD_DMAWAVIBC 0x9c /* WAV interrupt base count */
  34. #define AD_DMARESCTRL 0xa0 /* RES PCI control/status */
  35. #define AD_DMAADCCTRL 0xa8 /* ADC PCI control/status */
  36. #define AD_DMASYNCTRL 0xb0 /* SYN PCI control/status */
  37. #define AD_DMAWAVCTRL 0xb8 /* WAV PCI control/status */
  38. #define AD_DMADISR 0xc0 /* PCI DMA intr status */
  39. #define AD_DMACHSS 0xc4 /* PCI DMA channel stop status */
  40. #define AD_GPIOIPC 0xc8 /* IO port ctrl */
  41. #define AD_GPIOOP 0xca /* IO output status */
  42. #define AD_GPIOIP 0xcc /* IO input status */
  43. /* AC97 registers, 0x100 - 0x17f; see ac97.h */
  44. #define AD_ACIC 0x180 /* AC Link interface ctrl */
  45. /* OPL3; BAR1 */
  46. #define AD_OPLM0AS 0x00 /* Music0 address/status */
  47. #define AD_OPLM0DATA 0x01 /* Music0 data */
  48. #define AD_OPLM1A 0x02 /* Music1 address */
  49. #define AD_OPLM1DATA 0x03 /* Music1 data */
  50. /* 0x04-0x0f reserved */
  51. /* MIDI; BAR2 */
  52. #define AD_MIDA 0x00 /* MIDI data */
  53. #define AD_MISC 0x01 /* MIDI status/cmd */
  54. /* 0x02-0xff reserved */
  55. #define AD_DSIOMEMSIZE 512
  56. #define AD_OPLMEMSIZE 16
  57. #define AD_MIDIMEMSIZE 16
  58. #define AD_WAV_STATE 0
  59. #define AD_ADC_STATE 1
  60. #define AD_MAX_STATES 2
  61. #define DMA_SIZE (128*1024)
  62. #define DMA_FLAG_MAPPED 1
  63. struct ad1889_dev;
  64. typedef struct ad1889_state {
  65. struct ad1889_dev *card;
  66. mode_t open_mode;
  67. struct dmabuf {
  68. unsigned int rate;
  69. unsigned char fmt, enable;
  70. /* buf management */
  71. size_t rawbuf_size;
  72. void *rawbuf;
  73. dma_addr_t dma_handle; /* mapped address */
  74. unsigned long dma_len; /* number of bytes mapped */
  75. /* indexes into rawbuf for setting up DMA engine */
  76. volatile unsigned long rd_ptr, wr_ptr;
  77. wait_queue_head_t wait; /* to wait for buf servicing */
  78. /* OSS bits */
  79. unsigned int mapped:1;
  80. unsigned int ready:1;
  81. unsigned int ossfragshift;
  82. int ossmaxfrags;
  83. unsigned int subdivision;
  84. } dmabuf;
  85. struct semaphore sem;
  86. } ad1889_state_t;
  87. typedef struct ad1889_dev {
  88. void __iomem *regbase;
  89. struct pci_dev *pci;
  90. spinlock_t lock;
  91. int dev_audio;
  92. /* states; one per channel; right now only WAV and ADC */
  93. struct ad1889_state state[AD_MAX_STATES];
  94. /* AC97 codec */
  95. struct ac97_codec *ac97_codec;
  96. u16 ac97_features;
  97. /* debugging stuff */
  98. struct stats {
  99. unsigned int wav_intrs, adc_intrs;
  100. unsigned int blocks, underrun, error;
  101. } stats;
  102. } ad1889_dev_t;
  103. typedef struct ad1889_reg {
  104. const char *name;
  105. int offset;
  106. int width;
  107. } ad1889_reg_t;
  108. #endif