Re: Using a second UART to control a serial device
Reinier Millo Sánchez <[email protected]>
| Newsgroups | gmane.comp.micro-kernel.l4.devel |
|---|---|
| Organization | Universidad Central "Marta Abreu" de Las Villas |
| Message-ID | <[email protected]> |
Hi Clemens
I have been testing something similar in other board (YSE5250-Exynos5).
First you must guarantee that the UART device driver is compatible with
the hardware or you must write an specific device driver.
I have tried to make a GPS device driver using the S3C2410 UART based on
the serial-drv package.
To connect the uart on the user land with my server i have configured
the HW.Device in a vbus with the IO server using this configuration:
-- File: yse5250.devs
local Hw = Io.Hw
local Res = Io.Res
Io.hw_add_devices
{
UART3 = Hw.Device
{
hid = "UART3";
Res.irq(86);
Res.mmio(0x12C30000, 0x12C3ffff);
}
}
To create the vbus, i have created the file yse5250.io:
-- File: yse5250.io
Io.add_vbusses
{
-- Create a virtual bus for a client and give access to UART3
uart03 = Io.Vi.System_bus(function ()
dev = wrap(Io.system_bus():match("UART3"));
end);
}
To run my server using the UART3 on the vbus have used this configuration
-- gps-drv.cfg
-- Run GPS Driver for YSE5250 (Exynos 5250)
require("L4");
-- Shortcuts
local ld = L4.default_loader;
local vbus_uart03 = ld:new_channel();
local platform_ctl = ld:new_channel();
local gps_srv = ld:new_channel();
-- Start the IO Server
ld:start(
{
caps = {
sigma0 = L4.cast(L4.Proto.Factory,
L4.Env.sigma0):create(L4.Proto.Sigma0);
icu = L4.Env.icu;
platform_ctl = platform_ctl:svr();
uart03 = vbus_uart03:svr();
},
log = { "IO Server", "green" },
l4re_dbg = L4.Dbg.Warn,
}, "rom/io rom/yse5250.devs rom/yse5250.io");
-- Start the GPS Driver Server conected to UART3
ld:start(
{
caps = {
gps_srv = gps_srv:svr();
vbus = vbus_uart03;
},
log = {"GPS Driver","blue"}
}, "rom/gps_drv");
The server code is very similar to:
/pkg/serial-drv/server/src/main.cc
But in my case i have adjusted the UART to use the S3C2410 uart.
Best regards
On 04/18/2015 06:00 AM, [email protected] wrote:
> Message: 1
> Date: Fri, 17 Apr 2015 12:03:46 +0200
> From: "Pflaum, Clemens"<[email protected]>
> To:[email protected]
> Subject: Using a second UART to control a serial device
> Message-ID:<[email protected]>
> Content-Type: text/plain; charset=US-ASCII; format=flowed
>
> 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,
> [email protected]
--
Lic. Reinier Millo Sánchez
Centro de Estudios de Informática
Universidad Central "Marta Abreu" de Las Villas
Carretera a Camajuanà Km 5 1/2
Santa Clara, Villa Clara, Cuba
CP 54830
"antes de discutir ... respira;
antes de hablar ... escucha;
antes de escribir ... piensa;
antes de herir ... siente;
antes de rendirte ... intenta;
antes de morir ... vive"
_______________________________________________
l4-hackers mailing list
[email protected]
http://os.inf.tu-dresden.de/mailman/listinfo/l4-hackers
rmillo.vcf
(text/x-vcard, 515 B)
begin:vcard fn;quoted-printable:Reinier Millo S=C3=A1nchez n;quoted-printable:Millo S=C3=A1nchez;Reinier org;quoted-printable:Universidad Central "Marta Abreu" de Las Villas;Centro de Estudios de Inform=C3=A1tica adr;quoted-printable:;;Carretera a Camajuan=C3=AD Km 5 1/2;Santa Clara;Villa Clara;54830;Cuba email;internet:[email protected] title;quoted-printable:Lic. en Ciencia de la Computaci=C3=B3n tel;work:(0142)-226714 tel;home:(0143)-523119 x-mozilla-html:TRUE url:http://www.uclv.edu.cu version:2.1 end:vcard