All of lore.kernel.org
 help / color / mirror / Atom feed
* MIDI port using UART interface
@ 2015-09-19 13:35 Francesco Lavra
  2015-09-23 18:14 ` Clemens Ladisch
  0 siblings, 1 reply; 3+ messages in thread
From: Francesco Lavra @ 2015-09-19 13:35 UTC (permalink / raw)
  To: alsa-devel

Hi,
I'm looking to use an UART interface as a MIDI in/out port.
Since MIDI is an asynchronous serial interface just like UART, and 
provided a given UART controller is able to operate at 31.25 kbps (in my 
case, it is) a UART port can be transformed into a MIDI port by adding 
some hardware components (e.g. an optocopuler) to it, I would have 
expected to find a generic MIDI<->UART adapter layer in the kernel that 
bridges the ALSA MIDI interface with UART drivers and allows to operate 
UARTs as MIDI ports. But apparently there is no such generic adapter, 
the closest driver I found is for the UART 16550 but this is specific to 
a type of UART controller different from the one in the platform I'm 
using (which is i.MX6).
So how would you approach the task of writing a MIDI driver that uses 
UART behind the scenes? Am I correct in assuming that I have to use the 
RawMIDI interface (as the UART 16550 driver does) to make my MIDI port 
available to ALSA applications? Or is there a better alternative?

Thanks,
Francesco

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: MIDI port using UART interface
  2015-09-19 13:35 MIDI port using UART interface Francesco Lavra
@ 2015-09-23 18:14 ` Clemens Ladisch
  2015-09-24  6:58   ` Francesco Lavra
  0 siblings, 1 reply; 3+ messages in thread
From: Clemens Ladisch @ 2015-09-23 18:14 UTC (permalink / raw)
  To: Francesco Lavra, alsa-devel

Francesco Lavra wrote:
> I would have expected to find a generic MIDI<->UART adapter layer in
> the kernel that bridges the ALSA MIDI interface with UART drivers and
> allows to operate UARTs as MIDI ports. But apparently there is no such
> generic adapter, the closest driver I found is for the UART 16550 but
> this is specific to a type of UART controller different from the one
> in the platform I'm using (which is i.MX6).

In the Good Old Times™, all UARTs were 16550 or MPU-401 compatible.

> So how would you approach the task of writing a MIDI driver that uses
> UART behind the scenes? Am I correct in assuming that I have to use
> the RawMIDI interface (as the UART 16550 driver does) to make my MIDI
> port available to ALSA applications? Or is there a better alternative?

The kernel-internal serial port interfaces are designed to be able to
run a console.

The easiest way would be a userspace daemon that bridges between some
/dev/tty* and the ALSA sequencer.
See <http://www.alsa-project.org/~clemens/usbmidid/usbmidid.c> for an
example that uses some other device.


Regards,
Clemens
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: MIDI port using UART interface
  2015-09-23 18:14 ` Clemens Ladisch
@ 2015-09-24  6:58   ` Francesco Lavra
  0 siblings, 0 replies; 3+ messages in thread
From: Francesco Lavra @ 2015-09-24  6:58 UTC (permalink / raw)
  To: Clemens Ladisch; +Cc: alsa-devel

On Wed, Sep 23, 2015 at 8:14 PM, Clemens Ladisch <clemens@ladisch.de> wrote:
> Francesco Lavra wrote:
>> So how would you approach the task of writing a MIDI driver that uses
>> UART behind the scenes? Am I correct in assuming that I have to use
>> the RawMIDI interface (as the UART 16550 driver does) to make my MIDI
>> port available to ALSA applications? Or is there a better alternative?
>
> The kernel-internal serial port interfaces are designed to be able to
> run a console.
>
> The easiest way would be a userspace daemon that bridges between some
> /dev/tty* and the ALSA sequencer.
> See <http://www.alsa-project.org/~clemens/usbmidid/usbmidid.c> for an
> example that uses some other device.

There already is an userspace daemon that bridges a tty with the ALSA
sequencer: ttymidi (http://www.varal.org/ttymidi/). Unfortunately it
doesn't support non-standard baud rates such as 31.25 kbps, and using
the termios API it's not possible to set non-standard baud rates.
Messing with the serial port settings via setserial could do the trick
(not sure if it works on my system, though), otherwise another
solution could be to use the (non-POSIX) termios2 API...

Regards,
Francesco

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-09-24  6:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-19 13:35 MIDI port using UART interface Francesco Lavra
2015-09-23 18:14 ` Clemens Ladisch
2015-09-24  6:58   ` Francesco Lavra

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.