1 |
#define __NO_VERSION__ |
/* |
2 |
#include "../../alsa-kernel/pci/au88x0/au88x0.h" |
Aureal Vortex Soundcard driver. |
3 |
|
|
4 |
|
IO addr collected from asp4core.vxd: |
5 |
|
function address |
6 |
|
0005D5A0 13004 |
7 |
|
00080674 14004 |
8 |
|
00080AFF 12818 |
9 |
|
|
10 |
|
*/ |
11 |
|
|
12 |
|
#ifndef __SOUND_AU88X0_H |
13 |
|
#define __SOUND_AU88X0_H |
14 |
|
|
15 |
|
#ifdef __KERNEL__ |
16 |
|
#include <sound/driver.h> |
17 |
|
#include <sound/core.h> |
18 |
|
#include <sound/pcm.h> |
19 |
|
#include <sound/rawmidi.h> |
20 |
|
#include <sound/mpu401.h> |
21 |
|
#include <sound/hwdep.h> |
22 |
|
#include <sound/ac97_codec.h> |
23 |
|
#include <asm/io.h> |
24 |
|
#include <linux/init.h> |
25 |
|
#include "au88x0_eq.h" |
26 |
|
|
27 |
|
/* |
28 |
|
#ifndef PCI_VENDOR_ID_AUREAL |
29 |
|
#define PCI_VENDOR_ID_AUREAL 0x12eb |
30 |
|
#endif |
31 |
|
#ifndef PCI_VENDOR_ID_AUREAL_VORTEX |
32 |
|
#define PCI_DEVICE_ID_AUREAL_VORTEX 0x0001 |
33 |
|
#endif |
34 |
|
#ifndef PCI_VENDOR_ID_AUREAL_VORTEX2 |
35 |
|
#define PCI_DEVICE_ID_AUREAL_VORTEX2 0x0002 |
36 |
|
#endif |
37 |
|
#ifndef PCI_VENDOR_ID_AUREAL_ADVANTAGE |
38 |
|
#define PCI_DEVICE_ID_AUREAL_ADVANTAGE 0x0003 |
39 |
|
#endif |
40 |
|
*/ |
41 |
|
#endif |
42 |
|
|
43 |
|
#define VORTEX_DMA_MASK 0xffffffff |
44 |
|
|
45 |
|
#define hwread(x,y) readl((x)+((y)>>2)) |
46 |
|
#define hwwrite(x,y,z) writel((z),(x)+((y)>>2)) |
47 |
|
|
48 |
|
/* Vortex MPU401 defines. */ |
49 |
|
#define MIDI_CLOCK_DIV 0x61 |
50 |
|
/* Standart MPU401 defines. */ |
51 |
|
#define MPU401_RESET 0xff |
52 |
|
#define MPU401_ENTER_UART 0x3f |
53 |
|
#define MPU401_ACK 0xfe |
54 |
|
|
55 |
|
#define SRC_RATIO(x) ((((x<<15)/48000) + 1)/2) |
56 |
|
#define SRC_RATIO2(x) ((((48000<<15)/x) + 1)/2) |
57 |
|
|
58 |
|
|
59 |
|
/* FIFO software state constants. */ |
60 |
|
#define FIFO_STOP 0 |
61 |
|
#define FIFO_START 1 |
62 |
|
#define FIFO_PAUSE 2 |
63 |
|
|
64 |
|
|
65 |
|
/* Structs */ |
66 |
|
|
67 |
|
typedef struct { |
68 |
|
int fifo_enabled; /* this_24 */ |
69 |
|
int fifo_status; /* this_1c */ |
70 |
|
int dma_ctrl; /* this_78 (ADB), this_7c (WT) */ |
71 |
|
int dma_unknown; /* this_74 (ADB), this_78 (WT) */ |
72 |
|
int cfg0; |
73 |
|
int cfg1; |
74 |
|
|
75 |
|
int nr_ch; /* Used channel bitmap */ |
76 |
|
int dma; /* dma channel */ |
77 |
|
|
78 |
|
/* Virtual page extender stuff */ |
79 |
|
int nr_periods; |
80 |
|
int period_bytes; |
81 |
|
unsigned long buf_addr; |
82 |
|
int period_real; |
83 |
|
int period_virt; |
84 |
|
|
85 |
|
snd_pcm_substream_t *substream; |
86 |
|
} dma_t; |
87 |
|
|
88 |
|
typedef struct snd_vortex vortex_t; |
89 |
|
struct snd_vortex { |
90 |
|
// ALSA structs. |
91 |
|
snd_card_t *card; |
92 |
|
snd_pcm_t *pcm_adb; |
93 |
|
snd_pcm_t *pcm_wt; |
94 |
|
snd_rawmidi_t *rmidi; /* Legacy Midi interface. */ |
95 |
|
ac97_t *codec; |
96 |
|
|
97 |
|
// DMA structs. |
98 |
|
dma_t dma_adb[NR_ADB]; |
99 |
|
dma_t dma_wt[NR_WT]; |
100 |
|
|
101 |
|
/* Hardware equalizer structs */ |
102 |
|
eqlzr_t eq; |
103 |
|
snd_kcontrol_t *eqctrl[20]; |
104 |
|
snd_kcontrol_t *eqlvs[20]; |
105 |
|
|
106 |
|
/* Gameport stuff. */ |
107 |
|
struct gameport *gameport; |
108 |
|
|
109 |
|
/* hardware resouces */ |
110 |
|
unsigned long io; |
111 |
|
unsigned long *mmio; |
112 |
|
unsigned int irq; |
113 |
|
spinlock_t lock; |
114 |
|
|
115 |
|
/* PCI device */ |
116 |
|
struct pci_dev * pci_dev; |
117 |
|
u16 vendor; |
118 |
|
u16 device; |
119 |
|
u8 rev; |
120 |
|
}; |
121 |
|
|
122 |
|
#define chip_t vortex_t |
123 |
|
|
124 |
|
/* Functions. */ |
125 |
|
|
126 |
|
/* SRC */ |
127 |
|
void vortex_adb_setsrc(vortex_t *vortex, int adbdma, unsigned int cvrt, int dir); |
128 |
|
/*void vortex_src_setupchannel(vortex_t *card, unsigned char src, unsigned int cvr, |
129 |
|
unsigned int b, int c, int d, int e, int f, unsigned int g, int thsource); |
130 |
|
void vortex_src_change_convratio(vortex_t *vortex, unsigned char src, int ratio); |
131 |
|
*/ |
132 |
|
/* DMA Engines. */ |
133 |
|
int vortex_getadb(vortex_t *vortex); |
134 |
|
int vortex_getwt(vortex_t *vortex); |
135 |
|
void vortex_adbdma_setbuffers(vortex_t *vortex, int adbdma, unsigned int addr, int size, int count); |
136 |
|
void vortex_wtdma_setbuffers(vortex_t *vortex, int wtdma, unsigned int addr, int size, int count); |
137 |
|
void vortex_adbdma_setmode(vortex_t *vortex, int adbdma, int ie, int b, int fmt, int d, unsigned long offset); |
138 |
|
void vortex_wtdma_setmode(vortex_t *vortex, int wtdma, int ie, int b, int fmt, int d, unsigned long offset); |
139 |
|
void vortex_adbdma_setstartbuffer(vortex_t *vortex, int adbdma, int sb); |
140 |
|
void vortex_wtdma_setstartbuffer(vortex_t *vortex, int wtdma, int sb); |
141 |
|
|
142 |
|
void vortex_fifo_adbinitialize(vortex_t *vortex, int fifo, int j); |
143 |
|
void vortex_fifo_wtinitialize(vortex_t *vortex, int fifo, int j); |
144 |
|
void vortex_adbdma_startfifo(vortex_t *vortex, int adbdma); |
145 |
|
void vortex_adbdma_stopfifo(vortex_t *vortex, int adbdma); |
146 |
|
void vortex_wtdma_startfifo(vortex_t *vortex, int wtdma); |
147 |
|
void vortex_wtdma_stopfifo(vortex_t *vortex, int wtdma); |
148 |
|
void vortex_adbdma_pausefifo(vortex_t *vortex, int adbdma); |
149 |
|
void vortex_adbdma_resumefifo(vortex_t *vortex, int adbdma); |
150 |
|
void vortex_wtdma_pausefifo(vortex_t *vortex, int wtdma); |
151 |
|
void vortex_wtdma_resumefifo(vortex_t *vortex, int wtdma); |
152 |
|
|
153 |
|
int inline vortex_adbdma_getlinearpos(vortex_t *vortex, int adbdma); |
154 |
|
int inline vortex_wtdma_getlinearpos(vortex_t *vortex, int wtdma); |
155 |
|
|
156 |
|
/* global stuff. */ |
157 |
|
void vortex_codec_init(vortex_t *vortex); |
158 |
|
void vortex_codec_write(ac97_t *codec, unsigned short addr,unsigned short data); |
159 |
|
unsigned short vortex_codec_read(ac97_t *codec, unsigned short addr); |
160 |
|
|
161 |
|
int vortex_core_init(vortex_t *card); |
162 |
|
int vortex_core_shutdown(vortex_t *card); |
163 |
|
void vortex_enable_int(vortex_t *card); |
164 |
|
irqreturn_t vortex_interrupt(int irq, void *dev_id, struct pt_regs *regs); |
165 |
|
int vortex_alsafmt_aspfmt(int alsafmt); |
166 |
|
|
167 |
|
/* Connection stuff. */ |
168 |
|
int vortex_adb_waveroute(vortex_t *vortex, int adbdma, int nch); |
169 |
|
int vortex_wt_waveroute(vortex_t *vortex, int adbdma, int nch); |
170 |
|
|
171 |
|
/* Driver stuff. */ |
172 |
|
|
173 |
|
int __devinit vortex_gameport_register(vortex_t *card); |
174 |
|
int __devexit vortex_gameport_unregister(vortex_t *card); |
175 |
|
int __devinit vortex_eq_init(vortex_t *vortex); |
176 |
|
int __devexit vortex_eq_free(vortex_t *vortex); |
177 |
|
/* ALSA stuff. */ |
178 |
|
int __devinit snd_vortex_new_pcm(vortex_t *vortex, int idx, int nr); |
179 |
|
int __devinit snd_vortex_mixer(vortex_t *vortex); |
180 |
|
int __devinit snd_vortex_midi(vortex_t *vortex); |
181 |
|
#endif |