1 |
/* |
#define __NO_VERSION__ |
2 |
Aureal Vortex Soundcard driver. |
#include "../../alsa-kernel/pci/au88x0/au88x0.h" |
3 |
|
|
|
IO addr collected from asp4core.vxd: |
|
|
function address |
|
|
0005D5A0 13004 |
|
|
00080674 14004 |
|
|
00080AFF 12818 |
|
|
|
|
|
*/ |
|
|
|
|
|
#ifndef __SOUND_AU88X0_H |
|
|
#define __SOUND_AU88X0_H |
|
|
|
|
|
#ifdef __KERNEL__ |
|
|
#include <sound/driver.h> |
|
|
#include <sound/core.h> |
|
|
#include <sound/pcm.h> |
|
|
#include <sound/rawmidi.h> |
|
|
#include <sound/mpu401.h> |
|
|
#include <sound/hwdep.h> |
|
|
#include <sound/ac97_codec.h> |
|
|
#include <asm/io.h> |
|
|
#include <linux/init.h> |
|
|
#include "au88x0_eq.h" |
|
|
|
|
|
/* |
|
|
#ifndef PCI_VENDOR_ID_AUREAL |
|
|
#define PCI_VENDOR_ID_AUREAL 0x12eb |
|
|
#endif |
|
|
#ifndef PCI_VENDOR_ID_AUREAL_VORTEX |
|
|
#define PCI_DEVICE_ID_AUREAL_VORTEX 0x0001 |
|
|
#endif |
|
|
#ifndef PCI_VENDOR_ID_AUREAL_VORTEX2 |
|
|
#define PCI_DEVICE_ID_AUREAL_VORTEX2 0x0002 |
|
|
#endif |
|
|
#ifndef PCI_VENDOR_ID_AUREAL_ADVANTAGE |
|
|
#define PCI_DEVICE_ID_AUREAL_ADVANTAGE 0x0003 |
|
|
#endif |
|
|
*/ |
|
|
#endif |
|
|
|
|
|
#define VORTEX_DMA_MASK 0xffffffff |
|
|
|
|
|
#define hwread(x,y) readl((x)+((y)>>2)) |
|
|
#define hwwrite(x,y,z) writel((z),(x)+((y)>>2)) |
|
|
|
|
|
/* Vortex MPU401 defines. */ |
|
|
#define MIDI_CLOCK_DIV 0x61 |
|
|
/* Standart MPU401 defines. */ |
|
|
#define MPU401_RESET 0xff |
|
|
#define MPU401_ENTER_UART 0x3f |
|
|
#define MPU401_ACK 0xfe |
|
|
|
|
|
#define SRC_RATIO(x) ((((x<<15)/48000) + 1)/2) |
|
|
#define SRC_RATIO2(x) ((((48000<<15)/x) + 1)/2) |
|
|
|
|
|
|
|
|
/* FIFO software state constants. */ |
|
|
#define FIFO_STOP 0 |
|
|
#define FIFO_START 1 |
|
|
#define FIFO_PAUSE 2 |
|
|
|
|
|
|
|
|
/* Structs */ |
|
|
|
|
|
typedef struct { |
|
|
int fifo_enabled; /* this_24 */ |
|
|
int fifo_status; /* this_1c */ |
|
|
int dma_ctrl; /* this_78 (ADB), this_7c (WT) */ |
|
|
int dma_unknown; /* this_74 (ADB), this_78 (WT) */ |
|
|
int cfg0; |
|
|
int cfg1; |
|
|
|
|
|
int nr_ch; /* Used channel bitmap */ |
|
|
int dma; /* dma channel */ |
|
|
|
|
|
/* Virtual page extender stuff */ |
|
|
int nr_periods; |
|
|
int period_bytes; |
|
|
unsigned long buf_addr; |
|
|
int period_real; |
|
|
int period_virt; |
|
|
|
|
|
snd_pcm_substream_t *substream; |
|
|
} dma_t; |
|
|
|
|
|
typedef struct snd_vortex vortex_t; |
|
|
struct snd_vortex { |
|
|
// ALSA structs. |
|
|
snd_card_t *card; |
|
|
snd_pcm_t *pcm_adb; |
|
|
snd_pcm_t *pcm_wt; |
|
|
snd_rawmidi_t *rmidi; /* Legacy Midi interface. */ |
|
|
ac97_t *codec; |
|
|
|
|
|
// DMA structs. |
|
|
dma_t dma_adb[NR_ADB]; |
|
|
dma_t dma_wt[NR_WT]; |
|
|
|
|
|
/* Hardware equalizer structs */ |
|
|
eqlzr_t eq; |
|
|
snd_kcontrol_t *eqctrl[20]; |
|
|
snd_kcontrol_t *eqlvs[20]; |
|
|
|
|
|
/* Gameport stuff. */ |
|
|
struct gameport *gameport; |
|
|
|
|
|
/* hardware resouces */ |
|
|
unsigned long io; |
|
|
unsigned long *mmio; |
|
|
unsigned int irq; |
|
|
spinlock_t lock; |
|
|
|
|
|
/* PCI device */ |
|
|
struct pci_dev * pci_dev; |
|
|
u16 vendor; |
|
|
u16 device; |
|
|
u8 rev; |
|
|
}; |
|
|
|
|
|
#define chip_t vortex_t |
|
|
|
|
|
/* Functions. */ |
|
|
|
|
|
/* SRC */ |
|
|
void vortex_adb_setsrc(vortex_t *vortex, int adbdma, unsigned int cvrt, int dir); |
|
|
/*void vortex_src_setupchannel(vortex_t *card, unsigned char src, unsigned int cvr, |
|
|
unsigned int b, int c, int d, int e, int f, unsigned int g, int thsource); |
|
|
void vortex_src_change_convratio(vortex_t *vortex, unsigned char src, int ratio); |
|
|
*/ |
|
|
/* DMA Engines. */ |
|
|
int vortex_getadb(vortex_t *vortex); |
|
|
int vortex_getwt(vortex_t *vortex); |
|
|
void vortex_adbdma_setbuffers(vortex_t *vortex, int adbdma, unsigned int addr, int size, int count); |
|
|
void vortex_wtdma_setbuffers(vortex_t *vortex, int wtdma, unsigned int addr, int size, int count); |
|
|
void vortex_adbdma_setmode(vortex_t *vortex, int adbdma, int ie, int b, int fmt, int d, unsigned long offset); |
|
|
void vortex_wtdma_setmode(vortex_t *vortex, int wtdma, int ie, int b, int fmt, int d, unsigned long offset); |
|
|
void vortex_adbdma_setstartbuffer(vortex_t *vortex, int adbdma, int sb); |
|
|
void vortex_wtdma_setstartbuffer(vortex_t *vortex, int wtdma, int sb); |
|
|
|
|
|
void vortex_fifo_adbinitialize(vortex_t *vortex, int fifo, int j); |
|
|
void vortex_fifo_wtinitialize(vortex_t *vortex, int fifo, int j); |
|
|
void vortex_adbdma_startfifo(vortex_t *vortex, int adbdma); |
|
|
void vortex_adbdma_stopfifo(vortex_t *vortex, int adbdma); |
|
|
void vortex_wtdma_startfifo(vortex_t *vortex, int wtdma); |
|
|
void vortex_wtdma_stopfifo(vortex_t *vortex, int wtdma); |
|
|
void vortex_adbdma_pausefifo(vortex_t *vortex, int adbdma); |
|
|
void vortex_adbdma_resumefifo(vortex_t *vortex, int adbdma); |
|
|
void vortex_wtdma_pausefifo(vortex_t *vortex, int wtdma); |
|
|
void vortex_wtdma_resumefifo(vortex_t *vortex, int wtdma); |
|
|
|
|
|
int inline vortex_adbdma_getlinearpos(vortex_t *vortex, int adbdma); |
|
|
int inline vortex_wtdma_getlinearpos(vortex_t *vortex, int wtdma); |
|
|
|
|
|
/* global stuff. */ |
|
|
void vortex_codec_init(vortex_t *vortex); |
|
|
void vortex_codec_write(ac97_t *codec, unsigned short addr,unsigned short data); |
|
|
unsigned short vortex_codec_read(ac97_t *codec, unsigned short addr); |
|
|
|
|
|
int vortex_core_init(vortex_t *card); |
|
|
int vortex_core_shutdown(vortex_t *card); |
|
|
void vortex_enable_int(vortex_t *card); |
|
|
irqreturn_t vortex_interrupt(int irq, void *dev_id, struct pt_regs *regs); |
|
|
int vortex_alsafmt_aspfmt(int alsafmt); |
|
|
|
|
|
/* Connection stuff. */ |
|
|
int vortex_adb_waveroute(vortex_t *vortex, int adbdma, int nch); |
|
|
int vortex_wt_waveroute(vortex_t *vortex, int adbdma, int nch); |
|
|
|
|
|
/* Driver stuff. */ |
|
|
|
|
|
int __devinit vortex_gameport_register(vortex_t *card); |
|
|
int __devexit vortex_gameport_unregister(vortex_t *card); |
|
|
int __devinit vortex_eq_init(vortex_t *vortex); |
|
|
int __devexit vortex_eq_free(vortex_t *vortex); |
|
|
/* ALSA stuff. */ |
|
|
int __devinit snd_vortex_new_pcm(vortex_t *vortex, int idx, int nr); |
|
|
int __devinit snd_vortex_mixer(vortex_t *vortex); |
|
|
int __devinit snd_vortex_midi(vortex_t *vortex); |
|
|
#endif |
|