Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-or-later */
0002 #ifndef __SOUND_GUS_H
0003 #define __SOUND_GUS_H
0004 
0005 /*
0006  *  Global structures used for GUS part of ALSA driver
0007  *  Copyright (c) by Jaroslav Kysela <perex@perex.cz>
0008  */
0009 
0010 #include <sound/pcm.h>
0011 #include <sound/rawmidi.h>
0012 #include <sound/timer.h>
0013 #include <sound/seq_midi_emul.h>
0014 #include <sound/seq_device.h>
0015 #include <linux/io.h>
0016 
0017 /* IO ports */
0018 
0019 #define GUSP(gus, x)            ((gus)->gf1.port + SNDRV_g_u_s_##x)
0020 
0021 #define SNDRV_g_u_s_MIDICTRL        (0x320-0x220)
0022 #define SNDRV_g_u_s_MIDISTAT        (0x320-0x220)
0023 #define SNDRV_g_u_s_MIDIDATA        (0x321-0x220)
0024 
0025 #define SNDRV_g_u_s_GF1PAGE     (0x322-0x220)
0026 #define SNDRV_g_u_s_GF1REGSEL       (0x323-0x220)
0027 #define SNDRV_g_u_s_GF1DATALOW      (0x324-0x220)
0028 #define SNDRV_g_u_s_GF1DATAHIGH     (0x325-0x220)
0029 #define SNDRV_g_u_s_IRQSTAT     (0x226-0x220)
0030 #define SNDRV_g_u_s_TIMERCNTRL      (0x228-0x220)
0031 #define SNDRV_g_u_s_TIMERDATA       (0x229-0x220)
0032 #define SNDRV_g_u_s_DRAM        (0x327-0x220)
0033 #define SNDRV_g_u_s_MIXCNTRLREG     (0x220-0x220)
0034 #define SNDRV_g_u_s_IRQDMACNTRLREG  (0x22b-0x220)
0035 #define SNDRV_g_u_s_REGCNTRLS       (0x22f-0x220)
0036 #define SNDRV_g_u_s_BOARDVERSION    (0x726-0x220)
0037 #define SNDRV_g_u_s_MIXCNTRLPORT    (0x726-0x220)
0038 #define SNDRV_g_u_s_IVER        (0x325-0x220)
0039 #define SNDRV_g_u_s_MIXDATAPORT     (0x326-0x220)
0040 #define SNDRV_g_u_s_MAXCNTRLPORT    (0x326-0x220)
0041 
0042 /* GF1 registers */
0043 
0044 /* global registers */
0045 #define SNDRV_GF1_GB_ACTIVE_VOICES      0x0e
0046 #define SNDRV_GF1_GB_VOICES_IRQ         0x0f
0047 #define SNDRV_GF1_GB_GLOBAL_MODE        0x19
0048 #define SNDRV_GF1_GW_LFO_BASE           0x1a
0049 #define SNDRV_GF1_GB_VOICES_IRQ_READ        0x1f
0050 #define SNDRV_GF1_GB_DRAM_DMA_CONTROL       0x41
0051 #define SNDRV_GF1_GW_DRAM_DMA_LOW       0x42
0052 #define SNDRV_GF1_GW_DRAM_IO_LOW        0x43
0053 #define SNDRV_GF1_GB_DRAM_IO_HIGH       0x44
0054 #define SNDRV_GF1_GB_SOUND_BLASTER_CONTROL  0x45
0055 #define SNDRV_GF1_GB_ADLIB_TIMER_1      0x46
0056 #define SNDRV_GF1_GB_ADLIB_TIMER_2      0x47
0057 #define SNDRV_GF1_GB_RECORD_RATE        0x48
0058 #define SNDRV_GF1_GB_REC_DMA_CONTROL        0x49
0059 #define SNDRV_GF1_GB_JOYSTICK_DAC_LEVEL     0x4b
0060 #define SNDRV_GF1_GB_RESET          0x4c
0061 #define SNDRV_GF1_GB_DRAM_DMA_HIGH      0x50
0062 #define SNDRV_GF1_GW_DRAM_IO16          0x51
0063 #define SNDRV_GF1_GW_MEMORY_CONFIG      0x52
0064 #define SNDRV_GF1_GB_MEMORY_CONTROL     0x53
0065 #define SNDRV_GF1_GW_FIFO_RECORD_BASE_ADDR  0x54
0066 #define SNDRV_GF1_GW_FIFO_PLAY_BASE_ADDR    0x55
0067 #define SNDRV_GF1_GW_FIFO_SIZE          0x56
0068 #define SNDRV_GF1_GW_INTERLEAVE         0x57
0069 #define SNDRV_GF1_GB_COMPATIBILITY      0x59
0070 #define SNDRV_GF1_GB_DECODE_CONTROL     0x5a
0071 #define SNDRV_GF1_GB_VERSION_NUMBER     0x5b
0072 #define SNDRV_GF1_GB_MPU401_CONTROL_A       0x5c
0073 #define SNDRV_GF1_GB_MPU401_CONTROL_B       0x5d
0074 #define SNDRV_GF1_GB_EMULATION_IRQ      0x60
0075 /* voice specific registers */
0076 #define SNDRV_GF1_VB_ADDRESS_CONTROL        0x00
0077 #define SNDRV_GF1_VW_FREQUENCY          0x01
0078 #define SNDRV_GF1_VW_START_HIGH         0x02
0079 #define SNDRV_GF1_VW_START_LOW          0x03
0080 #define SNDRV_GF1_VA_START          SNDRV_GF1_VW_START_HIGH
0081 #define SNDRV_GF1_VW_END_HIGH           0x04
0082 #define SNDRV_GF1_VW_END_LOW            0x05
0083 #define SNDRV_GF1_VA_END            SNDRV_GF1_VW_END_HIGH
0084 #define SNDRV_GF1_VB_VOLUME_RATE        0x06
0085 #define SNDRV_GF1_VB_VOLUME_START       0x07
0086 #define SNDRV_GF1_VB_VOLUME_END         0x08
0087 #define SNDRV_GF1_VW_VOLUME         0x09
0088 #define SNDRV_GF1_VW_CURRENT_HIGH       0x0a
0089 #define SNDRV_GF1_VW_CURRENT_LOW        0x0b
0090 #define SNDRV_GF1_VA_CURRENT            SNDRV_GF1_VW_CURRENT_HIGH
0091 #define SNDRV_GF1_VB_PAN            0x0c
0092 #define SNDRV_GF1_VW_OFFSET_RIGHT       0x0c
0093 #define SNDRV_GF1_VB_VOLUME_CONTROL     0x0d
0094 #define SNDRV_GF1_VB_UPPER_ADDRESS      0x10
0095 #define SNDRV_GF1_VW_EFFECT_HIGH        0x11
0096 #define SNDRV_GF1_VW_EFFECT_LOW         0x12
0097 #define SNDRV_GF1_VA_EFFECT         SNDRV_GF1_VW_EFFECT_HIGH
0098 #define SNDRV_GF1_VW_OFFSET_LEFT        0x13
0099 #define SNDRV_GF1_VB_ACCUMULATOR        0x14
0100 #define SNDRV_GF1_VB_MODE           0x15
0101 #define SNDRV_GF1_VW_EFFECT_VOLUME      0x16
0102 #define SNDRV_GF1_VB_FREQUENCY_LFO      0x17
0103 #define SNDRV_GF1_VB_VOLUME_LFO         0x18
0104 #define SNDRV_GF1_VW_OFFSET_RIGHT_FINAL     0x1b
0105 #define SNDRV_GF1_VW_OFFSET_LEFT_FINAL      0x1c
0106 #define SNDRV_GF1_VW_EFFECT_VOLUME_FINAL    0x1d
0107 
0108 /* ICS registers */
0109 
0110 #define SNDRV_ICS_MIC_DEV       0
0111 #define SNDRV_ICS_LINE_DEV      1
0112 #define SNDRV_ICS_CD_DEV        2
0113 #define SNDRV_ICS_GF1_DEV       3
0114 #define SNDRV_ICS_NONE_DEV      4
0115 #define SNDRV_ICS_MASTER_DEV        5
0116 
0117 /* LFO */
0118 
0119 #define SNDRV_LFO_TREMOLO       0
0120 #define SNDRV_LFO_VIBRATO       1
0121 
0122 /* misc */
0123 
0124 #define SNDRV_GF1_DMA_UNSIGNED  0x80
0125 #define SNDRV_GF1_DMA_16BIT 0x40
0126 #define SNDRV_GF1_DMA_IRQ   0x20
0127 #define SNDRV_GF1_DMA_WIDTH16   0x04
0128 #define SNDRV_GF1_DMA_READ  0x02    /* read from GUS's DRAM */
0129 #define SNDRV_GF1_DMA_ENABLE    0x01
0130 
0131 /* ramp ranges */
0132 
0133 #define SNDRV_GF1_ATTEN(x)  (snd_gf1_atten_table[x])
0134 #define SNDRV_GF1_MIN_VOLUME    1800
0135 #define SNDRV_GF1_MAX_VOLUME    4095
0136 #define SNDRV_GF1_MIN_OFFSET    (SNDRV_GF1_MIN_VOLUME>>4)
0137 #define SNDRV_GF1_MAX_OFFSET    255
0138 #define SNDRV_GF1_MAX_TDEPTH    90
0139 
0140 /* defines for memory manager */
0141 
0142 #define SNDRV_GF1_MEM_BLOCK_16BIT   0x0001
0143 
0144 #define SNDRV_GF1_MEM_OWNER_DRIVER  0x0001
0145 #define SNDRV_GF1_MEM_OWNER_WAVE_SIMPLE 0x0002
0146 #define SNDRV_GF1_MEM_OWNER_WAVE_GF1    0x0003
0147 #define SNDRV_GF1_MEM_OWNER_WAVE_IWFFFF 0x0004
0148 
0149 /* constants for interrupt handlers */
0150 
0151 #define SNDRV_GF1_HANDLER_MIDI_OUT  0x00010000
0152 #define SNDRV_GF1_HANDLER_MIDI_IN   0x00020000
0153 #define SNDRV_GF1_HANDLER_TIMER1    0x00040000
0154 #define SNDRV_GF1_HANDLER_TIMER2    0x00080000
0155 #define SNDRV_GF1_HANDLER_VOICE     0x00100000
0156 #define SNDRV_GF1_HANDLER_DMA_WRITE 0x00200000
0157 #define SNDRV_GF1_HANDLER_DMA_READ  0x00400000
0158 #define SNDRV_GF1_HANDLER_ALL       (0xffff0000&~SNDRV_GF1_HANDLER_VOICE)
0159 
0160 /* constants for DMA flags */
0161 
0162 #define SNDRV_GF1_DMA_TRIGGER       1
0163 
0164 /* --- */
0165 
0166 struct snd_gus_card;
0167 
0168 /* GF1 specific structure */
0169 
0170 struct snd_gf1_bank_info {
0171     unsigned int address;
0172     unsigned int size;
0173 };
0174 
0175 struct snd_gf1_mem_block {
0176     unsigned short flags;   /* flags - SNDRV_GF1_MEM_BLOCK_XXXX */
0177     unsigned short owner;   /* owner - SNDRV_GF1_MEM_OWNER_XXXX */
0178     unsigned int share; /* share count */
0179     unsigned int share_id[4]; /* share ID */
0180     unsigned int ptr;
0181     unsigned int size;
0182     char *name;
0183     struct snd_gf1_mem_block *next;
0184     struct snd_gf1_mem_block *prev;
0185 };
0186 
0187 struct snd_gf1_mem {
0188     struct snd_gf1_bank_info banks_8[4];
0189     struct snd_gf1_bank_info banks_16[4];
0190     struct snd_gf1_mem_block *first;
0191     struct snd_gf1_mem_block *last;
0192     struct mutex memory_mutex;
0193 };
0194 
0195 struct snd_gf1_dma_block {
0196     void *buffer;       /* buffer in computer's RAM */
0197     unsigned long buf_addr; /* buffer address */
0198     unsigned int addr;  /* address in onboard memory */
0199     unsigned int count; /* count in bytes */
0200     unsigned int cmd;   /* DMA command (format) */
0201     void (*ack)(struct snd_gus_card * gus, void *private_data);
0202     void *private_data;
0203     struct snd_gf1_dma_block *next;
0204 };
0205 
0206 struct snd_gus_port {
0207     struct snd_midi_channel_set * chset;
0208     struct snd_gus_card * gus;
0209     int mode;       /* operation mode */
0210     int client;     /* sequencer client number */
0211     int port;       /* sequencer port number */
0212     unsigned int midi_has_voices: 1;
0213 };
0214 
0215 struct snd_gus_voice;
0216 
0217 #define SNDRV_GF1_VOICE_TYPE_PCM    0
0218 #define SNDRV_GF1_VOICE_TYPE_SYNTH  1
0219 #define SNDRV_GF1_VOICE_TYPE_MIDI   2
0220 
0221 #define SNDRV_GF1_VFLG_RUNNING      (1<<0)
0222 #define SNDRV_GF1_VFLG_EFFECT_TIMER1    (1<<1)
0223 #define SNDRV_GF1_VFLG_PAN      (1<<2)
0224 
0225 enum snd_gus_volume_state {
0226     VENV_BEFORE,
0227     VENV_ATTACK,
0228     VENV_SUSTAIN,
0229     VENV_RELEASE,
0230     VENV_DONE,
0231     VENV_VOLUME
0232 };
0233 
0234 struct snd_gus_voice {
0235     int number;
0236     unsigned int use: 1,
0237         pcm: 1,
0238         synth:1,
0239         midi: 1;
0240     unsigned int flags;
0241     unsigned char client;
0242     unsigned char port;
0243     unsigned char index;
0244     unsigned char pad;
0245     
0246 #ifdef CONFIG_SND_DEBUG
0247     unsigned int interrupt_stat_wave;
0248     unsigned int interrupt_stat_volume;
0249 #endif
0250     void (*handler_wave) (struct snd_gus_card * gus, struct snd_gus_voice * voice);
0251     void (*handler_volume) (struct snd_gus_card * gus, struct snd_gus_voice * voice);
0252     void (*handler_effect) (struct snd_gus_card * gus, struct snd_gus_voice * voice);
0253     void (*volume_change) (struct snd_gus_card * gus);
0254 
0255     struct snd_gus_sample_ops *sample_ops;
0256 
0257     /* running status / registers */
0258 
0259     unsigned short fc_register;
0260     unsigned short fc_lfo;
0261     unsigned short gf1_volume;
0262     unsigned char control;
0263     unsigned char mode;
0264     unsigned char gf1_pan;
0265     unsigned char effect_accumulator;
0266     unsigned char volume_control;
0267     unsigned char venv_value_next;
0268     enum snd_gus_volume_state venv_state;
0269     enum snd_gus_volume_state venv_state_prev;
0270     unsigned short vlo;
0271     unsigned short vro;
0272     unsigned short gf1_effect_volume;
0273     
0274     /* --- */
0275 
0276     void *private_data;
0277     void (*private_free)(struct snd_gus_voice *voice);
0278 };
0279 
0280 struct snd_gf1 {
0281 
0282     unsigned int enh_mode:1,    /* enhanced mode (GFA1) */
0283              hw_lfo:1,      /* use hardware LFO */
0284              sw_lfo:1,      /* use software LFO */
0285              effect:1;      /* use effect voices */
0286 
0287     unsigned long port;     /* port of GF1 chip */
0288     struct resource *res_port1;
0289     struct resource *res_port2;
0290     int irq;            /* IRQ number */
0291     int dma1;           /* DMA1 number */
0292     int dma2;           /* DMA2 number */
0293     unsigned int memory;        /* GUS's DRAM size in bytes */
0294     unsigned int rom_memory;    /* GUS's ROM size in bytes */
0295     unsigned int rom_present;   /* bitmask */
0296     unsigned int rom_banks;     /* GUS's ROM banks */
0297 
0298     struct snd_gf1_mem mem_alloc;
0299 
0300     /* registers */
0301     unsigned short reg_page;
0302     unsigned short reg_regsel;
0303     unsigned short reg_data8;
0304     unsigned short reg_data16;
0305     unsigned short reg_irqstat;
0306     unsigned short reg_dram;
0307     unsigned short reg_timerctrl;
0308     unsigned short reg_timerdata;
0309     unsigned char ics_regs[6][2];
0310     /* --------- */
0311 
0312     unsigned char active_voices;    /* active voices */
0313     unsigned char active_voice; /* selected voice (GF1PAGE register) */
0314 
0315     struct snd_gus_voice voices[32];    /* GF1 voices */
0316 
0317     unsigned int default_voice_address;
0318 
0319     unsigned short playback_freq;   /* GF1 playback (mixing) frequency */
0320     unsigned short mode;        /* see to SNDRV_GF1_MODE_XXXX */
0321     unsigned char volume_ramp;
0322     unsigned char smooth_pan;
0323     unsigned char full_range_pan;
0324     unsigned char pad0;
0325 
0326     unsigned char *lfos;
0327 
0328     /* interrupt handlers */
0329 
0330     void (*interrupt_handler_midi_out) (struct snd_gus_card * gus);
0331     void (*interrupt_handler_midi_in) (struct snd_gus_card * gus);
0332     void (*interrupt_handler_timer1) (struct snd_gus_card * gus);
0333     void (*interrupt_handler_timer2) (struct snd_gus_card * gus);
0334     void (*interrupt_handler_dma_write) (struct snd_gus_card * gus);
0335     void (*interrupt_handler_dma_read) (struct snd_gus_card * gus);
0336 
0337 #ifdef CONFIG_SND_DEBUG
0338     unsigned int interrupt_stat_midi_out;
0339     unsigned int interrupt_stat_midi_in;
0340     unsigned int interrupt_stat_timer1;
0341     unsigned int interrupt_stat_timer2;
0342     unsigned int interrupt_stat_dma_write;
0343     unsigned int interrupt_stat_dma_read;
0344     unsigned int interrupt_stat_voice_lost;
0345 #endif
0346 
0347     /* synthesizer */
0348 
0349     int seq_client;
0350     struct snd_gus_port seq_ports[4];
0351 
0352     /* timer */
0353 
0354     unsigned short timer_enabled;
0355     struct snd_timer *timer1;
0356     struct snd_timer *timer2;
0357 
0358     /* midi */
0359 
0360     unsigned short uart_cmd;
0361     unsigned int uart_framing;
0362     unsigned int uart_overrun;
0363 
0364     /* dma operations */
0365 
0366     unsigned int dma_flags;
0367     unsigned int dma_shared;
0368     struct snd_gf1_dma_block *dma_data_pcm;
0369     struct snd_gf1_dma_block *dma_data_pcm_last;
0370     struct snd_gf1_dma_block *dma_data_synth;
0371     struct snd_gf1_dma_block *dma_data_synth_last;
0372     void (*dma_ack)(struct snd_gus_card * gus, void *private_data);
0373     void *dma_private_data;
0374 
0375     /* pcm */
0376     int pcm_channels;
0377     int pcm_alloc_voices;
0378         unsigned short pcm_volume_level_left;
0379     unsigned short pcm_volume_level_right;
0380     unsigned short pcm_volume_level_left1;
0381     unsigned short pcm_volume_level_right1;
0382                                 
0383     unsigned char pcm_rcntrl_reg;
0384     unsigned char pad_end;
0385 };
0386 
0387 /* main structure for GUS card */
0388 
0389 struct snd_gus_card {
0390     struct snd_card *card;
0391 
0392     unsigned int
0393      initialized: 1,        /* resources were initialized */
0394      equal_irq:1,           /* GF1 and CODEC shares IRQ (GUS MAX only) */
0395      equal_dma:1,           /* if dma channels are equal (not valid for daughter board) */
0396      ics_flag:1,            /* have we ICS mixer chip */
0397      ics_flipped:1,         /* ICS mixer have flipped some channels? */
0398      codec_flag:1,          /* have we CODEC chip? */
0399      max_flag:1,            /* have we GUS MAX card? */
0400      max_ctrl_flag:1,       /* have we original GUS MAX card? */
0401      daughter_flag:1,       /* have we daughter board? */
0402      interwave:1,           /* hey - we have InterWave card */
0403      ess_flag:1,            /* ESS chip found... GUS Extreme */
0404      ace_flag:1,            /* GUS ACE detected */
0405      uart_enable:1;         /* enable MIDI UART */
0406     unsigned short revision;    /* revision of chip */
0407     unsigned short max_cntrl_val;   /* GUS MAX control value */
0408     unsigned short mix_cntrl_reg;   /* mixer control register */
0409     unsigned short joystick_dac;    /* joystick DAC level */
0410     int timer_dev;          /* timer device */
0411 
0412     struct snd_gf1 gf1; /* gf1 specific variables */
0413     struct snd_pcm *pcm;
0414     struct snd_pcm_substream *pcm_cap_substream;
0415     unsigned int c_dma_size;
0416     unsigned int c_period_size;
0417     unsigned int c_pos;
0418 
0419     struct snd_rawmidi *midi_uart;
0420     struct snd_rawmidi_substream *midi_substream_output;
0421     struct snd_rawmidi_substream *midi_substream_input;
0422 
0423     spinlock_t reg_lock;
0424     spinlock_t voice_alloc;
0425     spinlock_t active_voice_lock;
0426     spinlock_t event_lock;
0427     spinlock_t dma_lock;
0428     spinlock_t pcm_volume_level_lock;
0429     spinlock_t uart_cmd_lock;
0430     struct mutex dma_mutex;
0431     struct mutex register_mutex;
0432 };
0433 
0434 /* I/O functions for GF1/InterWave chip - gus_io.c */
0435 
0436 static inline void snd_gf1_select_voice(struct snd_gus_card * gus, int voice)
0437 {
0438     unsigned long flags;
0439 
0440     spin_lock_irqsave(&gus->active_voice_lock, flags);
0441     if (voice != gus->gf1.active_voice) {
0442         gus->gf1.active_voice = voice;
0443         outb(voice, GUSP(gus, GF1PAGE));
0444     }
0445     spin_unlock_irqrestore(&gus->active_voice_lock, flags);
0446 }
0447 
0448 static inline void snd_gf1_uart_cmd(struct snd_gus_card * gus, unsigned char b)
0449 {
0450     outb(gus->gf1.uart_cmd = b, GUSP(gus, MIDICTRL));
0451 }
0452 
0453 static inline unsigned char snd_gf1_uart_stat(struct snd_gus_card * gus)
0454 {
0455     return inb(GUSP(gus, MIDISTAT));
0456 }
0457 
0458 static inline void snd_gf1_uart_put(struct snd_gus_card * gus, unsigned char b)
0459 {
0460     outb(b, GUSP(gus, MIDIDATA));
0461 }
0462 
0463 static inline unsigned char snd_gf1_uart_get(struct snd_gus_card * gus)
0464 {
0465     return inb(GUSP(gus, MIDIDATA));
0466 }
0467 
0468 extern void snd_gf1_delay(struct snd_gus_card * gus);
0469 
0470 extern void snd_gf1_ctrl_stop(struct snd_gus_card * gus, unsigned char reg);
0471 
0472 extern void snd_gf1_write8(struct snd_gus_card * gus, unsigned char reg, unsigned char data);
0473 extern unsigned char snd_gf1_look8(struct snd_gus_card * gus, unsigned char reg);
0474 static inline unsigned char snd_gf1_read8(struct snd_gus_card * gus, unsigned char reg)
0475 {
0476     return snd_gf1_look8(gus, reg | 0x80);
0477 }
0478 extern void snd_gf1_write16(struct snd_gus_card * gus, unsigned char reg, unsigned int data);
0479 extern unsigned short snd_gf1_look16(struct snd_gus_card * gus, unsigned char reg);
0480 static inline unsigned short snd_gf1_read16(struct snd_gus_card * gus, unsigned char reg)
0481 {
0482     return snd_gf1_look16(gus, reg | 0x80);
0483 }
0484 extern void snd_gf1_adlib_write(struct snd_gus_card * gus, unsigned char reg, unsigned char data);
0485 extern void snd_gf1_dram_addr(struct snd_gus_card * gus, unsigned int addr);
0486 extern void snd_gf1_poke(struct snd_gus_card * gus, unsigned int addr, unsigned char data);
0487 extern unsigned char snd_gf1_peek(struct snd_gus_card * gus, unsigned int addr);
0488 extern void snd_gf1_write_addr(struct snd_gus_card * gus, unsigned char reg, unsigned int addr, short w_16bit);
0489 extern unsigned int snd_gf1_read_addr(struct snd_gus_card * gus, unsigned char reg, short w_16bit);
0490 extern void snd_gf1_i_ctrl_stop(struct snd_gus_card * gus, unsigned char reg);
0491 extern void snd_gf1_i_write8(struct snd_gus_card * gus, unsigned char reg, unsigned char data);
0492 extern unsigned char snd_gf1_i_look8(struct snd_gus_card * gus, unsigned char reg);
0493 extern void snd_gf1_i_write16(struct snd_gus_card * gus, unsigned char reg, unsigned int data);
0494 static inline unsigned char snd_gf1_i_read8(struct snd_gus_card * gus, unsigned char reg)
0495 {
0496     return snd_gf1_i_look8(gus, reg | 0x80);
0497 }
0498 extern unsigned short snd_gf1_i_look16(struct snd_gus_card * gus, unsigned char reg);
0499 static inline unsigned short snd_gf1_i_read16(struct snd_gus_card * gus, unsigned char reg)
0500 {
0501     return snd_gf1_i_look16(gus, reg | 0x80);
0502 }
0503 
0504 extern void snd_gf1_select_active_voices(struct snd_gus_card * gus);
0505 
0506 /* gus_lfo.c */
0507 
0508 struct _SND_IW_LFO_PROGRAM {
0509     unsigned short freq_and_control;
0510     unsigned char depth_final;
0511     unsigned char depth_inc;
0512     unsigned short twave;
0513     unsigned short depth;
0514 };
0515 
0516 #if 0
0517 extern irqreturn_t snd_gf1_lfo_effect_interrupt(struct snd_gus_card * gus, snd_gf1_voice_t * voice);
0518 #endif
0519 extern void snd_gf1_lfo_init(struct snd_gus_card * gus);
0520 extern void snd_gf1_lfo_done(struct snd_gus_card * gus);
0521 extern void snd_gf1_lfo_program(struct snd_gus_card * gus, int voice, int lfo_type, struct _SND_IW_LFO_PROGRAM *program);
0522 extern void snd_gf1_lfo_enable(struct snd_gus_card * gus, int voice, int lfo_type);
0523 extern void snd_gf1_lfo_disable(struct snd_gus_card * gus, int voice, int lfo_type);
0524 extern void snd_gf1_lfo_change_freq(struct snd_gus_card * gus, int voice, int lfo_type, int freq);
0525 extern void snd_gf1_lfo_change_depth(struct snd_gus_card * gus, int voice, int lfo_type, int depth);
0526 extern 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);
0527 extern void snd_gf1_lfo_shutdown(struct snd_gus_card * gus, int voice, int lfo_type);
0528 #if 0
0529 extern void snd_gf1_lfo_command(struct snd_gus_card * gus, int voice, unsigned char *command);
0530 #endif
0531 
0532 /* gus_mem.c */
0533 
0534 void snd_gf1_mem_lock(struct snd_gf1_mem * alloc, int xup);
0535 int snd_gf1_mem_xfree(struct snd_gf1_mem * alloc, struct snd_gf1_mem_block * block);
0536 struct snd_gf1_mem_block *snd_gf1_mem_alloc(struct snd_gf1_mem * alloc, int owner,
0537                        char *name, int size, int w_16,
0538                        int align, unsigned int *share_id);
0539 int snd_gf1_mem_free(struct snd_gf1_mem * alloc, unsigned int address);
0540 int snd_gf1_mem_free_owner(struct snd_gf1_mem * alloc, int owner);
0541 int snd_gf1_mem_init(struct snd_gus_card * gus);
0542 int snd_gf1_mem_done(struct snd_gus_card * gus);
0543 
0544 /* gus_mem_proc.c */
0545 
0546 int snd_gf1_mem_proc_init(struct snd_gus_card * gus);
0547 
0548 /* gus_dma.c */
0549 
0550 int snd_gf1_dma_init(struct snd_gus_card * gus);
0551 int snd_gf1_dma_done(struct snd_gus_card * gus);
0552 int snd_gf1_dma_transfer_block(struct snd_gus_card * gus,
0553                    struct snd_gf1_dma_block * block,
0554                    int atomic,
0555                    int synth);
0556 
0557 /* gus_volume.c */
0558 
0559 unsigned short snd_gf1_lvol_to_gvol_raw(unsigned int vol);
0560 unsigned short snd_gf1_translate_freq(struct snd_gus_card * gus, unsigned int freq2);
0561 
0562 /* gus_reset.c */
0563 
0564 void snd_gf1_set_default_handlers(struct snd_gus_card * gus, unsigned int what);
0565 void snd_gf1_smart_stop_voice(struct snd_gus_card * gus, unsigned short voice);
0566 void snd_gf1_stop_voice(struct snd_gus_card * gus, unsigned short voice);
0567 void snd_gf1_stop_voices(struct snd_gus_card * gus, unsigned short v_min, unsigned short v_max);
0568 struct snd_gus_voice *snd_gf1_alloc_voice(struct snd_gus_card * gus, int type, int client, int port);
0569 void snd_gf1_free_voice(struct snd_gus_card * gus, struct snd_gus_voice *voice);
0570 int snd_gf1_start(struct snd_gus_card * gus);
0571 int snd_gf1_stop(struct snd_gus_card * gus);
0572 
0573 /* gus_mixer.c */
0574 
0575 int snd_gf1_new_mixer(struct snd_gus_card * gus);
0576 
0577 /* gus_pcm.c */
0578 
0579 int snd_gf1_pcm_new(struct snd_gus_card *gus, int pcm_dev, int control_index);
0580 
0581 #ifdef CONFIG_SND_DEBUG
0582 extern void snd_gf1_print_voice_registers(struct snd_gus_card * gus);
0583 #endif
0584 
0585 /* gus.c */
0586 
0587 int snd_gus_use_inc(struct snd_gus_card * gus);
0588 void snd_gus_use_dec(struct snd_gus_card * gus);
0589 int snd_gus_create(struct snd_card *card,
0590            unsigned long port,
0591            int irq, int dma1, int dma2,
0592            int timer_dev,
0593            int voices,
0594            int pcm_channels,
0595            int effect,
0596            struct snd_gus_card ** rgus);
0597 int snd_gus_initialize(struct snd_gus_card * gus);
0598 
0599 /* gus_irq.c */
0600 
0601 irqreturn_t snd_gus_interrupt(int irq, void *dev_id);
0602 #ifdef CONFIG_SND_DEBUG
0603 void snd_gus_irq_profile_init(struct snd_gus_card *gus);
0604 #endif
0605 
0606 /* gus_uart.c */
0607 
0608 int snd_gf1_rawmidi_new(struct snd_gus_card *gus, int device);
0609 
0610 /* gus_dram.c */
0611 int snd_gus_dram_write(struct snd_gus_card *gus, char __user *ptr,
0612                unsigned int addr, unsigned int size);
0613 int snd_gus_dram_read(struct snd_gus_card *gus, char __user *ptr,
0614               unsigned int addr, unsigned int size, int rom);
0615 
0616 /* gus_timer.c */
0617 void snd_gf1_timers_init(struct snd_gus_card *gus);
0618 void snd_gf1_timers_done(struct snd_gus_card *gus);
0619 
0620 #endif /* __SOUND_GUS_H */