Lines Matching refs:emu
15 static inline unsigned char mpu401_read(struct snd_emu10k1 *emu, in mpu401_read() argument
18 if (emu->audigy) in mpu401_read()
19 return (unsigned char)snd_emu10k1_ptr_read(emu, mpu->port + idx, 0); in mpu401_read()
21 return inb(emu->port + mpu->port + idx); in mpu401_read()
24 static inline void mpu401_write(struct snd_emu10k1 *emu, in mpu401_write() argument
27 if (emu->audigy) in mpu401_write()
28 snd_emu10k1_ptr_write(emu, mpu->port + idx, 0, data); in mpu401_write()
30 outb(data, emu->port + mpu->port + idx); in mpu401_write()
33 #define mpu401_write_data(emu, mpu, data) mpu401_write(emu, mpu, data, 0) argument
34 #define mpu401_write_cmd(emu, mpu, data) mpu401_write(emu, mpu, data, 1) argument
35 #define mpu401_read_data(emu, mpu) mpu401_read(emu, mpu, 0) argument
36 #define mpu401_read_stat(emu, mpu) mpu401_read(emu, mpu, 1) argument
38 #define mpu401_input_avail(emu,mpu) (!(mpu401_read_stat(emu,mpu) & 0x80)) argument
39 #define mpu401_output_ready(emu,mpu) (!(mpu401_read_stat(emu,mpu) & 0x40)) argument
45 static void mpu401_clear_rx(struct snd_emu10k1 *emu, struct snd_emu10k1_midi *mpu) in mpu401_clear_rx() argument
48 for (; timeout > 0 && mpu401_input_avail(emu, mpu); timeout--) in mpu401_clear_rx()
49 mpu401_read_data(emu, mpu); in mpu401_clear_rx()
52 dev_err(emu->card->dev, in mpu401_clear_rx()
54 mpu401_read_stat(emu, mpu)); in mpu401_clear_rx()
62 static void do_emu10k1_midi_interrupt(struct snd_emu10k1 *emu, struct snd_emu10k1_midi *midi, unsig… in do_emu10k1_midi_interrupt() argument
67 snd_emu10k1_intr_disable(emu, midi->tx_enable | midi->rx_enable); in do_emu10k1_midi_interrupt()
72 if ((status & midi->ipr_rx) && mpu401_input_avail(emu, midi)) { in do_emu10k1_midi_interrupt()
74 mpu401_clear_rx(emu, midi); in do_emu10k1_midi_interrupt()
76 byte = mpu401_read_data(emu, midi); in do_emu10k1_midi_interrupt()
84 if ((status & midi->ipr_tx) && mpu401_output_ready(emu, midi)) { in do_emu10k1_midi_interrupt()
87 mpu401_write_data(emu, midi, byte); in do_emu10k1_midi_interrupt()
89 snd_emu10k1_intr_disable(emu, midi->tx_enable); in do_emu10k1_midi_interrupt()
95 static void snd_emu10k1_midi_interrupt(struct snd_emu10k1 *emu, unsigned int status) in snd_emu10k1_midi_interrupt() argument
97 do_emu10k1_midi_interrupt(emu, &emu->midi, status); in snd_emu10k1_midi_interrupt()
100 static void snd_emu10k1_midi_interrupt2(struct snd_emu10k1 *emu, unsigned int status) in snd_emu10k1_midi_interrupt2() argument
102 do_emu10k1_midi_interrupt(emu, &emu->midi2, status); in snd_emu10k1_midi_interrupt2()
105 static int snd_emu10k1_midi_cmd(struct snd_emu10k1 * emu, struct snd_emu10k1_midi *midi, unsigned c… in snd_emu10k1_midi_cmd() argument
111 mpu401_write_data(emu, midi, 0x00); in snd_emu10k1_midi_cmd()
114 mpu401_write_cmd(emu, midi, cmd); in snd_emu10k1_midi_cmd()
119 if (mpu401_input_avail(emu, midi)) { in snd_emu10k1_midi_cmd()
120 if (mpu401_read_data(emu, midi) == MPU401_ACK) in snd_emu10k1_midi_cmd()
124 if (!ok && mpu401_read_data(emu, midi) == MPU401_ACK) in snd_emu10k1_midi_cmd()
131 dev_err(emu->card->dev, in snd_emu10k1_midi_cmd()
133 cmd, emu->port, in snd_emu10k1_midi_cmd()
134 mpu401_read_stat(emu, midi), in snd_emu10k1_midi_cmd()
135 mpu401_read_data(emu, midi)); in snd_emu10k1_midi_cmd()
143 struct snd_emu10k1 *emu; in snd_emu10k1_midi_input_open() local
147 emu = midi->emu; in snd_emu10k1_midi_input_open()
148 if (snd_BUG_ON(!emu)) in snd_emu10k1_midi_input_open()
155 if (snd_emu10k1_midi_cmd(emu, midi, MPU401_RESET, 1)) in snd_emu10k1_midi_input_open()
157 if (snd_emu10k1_midi_cmd(emu, midi, MPU401_ENTER_UART, 1)) in snd_emu10k1_midi_input_open()
170 struct snd_emu10k1 *emu; in snd_emu10k1_midi_output_open() local
174 emu = midi->emu; in snd_emu10k1_midi_output_open()
175 if (snd_BUG_ON(!emu)) in snd_emu10k1_midi_output_open()
182 if (snd_emu10k1_midi_cmd(emu, midi, MPU401_RESET, 1)) in snd_emu10k1_midi_output_open()
184 if (snd_emu10k1_midi_cmd(emu, midi, MPU401_ENTER_UART, 1)) in snd_emu10k1_midi_output_open()
197 struct snd_emu10k1 *emu; in snd_emu10k1_midi_input_close() local
202 emu = midi->emu; in snd_emu10k1_midi_input_close()
203 if (snd_BUG_ON(!emu)) in snd_emu10k1_midi_input_close()
206 snd_emu10k1_intr_disable(emu, midi->rx_enable); in snd_emu10k1_midi_input_close()
211 err = snd_emu10k1_midi_cmd(emu, midi, MPU401_RESET, 0); in snd_emu10k1_midi_input_close()
220 struct snd_emu10k1 *emu; in snd_emu10k1_midi_output_close() local
225 emu = midi->emu; in snd_emu10k1_midi_output_close()
226 if (snd_BUG_ON(!emu)) in snd_emu10k1_midi_output_close()
229 snd_emu10k1_intr_disable(emu, midi->tx_enable); in snd_emu10k1_midi_output_close()
234 err = snd_emu10k1_midi_cmd(emu, midi, MPU401_RESET, 0); in snd_emu10k1_midi_output_close()
243 struct snd_emu10k1 *emu; in snd_emu10k1_midi_input_trigger() local
245 emu = midi->emu; in snd_emu10k1_midi_input_trigger()
246 if (snd_BUG_ON(!emu)) in snd_emu10k1_midi_input_trigger()
250 snd_emu10k1_intr_enable(emu, midi->rx_enable); in snd_emu10k1_midi_input_trigger()
252 snd_emu10k1_intr_disable(emu, midi->rx_enable); in snd_emu10k1_midi_input_trigger()
257 struct snd_emu10k1 *emu; in snd_emu10k1_midi_output_trigger() local
261 emu = midi->emu; in snd_emu10k1_midi_output_trigger()
262 if (snd_BUG_ON(!emu)) in snd_emu10k1_midi_output_trigger()
272 if (mpu401_output_ready(emu, midi)) { in snd_emu10k1_midi_output_trigger()
279 mpu401_write_data(emu, midi, byte); in snd_emu10k1_midi_output_trigger()
286 snd_emu10k1_intr_enable(emu, midi->tx_enable); in snd_emu10k1_midi_output_trigger()
288 snd_emu10k1_intr_disable(emu, midi->tx_enable); in snd_emu10k1_midi_output_trigger()
317 static int emu10k1_midi_init(struct snd_emu10k1 *emu, struct snd_emu10k1_midi *midi, int device, ch… in emu10k1_midi_init() argument
322 err = snd_rawmidi_new(emu->card, name, device, 1, 1, &rmidi); in emu10k1_midi_init()
325 midi->emu = emu; in emu10k1_midi_init()
341 int snd_emu10k1_midi(struct snd_emu10k1 *emu) in snd_emu10k1_midi() argument
343 struct snd_emu10k1_midi *midi = &emu->midi; in snd_emu10k1_midi()
346 err = emu10k1_midi_init(emu, midi, 0, "EMU10K1 MPU-401 (UART)"); in snd_emu10k1_midi()
359 int snd_emu10k1_audigy_midi(struct snd_emu10k1 *emu) in snd_emu10k1_audigy_midi() argument
364 midi = &emu->midi; in snd_emu10k1_audigy_midi()
365 err = emu10k1_midi_init(emu, midi, 0, "Audigy MPU-401 (UART)"); in snd_emu10k1_audigy_midi()
376 midi = &emu->midi2; in snd_emu10k1_audigy_midi()
377 err = emu10k1_midi_init(emu, midi, 1, "Audigy MPU-401 #2"); in snd_emu10k1_audigy_midi()