Accessing two UARTs from within one application

Norman Feske norman.feske at ...1...
Tue May 26 14:39:38 CEST 2015


Hi Josef,

> is it possible to use two UARTs at the same time from within one app?
> We had a look at the example script and application
> repos/os/run/uart.run and repos/os/src/test/uart
> and tried several things, including:
> 
> - adding two lines in the config for the same process but with different UARTs:
> 				<policy label="test-uart1" uart="1"/>
> 				<policy label="test-uart1" uart="2"/>
> - comma-separating UARTs (uart="1,2")
> - adding a second uart-attribute (uart="1" uart="2")
> - and many more.
> 
> - In the application, we simply added a second instance of 
> Uart::Connection and accessed it in the same way as the first.
> (The Uart::Connection doesn't seem to offer any other constructor
> than the default one, in which one could specify which UART to
> access.)
> 
> 
> but all of those attemptes either led to a build error or made the output appear
> on only one UART.
> Is there any way to access two UARTs in one application or
> would we need a separate process for each one?

when using multiple connections, each connection should be equipped with
a specific label to enable the server (the UART driver) to distinguish
them. Unfortunately, the constructor of 'Uart_connection' lacks a
parameter for an optional 'label' argument. To accommodate your
scenario, you would need to add such an argument similar to how it is
done in 'Terminal::Connection'. Btw, unless you really need the specific
baud-rate settings of the 'Uart' session, you may just use a
'Terminal::Connection' instead. This would work because the UART driver
provides both a "Terminal" service and an "Uart" service.

Once you have passed a different label to each connection, you may add a
dedicated <policy> node for each label to the driver's configuration.
For example, if your connections have the labels "adam" and "eve", the
policy would look like this (the "->" is the separator of the label
elements):

  <policy label="test-uart1 -> adam" uart="1"/>
  <policy label="test-uart1 -> eve"  uart="2"/>

In case you decide to extend the 'Uart::Connection' constructor with a
'label' argument, please tell us. So we can do same for the mainline of
Genode.

Cheers
Norman


-- 
Dr.-Ing. Norman Feske
Genode Labs

http://www.genode-labs.com · http://genode.org

Genode Labs GmbH · Amtsgericht Dresden · HRB 28424 · Sitz Dresden
Geschäftsführer: Dr.-Ing. Norman Feske, Christian Helmuth




More information about the users mailing list