mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-22 06:57:51 +00:00
os: pl050, pl11x, lan9118 use ARM platform driver
Make the framebuffer driver for pl11x chipsets, the ps2 input driver for pl050, and the lan9116 NIC driver independent from the pbxa9 board by using the newly introduced common ARM platform driver API. Ref #3299
This commit is contained in:
parent
1a80f166c5
commit
70acd4b2d5
@ -23,7 +23,7 @@ proc use_fb_drv { feature_arg } {
|
||||
}
|
||||
|
||||
proc fb_drv_binary { } {
|
||||
if {[have_spec pbxa9]} { return pbxa9_fb_drv }
|
||||
if {[have_spec pbxa9]} { return pl11x_fb_drv }
|
||||
if {[have_spec x86]} { return vesa_fb_drv }
|
||||
if {[have_spec imx53]} { return imx53_fb_drv }
|
||||
if {[have_spec rpi]} { return rpi_fb_drv }
|
||||
|
@ -1,3 +1,4 @@
|
||||
_/src/pbxa9_drivers
|
||||
_/src/platform_drv
|
||||
_/src/input_filter
|
||||
_/raw/drivers_interactive-pbxa9
|
||||
|
@ -1,2 +1,3 @@
|
||||
_/src/lan9118_nic_drv
|
||||
_/src/platform_drv
|
||||
_/raw/drivers_nic-pbxa9
|
||||
|
@ -2,7 +2,6 @@
|
||||
<parent-provides>
|
||||
<service name="IRQ"/>
|
||||
<service name="IO_MEM"/>
|
||||
<service name="IO_PORT"/>
|
||||
<service name="ROM"/>
|
||||
<service name="PD"/>
|
||||
<service name="CPU"/>
|
||||
@ -18,26 +17,94 @@
|
||||
<service name="Input">
|
||||
<default-policy> <child name="input_filter"/> </default-policy> </service>
|
||||
|
||||
<start name="platform_drv">
|
||||
<resource name="RAM" quantum="2M"/>
|
||||
<provides> <service name="Platform"/> </provides>
|
||||
<route> <any-service> <parent/> </any-service> </route>
|
||||
<config>
|
||||
|
||||
<!-- device resource declarations -->
|
||||
|
||||
<device name="clcd">
|
||||
<resource name="IO_MEM" address="0x10020000" size="0x1000"/>
|
||||
<property name="compatible" value="arm,pl111"/>
|
||||
</device>
|
||||
|
||||
<device name="sp810_syscon0">
|
||||
<resource name="IO_MEM" address="0x10001000" size="0x1000"/>
|
||||
<property name="compatible" value="arm,sp810"/>
|
||||
</device>
|
||||
|
||||
<device name="kmi0">
|
||||
<resource name="IO_MEM" address="0x10006000" size="0x1000"/>
|
||||
<resource name="IRQ" number="52"/>
|
||||
<property name="compatible" value="arm,pl050"/>
|
||||
</device>
|
||||
|
||||
<device name="kmi1">
|
||||
<resource name="IO_MEM" address="0x10007000" size="0x1000"/>
|
||||
<resource name="IRQ" number="53"/>
|
||||
<property name="compatible" value="arm,pl050"/>
|
||||
</device>
|
||||
|
||||
<!-- policy part, who owns which devices -->
|
||||
|
||||
<policy label="fb_drv -> ">
|
||||
<device name="clcd"/>
|
||||
<device name="sp810_syscon0"/>
|
||||
</policy>
|
||||
|
||||
<policy label="ps2_drv -> ">
|
||||
<device name="kmi0"/>
|
||||
<device name="kmi1"/>
|
||||
</policy>
|
||||
</config>
|
||||
</start>
|
||||
|
||||
<start name="fb_drv">
|
||||
<binary name="pbxa9_fb_drv"/>
|
||||
<binary name="pl11x_fb_drv"/>
|
||||
<resource name="RAM" quantum="4M"/>
|
||||
<provides> <service name="Framebuffer"/> </provides>
|
||||
<route> <any-service> <parent/> </any-service> </route>
|
||||
<route>
|
||||
<service name="Platform">
|
||||
<child name="platform_drv"/>
|
||||
</service>
|
||||
<service name="ROM"> <parent/> </service>
|
||||
<service name="PD"> <parent/> </service>
|
||||
<service name="CPU"> <parent/> </service>
|
||||
<service name="LOG"> <parent/> </service>
|
||||
<service name="Timer"> <parent/> </service>
|
||||
</route>
|
||||
</start>
|
||||
|
||||
<start name="ps2_drv">
|
||||
<binary name="pbxa9_ps2_drv"/>
|
||||
<binary name="pl050_input_drv"/>
|
||||
<resource name="RAM" quantum="1M"/>
|
||||
<provides> <service name="Input"/> <service name="Framebuffer"/> </provides>
|
||||
<route> <any-service> <parent/> </any-service> </route>
|
||||
<provides>
|
||||
<service name="Input"/> <service name="Framebuffer"/>
|
||||
</provides>
|
||||
<route>
|
||||
<service name="Platform">
|
||||
<child name="platform_drv"/>
|
||||
</service>
|
||||
<service name="ROM"> <parent/> </service>
|
||||
<service name="PD"> <parent/> </service>
|
||||
<service name="CPU"> <parent/> </service>
|
||||
<service name="LOG"> <parent/> </service>
|
||||
<service name="Timer"> <parent/> </service>
|
||||
</route>
|
||||
</start>
|
||||
|
||||
<start name="input_filter" caps="80">
|
||||
<resource name="RAM" quantum="1280K"/>
|
||||
<provides> <service name="Input"/> </provides>
|
||||
<route>
|
||||
<service name="ROM" label="config"> <parent label="input_filter.config"/> </service>
|
||||
<service name="Input" label="ps2"> <child name="ps2_drv"/> </service>
|
||||
<service name="ROM" label="config">
|
||||
<parent label="input_filter.config"/>
|
||||
</service>
|
||||
<service name="Input" label="ps2">
|
||||
<child name="ps2_drv"/>
|
||||
</service>
|
||||
<service name="ROM"> <parent/> </service>
|
||||
<service name="PD"> <parent/> </service>
|
||||
<service name="CPU"> <parent/> </service>
|
||||
|
@ -15,11 +15,42 @@
|
||||
<service name="Nic">
|
||||
<default-policy> <child name="nic_drv"/> </default-policy> </service>
|
||||
|
||||
<start name="platform_drv">
|
||||
<resource name="RAM" quantum="2M"/>
|
||||
<provides> <service name="Platform"/> </provides>
|
||||
<route> <any-service> <parent/> </any-service> </route>
|
||||
<config>
|
||||
|
||||
<!-- device resource declarations -->
|
||||
|
||||
<device name="ethernet">
|
||||
<resource name="IO_MEM" address="0x4e000000" size="0x1000"/>
|
||||
<resource name="IRQ" number="60"/>
|
||||
<property name="compatible" value="smsc,lan9118"/>
|
||||
</device>
|
||||
|
||||
<!-- policy part, who owns which devices -->
|
||||
|
||||
<policy label="nic_drv -> ">
|
||||
<device name="ethernet"/>
|
||||
</policy>
|
||||
</config>
|
||||
</start>
|
||||
|
||||
<start name="nic_drv">
|
||||
<binary name="lan9118_nic_drv"/>
|
||||
<resource name="RAM" quantum="4M"/>
|
||||
<provides> <service name="Nic"/> </provides>
|
||||
<config mmio_base="0x4e000000" irq="60" />
|
||||
<route> <any-service> <parent/> </any-service> </route>
|
||||
<route>
|
||||
<service name="Platform">
|
||||
<child name="platform_drv"/>
|
||||
</service>
|
||||
<service name="ROM"> <parent/> </service>
|
||||
<service name="PD"> <parent/> </service>
|
||||
<service name="CPU"> <parent/> </service>
|
||||
<service name="LOG"> <parent/> </service>
|
||||
<service name="Timer"> <parent/> </service>
|
||||
</route>
|
||||
</start>
|
||||
</config>
|
||||
|
@ -1,3 +1,4 @@
|
||||
base
|
||||
os
|
||||
platform_session
|
||||
nic_session
|
||||
|
@ -4,8 +4,6 @@ content: src/drivers
|
||||
|
||||
src/drivers:
|
||||
mkdir -p $@/framebuffer $@/input/ps2
|
||||
cp -r $(REP_DIR)/src/drivers/framebuffer/spec/pl11x/* $@/framebuffer
|
||||
cp -r $(REP_DIR)/src/drivers/framebuffer/pl11x/* $@/framebuffer
|
||||
cp $(REP_DIR)/src/drivers/input/spec/ps2/*.h $@/input/ps2/
|
||||
cp -r $(REP_DIR)/src/drivers/input/spec/ps2/pbxa9 $@/input/ps2/
|
||||
sed -i "/REQUIRES/s/=.*/= arm/" src/drivers/framebuffer/pbxa9/target.mk
|
||||
sed -i "/REQUIRES/s/=.*/= arm/" src/drivers/input/ps2/pbxa9/target.mk
|
||||
cp -r $(REP_DIR)/src/drivers/input/spec/ps2/pl050 $@/input/ps2/
|
||||
|
@ -2,4 +2,5 @@ base
|
||||
os
|
||||
framebuffer_session
|
||||
input_session
|
||||
platform_session
|
||||
timer_session
|
||||
|
@ -13,22 +13,15 @@
|
||||
*/
|
||||
|
||||
/* Genode includes */
|
||||
#include <base/attached_rom_dataspace.h>
|
||||
#include <base/attached_dataspace.h>
|
||||
#include <base/component.h>
|
||||
#include <base/heap.h>
|
||||
#include <base/log.h>
|
||||
#include <io_mem_session/connection.h>
|
||||
#include <timer_session/connection.h>
|
||||
#include <dataspace/client.h>
|
||||
#include <timer_session/connection.h>
|
||||
#include <framebuffer_session/framebuffer_session.h>
|
||||
#include <os/ring_buffer.h>
|
||||
#include <os/static_root.h>
|
||||
#include <util/reconstructible.h>
|
||||
|
||||
/* device configuration */
|
||||
#include <pl11x_defs.h>
|
||||
#include <sp810_defs.h>
|
||||
#include <platform_session/connection.h>
|
||||
#include <platform_device/client.h>
|
||||
#include <timer_session/connection.h>
|
||||
|
||||
|
||||
/***********************************************
|
||||
@ -58,14 +51,14 @@ namespace Framebuffer
|
||||
class Main;
|
||||
}
|
||||
|
||||
class Framebuffer::Session_component : public Genode::Rpc_object<Framebuffer::Session>
|
||||
class Framebuffer::Session_component :
|
||||
public Genode::Rpc_object<Framebuffer::Session>
|
||||
{
|
||||
private:
|
||||
|
||||
Genode::Dataspace_capability _fb_ds_cap;
|
||||
Genode::Dataspace_client _fb_ds;
|
||||
Genode::addr_t _regs_base;
|
||||
Genode::addr_t _sys_regs_base;
|
||||
Ram_dataspace_capability _fb_ds_cap;
|
||||
addr_t _regs_base;
|
||||
addr_t _sys_regs_base;
|
||||
Timer::Connection _timer;
|
||||
|
||||
enum {
|
||||
@ -88,6 +81,22 @@ class Framebuffer::Session_component : public Genode::Rpc_object<Framebuffer::Se
|
||||
CLCDC_BCD = 1 << 26,
|
||||
};
|
||||
|
||||
enum Sp810_defs {
|
||||
SP810_REG_OSCCLCD = 0x1c,
|
||||
SP810_REG_LOCK = 0x20,
|
||||
};
|
||||
|
||||
enum Pl11x_defs {
|
||||
PL11X_REG_TIMING0 = 0,
|
||||
PL11X_REG_TIMING1 = 1,
|
||||
PL11X_REG_TIMING2 = 2,
|
||||
PL11X_REG_TIMING3 = 3,
|
||||
PL11X_REG_UPBASE = 4,
|
||||
PL11X_REG_LPBASE = 5,
|
||||
PL11X_REG_CTRL = 6,
|
||||
PL11X_REG_IMSC = 7,
|
||||
};
|
||||
|
||||
void sys_reg_write(unsigned reg, long value) {
|
||||
*(volatile long *)(_sys_regs_base + sizeof(long)*reg) = value; }
|
||||
|
||||
@ -105,12 +114,14 @@ class Framebuffer::Session_component : public Genode::Rpc_object<Framebuffer::Se
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Session_component(Genode::Env &env,
|
||||
void *regs_base, void *sys_regs_base,
|
||||
Genode::Dataspace_capability fb_ds_cap)
|
||||
: _fb_ds_cap(fb_ds_cap), _fb_ds(_fb_ds_cap),
|
||||
_regs_base((Genode::addr_t)regs_base),
|
||||
_sys_regs_base((Genode::addr_t)sys_regs_base),
|
||||
Session_component(Env & env,
|
||||
void * regs_base,
|
||||
void * sys_regs_base,
|
||||
Ram_dataspace_capability fb_ds_cap,
|
||||
Genode::addr_t fb_ds_bus_addr)
|
||||
: _fb_ds_cap(fb_ds_cap),
|
||||
_regs_base((addr_t)regs_base),
|
||||
_sys_regs_base((addr_t)sys_regs_base),
|
||||
_timer(env)
|
||||
{
|
||||
using namespace Genode;
|
||||
@ -154,7 +165,7 @@ class Framebuffer::Session_component : public Genode::Rpc_object<Framebuffer::Se
|
||||
reg_write(PL11X_REG_TIMING3, tim3);
|
||||
|
||||
/* set framebuffer address and ctrl register */
|
||||
reg_write(PL11X_REG_UPBASE, _fb_ds.phys_addr());
|
||||
reg_write(PL11X_REG_UPBASE, fb_ds_bus_addr);
|
||||
reg_write(PL11X_REG_LPBASE, 0);
|
||||
reg_write(PL11X_REG_IMSC, 0);
|
||||
reg_write(PL11X_REG_CTRL, ctrl);
|
||||
@ -182,29 +193,33 @@ class Framebuffer::Session_component : public Genode::Rpc_object<Framebuffer::Se
|
||||
|
||||
struct Framebuffer::Main
|
||||
{
|
||||
Env &_env;
|
||||
Entrypoint &_ep;
|
||||
Env & _env;
|
||||
Platform::Connection _platform { _env };
|
||||
Platform::Device_client _pl11x_dev {
|
||||
_platform.device_by_property("compatible", "arm,pl111") };
|
||||
Platform::Device_client _sp810_dev {
|
||||
_platform.device_by_property("compatible", "arm,sp810") };
|
||||
Attached_dataspace _lcd_io_mem { _env.rm(),
|
||||
_pl11x_dev.io_mem_dataspace() };
|
||||
Attached_dataspace _sys_mem { _env.rm(),
|
||||
_sp810_dev.io_mem_dataspace() };
|
||||
Ram_dataspace_capability _fb_ds_cap {
|
||||
_platform.alloc_dma_buffer(FRAMEBUFFER_SIZE) };
|
||||
|
||||
Heap _heap { _env.ram(), _env.rm() };
|
||||
Session_component _fb_session { _env,
|
||||
_lcd_io_mem.local_addr<void*>(),
|
||||
_sys_mem.local_addr<void*>(),
|
||||
_fb_ds_cap,
|
||||
_platform.bus_addr_dma_buffer(_fb_ds_cap) };
|
||||
|
||||
/* locally map LCD control registers */
|
||||
Io_mem_connection _lcd_io_mem { _env, PL11X_LCD_PHYS, PL11X_LCD_SIZE };
|
||||
void * _lcd_base { _env.rm().attach(_lcd_io_mem.dataspace()) };
|
||||
Static_root<Session> _fb_root { _env.ep().manage(_fb_session) };
|
||||
|
||||
/* locally map system control registers */
|
||||
Io_mem_connection _sys_mem { _env, SP810_PHYS, SP810_SIZE };
|
||||
void * _sys_base { _env.rm().attach(_sys_mem.dataspace()) };
|
||||
|
||||
Dataspace_capability _fb_ds_cap { _env.ram().alloc(Framebuffer::FRAMEBUFFER_SIZE) };
|
||||
Session_component _fb_session { _env, _lcd_base, _sys_base, _fb_ds_cap };
|
||||
Static_root<Session> _fb_root { _ep.manage(_fb_session) };
|
||||
|
||||
Main(Env &env) : _env(env), _ep(_env.ep())
|
||||
Main(Env &env) : _env(env)
|
||||
{
|
||||
log("--- pl11x framebuffer driver ---\n");
|
||||
|
||||
/* announce service */
|
||||
_env.parent().announce(_ep.manage(_fb_root));
|
||||
_env.parent().announce(env.ep().manage(_fb_root));
|
||||
}
|
||||
|
||||
private:
|
4
repos/os/src/drivers/framebuffer/pl11x/target.mk
Normal file
4
repos/os/src/drivers/framebuffer/pl11x/target.mk
Normal file
@ -0,0 +1,4 @@
|
||||
TARGET = pl11x_fb_drv
|
||||
REQUIRES = arm_v7
|
||||
SRC_CC = main.cc
|
||||
LIBS = base
|
@ -1,34 +0,0 @@
|
||||
/*
|
||||
* \brief PL111 display controller definitions for the RealView platform
|
||||
* \author Norman Feske
|
||||
* \date 2010-03-23
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2010-2017 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU Affero General Public License version 3.
|
||||
*/
|
||||
|
||||
#ifndef _INCLUDE__SPEC__PBXA9__PL11X_DEFS_H_
|
||||
#define _INCLUDE__SPEC__PBXA9__PL11X_DEFS_H_
|
||||
|
||||
enum {
|
||||
PL11X_LCD_PHYS = 0x10020000,
|
||||
PL11X_LCD_SIZE = 0x1000,
|
||||
|
||||
/**
|
||||
* Offsets of LCD control register offsets (in 32bit words)
|
||||
*/
|
||||
PL11X_REG_TIMING0 = 0,
|
||||
PL11X_REG_TIMING1 = 1,
|
||||
PL11X_REG_TIMING2 = 2,
|
||||
PL11X_REG_TIMING3 = 3,
|
||||
PL11X_REG_UPBASE = 4,
|
||||
PL11X_REG_LPBASE = 5,
|
||||
PL11X_REG_CTRL = 6,
|
||||
PL11X_REG_IMSC = 7,
|
||||
};
|
||||
|
||||
#endif /* _INCLUDE__SPEC__PBXA9__PL11X_DEFS_H_ */
|
@ -1,27 +0,0 @@
|
||||
/*
|
||||
* \brief SP810 System Controller.
|
||||
* \author Stefan Kalkowski
|
||||
* \date 2011-11-14
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2011-2017 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU Affero General Public License version 3.
|
||||
*/
|
||||
|
||||
#ifndef _INCLUDE__SPEC__PBXA9__SP810_DEFS_H_
|
||||
#define _INCLUDE__SPEC__PBXA9__SP810_DEFS_H_
|
||||
|
||||
enum {
|
||||
|
||||
SP810_PHYS = 0x10001000,
|
||||
SP810_SIZE = 0x1000,
|
||||
|
||||
SP810_REG_ID = 0x0,
|
||||
SP810_REG_OSCCLCD = 0x1c,
|
||||
SP810_REG_LOCK = 0x20,
|
||||
};
|
||||
|
||||
#endif /* _INCLUDE__SPEC__PBXA9__SP810_DEFS_H_ */
|
@ -1,7 +0,0 @@
|
||||
TARGET = pbxa9_fb_drv
|
||||
REQUIRES = arm_v7
|
||||
SRC_CC = main.cc
|
||||
LIBS = base
|
||||
INC_DIR += $(PRG_DIR)
|
||||
|
||||
vpath %.cc $(PRG_DIR)/..
|
@ -17,7 +17,7 @@
|
||||
/* Genode includes */
|
||||
#include <base/env.h>
|
||||
#include <base/signal.h>
|
||||
#include <irq_session/connection.h>
|
||||
#include <irq_session/client.h>
|
||||
|
||||
/* local includes */
|
||||
#include "input_driver.h"
|
||||
@ -27,7 +27,7 @@ class Irq_handler
|
||||
{
|
||||
private:
|
||||
|
||||
Genode::Irq_connection _irq;
|
||||
Genode::Irq_session_client _irq;
|
||||
Genode::Signal_handler<Irq_handler> _dispatcher;
|
||||
Input_driver &_input_driver;
|
||||
|
||||
@ -42,10 +42,10 @@ class Irq_handler
|
||||
|
||||
public:
|
||||
|
||||
Irq_handler(Genode::Env &env, int irq_number,
|
||||
Irq_handler(Genode::Env &env, Genode::Irq_session_capability irq_cap,
|
||||
Serial_interface &, Input_driver &input_driver)
|
||||
:
|
||||
_irq(env, irq_number),
|
||||
_irq(irq_cap),
|
||||
_dispatcher(env.ep(), *this, &Irq_handler::_handle),
|
||||
_input_driver(input_driver)
|
||||
{
|
@ -14,9 +14,9 @@
|
||||
/* Genode includes */
|
||||
#include <base/component.h>
|
||||
#include <base/attached_rom_dataspace.h>
|
||||
#include <drivers/defs/pbxa9.h>
|
||||
#include <input/component.h>
|
||||
#include <input/root.h>
|
||||
#include <platform_session/connection.h>
|
||||
#include <timer_session/connection.h>
|
||||
|
||||
/* local includes */
|
||||
@ -31,33 +31,30 @@ namespace Ps2 { struct Main; }
|
||||
|
||||
struct Ps2::Main
|
||||
{
|
||||
Genode::Env &_env;
|
||||
using Device = Platform::Device_client;
|
||||
|
||||
enum {
|
||||
PL050_KEYBD_PHYS = 0x10006000,
|
||||
PL050_KEYBD_SIZE = 0x1000,
|
||||
PL050_MOUSE_PHYS = 0x10007000,
|
||||
PL050_MOUSE_SIZE = 0x1000,
|
||||
PL050_KEYBD_IRQ = Pbxa9::KMI_0_IRQ,
|
||||
PL050_MOUSE_IRQ = Pbxa9::KMI_1_IRQ,
|
||||
};
|
||||
Genode::Env & _env;
|
||||
Platform::Connection _platform { _env };
|
||||
|
||||
Device _device_0 { _platform.device_by_index(0) };
|
||||
Device _device_1 { _platform.device_by_index(1) };
|
||||
Pl050 _pl050 { _env, _device_0.io_mem_dataspace(),
|
||||
_device_1.io_mem_dataspace() };
|
||||
|
||||
Pl050 _pl050 { _env, PL050_KEYBD_PHYS, PL050_KEYBD_SIZE,
|
||||
PL050_MOUSE_PHYS, PL050_MOUSE_SIZE };
|
||||
Input::Session_component _session { _env, _env.ram() };
|
||||
Input::Root_component _root { _env.ep().rpc_ep(), _session };
|
||||
|
||||
Timer::Connection _timer { _env };
|
||||
|
||||
Genode::Attached_rom_dataspace _config { _env, "config" };
|
||||
|
||||
Genode::Reconstructible<Verbose> _verbose { _config.xml() };
|
||||
|
||||
Mouse _mouse { _pl050.aux_interface(), _session.event_queue(), _timer, *_verbose };
|
||||
Keyboard _keyboard { _pl050.kbd_interface(), _session.event_queue(), false, *_verbose };
|
||||
|
||||
Irq_handler _mouse_irq { _env, PL050_MOUSE_IRQ, _pl050.aux_interface(), _mouse };
|
||||
Irq_handler _keyboard_irq { _env, PL050_KEYBD_IRQ, _pl050.kbd_interface(), _keyboard };
|
||||
Irq_handler _mouse_irq { _env, _device_1.irq(),
|
||||
_pl050.aux_interface(), _mouse };
|
||||
Irq_handler _keyboard_irq { _env, _device_0.irq(),
|
||||
_pl050.kbd_interface(), _keyboard };
|
||||
|
||||
Led_state _capslock { _env, "capslock" },
|
||||
_numlock { _env, "numlock" },
|
||||
@ -94,4 +91,3 @@ struct Ps2::Main
|
||||
|
||||
|
||||
void Component::construct(Genode::Env &env) { static Ps2::Main main(env); }
|
||||
|
@ -16,7 +16,8 @@
|
||||
|
||||
/* Genode includes */
|
||||
#include <os/ring_buffer.h>
|
||||
#include <base/attached_io_mem_dataspace.h>
|
||||
#include <base/attached_dataspace.h>
|
||||
#include <io_mem_session/client.h>
|
||||
|
||||
/* local includes */
|
||||
#include "serial_interface.h"
|
||||
@ -67,8 +68,8 @@ class Pl050
|
||||
_Channel &operator = (_Channel const &);
|
||||
|
||||
Genode::Mutex _mutex { };
|
||||
Genode::Attached_io_mem_dataspace _io_mem;
|
||||
volatile Genode::uint32_t *_reg_base;
|
||||
Genode::Attached_dataspace _io_mem_ds;
|
||||
volatile Genode::uint32_t * _reg_base;
|
||||
|
||||
/**
|
||||
* Return true if input is available
|
||||
@ -78,17 +79,11 @@ class Pl050
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* \param phys_base local address of the channel's device
|
||||
* registers
|
||||
*/
|
||||
_Channel(Genode::Env &env,
|
||||
Genode::addr_t phys_base, Genode::size_t phys_size)
|
||||
_Channel(Genode::Env & env,
|
||||
Genode::Io_mem_dataspace_capability cap)
|
||||
:
|
||||
_io_mem(env, phys_base, phys_size),
|
||||
_reg_base(_io_mem.local_addr<Genode::uint32_t>())
|
||||
_io_mem_ds(env.rm(), cap),
|
||||
_reg_base(_io_mem_ds.local_addr<Genode::uint32_t>())
|
||||
{ }
|
||||
|
||||
/**
|
||||
@ -129,13 +124,11 @@ class Pl050
|
||||
|
||||
public:
|
||||
|
||||
Pl050(Genode::Env &env,
|
||||
Genode::addr_t keyb_mmio_base,
|
||||
Genode::size_t keyb_mmio_size,
|
||||
Genode::addr_t mouse_mmio_base,
|
||||
Genode::size_t mouse_mmio_size) :
|
||||
_kbd(env, keyb_mmio_base, keyb_mmio_size),
|
||||
_aux(env, mouse_mmio_base, mouse_mmio_size)
|
||||
Pl050(Genode::Env & env,
|
||||
Genode::Io_mem_dataspace_capability keyb_cap,
|
||||
Genode::Io_mem_dataspace_capability mouse_cap) :
|
||||
_kbd(env, keyb_cap),
|
||||
_aux(env, mouse_cap)
|
||||
{
|
||||
_kbd.enable_irq();
|
||||
_aux.enable_irq();
|
@ -1,4 +1,4 @@
|
||||
TARGET = pbxa9_ps2_drv
|
||||
TARGET = pl050_input_drv
|
||||
REQUIRES = arm_v7
|
||||
SRC_CC = main.cc
|
||||
LIBS = base
|
@ -15,10 +15,10 @@
|
||||
#ifndef _DRIVERS__NIC__SPEC__LAN9118__LAN9118_H_
|
||||
#define _DRIVERS__NIC__SPEC__LAN9118__LAN9118_H_
|
||||
|
||||
#include <base/attached_io_mem_dataspace.h>
|
||||
#include <base/attached_dataspace.h>
|
||||
#include <base/log.h>
|
||||
#include <util/misc_math.h>
|
||||
#include <irq_session/connection.h>
|
||||
#include <irq_session/client.h>
|
||||
#include <timer_session/connection.h>
|
||||
#include <nic/component.h>
|
||||
|
||||
@ -74,11 +74,11 @@ class Lan9118 : public Nic::Session_component
|
||||
MAC_CSR_CMD_WRITE = (0 << 30),
|
||||
};
|
||||
|
||||
Genode::Attached_io_mem_dataspace _mmio;
|
||||
Genode::Attached_dataspace _mmio;
|
||||
volatile Genode::uint32_t *_reg_base;
|
||||
Timer::Connection _timer;
|
||||
Nic::Mac_address _mac_addr { };
|
||||
Genode::Irq_connection _irq;
|
||||
Genode::Irq_session_client _irq;
|
||||
Genode::Signal_handler<Lan9118> _irq_handler;
|
||||
|
||||
/**
|
||||
@ -304,17 +304,18 @@ class Lan9118 : public Nic::Session_component
|
||||
*
|
||||
* \throw Device_not_supported
|
||||
*/
|
||||
Lan9118(Genode::addr_t mmio_base, Genode::size_t mmio_size, int irq,
|
||||
Lan9118(Genode::Io_mem_dataspace_capability ds_cap,
|
||||
Genode::Irq_session_capability irq_cap,
|
||||
Genode::size_t const tx_buf_size,
|
||||
Genode::size_t const rx_buf_size,
|
||||
Genode::Allocator &rx_block_md_alloc,
|
||||
Genode::Env &env)
|
||||
Genode::Allocator & rx_block_md_alloc,
|
||||
Genode::Env & env)
|
||||
: Session_component(tx_buf_size, rx_buf_size, Genode::CACHED,
|
||||
rx_block_md_alloc, env),
|
||||
_mmio(env, mmio_base, mmio_size),
|
||||
_mmio(env.rm(), ds_cap),
|
||||
_reg_base(_mmio.local_addr<Genode::uint32_t>()),
|
||||
_timer(env),
|
||||
_irq(env, irq),
|
||||
_irq(irq_cap),
|
||||
_irq_handler(env.ep(), *this, &Lan9118::_handle_irq)
|
||||
{
|
||||
_irq.sigh(_irq_handler);
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include <base/env.h>
|
||||
#include <base/heap.h>
|
||||
#include <nic/component.h>
|
||||
#include <platform_session/connection.h>
|
||||
#include <root/component.h>
|
||||
|
||||
/* driver code */
|
||||
@ -30,28 +31,9 @@ class Root : public Genode::Root_component<Lan9118, Genode::Single_client>
|
||||
{
|
||||
private:
|
||||
|
||||
enum {
|
||||
|
||||
/**
|
||||
* If no resource addresses are given, we take these Realview
|
||||
* platform addresses as default ones.
|
||||
*/
|
||||
REALVIEW_MMIO_BASE = 0x4e000000,
|
||||
REALVIEW_IRQ = 60,
|
||||
|
||||
/**
|
||||
* Size of MMIO resource
|
||||
*
|
||||
* The device spans actually a much larger
|
||||
* resource. However, only the first page is needed.
|
||||
*/
|
||||
LAN9118_MMIO_SIZE = 0x1000,
|
||||
};
|
||||
|
||||
Genode::Env &_env;
|
||||
Genode::Attached_rom_dataspace _config { _env, "config" };
|
||||
Genode::addr_t _mmio_base { REALVIEW_MMIO_BASE };
|
||||
unsigned _irq { REALVIEW_IRQ };
|
||||
Genode::Env & _env;
|
||||
Platform::Connection _platform { _env };
|
||||
Platform::Device_client _device { _platform.device_by_index(0) };
|
||||
|
||||
protected:
|
||||
|
||||
@ -75,7 +57,7 @@ class Root : public Genode::Root_component<Lan9118, Genode::Single_client>
|
||||
}
|
||||
|
||||
return new (Root::md_alloc())
|
||||
Lan9118(_mmio_base, LAN9118_MMIO_SIZE, _irq,
|
||||
Lan9118(_device.io_mem_dataspace(), _device.irq(),
|
||||
tx_buf_size, rx_buf_size, *md_alloc(), _env);
|
||||
}
|
||||
|
||||
@ -84,13 +66,7 @@ class Root : public Genode::Root_component<Lan9118, Genode::Single_client>
|
||||
Root(Genode::Env &env, Genode::Allocator &md_alloc)
|
||||
: Genode::Root_component<Lan9118,
|
||||
Genode::Single_client>(env.ep(), md_alloc),
|
||||
_env(env)
|
||||
{
|
||||
_mmio_base =
|
||||
_config.xml().attribute_value("mmio_base",
|
||||
(Genode::addr_t)REALVIEW_MMIO_BASE);
|
||||
_irq = _config.xml().attribute_value<unsigned>("irq", REALVIEW_IRQ);
|
||||
}
|
||||
_env(env) { }
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user