Esempio n. 1
0
static int uart6850_out(int dev, unsigned char midi_byte)
{
	int timeout;
	unsigned long flags;

	/*
	 * Test for input since pending input seems to block the output.
	 */

	spin_lock_irqsave(&lock,flags);

	if (input_avail())
		uart6850_input_loop();

	spin_unlock_irqrestore(&lock,flags);

	/*
	 * Sometimes it takes about 13000 loops before the output becomes ready
	 * (After reset). Normally it takes just about 10 loops.
	 */

	for (timeout = 30000; timeout > 0 && !output_ready(); timeout--);	/*
										 * Wait
										 */
	if (!output_ready())
	{
		printk(KERN_WARNING "Midi6850: Timeout\n");
		return 0;
	}
	uart6850_write(midi_byte);
	return 1;
}
Esempio n. 2
0
static void poll_uart6850(unsigned long dummy)
{
	unsigned long flags;

	if (!(uart6850_opened & OPEN_READ))
		return;		/* Device has been closed */

	spin_lock_irqsave(&lock,flags);
	if (input_avail())
		uart6850_input_loop();

	uart6850_timer.expires = 1 + jiffies;
	add_timer(&uart6850_timer);
	
	/*
	 *	Come back later
	 */

	spin_unlock_irqrestore(&lock,flags);
}
Esempio n. 3
0
static int uart6850_open(int dev, int mode,
	      void            (*input) (int dev, unsigned char data),
	      void            (*output) (int dev)
)
{
	if (uart6850_opened)
	{
/*		  printk("Midi6850: Midi busy\n");*/
		  return -EBUSY;
	};

	uart6850_cmd(UART_RESET);
	uart6850_input_loop();
	midi_input_intr = input;
	uart6850_opened = mode;
	poll_uart6850(0);	/*
				 * Enable input polling
				 */

	return 0;
}
Esempio n. 4
0
static void
poll_uart6850 (unsigned long dummy)
{
  unsigned long   flags;

  DEFINE_TIMER (uart6850_timer, poll_uart6850);

  if (!(uart6850_opened & OPEN_READ))
    return;			/*
				 * No longer required
				 */

  DISABLE_INTR (flags);

  if (input_avail ())
    uart6850_input_loop ();

  ACTIVATE_TIMER (uart6850_timer, poll_uart6850, 1);	/*
							 * Come back later
							 */

  RESTORE_INTR (flags);
}
Esempio n. 5
0
static irqreturn_t m6850intr(int irq, void *dev_id)
{
	if (input_avail())
		uart6850_input_loop();
	return IRQ_HANDLED;
}
Esempio n. 6
0
static irqreturn_t m6850intr(int irq, void *dev_id, struct pt_regs *dummy)
{
	if (input_avail())
		uart6850_input_loop();
	return IRQ_HANDLED;
}
Esempio n. 7
0
void
m6850intr (int unit)
{
  if (input_avail ())
    uart6850_input_loop ();
}