⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gus.h

📁 linux 内核源代码
💻 H
📖 第 1 页 / 共 2 页
字号:
#ifndef __SOUND_GUS_H#define __SOUND_GUS_H/* *  Global structures used for GUS part of ALSA driver *  Copyright (c) by Jaroslav Kysela <perex@perex.cz> * * *   This program is free software; you can redistribute it and/or modify *   it under the terms of the GNU General Public License as published by *   the Free Software Foundation; either version 2 of the License, or *   (at your option) any later version. * *   This program is distributed in the hope that it will be useful, *   but WITHOUT ANY WARRANTY; without even the implied warranty of *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the *   GNU General Public License for more details. * *   You should have received a copy of the GNU General Public License *   along with this program; if not, write to the Free Software *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA * */#include "pcm.h"#include "rawmidi.h"#include "timer.h"#include "seq_midi_emul.h"#include "seq_device.h"#include "ainstr_iw.h"#include "ainstr_gf1.h"#include "ainstr_simple.h"#include <asm/io.h>#define SNDRV_SEQ_DEV_ID_GUS			"gus-synth"/* IO ports */#define GUSP(gus, x)			((gus)->gf1.port + SNDRV_g_u_s_##x)#define SNDRV_g_u_s_MIDICTRL		(0x320-0x220)#define SNDRV_g_u_s_MIDISTAT		(0x320-0x220)#define SNDRV_g_u_s_MIDIDATA		(0x321-0x220)#define SNDRV_g_u_s_GF1PAGE		(0x322-0x220)#define SNDRV_g_u_s_GF1REGSEL		(0x323-0x220)#define SNDRV_g_u_s_GF1DATALOW		(0x324-0x220)#define SNDRV_g_u_s_GF1DATAHIGH		(0x325-0x220)#define SNDRV_g_u_s_IRQSTAT		(0x226-0x220)#define SNDRV_g_u_s_TIMERCNTRL		(0x228-0x220)#define SNDRV_g_u_s_TIMERDATA		(0x229-0x220)#define SNDRV_g_u_s_DRAM		(0x327-0x220)#define SNDRV_g_u_s_MIXCNTRLREG		(0x220-0x220)#define SNDRV_g_u_s_IRQDMACNTRLREG	(0x22b-0x220)#define SNDRV_g_u_s_REGCNTRLS		(0x22f-0x220)#define SNDRV_g_u_s_BOARDVERSION	(0x726-0x220)#define SNDRV_g_u_s_MIXCNTRLPORT	(0x726-0x220)#define SNDRV_g_u_s_IVER		(0x325-0x220)#define SNDRV_g_u_s_MIXDATAPORT		(0x326-0x220)#define SNDRV_g_u_s_MAXCNTRLPORT	(0x326-0x220)/* GF1 registers *//* global registers */#define SNDRV_GF1_GB_ACTIVE_VOICES		0x0e#define SNDRV_GF1_GB_VOICES_IRQ			0x0f#define SNDRV_GF1_GB_GLOBAL_MODE		0x19#define SNDRV_GF1_GW_LFO_BASE			0x1a#define SNDRV_GF1_GB_VOICES_IRQ_READ		0x1f#define SNDRV_GF1_GB_DRAM_DMA_CONTROL		0x41#define SNDRV_GF1_GW_DRAM_DMA_LOW		0x42#define SNDRV_GF1_GW_DRAM_IO_LOW		0x43#define SNDRV_GF1_GB_DRAM_IO_HIGH		0x44#define SNDRV_GF1_GB_SOUND_BLASTER_CONTROL	0x45#define SNDRV_GF1_GB_ADLIB_TIMER_1		0x46#define SNDRV_GF1_GB_ADLIB_TIMER_2		0x47#define SNDRV_GF1_GB_RECORD_RATE		0x48#define SNDRV_GF1_GB_REC_DMA_CONTROL		0x49#define SNDRV_GF1_GB_JOYSTICK_DAC_LEVEL		0x4b#define SNDRV_GF1_GB_RESET			0x4c#define SNDRV_GF1_GB_DRAM_DMA_HIGH		0x50#define SNDRV_GF1_GW_DRAM_IO16			0x51#define SNDRV_GF1_GW_MEMORY_CONFIG		0x52#define SNDRV_GF1_GB_MEMORY_CONTROL		0x53#define SNDRV_GF1_GW_FIFO_RECORD_BASE_ADDR	0x54#define SNDRV_GF1_GW_FIFO_PLAY_BASE_ADDR	0x55#define SNDRV_GF1_GW_FIFO_SIZE			0x56#define SNDRV_GF1_GW_INTERLEAVE			0x57#define SNDRV_GF1_GB_COMPATIBILITY		0x59#define SNDRV_GF1_GB_DECODE_CONTROL		0x5a#define SNDRV_GF1_GB_VERSION_NUMBER		0x5b#define SNDRV_GF1_GB_MPU401_CONTROL_A		0x5c#define SNDRV_GF1_GB_MPU401_CONTROL_B		0x5d#define SNDRV_GF1_GB_EMULATION_IRQ		0x60/* voice specific registers */#define SNDRV_GF1_VB_ADDRESS_CONTROL		0x00#define SNDRV_GF1_VW_FREQUENCY			0x01#define SNDRV_GF1_VW_START_HIGH			0x02#define SNDRV_GF1_VW_START_LOW			0x03#define SNDRV_GF1_VA_START			SNDRV_GF1_VW_START_HIGH#define SNDRV_GF1_VW_END_HIGH			0x04#define SNDRV_GF1_VW_END_LOW			0x05#define SNDRV_GF1_VA_END			SNDRV_GF1_VW_END_HIGH#define SNDRV_GF1_VB_VOLUME_RATE		0x06#define SNDRV_GF1_VB_VOLUME_START		0x07#define SNDRV_GF1_VB_VOLUME_END			0x08#define SNDRV_GF1_VW_VOLUME			0x09#define SNDRV_GF1_VW_CURRENT_HIGH		0x0a#define SNDRV_GF1_VW_CURRENT_LOW		0x0b#define SNDRV_GF1_VA_CURRENT			SNDRV_GF1_VW_CURRENT_HIGH#define SNDRV_GF1_VB_PAN			0x0c#define SNDRV_GF1_VW_OFFSET_RIGHT		0x0c#define SNDRV_GF1_VB_VOLUME_CONTROL		0x0d#define SNDRV_GF1_VB_UPPER_ADDRESS		0x10#define SNDRV_GF1_VW_EFFECT_HIGH		0x11#define SNDRV_GF1_VW_EFFECT_LOW			0x12#define SNDRV_GF1_VA_EFFECT			SNDRV_GF1_VW_EFFECT_HIGH#define SNDRV_GF1_VW_OFFSET_LEFT		0x13#define SNDRV_GF1_VB_ACCUMULATOR		0x14#define SNDRV_GF1_VB_MODE			0x15#define SNDRV_GF1_VW_EFFECT_VOLUME		0x16#define SNDRV_GF1_VB_FREQUENCY_LFO		0x17#define SNDRV_GF1_VB_VOLUME_LFO			0x18#define SNDRV_GF1_VW_OFFSET_RIGHT_FINAL		0x1b#define SNDRV_GF1_VW_OFFSET_LEFT_FINAL		0x1c#define SNDRV_GF1_VW_EFFECT_VOLUME_FINAL	0x1d/* ICS registers */#define SNDRV_ICS_MIC_DEV		0#define SNDRV_ICS_LINE_DEV		1#define SNDRV_ICS_CD_DEV		2#define SNDRV_ICS_GF1_DEV		3#define SNDRV_ICS_NONE_DEV		4#define SNDRV_ICS_MASTER_DEV		5/* LFO */#define SNDRV_LFO_TREMOLO		0#define SNDRV_LFO_VIBRATO		1/* misc */#define SNDRV_GF1_DMA_UNSIGNED	0x80#define SNDRV_GF1_DMA_16BIT	0x40#define SNDRV_GF1_DMA_IRQ	0x20#define SNDRV_GF1_DMA_WIDTH16	0x04#define SNDRV_GF1_DMA_READ	0x02	/* read from GUS's DRAM */#define SNDRV_GF1_DMA_ENABLE	0x01/* ramp ranges */#define SNDRV_GF1_ATTEN(x)	(snd_gf1_atten_table[x])#define SNDRV_GF1_MIN_VOLUME	1800#define SNDRV_GF1_MAX_VOLUME	4095#define SNDRV_GF1_MIN_OFFSET	(SNDRV_GF1_MIN_VOLUME>>4)#define SNDRV_GF1_MAX_OFFSET	255#define SNDRV_GF1_MAX_TDEPTH	90/* defines for memory manager */#define SNDRV_GF1_MEM_BLOCK_16BIT	0x0001#define SNDRV_GF1_MEM_OWNER_DRIVER	0x0001#define SNDRV_GF1_MEM_OWNER_WAVE_SIMPLE	0x0002#define SNDRV_GF1_MEM_OWNER_WAVE_GF1	0x0003#define SNDRV_GF1_MEM_OWNER_WAVE_IWFFFF	0x0004/* constants for interrupt handlers */#define SNDRV_GF1_HANDLER_MIDI_OUT	0x00010000#define SNDRV_GF1_HANDLER_MIDI_IN	0x00020000#define SNDRV_GF1_HANDLER_TIMER1	0x00040000#define SNDRV_GF1_HANDLER_TIMER2	0x00080000#define SNDRV_GF1_HANDLER_VOICE		0x00100000#define SNDRV_GF1_HANDLER_DMA_WRITE	0x00200000#define SNDRV_GF1_HANDLER_DMA_READ	0x00400000#define SNDRV_GF1_HANDLER_ALL		(0xffff0000&~SNDRV_GF1_HANDLER_VOICE)/* constants for DMA flags */#define SNDRV_GF1_DMA_TRIGGER		1/* --- */struct snd_gus_card;/* GF1 specific structure */struct snd_gf1_bank_info {	unsigned int address;	unsigned int size;};struct snd_gf1_mem_block {	unsigned short flags;	/* flags - SNDRV_GF1_MEM_BLOCK_XXXX */	unsigned short owner;	/* owner - SNDRV_GF1_MEM_OWNER_XXXX */	unsigned int share;	/* share count */	unsigned int share_id[4]; /* share ID */	unsigned int ptr;	unsigned int size;	char *name;	struct snd_gf1_mem_block *next;	struct snd_gf1_mem_block *prev;};struct snd_gf1_mem {	struct snd_gf1_bank_info banks_8[4];	struct snd_gf1_bank_info banks_16[4];	struct snd_gf1_mem_block *first;	struct snd_gf1_mem_block *last;	struct mutex memory_mutex;};struct snd_gf1_dma_block {	void *buffer;		/* buffer in computer's RAM */	unsigned long buf_addr;	/* buffer address */	unsigned int addr;	/* address in onboard memory */	unsigned int count;	/* count in bytes */	unsigned int cmd;	/* DMA command (format) */	void (*ack)(struct snd_gus_card * gus, void *private_data);	void *private_data;	struct snd_gf1_dma_block *next;};struct snd_gus_port {	struct snd_midi_channel_set * chset;	struct snd_gus_card * gus;	int mode;		/* operation mode */	int client;		/* sequencer client number */	int port;		/* sequencer port number */	unsigned int midi_has_voices: 1;};struct snd_gus_voice;struct snd_gus_sample_ops {	void (*sample_start)(struct snd_gus_card *gus, struct snd_gus_voice *voice, snd_seq_position_t position);	void (*sample_stop)(struct snd_gus_card *gus, struct snd_gus_voice *voice, int mode);	void (*sample_freq)(struct snd_gus_card *gus, struct snd_gus_voice *voice, snd_seq_frequency_t freq);	void (*sample_volume)(struct snd_gus_card *gus, struct snd_gus_voice *voice, struct snd_seq_ev_volume *volume);	void (*sample_loop)(struct snd_gus_card *card, struct snd_gus_voice *voice, struct snd_seq_ev_loop *loop);	void (*sample_pos)(struct snd_gus_card *card, struct snd_gus_voice *voice, snd_seq_position_t position);	void (*sample_private1)(struct snd_gus_card *card, struct snd_gus_voice *voice, unsigned char *data);};#define SNDRV_GF1_VOICE_TYPE_PCM	0#define SNDRV_GF1_VOICE_TYPE_SYNTH 	1#define SNDRV_GF1_VOICE_TYPE_MIDI	2#define SNDRV_GF1_VFLG_RUNNING		(1<<0)#define SNDRV_GF1_VFLG_EFFECT_TIMER1	(1<<1)#define SNDRV_GF1_VFLG_PAN		(1<<2)enum snd_gus_volume_state {	VENV_BEFORE,	VENV_ATTACK,	VENV_SUSTAIN,	VENV_RELEASE,	VENV_DONE,	VENV_VOLUME};struct snd_gus_voice {	int number;	unsigned int use: 1,	    pcm: 1,	    synth:1,	    midi: 1;	unsigned int flags;	unsigned char client;	unsigned char port;	unsigned char index;	unsigned char pad;	#ifdef CONFIG_SND_DEBUG	unsigned int interrupt_stat_wave;	unsigned int interrupt_stat_volume;#endif	void (*handler_wave) (struct snd_gus_card * gus, struct snd_gus_voice * voice);	void (*handler_volume) (struct snd_gus_card * gus, struct snd_gus_voice * voice);	void (*handler_effect) (struct snd_gus_card * gus, struct snd_gus_voice * voice);	void (*volume_change) (struct snd_gus_card * gus);	struct snd_gus_sample_ops *sample_ops;	struct snd_seq_instr instr;	/* running status / registers */	struct snd_seq_ev_volume sample_volume;	unsigned short fc_register;	unsigned short fc_lfo;	unsigned short gf1_volume;	unsigned char control;	unsigned char mode;	unsigned char gf1_pan;	unsigned char effect_accumulator;	unsigned char volume_control;	unsigned char venv_value_next;	enum snd_gus_volume_state venv_state;	enum snd_gus_volume_state venv_state_prev;	unsigned short vlo;	unsigned short vro;	unsigned short gf1_effect_volume;		/* --- */	void *private_data;	void (*private_free)(struct snd_gus_voice *voice);};struct snd_gf1 {	unsigned int enh_mode:1,	/* enhanced mode (GFA1) */		     hw_lfo:1,		/* use hardware LFO */		     sw_lfo:1,		/* use software LFO */		     effect:1;		/* use effect voices */	unsigned long port;		/* port of GF1 chip */	struct resource *res_port1;	struct resource *res_port2;	int irq;			/* IRQ number */	int dma1;			/* DMA1 number */	int dma2;			/* DMA2 number */	unsigned int memory;		/* GUS's DRAM size in bytes */	unsigned int rom_memory;	/* GUS's ROM size in bytes */	unsigned int rom_present;	/* bitmask */	unsigned int rom_banks;		/* GUS's ROM banks */	struct snd_gf1_mem mem_alloc;	/* registers */	unsigned short reg_page;	unsigned short reg_regsel;	unsigned short reg_data8;	unsigned short reg_data16;	unsigned short reg_irqstat;	unsigned short reg_dram;	unsigned short reg_timerctrl;	unsigned short reg_timerdata;	unsigned char ics_regs[6][2];	/* --------- */	unsigned char active_voices;	/* active voices */	unsigned char active_voice;	/* selected voice (GF1PAGE register) */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -