📄 gus.h
字号:
struct snd_gus_voice voices[32]; /* GF1 voices */ unsigned int default_voice_address; unsigned short playback_freq; /* GF1 playback (mixing) frequency */ unsigned short mode; /* see to SNDRV_GF1_MODE_XXXX */ unsigned char volume_ramp; unsigned char smooth_pan; unsigned char full_range_pan; unsigned char pad0; unsigned char *lfos; /* interrupt handlers */ void (*interrupt_handler_midi_out) (struct snd_gus_card * gus); void (*interrupt_handler_midi_in) (struct snd_gus_card * gus); void (*interrupt_handler_timer1) (struct snd_gus_card * gus); void (*interrupt_handler_timer2) (struct snd_gus_card * gus); void (*interrupt_handler_dma_write) (struct snd_gus_card * gus); void (*interrupt_handler_dma_read) (struct snd_gus_card * gus);#ifdef CONFIG_SND_DEBUG unsigned int interrupt_stat_midi_out; unsigned int interrupt_stat_midi_in; unsigned int interrupt_stat_timer1; unsigned int interrupt_stat_timer2; unsigned int interrupt_stat_dma_write; unsigned int interrupt_stat_dma_read; unsigned int interrupt_stat_voice_lost;#endif /* synthesizer */ int seq_client; struct snd_gus_port seq_ports[4]; struct snd_seq_kinstr_list *ilist; struct snd_iwffff_ops iwffff_ops; struct snd_gf1_ops gf1_ops; struct snd_simple_ops simple_ops; /* timer */ unsigned short timer_enabled; struct snd_timer *timer1; struct snd_timer *timer2; /* midi */ unsigned short uart_cmd; unsigned int uart_framing; unsigned int uart_overrun; /* dma operations */ unsigned int dma_flags; unsigned int dma_shared; struct snd_gf1_dma_block *dma_data_pcm; struct snd_gf1_dma_block *dma_data_pcm_last; struct snd_gf1_dma_block *dma_data_synth; struct snd_gf1_dma_block *dma_data_synth_last; void (*dma_ack)(struct snd_gus_card * gus, void *private_data); void *dma_private_data; /* pcm */ int pcm_channels; int pcm_alloc_voices; unsigned short pcm_volume_level_left; unsigned short pcm_volume_level_right; unsigned short pcm_volume_level_left1; unsigned short pcm_volume_level_right1; unsigned char pcm_rcntrl_reg; unsigned char pad_end;};/* main structure for GUS card */struct snd_gus_card { struct snd_card *card; unsigned int initialized: 1, /* resources were initialized */ equal_irq:1, /* GF1 and CODEC shares IRQ (GUS MAX only) */ equal_dma:1, /* if dma channels are equal (not valid for daughter board) */ ics_flag:1, /* have we ICS mixer chip */ ics_flipped:1, /* ICS mixer have flipped some channels? */ codec_flag:1, /* have we CODEC chip? */ max_flag:1, /* have we GUS MAX card? */ max_ctrl_flag:1, /* have we original GUS MAX card? */ daughter_flag:1, /* have we daughter board? */ interwave:1, /* hey - we have InterWave card */ ess_flag:1, /* ESS chip found... GUS Extreme */ ace_flag:1, /* GUS ACE detected */ uart_enable:1; /* enable MIDI UART */ unsigned short revision; /* revision of chip */ unsigned short max_cntrl_val; /* GUS MAX control value */ unsigned short mix_cntrl_reg; /* mixer control register */ unsigned short joystick_dac; /* joystick DAC level */ int timer_dev; /* timer device */ struct snd_gf1 gf1; /* gf1 specific variables */ struct snd_pcm *pcm; struct snd_pcm_substream *pcm_cap_substream; unsigned int c_dma_size; unsigned int c_period_size; unsigned int c_pos; struct snd_rawmidi *midi_uart; struct snd_rawmidi_substream *midi_substream_output; struct snd_rawmidi_substream *midi_substream_input; struct snd_seq_device *seq_dev; spinlock_t reg_lock; spinlock_t voice_alloc; spinlock_t active_voice_lock; spinlock_t event_lock; spinlock_t dma_lock; spinlock_t pcm_volume_level_lock; spinlock_t uart_cmd_lock; struct mutex dma_mutex; struct mutex register_mutex;};/* I/O functions for GF1/InterWave chip - gus_io.c */static inline void snd_gf1_select_voice(struct snd_gus_card * gus, int voice){ unsigned long flags; spin_lock_irqsave(&gus->active_voice_lock, flags); if (voice != gus->gf1.active_voice) { gus->gf1.active_voice = voice; outb(voice, GUSP(gus, GF1PAGE)); } spin_unlock_irqrestore(&gus->active_voice_lock, flags);}static inline void snd_gf1_uart_cmd(struct snd_gus_card * gus, unsigned char b){ outb(gus->gf1.uart_cmd = b, GUSP(gus, MIDICTRL));}static inline unsigned char snd_gf1_uart_stat(struct snd_gus_card * gus){ return inb(GUSP(gus, MIDISTAT));}static inline void snd_gf1_uart_put(struct snd_gus_card * gus, unsigned char b){ outb(b, GUSP(gus, MIDIDATA));}static inline unsigned char snd_gf1_uart_get(struct snd_gus_card * gus){ return inb(GUSP(gus, MIDIDATA));}extern void snd_gf1_delay(struct snd_gus_card * gus);extern void snd_gf1_ctrl_stop(struct snd_gus_card * gus, unsigned char reg);extern void snd_gf1_write8(struct snd_gus_card * gus, unsigned char reg, unsigned char data);extern unsigned char snd_gf1_look8(struct snd_gus_card * gus, unsigned char reg);static inline unsigned char snd_gf1_read8(struct snd_gus_card * gus, unsigned char reg){ return snd_gf1_look8(gus, reg | 0x80);}extern void snd_gf1_write16(struct snd_gus_card * gus, unsigned char reg, unsigned int data);extern unsigned short snd_gf1_look16(struct snd_gus_card * gus, unsigned char reg);static inline unsigned short snd_gf1_read16(struct snd_gus_card * gus, unsigned char reg){ return snd_gf1_look16(gus, reg | 0x80);}extern void snd_gf1_adlib_write(struct snd_gus_card * gus, unsigned char reg, unsigned char data);extern void snd_gf1_dram_addr(struct snd_gus_card * gus, unsigned int addr);extern void snd_gf1_poke(struct snd_gus_card * gus, unsigned int addr, unsigned char data);extern unsigned char snd_gf1_peek(struct snd_gus_card * gus, unsigned int addr);extern void snd_gf1_write_addr(struct snd_gus_card * gus, unsigned char reg, unsigned int addr, short w_16bit);extern unsigned int snd_gf1_read_addr(struct snd_gus_card * gus, unsigned char reg, short w_16bit);extern void snd_gf1_i_ctrl_stop(struct snd_gus_card * gus, unsigned char reg);extern void snd_gf1_i_write8(struct snd_gus_card * gus, unsigned char reg, unsigned char data);extern unsigned char snd_gf1_i_look8(struct snd_gus_card * gus, unsigned char reg);extern void snd_gf1_i_write16(struct snd_gus_card * gus, unsigned char reg, unsigned int data);static inline unsigned char snd_gf1_i_read8(struct snd_gus_card * gus, unsigned char reg){ return snd_gf1_i_look8(gus, reg | 0x80);}extern unsigned short snd_gf1_i_look16(struct snd_gus_card * gus, unsigned char reg);static inline unsigned short snd_gf1_i_read16(struct snd_gus_card * gus, unsigned char reg){ return snd_gf1_i_look16(gus, reg | 0x80);}extern void snd_gf1_select_active_voices(struct snd_gus_card * gus);/* gus_lfo.c */struct _SND_IW_LFO_PROGRAM { unsigned short freq_and_control; unsigned char depth_final; unsigned char depth_inc; unsigned short twave; unsigned short depth;};#if 0extern irqreturn_t snd_gf1_lfo_effect_interrupt(struct snd_gus_card * gus, snd_gf1_voice_t * voice);#endifextern void snd_gf1_lfo_init(struct snd_gus_card * gus);extern void snd_gf1_lfo_done(struct snd_gus_card * gus);extern void snd_gf1_lfo_program(struct snd_gus_card * gus, int voice, int lfo_type, struct _SND_IW_LFO_PROGRAM *program);extern void snd_gf1_lfo_enable(struct snd_gus_card * gus, int voice, int lfo_type);extern void snd_gf1_lfo_disable(struct snd_gus_card * gus, int voice, int lfo_type);extern void snd_gf1_lfo_change_freq(struct snd_gus_card * gus, int voice, int lfo_type, int freq);extern void snd_gf1_lfo_change_depth(struct snd_gus_card * gus, int voice, int lfo_type, int depth);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);extern void snd_gf1_lfo_shutdown(struct snd_gus_card * gus, int voice, int lfo_type);#if 0extern void snd_gf1_lfo_command(struct snd_gus_card * gus, int voice, unsigned char *command);#endif/* gus_mem.c */void snd_gf1_mem_lock(struct snd_gf1_mem * alloc, int xup);int snd_gf1_mem_xfree(struct snd_gf1_mem * alloc, struct snd_gf1_mem_block * block);struct snd_gf1_mem_block *snd_gf1_mem_alloc(struct snd_gf1_mem * alloc, int owner, char *name, int size, int w_16, int align, unsigned int *share_id);int snd_gf1_mem_free(struct snd_gf1_mem * alloc, unsigned int address);int snd_gf1_mem_free_owner(struct snd_gf1_mem * alloc, int owner);int snd_gf1_mem_init(struct snd_gus_card * gus);int snd_gf1_mem_done(struct snd_gus_card * gus);/* gus_mem_proc.c */int snd_gf1_mem_proc_init(struct snd_gus_card * gus);/* gus_dma.c */int snd_gf1_dma_init(struct snd_gus_card * gus);int snd_gf1_dma_done(struct snd_gus_card * gus);int snd_gf1_dma_transfer_block(struct snd_gus_card * gus, struct snd_gf1_dma_block * block, int atomic, int synth);/* gus_volume.c */unsigned short snd_gf1_lvol_to_gvol_raw(unsigned int vol);unsigned short snd_gf1_translate_freq(struct snd_gus_card * gus, unsigned int freq2);/* gus_reset.c */void snd_gf1_set_default_handlers(struct snd_gus_card * gus, unsigned int what);void snd_gf1_smart_stop_voice(struct snd_gus_card * gus, unsigned short voice);void snd_gf1_stop_voice(struct snd_gus_card * gus, unsigned short voice);void snd_gf1_stop_voices(struct snd_gus_card * gus, unsigned short v_min, unsigned short v_max);struct snd_gus_voice *snd_gf1_alloc_voice(struct snd_gus_card * gus, int type, int client, int port);void snd_gf1_free_voice(struct snd_gus_card * gus, struct snd_gus_voice *voice);int snd_gf1_start(struct snd_gus_card * gus);int snd_gf1_stop(struct snd_gus_card * gus);/* gus_mixer.c */int snd_gf1_new_mixer(struct snd_gus_card * gus);/* gus_pcm.c */int snd_gf1_pcm_new(struct snd_gus_card * gus, int pcm_dev, int control_index, struct snd_pcm ** rpcm);#ifdef CONFIG_SND_DEBUGextern void snd_gf1_print_voice_registers(struct snd_gus_card * gus);#endif/* gus.c */int snd_gus_use_inc(struct snd_gus_card * gus);void snd_gus_use_dec(struct snd_gus_card * gus);int snd_gus_create(struct snd_card *card, unsigned long port, int irq, int dma1, int dma2, int timer_dev, int voices, int pcm_channels, int effect, struct snd_gus_card ** rgus);int snd_gus_initialize(struct snd_gus_card * gus);/* gus_irq.c */irqreturn_t snd_gus_interrupt(int irq, void *dev_id);#ifdef CONFIG_SND_DEBUGvoid snd_gus_irq_profile_init(struct snd_gus_card *gus);#endif/* gus_uart.c */int snd_gf1_rawmidi_new(struct snd_gus_card * gus, int device, struct snd_rawmidi **rrawmidi);#if 0extern void snd_engine_instrument_register(unsigned short mode, struct _SND_INSTRUMENT_VOICE_COMMANDS *voice_cmds, struct _SND_INSTRUMENT_NOTE_COMMANDS *note_cmds, struct _SND_INSTRUMENT_CHANNEL_COMMANDS *channel_cmds);extern int snd_engine_instrument_register_ask(unsigned short mode);#endif/* gus_dram.c */int snd_gus_dram_write(struct snd_gus_card *gus, char __user *ptr, unsigned int addr, unsigned int size);int snd_gus_dram_read(struct snd_gus_card *gus, char __user *ptr, unsigned int addr, unsigned int size, int rom);#if defined(CONFIG_SND_SEQUENCER) || defined(CONFIG_SND_SEQUENCER_MODULE)/* gus_sample.c */void snd_gus_sample_event(struct snd_seq_event *ev, struct snd_gus_port *p);/* gus_simple.c */void snd_gf1_simple_init(struct snd_gus_voice *voice);/* gus_instr.c */int snd_gus_iwffff_put_sample(void *private_data, struct iwffff_wave *wave, char __user *data, long len, int atomic);int snd_gus_iwffff_get_sample(void *private_data, struct iwffff_wave *wave, char __user *data, long len, int atomic);int snd_gus_iwffff_remove_sample(void *private_data, struct iwffff_wave *wave, int atomic);int snd_gus_gf1_put_sample(void *private_data, struct gf1_wave *wave, char __user *data, long len, int atomic);int snd_gus_gf1_get_sample(void *private_data, struct gf1_wave *wave, char __user *data, long len, int atomic);int snd_gus_gf1_remove_sample(void *private_data, struct gf1_wave *wave, int atomic);int snd_gus_simple_put_sample(void *private_data, struct simple_instrument *instr, char __user *data, long len, int atomic);int snd_gus_simple_get_sample(void *private_data, struct simple_instrument *instr, char __user *data, long len, int atomic);int snd_gus_simple_remove_sample(void *private_data, struct simple_instrument *instr, int atomic);#endif /* CONFIG_SND_SEQUENCER */#endif /* __SOUND_GUS_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -