📄 trident.h
字号:
I2S_OUTPUT_EN = 0x00000040, I2S_INPUT_EN = 0x00000080, PCMIN = 0x00000100, LINE1IN = 0x00000200, MICIN = 0x00000400, LINE2IN = 0x00000800, HEAD_SET_IN = 0x00001000, GPIOIN = 0x00002000, /* 7018 spec says id = 01 but the demo board routed to 10 SECONDARY_ID= 0x00004000, */ SECONDARY_ID = 0x00004000, PCMOUT = 0x00010000, SURROUT = 0x00020000, CENTEROUT = 0x00040000, LFEOUT = 0x00080000, LINE1OUT = 0x00100000, LINE2OUT = 0x00200000, GPIOOUT = 0x00400000, SI_AC97_PRIMARY_READY = 0x01000000, SI_AC97_SECONDARY_READY = 0x02000000, SI_AC97_POWERDOWN = 0x04000000,}; /* PCM defaults */#define T4D_DEFAULT_PCM_VOL 10 /* 0 - 255 */#define T4D_DEFAULT_PCM_PAN 0 /* 0 - 127 */#define T4D_DEFAULT_PCM_RVOL 127 /* 0 - 127 */#define T4D_DEFAULT_PCM_CVOL 127 /* 0 - 127 */typedef struct _snd_trident trident_t;typedef struct _snd_trident_voice snd_trident_voice_t;typedef struct _snd_trident_pcm_mixer snd_trident_pcm_mixer_t;typedef struct { void (*sample_start)(trident_t *gus, snd_trident_voice_t *voice, snd_seq_position_t position); void (*sample_stop)(trident_t *gus, snd_trident_voice_t *voice, snd_seq_stop_mode_t mode); void (*sample_freq)(trident_t *gus, snd_trident_voice_t *voice, snd_seq_frequency_t freq); void (*sample_volume)(trident_t *gus, snd_trident_voice_t *voice, snd_seq_ev_volume_t *volume); void (*sample_loop)(trident_t *card, snd_trident_voice_t *voice, snd_seq_ev_loop_t *loop); void (*sample_pos)(trident_t *card, snd_trident_voice_t *voice, snd_seq_position_t position); void (*sample_private1)(trident_t *card, snd_trident_voice_t *voice, unsigned char *data);} snd_trident_sample_ops_t;typedef struct { snd_midi_channel_set_t * chset; trident_t * trident; int mode; /* operation mode */ int client; /* sequencer client number */ int port; /* sequencer port number */ int midi_has_voices: 1;} snd_trident_port_t;typedef struct snd_trident_memblk_arg { short first_page, last_page;} snd_trident_memblk_arg_t;typedef struct { unsigned int * entries; /* 16k-aligned TLB table */ dma_addr_t entries_dmaaddr; /* 16k-aligned PCI address to TLB table */ unsigned long * shadow_entries; /* shadow entries with virtual addresses */ struct snd_dma_buffer buffer; snd_util_memhdr_t * memhdr; /* page allocation list */ struct snd_dma_buffer silent_page;} snd_trident_tlb_t;struct _snd_trident_voice { unsigned int number; int use: 1, pcm: 1, synth:1, midi: 1; unsigned int flags; unsigned char client; unsigned char port; unsigned char index; snd_seq_instr_t instr; snd_trident_sample_ops_t *sample_ops; /* channel parameters */ unsigned int CSO; /* 24 bits (16 on DX) */ unsigned int ESO; /* 24 bits (16 on DX) */ unsigned int LBA; /* 30 bits */ unsigned short EC; /* 12 bits */ unsigned short Alpha; /* 12 bits */ unsigned short Delta; /* 16 bits */ unsigned short Attribute; /* 16 bits - SiS 7018 */ unsigned short Vol; /* 12 bits (6.6) */ unsigned char Pan; /* 7 bits (1.4.2) */ unsigned char GVSel; /* 1 bit */ unsigned char RVol; /* 7 bits (5.2) */ unsigned char CVol; /* 7 bits (5.2) */ unsigned char FMC; /* 2 bits */ unsigned char CTRL; /* 4 bits */ unsigned char FMS; /* 4 bits */ unsigned char LFO; /* 8 bits */ unsigned int negCSO; /* nonzero - use negative CSO */ snd_util_memblk_t *memblk; /* memory block if TLB enabled */ /* PCM data */ trident_t *trident; snd_pcm_substream_t *substream; snd_trident_voice_t *extra; /* extra PCM voice (acts as interrupt generator) */ int running: 1, capture: 1, spdif: 1, foldback: 1, isync: 1, isync2: 1, isync3: 1; int foldback_chan; /* foldback subdevice number */ unsigned int stimer; /* global sample timer (to detect spurious interrupts) */ unsigned int spurious_threshold; /* spurious threshold */ unsigned int isync_mark; unsigned int isync_max; unsigned int isync_ESO; /* --- */ void *private_data; void (*private_free)(snd_trident_voice_t *voice);};struct _snd_4dwave { int seq_client; snd_trident_port_t seq_ports[4]; snd_simple_ops_t simple_ops; snd_seq_kinstr_list_t *ilist; snd_trident_voice_t voices[64]; int ChanSynthCount; /* number of allocated synth channels */ int max_size; /* maximum synth memory size in bytes */ int current_size; /* current allocated synth mem in bytes */};struct _snd_trident_pcm_mixer { snd_trident_voice_t *voice; /* active voice */ unsigned short vol; /* front volume */ unsigned char pan; /* pan control */ unsigned char rvol; /* rear volume */ unsigned char cvol; /* center volume */ unsigned char pad;};struct _snd_trident { int irq; unsigned int device; /* device ID */ unsigned char bDMAStart; unsigned long port; unsigned long midi_port; unsigned int spurious_irq_count; unsigned int spurious_irq_max_delta; snd_trident_tlb_t tlb; /* TLB entries for NX cards */ unsigned char spdif_ctrl; unsigned char spdif_pcm_ctrl; unsigned int spdif_bits; unsigned int spdif_pcm_bits; snd_kcontrol_t *spdif_pcm_ctl; /* S/PDIF settings */ unsigned int ac97_ctrl; unsigned int ChanMap[2]; /* allocation map for hardware channels */ int ChanPCM; /* max number of PCM channels */ int ChanPCMcnt; /* actual number of PCM channels */ unsigned int ac97_detect: 1; /* 1 = AC97 in detection phase */ unsigned int in_suspend: 1; /* 1 during suspend/resume */ struct _snd_4dwave synth; /* synth specific variables */ spinlock_t event_lock; spinlock_t voice_alloc; struct snd_dma_device dma_dev; struct pci_dev *pci; snd_card_t *card; snd_pcm_t *pcm; /* ADC/DAC PCM */ snd_pcm_t *foldback; /* Foldback PCM */ snd_pcm_t *spdif; /* SPDIF PCM */ snd_rawmidi_t *rmidi; snd_seq_device_t *seq_dev; ac97_bus_t *ac97_bus; ac97_t *ac97; ac97_t *ac97_sec; unsigned int musicvol_wavevol; snd_trident_pcm_mixer_t pcm_mixer[32]; snd_kcontrol_t *ctl_vol; /* front volume */ snd_kcontrol_t *ctl_pan; /* pan */ snd_kcontrol_t *ctl_rvol; /* rear volume */ snd_kcontrol_t *ctl_cvol; /* center volume */ spinlock_t reg_lock; struct snd_trident_gameport *gameport;};int snd_trident_create(snd_card_t * card, struct pci_dev *pci, int pcm_streams, int pcm_spdif_device, int max_wavetable_size, trident_t ** rtrident);int snd_trident_free(trident_t *trident);void snd_trident_gameport(trident_t *trident);int snd_trident_pcm(trident_t * trident, int device, snd_pcm_t **rpcm);int snd_trident_foldback_pcm(trident_t * trident, int device, snd_pcm_t **rpcm);int snd_trident_spdif_pcm(trident_t * trident, int device, snd_pcm_t **rpcm);int snd_trident_attach_synthesizer(trident_t * trident);int snd_trident_detach_synthesizer(trident_t * trident);snd_trident_voice_t *snd_trident_alloc_voice(trident_t * trident, int type, int client, int port);void snd_trident_free_voice(trident_t * trident, snd_trident_voice_t *voice);void snd_trident_start_voice(trident_t * trident, unsigned int voice);void snd_trident_stop_voice(trident_t * trident, unsigned int voice);void snd_trident_write_voice_regs(trident_t * trident, snd_trident_voice_t *voice);void snd_trident_clear_voices(trident_t * trident, unsigned short v_min, unsigned short v_max);/* TLB memory allocation */snd_util_memblk_t *snd_trident_alloc_pages(trident_t *trident, snd_pcm_substream_t *substream);int snd_trident_free_pages(trident_t *trident, snd_util_memblk_t *blk);snd_util_memblk_t *snd_trident_synth_alloc(trident_t *trident, unsigned int size);int snd_trident_synth_free(trident_t *trident, snd_util_memblk_t *blk);int snd_trident_synth_bzero(trident_t *trident, snd_util_memblk_t *blk, int offset, int size);int snd_trident_synth_copy_from_user(trident_t *trident, snd_util_memblk_t *blk, int offset, const char __user *data, int size);#endif /* __SOUND_TRIDENT_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -