📄 echoaudio.h
字号:
#define DE_INIT(x) snd_printk x#else#define DE_INIT(x)#endif/* Debug hw_params callbacks */#ifdef CONFIG_SND_DEBUG#define DE_HWP(x) snd_printk x#else#define DE_HWP(x)#endif/* Debug normal activity (open, start, stop...) */#ifdef CONFIG_SND_DEBUG#define DE_ACT(x) snd_printk x#else#define DE_ACT(x)#endif/* Debug midi activity */#ifdef CONFIG_SND_DEBUG#define DE_MID(x) snd_printk x#else#define DE_MID(x)#endifstruct audiopipe { volatile u32 *dma_counter; /* Commpage register that contains * the current dma position * (lower 32 bits only) */ u32 last_counter; /* The last position, which is used * to compute... */ u32 position; /* ...the number of bytes tranferred * by the DMA engine, modulo the * buffer size */ short index; /* Index of the first channel or <0 * if hw is not configured yet */ short interleave; struct snd_dma_buffer sgpage; /* Room for the scatter-gather list */ struct snd_pcm_hardware hw; struct snd_pcm_hw_constraint_list constr; short sglist_head; char state; /* pipe state */};struct audioformat { u8 interleave; /* How the data is arranged in memory: * mono = 1, stereo = 2, ... */ u8 bits_per_sample; /* 8, 16, 24, 32 (24 bits left aligned) */ char mono_to_stereo; /* Only used if interleave is 1 and * if this is an output pipe. */ char data_are_bigendian; /* 1 = big endian, 0 = little endian */};struct echoaudio { spinlock_t lock; struct snd_pcm_substream *substream[DSP_MAXPIPES]; int last_period[DSP_MAXPIPES]; struct semaphore mode_mutex; u16 num_digital_modes, digital_mode_list[6]; u16 num_clock_sources, clock_source_list[10]; atomic_t opencount; struct snd_kcontrol *clock_src_ctl; struct snd_pcm *analog_pcm, *digital_pcm; struct snd_card *card; const char *card_name; struct pci_dev *pci; unsigned long dsp_registers_phys; struct resource *iores; struct snd_dma_buffer commpage_dma_buf; int irq;#ifdef ECHOCARD_HAS_MIDI struct snd_rawmidi *rmidi; struct snd_rawmidi_substream *midi_in, *midi_out;#endif struct timer_list timer; char tinuse; /* Timer in use */ char midi_full; /* MIDI output buffer is full */ char can_set_rate; char rate_set; /* This stuff is used mainly by the lowlevel code */ struct comm_page *comm_page; /* Virtual address of the memory * seen by DSP */ u32 pipe_alloc_mask; /* Bitmask of allocated pipes */ u32 pipe_cyclic_mask; /* Bitmask of pipes with cyclic * buffers */ u32 sample_rate; /* Card sample rate in Hz */ u8 digital_mode; /* Current digital mode * (see DIGITAL_MODE_*) */ u8 spdif_status; /* Gina20, Darla20, Darla24 - only */ u8 clock_state; /* Gina20, Darla20, Darla24 - only */ u8 input_clock; /* Currently selected sample clock * source */ u8 output_clock; /* Layla20 only */ char meters_enabled; /* VU-meters status */ char asic_loaded; /* Set TRUE when ASIC loaded */ char bad_board; /* Set TRUE if DSP won't load */ char professional_spdif; /* 0 = consumer; 1 = professional */ char non_audio_spdif; /* 3G - only */ char digital_in_automute; /* Gina24, Layla24, Mona - only */ char has_phantom_power; char hasnt_input_nominal_level; /* Gina3G */ char phantom_power; /* Gina3G - only */ char has_midi; char midi_input_enabled;#ifdef ECHOCARD_ECHO3G /* External module -dependent pipe and bus indexes */ char px_digital_out, px_analog_in, px_digital_in, px_num; char bx_digital_out, bx_analog_in, bx_digital_in, bx_num;#endif char nominal_level[ECHO_MAXAUDIOPIPES]; /* True == -10dBV * False == +4dBu */ s8 input_gain[ECHO_MAXAUDIOINPUTS]; /* Input level -50..+50 * unit is 0.5dB */ s8 output_gain[ECHO_MAXAUDIOOUTPUTS]; /* Output level -128..+6 dB * (-128=muted) */ s8 monitor_gain[ECHO_MAXAUDIOOUTPUTS][ECHO_MAXAUDIOINPUTS]; /* -128..+6 dB */ s8 vmixer_gain[ECHO_MAXAUDIOOUTPUTS][ECHO_MAXAUDIOOUTPUTS]; /* -128..+6 dB */ u16 digital_modes; /* Bitmask of supported modes * (see ECHOCAPS_HAS_DIGITAL_MODE_*) */ u16 input_clock_types; /* Suppoted input clock types */ u16 output_clock_types; /* Suppoted output clock types - * Layla20 only */ u16 device_id, subdevice_id; u16 *dsp_code; /* Current DSP code loaded, * NULL if nothing loaded */ const struct firmware *dsp_code_to_load;/* DSP code to load */ const struct firmware *asic_code; /* Current ASIC code */ u32 comm_page_phys; /* Physical address of the * memory seen by DSP */ volatile u32 __iomem *dsp_registers; /* DSP's register base */ u32 active_mask; /* Chs. active mask or * punks out */#ifdef ECHOCARD_HAS_MIDI u16 mtc_state; /* State for MIDI input parsing state machine */ u8 midi_buffer[MIDI_IN_BUFFER_SIZE];#endif};static int init_dsp_comm_page(struct echoaudio *chip);static int init_line_levels(struct echoaudio *chip);static int free_pipes(struct echoaudio *chip, struct audiopipe *pipe);static int load_firmware(struct echoaudio *chip);static int wait_handshake(struct echoaudio *chip);static int send_vector(struct echoaudio *chip, u32 command);static int get_firmware(const struct firmware **fw_entry, const struct firmware *frm, struct echoaudio *chip);static void free_firmware(const struct firmware *fw_entry);#ifdef ECHOCARD_HAS_MIDIstatic int enable_midi_input(struct echoaudio *chip, char enable);static int midi_service_irq(struct echoaudio *chip);static int __devinit snd_echo_midi_create(struct snd_card *card, struct echoaudio *chip);#endifstatic inline void clear_handshake(struct echoaudio *chip){ chip->comm_page->handshake = 0;}static inline u32 get_dsp_register(struct echoaudio *chip, u32 index){ return readl(&chip->dsp_registers[index]);}static inline void set_dsp_register(struct echoaudio *chip, u32 index, u32 value){ writel(value, &chip->dsp_registers[index]);}/* Pipe and bus indexes. PX_* and BX_* are defined as chip->px_* and chip->bx_*for 3G cards because they depend on the external box. They are integerconstants for all other cards.Never use those defines directly, use the following functions instead. */static inline int px_digital_out(const struct echoaudio *chip){ return PX_DIGITAL_OUT;}static inline int px_analog_in(const struct echoaudio *chip){ return PX_ANALOG_IN;}static inline int px_digital_in(const struct echoaudio *chip){ return PX_DIGITAL_IN;}static inline int px_num(const struct echoaudio *chip){ return PX_NUM;}static inline int bx_digital_out(const struct echoaudio *chip){ return BX_DIGITAL_OUT;}static inline int bx_analog_in(const struct echoaudio *chip){ return BX_ANALOG_IN;}static inline int bx_digital_in(const struct echoaudio *chip){ return BX_DIGITAL_IN;}static inline int bx_num(const struct echoaudio *chip){ return BX_NUM;}static inline int num_pipes_out(const struct echoaudio *chip){ return px_analog_in(chip);}static inline int num_pipes_in(const struct echoaudio *chip){ return px_num(chip) - px_analog_in(chip);}static inline int num_busses_out(const struct echoaudio *chip){ return bx_analog_in(chip);}static inline int num_busses_in(const struct echoaudio *chip){ return bx_num(chip) - bx_analog_in(chip);}static inline int num_analog_busses_out(const struct echoaudio *chip){ return bx_digital_out(chip);}static inline int num_analog_busses_in(const struct echoaudio *chip){ return bx_digital_in(chip) - bx_analog_in(chip);}static inline int num_digital_busses_out(const struct echoaudio *chip){ return num_busses_out(chip) - num_analog_busses_out(chip);}static inline int num_digital_busses_in(const struct echoaudio *chip){ return num_busses_in(chip) - num_analog_busses_in(chip);}/* The monitor array is a one-dimensional array; compute the offset * into the array */static inline int monitor_index(const struct echoaudio *chip, int out, int in){ return out * num_busses_in(chip) + in;}#ifndef pci_device#define pci_device(chip) (&chip->pci->dev)#endif#endif /* _ECHOAUDIO_H_ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -