18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
28c2ecf20Sopenharmony_ci#ifndef __SOUND_GUS_H
38c2ecf20Sopenharmony_ci#define __SOUND_GUS_H
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci/*
68c2ecf20Sopenharmony_ci *  Global structures used for GUS part of ALSA driver
78c2ecf20Sopenharmony_ci *  Copyright (c) by Jaroslav Kysela <perex@perex.cz>
88c2ecf20Sopenharmony_ci */
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci#include <sound/pcm.h>
118c2ecf20Sopenharmony_ci#include <sound/rawmidi.h>
128c2ecf20Sopenharmony_ci#include <sound/timer.h>
138c2ecf20Sopenharmony_ci#include <sound/seq_midi_emul.h>
148c2ecf20Sopenharmony_ci#include <sound/seq_device.h>
158c2ecf20Sopenharmony_ci#include <linux/io.h>
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci/* IO ports */
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ci#define GUSP(gus, x)			((gus)->gf1.port + SNDRV_g_u_s_##x)
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ci#define SNDRV_g_u_s_MIDICTRL		(0x320-0x220)
228c2ecf20Sopenharmony_ci#define SNDRV_g_u_s_MIDISTAT		(0x320-0x220)
238c2ecf20Sopenharmony_ci#define SNDRV_g_u_s_MIDIDATA		(0x321-0x220)
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ci#define SNDRV_g_u_s_GF1PAGE		(0x322-0x220)
268c2ecf20Sopenharmony_ci#define SNDRV_g_u_s_GF1REGSEL		(0x323-0x220)
278c2ecf20Sopenharmony_ci#define SNDRV_g_u_s_GF1DATALOW		(0x324-0x220)
288c2ecf20Sopenharmony_ci#define SNDRV_g_u_s_GF1DATAHIGH		(0x325-0x220)
298c2ecf20Sopenharmony_ci#define SNDRV_g_u_s_IRQSTAT		(0x226-0x220)
308c2ecf20Sopenharmony_ci#define SNDRV_g_u_s_TIMERCNTRL		(0x228-0x220)
318c2ecf20Sopenharmony_ci#define SNDRV_g_u_s_TIMERDATA		(0x229-0x220)
328c2ecf20Sopenharmony_ci#define SNDRV_g_u_s_DRAM		(0x327-0x220)
338c2ecf20Sopenharmony_ci#define SNDRV_g_u_s_MIXCNTRLREG		(0x220-0x220)
348c2ecf20Sopenharmony_ci#define SNDRV_g_u_s_IRQDMACNTRLREG	(0x22b-0x220)
358c2ecf20Sopenharmony_ci#define SNDRV_g_u_s_REGCNTRLS		(0x22f-0x220)
368c2ecf20Sopenharmony_ci#define SNDRV_g_u_s_BOARDVERSION	(0x726-0x220)
378c2ecf20Sopenharmony_ci#define SNDRV_g_u_s_MIXCNTRLPORT	(0x726-0x220)
388c2ecf20Sopenharmony_ci#define SNDRV_g_u_s_IVER		(0x325-0x220)
398c2ecf20Sopenharmony_ci#define SNDRV_g_u_s_MIXDATAPORT		(0x326-0x220)
408c2ecf20Sopenharmony_ci#define SNDRV_g_u_s_MAXCNTRLPORT	(0x326-0x220)
418c2ecf20Sopenharmony_ci
428c2ecf20Sopenharmony_ci/* GF1 registers */
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ci/* global registers */
458c2ecf20Sopenharmony_ci#define SNDRV_GF1_GB_ACTIVE_VOICES		0x0e
468c2ecf20Sopenharmony_ci#define SNDRV_GF1_GB_VOICES_IRQ			0x0f
478c2ecf20Sopenharmony_ci#define SNDRV_GF1_GB_GLOBAL_MODE		0x19
488c2ecf20Sopenharmony_ci#define SNDRV_GF1_GW_LFO_BASE			0x1a
498c2ecf20Sopenharmony_ci#define SNDRV_GF1_GB_VOICES_IRQ_READ		0x1f
508c2ecf20Sopenharmony_ci#define SNDRV_GF1_GB_DRAM_DMA_CONTROL		0x41
518c2ecf20Sopenharmony_ci#define SNDRV_GF1_GW_DRAM_DMA_LOW		0x42
528c2ecf20Sopenharmony_ci#define SNDRV_GF1_GW_DRAM_IO_LOW		0x43
538c2ecf20Sopenharmony_ci#define SNDRV_GF1_GB_DRAM_IO_HIGH		0x44
548c2ecf20Sopenharmony_ci#define SNDRV_GF1_GB_SOUND_BLASTER_CONTROL	0x45
558c2ecf20Sopenharmony_ci#define SNDRV_GF1_GB_ADLIB_TIMER_1		0x46
568c2ecf20Sopenharmony_ci#define SNDRV_GF1_GB_ADLIB_TIMER_2		0x47
578c2ecf20Sopenharmony_ci#define SNDRV_GF1_GB_RECORD_RATE		0x48
588c2ecf20Sopenharmony_ci#define SNDRV_GF1_GB_REC_DMA_CONTROL		0x49
598c2ecf20Sopenharmony_ci#define SNDRV_GF1_GB_JOYSTICK_DAC_LEVEL		0x4b
608c2ecf20Sopenharmony_ci#define SNDRV_GF1_GB_RESET			0x4c
618c2ecf20Sopenharmony_ci#define SNDRV_GF1_GB_DRAM_DMA_HIGH		0x50
628c2ecf20Sopenharmony_ci#define SNDRV_GF1_GW_DRAM_IO16			0x51
638c2ecf20Sopenharmony_ci#define SNDRV_GF1_GW_MEMORY_CONFIG		0x52
648c2ecf20Sopenharmony_ci#define SNDRV_GF1_GB_MEMORY_CONTROL		0x53
658c2ecf20Sopenharmony_ci#define SNDRV_GF1_GW_FIFO_RECORD_BASE_ADDR	0x54
668c2ecf20Sopenharmony_ci#define SNDRV_GF1_GW_FIFO_PLAY_BASE_ADDR	0x55
678c2ecf20Sopenharmony_ci#define SNDRV_GF1_GW_FIFO_SIZE			0x56
688c2ecf20Sopenharmony_ci#define SNDRV_GF1_GW_INTERLEAVE			0x57
698c2ecf20Sopenharmony_ci#define SNDRV_GF1_GB_COMPATIBILITY		0x59
708c2ecf20Sopenharmony_ci#define SNDRV_GF1_GB_DECODE_CONTROL		0x5a
718c2ecf20Sopenharmony_ci#define SNDRV_GF1_GB_VERSION_NUMBER		0x5b
728c2ecf20Sopenharmony_ci#define SNDRV_GF1_GB_MPU401_CONTROL_A		0x5c
738c2ecf20Sopenharmony_ci#define SNDRV_GF1_GB_MPU401_CONTROL_B		0x5d
748c2ecf20Sopenharmony_ci#define SNDRV_GF1_GB_EMULATION_IRQ		0x60
758c2ecf20Sopenharmony_ci/* voice specific registers */
768c2ecf20Sopenharmony_ci#define SNDRV_GF1_VB_ADDRESS_CONTROL		0x00
778c2ecf20Sopenharmony_ci#define SNDRV_GF1_VW_FREQUENCY			0x01
788c2ecf20Sopenharmony_ci#define SNDRV_GF1_VW_START_HIGH			0x02
798c2ecf20Sopenharmony_ci#define SNDRV_GF1_VW_START_LOW			0x03
808c2ecf20Sopenharmony_ci#define SNDRV_GF1_VA_START			SNDRV_GF1_VW_START_HIGH
818c2ecf20Sopenharmony_ci#define SNDRV_GF1_VW_END_HIGH			0x04
828c2ecf20Sopenharmony_ci#define SNDRV_GF1_VW_END_LOW			0x05
838c2ecf20Sopenharmony_ci#define SNDRV_GF1_VA_END			SNDRV_GF1_VW_END_HIGH
848c2ecf20Sopenharmony_ci#define SNDRV_GF1_VB_VOLUME_RATE		0x06
858c2ecf20Sopenharmony_ci#define SNDRV_GF1_VB_VOLUME_START		0x07
868c2ecf20Sopenharmony_ci#define SNDRV_GF1_VB_VOLUME_END			0x08
878c2ecf20Sopenharmony_ci#define SNDRV_GF1_VW_VOLUME			0x09
888c2ecf20Sopenharmony_ci#define SNDRV_GF1_VW_CURRENT_HIGH		0x0a
898c2ecf20Sopenharmony_ci#define SNDRV_GF1_VW_CURRENT_LOW		0x0b
908c2ecf20Sopenharmony_ci#define SNDRV_GF1_VA_CURRENT			SNDRV_GF1_VW_CURRENT_HIGH
918c2ecf20Sopenharmony_ci#define SNDRV_GF1_VB_PAN			0x0c
928c2ecf20Sopenharmony_ci#define SNDRV_GF1_VW_OFFSET_RIGHT		0x0c
938c2ecf20Sopenharmony_ci#define SNDRV_GF1_VB_VOLUME_CONTROL		0x0d
948c2ecf20Sopenharmony_ci#define SNDRV_GF1_VB_UPPER_ADDRESS		0x10
958c2ecf20Sopenharmony_ci#define SNDRV_GF1_VW_EFFECT_HIGH		0x11
968c2ecf20Sopenharmony_ci#define SNDRV_GF1_VW_EFFECT_LOW			0x12
978c2ecf20Sopenharmony_ci#define SNDRV_GF1_VA_EFFECT			SNDRV_GF1_VW_EFFECT_HIGH
988c2ecf20Sopenharmony_ci#define SNDRV_GF1_VW_OFFSET_LEFT		0x13
998c2ecf20Sopenharmony_ci#define SNDRV_GF1_VB_ACCUMULATOR		0x14
1008c2ecf20Sopenharmony_ci#define SNDRV_GF1_VB_MODE			0x15
1018c2ecf20Sopenharmony_ci#define SNDRV_GF1_VW_EFFECT_VOLUME		0x16
1028c2ecf20Sopenharmony_ci#define SNDRV_GF1_VB_FREQUENCY_LFO		0x17
1038c2ecf20Sopenharmony_ci#define SNDRV_GF1_VB_VOLUME_LFO			0x18
1048c2ecf20Sopenharmony_ci#define SNDRV_GF1_VW_OFFSET_RIGHT_FINAL		0x1b
1058c2ecf20Sopenharmony_ci#define SNDRV_GF1_VW_OFFSET_LEFT_FINAL		0x1c
1068c2ecf20Sopenharmony_ci#define SNDRV_GF1_VW_EFFECT_VOLUME_FINAL	0x1d
1078c2ecf20Sopenharmony_ci
1088c2ecf20Sopenharmony_ci/* ICS registers */
1098c2ecf20Sopenharmony_ci
1108c2ecf20Sopenharmony_ci#define SNDRV_ICS_MIC_DEV		0
1118c2ecf20Sopenharmony_ci#define SNDRV_ICS_LINE_DEV		1
1128c2ecf20Sopenharmony_ci#define SNDRV_ICS_CD_DEV		2
1138c2ecf20Sopenharmony_ci#define SNDRV_ICS_GF1_DEV		3
1148c2ecf20Sopenharmony_ci#define SNDRV_ICS_NONE_DEV		4
1158c2ecf20Sopenharmony_ci#define SNDRV_ICS_MASTER_DEV		5
1168c2ecf20Sopenharmony_ci
1178c2ecf20Sopenharmony_ci/* LFO */
1188c2ecf20Sopenharmony_ci
1198c2ecf20Sopenharmony_ci#define SNDRV_LFO_TREMOLO		0
1208c2ecf20Sopenharmony_ci#define SNDRV_LFO_VIBRATO		1
1218c2ecf20Sopenharmony_ci
1228c2ecf20Sopenharmony_ci/* misc */
1238c2ecf20Sopenharmony_ci
1248c2ecf20Sopenharmony_ci#define SNDRV_GF1_DMA_UNSIGNED	0x80
1258c2ecf20Sopenharmony_ci#define SNDRV_GF1_DMA_16BIT	0x40
1268c2ecf20Sopenharmony_ci#define SNDRV_GF1_DMA_IRQ	0x20
1278c2ecf20Sopenharmony_ci#define SNDRV_GF1_DMA_WIDTH16	0x04
1288c2ecf20Sopenharmony_ci#define SNDRV_GF1_DMA_READ	0x02	/* read from GUS's DRAM */
1298c2ecf20Sopenharmony_ci#define SNDRV_GF1_DMA_ENABLE	0x01
1308c2ecf20Sopenharmony_ci
1318c2ecf20Sopenharmony_ci/* ramp ranges */
1328c2ecf20Sopenharmony_ci
1338c2ecf20Sopenharmony_ci#define SNDRV_GF1_ATTEN(x)	(snd_gf1_atten_table[x])
1348c2ecf20Sopenharmony_ci#define SNDRV_GF1_MIN_VOLUME	1800
1358c2ecf20Sopenharmony_ci#define SNDRV_GF1_MAX_VOLUME	4095
1368c2ecf20Sopenharmony_ci#define SNDRV_GF1_MIN_OFFSET	(SNDRV_GF1_MIN_VOLUME>>4)
1378c2ecf20Sopenharmony_ci#define SNDRV_GF1_MAX_OFFSET	255
1388c2ecf20Sopenharmony_ci#define SNDRV_GF1_MAX_TDEPTH	90
1398c2ecf20Sopenharmony_ci
1408c2ecf20Sopenharmony_ci/* defines for memory manager */
1418c2ecf20Sopenharmony_ci
1428c2ecf20Sopenharmony_ci#define SNDRV_GF1_MEM_BLOCK_16BIT	0x0001
1438c2ecf20Sopenharmony_ci
1448c2ecf20Sopenharmony_ci#define SNDRV_GF1_MEM_OWNER_DRIVER	0x0001
1458c2ecf20Sopenharmony_ci#define SNDRV_GF1_MEM_OWNER_WAVE_SIMPLE	0x0002
1468c2ecf20Sopenharmony_ci#define SNDRV_GF1_MEM_OWNER_WAVE_GF1	0x0003
1478c2ecf20Sopenharmony_ci#define SNDRV_GF1_MEM_OWNER_WAVE_IWFFFF	0x0004
1488c2ecf20Sopenharmony_ci
1498c2ecf20Sopenharmony_ci/* constants for interrupt handlers */
1508c2ecf20Sopenharmony_ci
1518c2ecf20Sopenharmony_ci#define SNDRV_GF1_HANDLER_MIDI_OUT	0x00010000
1528c2ecf20Sopenharmony_ci#define SNDRV_GF1_HANDLER_MIDI_IN	0x00020000
1538c2ecf20Sopenharmony_ci#define SNDRV_GF1_HANDLER_TIMER1	0x00040000
1548c2ecf20Sopenharmony_ci#define SNDRV_GF1_HANDLER_TIMER2	0x00080000
1558c2ecf20Sopenharmony_ci#define SNDRV_GF1_HANDLER_VOICE		0x00100000
1568c2ecf20Sopenharmony_ci#define SNDRV_GF1_HANDLER_DMA_WRITE	0x00200000
1578c2ecf20Sopenharmony_ci#define SNDRV_GF1_HANDLER_DMA_READ	0x00400000
1588c2ecf20Sopenharmony_ci#define SNDRV_GF1_HANDLER_ALL		(0xffff0000&~SNDRV_GF1_HANDLER_VOICE)
1598c2ecf20Sopenharmony_ci
1608c2ecf20Sopenharmony_ci/* constants for DMA flags */
1618c2ecf20Sopenharmony_ci
1628c2ecf20Sopenharmony_ci#define SNDRV_GF1_DMA_TRIGGER		1
1638c2ecf20Sopenharmony_ci
1648c2ecf20Sopenharmony_ci/* --- */
1658c2ecf20Sopenharmony_ci
1668c2ecf20Sopenharmony_cistruct snd_gus_card;
1678c2ecf20Sopenharmony_ci
1688c2ecf20Sopenharmony_ci/* GF1 specific structure */
1698c2ecf20Sopenharmony_ci
1708c2ecf20Sopenharmony_cistruct snd_gf1_bank_info {
1718c2ecf20Sopenharmony_ci	unsigned int address;
1728c2ecf20Sopenharmony_ci	unsigned int size;
1738c2ecf20Sopenharmony_ci};
1748c2ecf20Sopenharmony_ci
1758c2ecf20Sopenharmony_cistruct snd_gf1_mem_block {
1768c2ecf20Sopenharmony_ci	unsigned short flags;	/* flags - SNDRV_GF1_MEM_BLOCK_XXXX */
1778c2ecf20Sopenharmony_ci	unsigned short owner;	/* owner - SNDRV_GF1_MEM_OWNER_XXXX */
1788c2ecf20Sopenharmony_ci	unsigned int share;	/* share count */
1798c2ecf20Sopenharmony_ci	unsigned int share_id[4]; /* share ID */
1808c2ecf20Sopenharmony_ci	unsigned int ptr;
1818c2ecf20Sopenharmony_ci	unsigned int size;
1828c2ecf20Sopenharmony_ci	char *name;
1838c2ecf20Sopenharmony_ci	struct snd_gf1_mem_block *next;
1848c2ecf20Sopenharmony_ci	struct snd_gf1_mem_block *prev;
1858c2ecf20Sopenharmony_ci};
1868c2ecf20Sopenharmony_ci
1878c2ecf20Sopenharmony_cistruct snd_gf1_mem {
1888c2ecf20Sopenharmony_ci	struct snd_gf1_bank_info banks_8[4];
1898c2ecf20Sopenharmony_ci	struct snd_gf1_bank_info banks_16[4];
1908c2ecf20Sopenharmony_ci	struct snd_gf1_mem_block *first;
1918c2ecf20Sopenharmony_ci	struct snd_gf1_mem_block *last;
1928c2ecf20Sopenharmony_ci	struct mutex memory_mutex;
1938c2ecf20Sopenharmony_ci};
1948c2ecf20Sopenharmony_ci
1958c2ecf20Sopenharmony_cistruct snd_gf1_dma_block {
1968c2ecf20Sopenharmony_ci	void *buffer;		/* buffer in computer's RAM */
1978c2ecf20Sopenharmony_ci	unsigned long buf_addr;	/* buffer address */
1988c2ecf20Sopenharmony_ci	unsigned int addr;	/* address in onboard memory */
1998c2ecf20Sopenharmony_ci	unsigned int count;	/* count in bytes */
2008c2ecf20Sopenharmony_ci	unsigned int cmd;	/* DMA command (format) */
2018c2ecf20Sopenharmony_ci	void (*ack)(struct snd_gus_card * gus, void *private_data);
2028c2ecf20Sopenharmony_ci	void *private_data;
2038c2ecf20Sopenharmony_ci	struct snd_gf1_dma_block *next;
2048c2ecf20Sopenharmony_ci};
2058c2ecf20Sopenharmony_ci
2068c2ecf20Sopenharmony_cistruct snd_gus_port {
2078c2ecf20Sopenharmony_ci	struct snd_midi_channel_set * chset;
2088c2ecf20Sopenharmony_ci	struct snd_gus_card * gus;
2098c2ecf20Sopenharmony_ci	int mode;		/* operation mode */
2108c2ecf20Sopenharmony_ci	int client;		/* sequencer client number */
2118c2ecf20Sopenharmony_ci	int port;		/* sequencer port number */
2128c2ecf20Sopenharmony_ci	unsigned int midi_has_voices: 1;
2138c2ecf20Sopenharmony_ci};
2148c2ecf20Sopenharmony_ci
2158c2ecf20Sopenharmony_cistruct snd_gus_voice;
2168c2ecf20Sopenharmony_ci
2178c2ecf20Sopenharmony_ci#define SNDRV_GF1_VOICE_TYPE_PCM	0
2188c2ecf20Sopenharmony_ci#define SNDRV_GF1_VOICE_TYPE_SYNTH 	1
2198c2ecf20Sopenharmony_ci#define SNDRV_GF1_VOICE_TYPE_MIDI	2
2208c2ecf20Sopenharmony_ci
2218c2ecf20Sopenharmony_ci#define SNDRV_GF1_VFLG_RUNNING		(1<<0)
2228c2ecf20Sopenharmony_ci#define SNDRV_GF1_VFLG_EFFECT_TIMER1	(1<<1)
2238c2ecf20Sopenharmony_ci#define SNDRV_GF1_VFLG_PAN		(1<<2)
2248c2ecf20Sopenharmony_ci
2258c2ecf20Sopenharmony_cienum snd_gus_volume_state {
2268c2ecf20Sopenharmony_ci	VENV_BEFORE,
2278c2ecf20Sopenharmony_ci	VENV_ATTACK,
2288c2ecf20Sopenharmony_ci	VENV_SUSTAIN,
2298c2ecf20Sopenharmony_ci	VENV_RELEASE,
2308c2ecf20Sopenharmony_ci	VENV_DONE,
2318c2ecf20Sopenharmony_ci	VENV_VOLUME
2328c2ecf20Sopenharmony_ci};
2338c2ecf20Sopenharmony_ci
2348c2ecf20Sopenharmony_cistruct snd_gus_voice {
2358c2ecf20Sopenharmony_ci	int number;
2368c2ecf20Sopenharmony_ci	unsigned int use: 1,
2378c2ecf20Sopenharmony_ci	    pcm: 1,
2388c2ecf20Sopenharmony_ci	    synth:1,
2398c2ecf20Sopenharmony_ci	    midi: 1;
2408c2ecf20Sopenharmony_ci	unsigned int flags;
2418c2ecf20Sopenharmony_ci	unsigned char client;
2428c2ecf20Sopenharmony_ci	unsigned char port;
2438c2ecf20Sopenharmony_ci	unsigned char index;
2448c2ecf20Sopenharmony_ci	unsigned char pad;
2458c2ecf20Sopenharmony_ci
2468c2ecf20Sopenharmony_ci#ifdef CONFIG_SND_DEBUG
2478c2ecf20Sopenharmony_ci	unsigned int interrupt_stat_wave;
2488c2ecf20Sopenharmony_ci	unsigned int interrupt_stat_volume;
2498c2ecf20Sopenharmony_ci#endif
2508c2ecf20Sopenharmony_ci	void (*handler_wave) (struct snd_gus_card * gus, struct snd_gus_voice * voice);
2518c2ecf20Sopenharmony_ci	void (*handler_volume) (struct snd_gus_card * gus, struct snd_gus_voice * voice);
2528c2ecf20Sopenharmony_ci	void (*handler_effect) (struct snd_gus_card * gus, struct snd_gus_voice * voice);
2538c2ecf20Sopenharmony_ci	void (*volume_change) (struct snd_gus_card * gus);
2548c2ecf20Sopenharmony_ci
2558c2ecf20Sopenharmony_ci	struct snd_gus_sample_ops *sample_ops;
2568c2ecf20Sopenharmony_ci
2578c2ecf20Sopenharmony_ci	/* running status / registers */
2588c2ecf20Sopenharmony_ci
2598c2ecf20Sopenharmony_ci	unsigned short fc_register;
2608c2ecf20Sopenharmony_ci	unsigned short fc_lfo;
2618c2ecf20Sopenharmony_ci	unsigned short gf1_volume;
2628c2ecf20Sopenharmony_ci	unsigned char control;
2638c2ecf20Sopenharmony_ci	unsigned char mode;
2648c2ecf20Sopenharmony_ci	unsigned char gf1_pan;
2658c2ecf20Sopenharmony_ci	unsigned char effect_accumulator;
2668c2ecf20Sopenharmony_ci	unsigned char volume_control;
2678c2ecf20Sopenharmony_ci	unsigned char venv_value_next;
2688c2ecf20Sopenharmony_ci	enum snd_gus_volume_state venv_state;
2698c2ecf20Sopenharmony_ci	enum snd_gus_volume_state venv_state_prev;
2708c2ecf20Sopenharmony_ci	unsigned short vlo;
2718c2ecf20Sopenharmony_ci	unsigned short vro;
2728c2ecf20Sopenharmony_ci	unsigned short gf1_effect_volume;
2738c2ecf20Sopenharmony_ci
2748c2ecf20Sopenharmony_ci	/* --- */
2758c2ecf20Sopenharmony_ci
2768c2ecf20Sopenharmony_ci	void *private_data;
2778c2ecf20Sopenharmony_ci	void (*private_free)(struct snd_gus_voice *voice);
2788c2ecf20Sopenharmony_ci};
2798c2ecf20Sopenharmony_ci
2808c2ecf20Sopenharmony_cistruct snd_gf1 {
2818c2ecf20Sopenharmony_ci
2828c2ecf20Sopenharmony_ci	unsigned int enh_mode:1,	/* enhanced mode (GFA1) */
2838c2ecf20Sopenharmony_ci		     hw_lfo:1,		/* use hardware LFO */
2848c2ecf20Sopenharmony_ci		     sw_lfo:1,		/* use software LFO */
2858c2ecf20Sopenharmony_ci		     effect:1;		/* use effect voices */
2868c2ecf20Sopenharmony_ci
2878c2ecf20Sopenharmony_ci	unsigned long port;		/* port of GF1 chip */
2888c2ecf20Sopenharmony_ci	struct resource *res_port1;
2898c2ecf20Sopenharmony_ci	struct resource *res_port2;
2908c2ecf20Sopenharmony_ci	int irq;			/* IRQ number */
2918c2ecf20Sopenharmony_ci	int dma1;			/* DMA1 number */
2928c2ecf20Sopenharmony_ci	int dma2;			/* DMA2 number */
2938c2ecf20Sopenharmony_ci	unsigned int memory;		/* GUS's DRAM size in bytes */
2948c2ecf20Sopenharmony_ci	unsigned int rom_memory;	/* GUS's ROM size in bytes */
2958c2ecf20Sopenharmony_ci	unsigned int rom_present;	/* bitmask */
2968c2ecf20Sopenharmony_ci	unsigned int rom_banks;		/* GUS's ROM banks */
2978c2ecf20Sopenharmony_ci
2988c2ecf20Sopenharmony_ci	struct snd_gf1_mem mem_alloc;
2998c2ecf20Sopenharmony_ci
3008c2ecf20Sopenharmony_ci	/* registers */
3018c2ecf20Sopenharmony_ci	unsigned short reg_page;
3028c2ecf20Sopenharmony_ci	unsigned short reg_regsel;
3038c2ecf20Sopenharmony_ci	unsigned short reg_data8;
3048c2ecf20Sopenharmony_ci	unsigned short reg_data16;
3058c2ecf20Sopenharmony_ci	unsigned short reg_irqstat;
3068c2ecf20Sopenharmony_ci	unsigned short reg_dram;
3078c2ecf20Sopenharmony_ci	unsigned short reg_timerctrl;
3088c2ecf20Sopenharmony_ci	unsigned short reg_timerdata;
3098c2ecf20Sopenharmony_ci	unsigned char ics_regs[6][2];
3108c2ecf20Sopenharmony_ci	/* --------- */
3118c2ecf20Sopenharmony_ci
3128c2ecf20Sopenharmony_ci	unsigned char active_voices;	/* active voices */
3138c2ecf20Sopenharmony_ci	unsigned char active_voice;	/* selected voice (GF1PAGE register) */
3148c2ecf20Sopenharmony_ci
3158c2ecf20Sopenharmony_ci	struct snd_gus_voice voices[32];	/* GF1 voices */
3168c2ecf20Sopenharmony_ci
3178c2ecf20Sopenharmony_ci	unsigned int default_voice_address;
3188c2ecf20Sopenharmony_ci
3198c2ecf20Sopenharmony_ci	unsigned short playback_freq;	/* GF1 playback (mixing) frequency */
3208c2ecf20Sopenharmony_ci	unsigned short mode;		/* see to SNDRV_GF1_MODE_XXXX */
3218c2ecf20Sopenharmony_ci	unsigned char volume_ramp;
3228c2ecf20Sopenharmony_ci	unsigned char smooth_pan;
3238c2ecf20Sopenharmony_ci	unsigned char full_range_pan;
3248c2ecf20Sopenharmony_ci	unsigned char pad0;
3258c2ecf20Sopenharmony_ci
3268c2ecf20Sopenharmony_ci	unsigned char *lfos;
3278c2ecf20Sopenharmony_ci
3288c2ecf20Sopenharmony_ci	/* interrupt handlers */
3298c2ecf20Sopenharmony_ci
3308c2ecf20Sopenharmony_ci	void (*interrupt_handler_midi_out) (struct snd_gus_card * gus);
3318c2ecf20Sopenharmony_ci	void (*interrupt_handler_midi_in) (struct snd_gus_card * gus);
3328c2ecf20Sopenharmony_ci	void (*interrupt_handler_timer1) (struct snd_gus_card * gus);
3338c2ecf20Sopenharmony_ci	void (*interrupt_handler_timer2) (struct snd_gus_card * gus);
3348c2ecf20Sopenharmony_ci	void (*interrupt_handler_dma_write) (struct snd_gus_card * gus);
3358c2ecf20Sopenharmony_ci	void (*interrupt_handler_dma_read) (struct snd_gus_card * gus);
3368c2ecf20Sopenharmony_ci
3378c2ecf20Sopenharmony_ci#ifdef CONFIG_SND_DEBUG
3388c2ecf20Sopenharmony_ci	unsigned int interrupt_stat_midi_out;
3398c2ecf20Sopenharmony_ci	unsigned int interrupt_stat_midi_in;
3408c2ecf20Sopenharmony_ci	unsigned int interrupt_stat_timer1;
3418c2ecf20Sopenharmony_ci	unsigned int interrupt_stat_timer2;
3428c2ecf20Sopenharmony_ci	unsigned int interrupt_stat_dma_write;
3438c2ecf20Sopenharmony_ci	unsigned int interrupt_stat_dma_read;
3448c2ecf20Sopenharmony_ci	unsigned int interrupt_stat_voice_lost;
3458c2ecf20Sopenharmony_ci#endif
3468c2ecf20Sopenharmony_ci
3478c2ecf20Sopenharmony_ci	/* synthesizer */
3488c2ecf20Sopenharmony_ci
3498c2ecf20Sopenharmony_ci	int seq_client;
3508c2ecf20Sopenharmony_ci	struct snd_gus_port seq_ports[4];
3518c2ecf20Sopenharmony_ci
3528c2ecf20Sopenharmony_ci	/* timer */
3538c2ecf20Sopenharmony_ci
3548c2ecf20Sopenharmony_ci	unsigned short timer_enabled;
3558c2ecf20Sopenharmony_ci	struct snd_timer *timer1;
3568c2ecf20Sopenharmony_ci	struct snd_timer *timer2;
3578c2ecf20Sopenharmony_ci
3588c2ecf20Sopenharmony_ci	/* midi */
3598c2ecf20Sopenharmony_ci
3608c2ecf20Sopenharmony_ci	unsigned short uart_cmd;
3618c2ecf20Sopenharmony_ci	unsigned int uart_framing;
3628c2ecf20Sopenharmony_ci	unsigned int uart_overrun;
3638c2ecf20Sopenharmony_ci
3648c2ecf20Sopenharmony_ci	/* dma operations */
3658c2ecf20Sopenharmony_ci
3668c2ecf20Sopenharmony_ci	unsigned int dma_flags;
3678c2ecf20Sopenharmony_ci	unsigned int dma_shared;
3688c2ecf20Sopenharmony_ci	struct snd_gf1_dma_block *dma_data_pcm;
3698c2ecf20Sopenharmony_ci	struct snd_gf1_dma_block *dma_data_pcm_last;
3708c2ecf20Sopenharmony_ci	struct snd_gf1_dma_block *dma_data_synth;
3718c2ecf20Sopenharmony_ci	struct snd_gf1_dma_block *dma_data_synth_last;
3728c2ecf20Sopenharmony_ci	void (*dma_ack)(struct snd_gus_card * gus, void *private_data);
3738c2ecf20Sopenharmony_ci	void *dma_private_data;
3748c2ecf20Sopenharmony_ci
3758c2ecf20Sopenharmony_ci	/* pcm */
3768c2ecf20Sopenharmony_ci	int pcm_channels;
3778c2ecf20Sopenharmony_ci	int pcm_alloc_voices;
3788c2ecf20Sopenharmony_ci        unsigned short pcm_volume_level_left;
3798c2ecf20Sopenharmony_ci	unsigned short pcm_volume_level_right;
3808c2ecf20Sopenharmony_ci	unsigned short pcm_volume_level_left1;
3818c2ecf20Sopenharmony_ci	unsigned short pcm_volume_level_right1;
3828c2ecf20Sopenharmony_ci
3838c2ecf20Sopenharmony_ci	unsigned char pcm_rcntrl_reg;
3848c2ecf20Sopenharmony_ci	unsigned char pad_end;
3858c2ecf20Sopenharmony_ci};
3868c2ecf20Sopenharmony_ci
3878c2ecf20Sopenharmony_ci/* main structure for GUS card */
3888c2ecf20Sopenharmony_ci
3898c2ecf20Sopenharmony_cistruct snd_gus_card {
3908c2ecf20Sopenharmony_ci	struct snd_card *card;
3918c2ecf20Sopenharmony_ci
3928c2ecf20Sopenharmony_ci	unsigned int
3938c2ecf20Sopenharmony_ci	 initialized: 1,		/* resources were initialized */
3948c2ecf20Sopenharmony_ci	 equal_irq:1,			/* GF1 and CODEC shares IRQ (GUS MAX only) */
3958c2ecf20Sopenharmony_ci	 equal_dma:1,			/* if dma channels are equal (not valid for daughter board) */
3968c2ecf20Sopenharmony_ci	 ics_flag:1,			/* have we ICS mixer chip */
3978c2ecf20Sopenharmony_ci	 ics_flipped:1,			/* ICS mixer have flipped some channels? */
3988c2ecf20Sopenharmony_ci	 codec_flag:1,			/* have we CODEC chip? */
3998c2ecf20Sopenharmony_ci	 max_flag:1,			/* have we GUS MAX card? */
4008c2ecf20Sopenharmony_ci	 max_ctrl_flag:1,		/* have we original GUS MAX card? */
4018c2ecf20Sopenharmony_ci	 daughter_flag:1,		/* have we daughter board? */
4028c2ecf20Sopenharmony_ci	 interwave:1,			/* hey - we have InterWave card */
4038c2ecf20Sopenharmony_ci	 ess_flag:1,			/* ESS chip found... GUS Extreme */
4048c2ecf20Sopenharmony_ci	 ace_flag:1,			/* GUS ACE detected */
4058c2ecf20Sopenharmony_ci	 uart_enable:1;			/* enable MIDI UART */
4068c2ecf20Sopenharmony_ci	unsigned short revision;	/* revision of chip */
4078c2ecf20Sopenharmony_ci	unsigned short max_cntrl_val;	/* GUS MAX control value */
4088c2ecf20Sopenharmony_ci	unsigned short mix_cntrl_reg;	/* mixer control register */
4098c2ecf20Sopenharmony_ci	unsigned short joystick_dac;	/* joystick DAC level */
4108c2ecf20Sopenharmony_ci	int timer_dev;			/* timer device */
4118c2ecf20Sopenharmony_ci
4128c2ecf20Sopenharmony_ci	struct snd_gf1 gf1;	/* gf1 specific variables */
4138c2ecf20Sopenharmony_ci	struct snd_pcm *pcm;
4148c2ecf20Sopenharmony_ci	struct snd_pcm_substream *pcm_cap_substream;
4158c2ecf20Sopenharmony_ci	unsigned int c_dma_size;
4168c2ecf20Sopenharmony_ci	unsigned int c_period_size;
4178c2ecf20Sopenharmony_ci	unsigned int c_pos;
4188c2ecf20Sopenharmony_ci
4198c2ecf20Sopenharmony_ci	struct snd_rawmidi *midi_uart;
4208c2ecf20Sopenharmony_ci	struct snd_rawmidi_substream *midi_substream_output;
4218c2ecf20Sopenharmony_ci	struct snd_rawmidi_substream *midi_substream_input;
4228c2ecf20Sopenharmony_ci
4238c2ecf20Sopenharmony_ci	spinlock_t reg_lock;
4248c2ecf20Sopenharmony_ci	spinlock_t voice_alloc;
4258c2ecf20Sopenharmony_ci	spinlock_t active_voice_lock;
4268c2ecf20Sopenharmony_ci	spinlock_t event_lock;
4278c2ecf20Sopenharmony_ci	spinlock_t dma_lock;
4288c2ecf20Sopenharmony_ci	spinlock_t pcm_volume_level_lock;
4298c2ecf20Sopenharmony_ci	spinlock_t uart_cmd_lock;
4308c2ecf20Sopenharmony_ci	struct mutex dma_mutex;
4318c2ecf20Sopenharmony_ci	struct mutex register_mutex;
4328c2ecf20Sopenharmony_ci};
4338c2ecf20Sopenharmony_ci
4348c2ecf20Sopenharmony_ci/* I/O functions for GF1/InterWave chip - gus_io.c */
4358c2ecf20Sopenharmony_ci
4368c2ecf20Sopenharmony_cistatic inline void snd_gf1_select_voice(struct snd_gus_card * gus, int voice)
4378c2ecf20Sopenharmony_ci{
4388c2ecf20Sopenharmony_ci	unsigned long flags;
4398c2ecf20Sopenharmony_ci
4408c2ecf20Sopenharmony_ci	spin_lock_irqsave(&gus->active_voice_lock, flags);
4418c2ecf20Sopenharmony_ci	if (voice != gus->gf1.active_voice) {
4428c2ecf20Sopenharmony_ci		gus->gf1.active_voice = voice;
4438c2ecf20Sopenharmony_ci		outb(voice, GUSP(gus, GF1PAGE));
4448c2ecf20Sopenharmony_ci	}
4458c2ecf20Sopenharmony_ci	spin_unlock_irqrestore(&gus->active_voice_lock, flags);
4468c2ecf20Sopenharmony_ci}
4478c2ecf20Sopenharmony_ci
4488c2ecf20Sopenharmony_cistatic inline void snd_gf1_uart_cmd(struct snd_gus_card * gus, unsigned char b)
4498c2ecf20Sopenharmony_ci{
4508c2ecf20Sopenharmony_ci	outb(gus->gf1.uart_cmd = b, GUSP(gus, MIDICTRL));
4518c2ecf20Sopenharmony_ci}
4528c2ecf20Sopenharmony_ci
4538c2ecf20Sopenharmony_cistatic inline unsigned char snd_gf1_uart_stat(struct snd_gus_card * gus)
4548c2ecf20Sopenharmony_ci{
4558c2ecf20Sopenharmony_ci	return inb(GUSP(gus, MIDISTAT));
4568c2ecf20Sopenharmony_ci}
4578c2ecf20Sopenharmony_ci
4588c2ecf20Sopenharmony_cistatic inline void snd_gf1_uart_put(struct snd_gus_card * gus, unsigned char b)
4598c2ecf20Sopenharmony_ci{
4608c2ecf20Sopenharmony_ci	outb(b, GUSP(gus, MIDIDATA));
4618c2ecf20Sopenharmony_ci}
4628c2ecf20Sopenharmony_ci
4638c2ecf20Sopenharmony_cistatic inline unsigned char snd_gf1_uart_get(struct snd_gus_card * gus)
4648c2ecf20Sopenharmony_ci{
4658c2ecf20Sopenharmony_ci	return inb(GUSP(gus, MIDIDATA));
4668c2ecf20Sopenharmony_ci}
4678c2ecf20Sopenharmony_ci
4688c2ecf20Sopenharmony_ciextern void snd_gf1_delay(struct snd_gus_card * gus);
4698c2ecf20Sopenharmony_ci
4708c2ecf20Sopenharmony_ciextern void snd_gf1_ctrl_stop(struct snd_gus_card * gus, unsigned char reg);
4718c2ecf20Sopenharmony_ci
4728c2ecf20Sopenharmony_ciextern void snd_gf1_write8(struct snd_gus_card * gus, unsigned char reg, unsigned char data);
4738c2ecf20Sopenharmony_ciextern unsigned char snd_gf1_look8(struct snd_gus_card * gus, unsigned char reg);
4748c2ecf20Sopenharmony_cistatic inline unsigned char snd_gf1_read8(struct snd_gus_card * gus, unsigned char reg)
4758c2ecf20Sopenharmony_ci{
4768c2ecf20Sopenharmony_ci	return snd_gf1_look8(gus, reg | 0x80);
4778c2ecf20Sopenharmony_ci}
4788c2ecf20Sopenharmony_ciextern void snd_gf1_write16(struct snd_gus_card * gus, unsigned char reg, unsigned int data);
4798c2ecf20Sopenharmony_ciextern unsigned short snd_gf1_look16(struct snd_gus_card * gus, unsigned char reg);
4808c2ecf20Sopenharmony_cistatic inline unsigned short snd_gf1_read16(struct snd_gus_card * gus, unsigned char reg)
4818c2ecf20Sopenharmony_ci{
4828c2ecf20Sopenharmony_ci	return snd_gf1_look16(gus, reg | 0x80);
4838c2ecf20Sopenharmony_ci}
4848c2ecf20Sopenharmony_ciextern void snd_gf1_adlib_write(struct snd_gus_card * gus, unsigned char reg, unsigned char data);
4858c2ecf20Sopenharmony_ciextern void snd_gf1_dram_addr(struct snd_gus_card * gus, unsigned int addr);
4868c2ecf20Sopenharmony_ciextern void snd_gf1_poke(struct snd_gus_card * gus, unsigned int addr, unsigned char data);
4878c2ecf20Sopenharmony_ciextern unsigned char snd_gf1_peek(struct snd_gus_card * gus, unsigned int addr);
4888c2ecf20Sopenharmony_ciextern void snd_gf1_write_addr(struct snd_gus_card * gus, unsigned char reg, unsigned int addr, short w_16bit);
4898c2ecf20Sopenharmony_ciextern unsigned int snd_gf1_read_addr(struct snd_gus_card * gus, unsigned char reg, short w_16bit);
4908c2ecf20Sopenharmony_ciextern void snd_gf1_i_ctrl_stop(struct snd_gus_card * gus, unsigned char reg);
4918c2ecf20Sopenharmony_ciextern void snd_gf1_i_write8(struct snd_gus_card * gus, unsigned char reg, unsigned char data);
4928c2ecf20Sopenharmony_ciextern unsigned char snd_gf1_i_look8(struct snd_gus_card * gus, unsigned char reg);
4938c2ecf20Sopenharmony_ciextern void snd_gf1_i_write16(struct snd_gus_card * gus, unsigned char reg, unsigned int data);
4948c2ecf20Sopenharmony_cistatic inline unsigned char snd_gf1_i_read8(struct snd_gus_card * gus, unsigned char reg)
4958c2ecf20Sopenharmony_ci{
4968c2ecf20Sopenharmony_ci	return snd_gf1_i_look8(gus, reg | 0x80);
4978c2ecf20Sopenharmony_ci}
4988c2ecf20Sopenharmony_ciextern unsigned short snd_gf1_i_look16(struct snd_gus_card * gus, unsigned char reg);
4998c2ecf20Sopenharmony_cistatic inline unsigned short snd_gf1_i_read16(struct snd_gus_card * gus, unsigned char reg)
5008c2ecf20Sopenharmony_ci{
5018c2ecf20Sopenharmony_ci	return snd_gf1_i_look16(gus, reg | 0x80);
5028c2ecf20Sopenharmony_ci}
5038c2ecf20Sopenharmony_ci
5048c2ecf20Sopenharmony_ciextern void snd_gf1_select_active_voices(struct snd_gus_card * gus);
5058c2ecf20Sopenharmony_ci
5068c2ecf20Sopenharmony_ci/* gus_lfo.c */
5078c2ecf20Sopenharmony_ci
5088c2ecf20Sopenharmony_cistruct _SND_IW_LFO_PROGRAM {
5098c2ecf20Sopenharmony_ci	unsigned short freq_and_control;
5108c2ecf20Sopenharmony_ci	unsigned char depth_final;
5118c2ecf20Sopenharmony_ci	unsigned char depth_inc;
5128c2ecf20Sopenharmony_ci	unsigned short twave;
5138c2ecf20Sopenharmony_ci	unsigned short depth;
5148c2ecf20Sopenharmony_ci};
5158c2ecf20Sopenharmony_ci
5168c2ecf20Sopenharmony_ci#if 0
5178c2ecf20Sopenharmony_ciextern irqreturn_t snd_gf1_lfo_effect_interrupt(struct snd_gus_card * gus, snd_gf1_voice_t * voice);
5188c2ecf20Sopenharmony_ci#endif
5198c2ecf20Sopenharmony_ciextern void snd_gf1_lfo_init(struct snd_gus_card * gus);
5208c2ecf20Sopenharmony_ciextern void snd_gf1_lfo_done(struct snd_gus_card * gus);
5218c2ecf20Sopenharmony_ciextern void snd_gf1_lfo_program(struct snd_gus_card * gus, int voice, int lfo_type, struct _SND_IW_LFO_PROGRAM *program);
5228c2ecf20Sopenharmony_ciextern void snd_gf1_lfo_enable(struct snd_gus_card * gus, int voice, int lfo_type);
5238c2ecf20Sopenharmony_ciextern void snd_gf1_lfo_disable(struct snd_gus_card * gus, int voice, int lfo_type);
5248c2ecf20Sopenharmony_ciextern void snd_gf1_lfo_change_freq(struct snd_gus_card * gus, int voice, int lfo_type, int freq);
5258c2ecf20Sopenharmony_ciextern void snd_gf1_lfo_change_depth(struct snd_gus_card * gus, int voice, int lfo_type, int depth);
5268c2ecf20Sopenharmony_ciextern void snd_gf1_lfo_setup(struct snd_gus_card * gus, int voice, int lfo_type, int freq, int current_depth, int depth, int sweep, int shape);
5278c2ecf20Sopenharmony_ciextern void snd_gf1_lfo_shutdown(struct snd_gus_card * gus, int voice, int lfo_type);
5288c2ecf20Sopenharmony_ci#if 0
5298c2ecf20Sopenharmony_ciextern void snd_gf1_lfo_command(struct snd_gus_card * gus, int voice, unsigned char *command);
5308c2ecf20Sopenharmony_ci#endif
5318c2ecf20Sopenharmony_ci
5328c2ecf20Sopenharmony_ci/* gus_mem.c */
5338c2ecf20Sopenharmony_ci
5348c2ecf20Sopenharmony_civoid snd_gf1_mem_lock(struct snd_gf1_mem * alloc, int xup);
5358c2ecf20Sopenharmony_ciint snd_gf1_mem_xfree(struct snd_gf1_mem * alloc, struct snd_gf1_mem_block * block);
5368c2ecf20Sopenharmony_cistruct snd_gf1_mem_block *snd_gf1_mem_alloc(struct snd_gf1_mem * alloc, int owner,
5378c2ecf20Sopenharmony_ci				       char *name, int size, int w_16,
5388c2ecf20Sopenharmony_ci				       int align, unsigned int *share_id);
5398c2ecf20Sopenharmony_ciint snd_gf1_mem_free(struct snd_gf1_mem * alloc, unsigned int address);
5408c2ecf20Sopenharmony_ciint snd_gf1_mem_free_owner(struct snd_gf1_mem * alloc, int owner);
5418c2ecf20Sopenharmony_ciint snd_gf1_mem_init(struct snd_gus_card * gus);
5428c2ecf20Sopenharmony_ciint snd_gf1_mem_done(struct snd_gus_card * gus);
5438c2ecf20Sopenharmony_ci
5448c2ecf20Sopenharmony_ci/* gus_mem_proc.c */
5458c2ecf20Sopenharmony_ci
5468c2ecf20Sopenharmony_ciint snd_gf1_mem_proc_init(struct snd_gus_card * gus);
5478c2ecf20Sopenharmony_ci
5488c2ecf20Sopenharmony_ci/* gus_dma.c */
5498c2ecf20Sopenharmony_ci
5508c2ecf20Sopenharmony_ciint snd_gf1_dma_init(struct snd_gus_card * gus);
5518c2ecf20Sopenharmony_ciint snd_gf1_dma_done(struct snd_gus_card * gus);
5528c2ecf20Sopenharmony_ciint snd_gf1_dma_transfer_block(struct snd_gus_card * gus,
5538c2ecf20Sopenharmony_ci			       struct snd_gf1_dma_block * block,
5548c2ecf20Sopenharmony_ci			       int atomic,
5558c2ecf20Sopenharmony_ci			       int synth);
5568c2ecf20Sopenharmony_ci
5578c2ecf20Sopenharmony_ci/* gus_volume.c */
5588c2ecf20Sopenharmony_ci
5598c2ecf20Sopenharmony_ciunsigned short snd_gf1_lvol_to_gvol_raw(unsigned int vol);
5608c2ecf20Sopenharmony_ciunsigned short snd_gf1_translate_freq(struct snd_gus_card * gus, unsigned int freq2);
5618c2ecf20Sopenharmony_ci
5628c2ecf20Sopenharmony_ci/* gus_reset.c */
5638c2ecf20Sopenharmony_ci
5648c2ecf20Sopenharmony_civoid snd_gf1_set_default_handlers(struct snd_gus_card * gus, unsigned int what);
5658c2ecf20Sopenharmony_civoid snd_gf1_smart_stop_voice(struct snd_gus_card * gus, unsigned short voice);
5668c2ecf20Sopenharmony_civoid snd_gf1_stop_voice(struct snd_gus_card * gus, unsigned short voice);
5678c2ecf20Sopenharmony_civoid snd_gf1_stop_voices(struct snd_gus_card * gus, unsigned short v_min, unsigned short v_max);
5688c2ecf20Sopenharmony_cistruct snd_gus_voice *snd_gf1_alloc_voice(struct snd_gus_card * gus, int type, int client, int port);
5698c2ecf20Sopenharmony_civoid snd_gf1_free_voice(struct snd_gus_card * gus, struct snd_gus_voice *voice);
5708c2ecf20Sopenharmony_ciint snd_gf1_start(struct snd_gus_card * gus);
5718c2ecf20Sopenharmony_ciint snd_gf1_stop(struct snd_gus_card * gus);
5728c2ecf20Sopenharmony_ci
5738c2ecf20Sopenharmony_ci/* gus_mixer.c */
5748c2ecf20Sopenharmony_ci
5758c2ecf20Sopenharmony_ciint snd_gf1_new_mixer(struct snd_gus_card * gus);
5768c2ecf20Sopenharmony_ci
5778c2ecf20Sopenharmony_ci/* gus_pcm.c */
5788c2ecf20Sopenharmony_ci
5798c2ecf20Sopenharmony_ciint snd_gf1_pcm_new(struct snd_gus_card *gus, int pcm_dev, int control_index);
5808c2ecf20Sopenharmony_ci
5818c2ecf20Sopenharmony_ci#ifdef CONFIG_SND_DEBUG
5828c2ecf20Sopenharmony_ciextern void snd_gf1_print_voice_registers(struct snd_gus_card * gus);
5838c2ecf20Sopenharmony_ci#endif
5848c2ecf20Sopenharmony_ci
5858c2ecf20Sopenharmony_ci/* gus.c */
5868c2ecf20Sopenharmony_ci
5878c2ecf20Sopenharmony_ciint snd_gus_use_inc(struct snd_gus_card * gus);
5888c2ecf20Sopenharmony_civoid snd_gus_use_dec(struct snd_gus_card * gus);
5898c2ecf20Sopenharmony_ciint snd_gus_create(struct snd_card *card,
5908c2ecf20Sopenharmony_ci		   unsigned long port,
5918c2ecf20Sopenharmony_ci		   int irq, int dma1, int dma2,
5928c2ecf20Sopenharmony_ci		   int timer_dev,
5938c2ecf20Sopenharmony_ci		   int voices,
5948c2ecf20Sopenharmony_ci		   int pcm_channels,
5958c2ecf20Sopenharmony_ci		   int effect,
5968c2ecf20Sopenharmony_ci		   struct snd_gus_card ** rgus);
5978c2ecf20Sopenharmony_ciint snd_gus_initialize(struct snd_gus_card * gus);
5988c2ecf20Sopenharmony_ci
5998c2ecf20Sopenharmony_ci/* gus_irq.c */
6008c2ecf20Sopenharmony_ci
6018c2ecf20Sopenharmony_ciirqreturn_t snd_gus_interrupt(int irq, void *dev_id);
6028c2ecf20Sopenharmony_ci#ifdef CONFIG_SND_DEBUG
6038c2ecf20Sopenharmony_civoid snd_gus_irq_profile_init(struct snd_gus_card *gus);
6048c2ecf20Sopenharmony_ci#endif
6058c2ecf20Sopenharmony_ci
6068c2ecf20Sopenharmony_ci/* gus_uart.c */
6078c2ecf20Sopenharmony_ci
6088c2ecf20Sopenharmony_ciint snd_gf1_rawmidi_new(struct snd_gus_card *gus, int device);
6098c2ecf20Sopenharmony_ci
6108c2ecf20Sopenharmony_ci/* gus_dram.c */
6118c2ecf20Sopenharmony_ciint snd_gus_dram_write(struct snd_gus_card *gus, char __user *ptr,
6128c2ecf20Sopenharmony_ci		       unsigned int addr, unsigned int size);
6138c2ecf20Sopenharmony_ciint snd_gus_dram_read(struct snd_gus_card *gus, char __user *ptr,
6148c2ecf20Sopenharmony_ci		      unsigned int addr, unsigned int size, int rom);
6158c2ecf20Sopenharmony_ci
6168c2ecf20Sopenharmony_ci/* gus_timer.c */
6178c2ecf20Sopenharmony_civoid snd_gf1_timers_init(struct snd_gus_card *gus);
6188c2ecf20Sopenharmony_civoid snd_gf1_timers_done(struct snd_gus_card *gus);
6198c2ecf20Sopenharmony_ci
6208c2ecf20Sopenharmony_ci#endif /* __SOUND_GUS_H */
621