Example #1
0
static int
sb_midi_out(int dev, u_char midi_byte)
{
    u_long   flags;

    if (sb_midi_mode == NORMAL_MIDI) {
	flags = splhigh();
	if (sb_dsp_command(0x38))
	    sb_dsp_command(midi_byte);
	else
	    printf("SB Error: Unable to send a MIDI byte\n");
	splx(flags);
    } else
	sb_dsp_command(midi_byte);	/* UART write */

    return 1;
}
Example #2
0
static int
sb_midi_out (int dev, unsigned char midi_byte)
{
  unsigned long   flags;

  if (sb_midi_mode == NORMAL_MIDI)
    {
      DISABLE_INTR (flags);
      if (sb_dsp_command (0x38))
	sb_dsp_command (midi_byte);
      else
	printk ("SB Error: Unable to send a MIDI byte\n");
      RESTORE_INTR (flags);
    }
  else
    sb_dsp_command (midi_byte);	/*
				 * UART write
				 */

  return 1;
}
Example #3
0
static int sb_midi_out(int dev, unsigned char midi_byte)
{
	sb_devc *devc = midi_devs[dev]->devc;

	if (devc == NULL)
		return 1;

	if (devc->midi_broken)
		return 1;

	if (!sb_dsp_command(devc, midi_byte))
	{
		devc->midi_broken = 1;
		return 1;
	}
	return 1;
}
Example #4
0
static int
sb_midi_open(int dev, int mode, void (*input) (int dev, u_char data),
	     void (*output) (int dev))
{
    int             ret;

    if (!sb_dsp_ok) {
	printf("SB Error: MIDI hardware not installed\n");
	return -(ENXIO);
    }
    if (sb_midi_busy)
	return -(EBUSY);

    if (mode != OPEN_WRITE && !sb_duplex_midi) {
	if (num_midis == 1)
	    printf("SoundBlaster: Midi input not currently supported\n");
	return -(EPERM);
    }
    sb_midi_mode = NORMAL_MIDI;
    if (mode != OPEN_WRITE) {
	if (sb_dsp_busy || sb_intr_active)
	    return -(EBUSY);
	sb_midi_mode = UART_MIDI;
    }
    if (sb_dsp_highspeed) {
	printf("SB Error: Midi output not possible during stereo or high speed audio\n");
	return -(EBUSY);
    }
    if (sb_midi_mode == UART_MIDI) {
	sb_irq_mode = IMODE_MIDI;

	sb_reset_dsp();

	if (!sb_dsp_command(0x35))
	    return -(EIO);	/* Enter the UART mode */
	sb_intr_active = 1;

	input_opened = 1;
	midi_input_intr = input;
    }
    sb_midi_busy = 1;

    return 0;
}
Example #5
0
static int sb_midi_open(int dev, int mode,
	     void            (*input) (int dev, unsigned char data),
	     void            (*output) (int dev)
)
{
	sb_devc *devc = midi_devs[dev]->devc;
	unsigned long flags;

	if (devc == NULL)
		return -ENXIO;

	save_flags(flags);
	cli();
	if (devc->opened)
	{
		restore_flags(flags);
		return -EBUSY;
	}
	devc->opened = 1;
	restore_flags(flags);

	devc->irq_mode = IMODE_MIDI;
	devc->midi_broken = 0;

	sb_dsp_reset(devc);

	if (!sb_dsp_command(devc, 0x35))	/* Start MIDI UART mode */
	{
		  devc->opened = 0;
		  return -EIO;
	}
	devc->intr_active = 1;

	if (mode & OPEN_READ)
	{
		devc->input_opened = 1;
		devc->midi_input_intr = input;
	}
	return 0;
}