Using a second UART to control a serial device

Pflaum, Clemens clemens.pflaum at mytum.de
Fri Apr 17 12:03:46 CEST 2015


Hi L4 Hackers,
Im currently running Fiasco.OC with L4Re on my BananaPi. I'm trying to 
control a serial device (Pololu Servo Controller) by sending a small 
series of Bytes over a second UART ( not UART 0 since im getting the 
console from there ). Via documentation I've found out that UART 3 is at 
0x01C28C00 and is a U6_16550A, so I'm hoping the driver  in 
/pkg/drivers-frst/uart/src/uart_pxa.cc will be compatible with that.
Where and how would I have to go about initiating my UART 3? By writing 
a new platform for BPi in /pkg/bootstrap/server/src/platform? The 
function set_stdio_uart(&_uart); made me think its only the "console" 
UART. Or do I have to instantiate some kind of Hw.Device like the gpio 
in /pkg/io/config/arm-omap3.devs and put it on a new vBus like in 
/pkg/io/doc/example.io ?

Or am I thinking way too complicated and it is as simple as editing the 
/pkg/serial-drv/server/src/main.cc :

bool
Serial_drv::init()
{
   int irq_num = 37;                                                      
         // How can i find out what this number refers to/do i have to 
change it at all?
   l4_addr_t phys_base = 0x1000a000;                                      
         // change to 0x01C28C00
#if 0
   int irq_num = 74;
   l4_addr_t phys_base = 0x49020000;
#endif
   l4_addr_t virt_base = 0;

   if (l4io_request_iomem(phys_base, 0x1000, L4IO_MEM_NONCACHED, 
&virt_base))
     {
       printf("serial-drv: request io-memory from l4io failed.\n");
       return false;
     }
   printf("serial-drv: virtual base at:%lx\n", virt_base);

   L4::Io_register_block_mmio *regs = new 
L4::Io_register_block_mmio(virt_base);
   _uart = new (malloc(sizeof(L4::Uart_pl011))) L4::Uart_pl011(24019200); 
                    //change to L4::Uart_pxa(what does this number mean?)
   _uart->startup(regs);


Thanks for any answers in advance.

Regards,
Clemens            c... at mytum.de








More information about the l4-hackers mailing list