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 { } {
|
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 x86]} { return vesa_fb_drv }
|
||||||
if {[have_spec imx53]} { return imx53_fb_drv }
|
if {[have_spec imx53]} { return imx53_fb_drv }
|
||||||
if {[have_spec rpi]} { return rpi_fb_drv }
|
if {[have_spec rpi]} { return rpi_fb_drv }
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
_/src/pbxa9_drivers
|
_/src/pbxa9_drivers
|
||||||
|
_/src/platform_drv
|
||||||
_/src/input_filter
|
_/src/input_filter
|
||||||
_/raw/drivers_interactive-pbxa9
|
_/raw/drivers_interactive-pbxa9
|
||||||
|
@ -1,2 +1,3 @@
|
|||||||
_/src/lan9118_nic_drv
|
_/src/lan9118_nic_drv
|
||||||
|
_/src/platform_drv
|
||||||
_/raw/drivers_nic-pbxa9
|
_/raw/drivers_nic-pbxa9
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
<parent-provides>
|
<parent-provides>
|
||||||
<service name="IRQ"/>
|
<service name="IRQ"/>
|
||||||
<service name="IO_MEM"/>
|
<service name="IO_MEM"/>
|
||||||
<service name="IO_PORT"/>
|
|
||||||
<service name="ROM"/>
|
<service name="ROM"/>
|
||||||
<service name="PD"/>
|
<service name="PD"/>
|
||||||
<service name="CPU"/>
|
<service name="CPU"/>
|
||||||
@ -18,26 +17,94 @@
|
|||||||
<service name="Input">
|
<service name="Input">
|
||||||
<default-policy> <child name="input_filter"/> </default-policy> </service>
|
<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">
|
<start name="fb_drv">
|
||||||
<binary name="pbxa9_fb_drv"/>
|
<binary name="pl11x_fb_drv"/>
|
||||||
<resource name="RAM" quantum="4M"/>
|
<resource name="RAM" quantum="4M"/>
|
||||||
<provides> <service name="Framebuffer"/> </provides>
|
<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>
|
||||||
|
|
||||||
<start name="ps2_drv">
|
<start name="ps2_drv">
|
||||||
<binary name="pbxa9_ps2_drv"/>
|
<binary name="pl050_input_drv"/>
|
||||||
<resource name="RAM" quantum="1M"/>
|
<resource name="RAM" quantum="1M"/>
|
||||||
<provides> <service name="Input"/> <service name="Framebuffer"/> </provides>
|
<provides>
|
||||||
<route> <any-service> <parent/> </any-service> </route>
|
<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>
|
||||||
|
|
||||||
<start name="input_filter" caps="80">
|
<start name="input_filter" caps="80">
|
||||||
<resource name="RAM" quantum="1280K"/>
|
<resource name="RAM" quantum="1280K"/>
|
||||||
<provides> <service name="Input"/> </provides>
|
<provides> <service name="Input"/> </provides>
|
||||||
<route>
|
<route>
|
||||||
<service name="ROM" label="config"> <parent label="input_filter.config"/> </service>
|
<service name="ROM" label="config">
|
||||||
<service name="Input" label="ps2"> <child name="ps2_drv"/> </service>
|
<parent label="input_filter.config"/>
|
||||||
|
</service>
|
||||||
|
<service name="Input" label="ps2">
|
||||||
|
<child name="ps2_drv"/>
|
||||||
|
</service>
|
||||||
<service name="ROM"> <parent/> </service>
|
<service name="ROM"> <parent/> </service>
|
||||||
<service name="PD"> <parent/> </service>
|
<service name="PD"> <parent/> </service>
|
||||||
<service name="CPU"> <parent/> </service>
|
<service name="CPU"> <parent/> </service>
|
||||||
|
@ -15,11 +15,42 @@
|
|||||||
<service name="Nic">
|
<service name="Nic">
|
||||||
<default-policy> <child name="nic_drv"/> </default-policy> </service>
|
<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">
|
<start name="nic_drv">
|
||||||
<binary name="lan9118_nic_drv"/>
|
<binary name="lan9118_nic_drv"/>
|
||||||
<resource name="RAM" quantum="4M"/>
|
<resource name="RAM" quantum="4M"/>
|
||||||
<provides> <service name="Nic"/> </provides>
|
<provides> <service name="Nic"/> </provides>
|
||||||
<config mmio_base="0x4e000000" irq="60" />
|
<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>
|
</start>
|
||||||
</config>
|
</config>
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
base
|
base
|
||||||
os
|
os
|
||||||
|
platform_session
|
||||||
nic_session
|
nic_session
|
||||||
|
@ -4,8 +4,6 @@ content: src/drivers
|
|||||||
|
|
||||||
src/drivers:
|
src/drivers:
|
||||||
mkdir -p $@/framebuffer $@/input/ps2
|
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 $(REP_DIR)/src/drivers/input/spec/ps2/*.h $@/input/ps2/
|
||||||
cp -r $(REP_DIR)/src/drivers/input/spec/ps2/pbxa9 $@/input/ps2/
|
cp -r $(REP_DIR)/src/drivers/input/spec/ps2/pl050 $@/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
|
|
||||||
|
@ -2,4 +2,5 @@ base
|
|||||||
os
|
os
|
||||||
framebuffer_session
|
framebuffer_session
|
||||||
input_session
|
input_session
|
||||||
|
platform_session
|
||||||
timer_session
|
timer_session
|
||||||
|
@ -13,22 +13,15 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* Genode includes */
|
/* Genode includes */
|
||||||
#include <base/attached_rom_dataspace.h>
|
#include <base/attached_dataspace.h>
|
||||||
#include <base/component.h>
|
#include <base/component.h>
|
||||||
#include <base/heap.h>
|
|
||||||
#include <base/log.h>
|
#include <base/log.h>
|
||||||
#include <io_mem_session/connection.h>
|
|
||||||
#include <timer_session/connection.h>
|
|
||||||
#include <dataspace/client.h>
|
#include <dataspace/client.h>
|
||||||
#include <timer_session/connection.h>
|
|
||||||
#include <framebuffer_session/framebuffer_session.h>
|
#include <framebuffer_session/framebuffer_session.h>
|
||||||
#include <os/ring_buffer.h>
|
|
||||||
#include <os/static_root.h>
|
#include <os/static_root.h>
|
||||||
#include <util/reconstructible.h>
|
#include <platform_session/connection.h>
|
||||||
|
#include <platform_device/client.h>
|
||||||
/* device configuration */
|
#include <timer_session/connection.h>
|
||||||
#include <pl11x_defs.h>
|
|
||||||
#include <sp810_defs.h>
|
|
||||||
|
|
||||||
|
|
||||||
/***********************************************
|
/***********************************************
|
||||||
@ -58,14 +51,14 @@ namespace Framebuffer
|
|||||||
class Main;
|
class Main;
|
||||||
}
|
}
|
||||||
|
|
||||||
class Framebuffer::Session_component : public Genode::Rpc_object<Framebuffer::Session>
|
class Framebuffer::Session_component :
|
||||||
|
public Genode::Rpc_object<Framebuffer::Session>
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
|
||||||
Genode::Dataspace_capability _fb_ds_cap;
|
Ram_dataspace_capability _fb_ds_cap;
|
||||||
Genode::Dataspace_client _fb_ds;
|
addr_t _regs_base;
|
||||||
Genode::addr_t _regs_base;
|
addr_t _sys_regs_base;
|
||||||
Genode::addr_t _sys_regs_base;
|
|
||||||
Timer::Connection _timer;
|
Timer::Connection _timer;
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
@ -88,6 +81,22 @@ class Framebuffer::Session_component : public Genode::Rpc_object<Framebuffer::Se
|
|||||||
CLCDC_BCD = 1 << 26,
|
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) {
|
void sys_reg_write(unsigned reg, long value) {
|
||||||
*(volatile long *)(_sys_regs_base + sizeof(long)*reg) = 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
|
* Constructor
|
||||||
*/
|
*/
|
||||||
Session_component(Genode::Env &env,
|
Session_component(Env & env,
|
||||||
void *regs_base, void *sys_regs_base,
|
void * regs_base,
|
||||||
Genode::Dataspace_capability fb_ds_cap)
|
void * sys_regs_base,
|
||||||
: _fb_ds_cap(fb_ds_cap), _fb_ds(_fb_ds_cap),
|
Ram_dataspace_capability fb_ds_cap,
|
||||||
_regs_base((Genode::addr_t)regs_base),
|
Genode::addr_t fb_ds_bus_addr)
|
||||||
_sys_regs_base((Genode::addr_t)sys_regs_base),
|
: _fb_ds_cap(fb_ds_cap),
|
||||||
|
_regs_base((addr_t)regs_base),
|
||||||
|
_sys_regs_base((addr_t)sys_regs_base),
|
||||||
_timer(env)
|
_timer(env)
|
||||||
{
|
{
|
||||||
using namespace Genode;
|
using namespace Genode;
|
||||||
@ -154,7 +165,7 @@ class Framebuffer::Session_component : public Genode::Rpc_object<Framebuffer::Se
|
|||||||
reg_write(PL11X_REG_TIMING3, tim3);
|
reg_write(PL11X_REG_TIMING3, tim3);
|
||||||
|
|
||||||
/* set framebuffer address and ctrl register */
|
/* 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_LPBASE, 0);
|
||||||
reg_write(PL11X_REG_IMSC, 0);
|
reg_write(PL11X_REG_IMSC, 0);
|
||||||
reg_write(PL11X_REG_CTRL, ctrl);
|
reg_write(PL11X_REG_CTRL, ctrl);
|
||||||
@ -182,29 +193,33 @@ class Framebuffer::Session_component : public Genode::Rpc_object<Framebuffer::Se
|
|||||||
|
|
||||||
struct Framebuffer::Main
|
struct Framebuffer::Main
|
||||||
{
|
{
|
||||||
Env &_env;
|
Env & _env;
|
||||||
Entrypoint &_ep;
|
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 */
|
Static_root<Session> _fb_root { _env.ep().manage(_fb_session) };
|
||||||
Io_mem_connection _lcd_io_mem { _env, PL11X_LCD_PHYS, PL11X_LCD_SIZE };
|
|
||||||
void * _lcd_base { _env.rm().attach(_lcd_io_mem.dataspace()) };
|
|
||||||
|
|
||||||
/* locally map system control registers */
|
Main(Env &env) : _env(env)
|
||||||
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())
|
|
||||||
{
|
{
|
||||||
log("--- pl11x framebuffer driver ---\n");
|
log("--- pl11x framebuffer driver ---\n");
|
||||||
|
|
||||||
/* announce service */
|
/* announce service */
|
||||||
_env.parent().announce(_ep.manage(_fb_root));
|
_env.parent().announce(env.ep().manage(_fb_root));
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
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 */
|
/* Genode includes */
|
||||||
#include <base/env.h>
|
#include <base/env.h>
|
||||||
#include <base/signal.h>
|
#include <base/signal.h>
|
||||||
#include <irq_session/connection.h>
|
#include <irq_session/client.h>
|
||||||
|
|
||||||
/* local includes */
|
/* local includes */
|
||||||
#include "input_driver.h"
|
#include "input_driver.h"
|
||||||
@ -27,7 +27,7 @@ class Irq_handler
|
|||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
|
||||||
Genode::Irq_connection _irq;
|
Genode::Irq_session_client _irq;
|
||||||
Genode::Signal_handler<Irq_handler> _dispatcher;
|
Genode::Signal_handler<Irq_handler> _dispatcher;
|
||||||
Input_driver &_input_driver;
|
Input_driver &_input_driver;
|
||||||
|
|
||||||
@ -42,10 +42,10 @@ class Irq_handler
|
|||||||
|
|
||||||
public:
|
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)
|
Serial_interface &, Input_driver &input_driver)
|
||||||
:
|
:
|
||||||
_irq(env, irq_number),
|
_irq(irq_cap),
|
||||||
_dispatcher(env.ep(), *this, &Irq_handler::_handle),
|
_dispatcher(env.ep(), *this, &Irq_handler::_handle),
|
||||||
_input_driver(input_driver)
|
_input_driver(input_driver)
|
||||||
{
|
{
|
@ -14,9 +14,9 @@
|
|||||||
/* Genode includes */
|
/* Genode includes */
|
||||||
#include <base/component.h>
|
#include <base/component.h>
|
||||||
#include <base/attached_rom_dataspace.h>
|
#include <base/attached_rom_dataspace.h>
|
||||||
#include <drivers/defs/pbxa9.h>
|
|
||||||
#include <input/component.h>
|
#include <input/component.h>
|
||||||
#include <input/root.h>
|
#include <input/root.h>
|
||||||
|
#include <platform_session/connection.h>
|
||||||
#include <timer_session/connection.h>
|
#include <timer_session/connection.h>
|
||||||
|
|
||||||
/* local includes */
|
/* local includes */
|
||||||
@ -31,33 +31,30 @@ namespace Ps2 { struct Main; }
|
|||||||
|
|
||||||
struct Ps2::Main
|
struct Ps2::Main
|
||||||
{
|
{
|
||||||
Genode::Env &_env;
|
using Device = Platform::Device_client;
|
||||||
|
|
||||||
enum {
|
Genode::Env & _env;
|
||||||
PL050_KEYBD_PHYS = 0x10006000,
|
Platform::Connection _platform { _env };
|
||||||
PL050_KEYBD_SIZE = 0x1000,
|
|
||||||
PL050_MOUSE_PHYS = 0x10007000,
|
Device _device_0 { _platform.device_by_index(0) };
|
||||||
PL050_MOUSE_SIZE = 0x1000,
|
Device _device_1 { _platform.device_by_index(1) };
|
||||||
PL050_KEYBD_IRQ = Pbxa9::KMI_0_IRQ,
|
Pl050 _pl050 { _env, _device_0.io_mem_dataspace(),
|
||||||
PL050_MOUSE_IRQ = Pbxa9::KMI_1_IRQ,
|
_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::Session_component _session { _env, _env.ram() };
|
||||||
Input::Root_component _root { _env.ep().rpc_ep(), _session };
|
Input::Root_component _root { _env.ep().rpc_ep(), _session };
|
||||||
|
|
||||||
Timer::Connection _timer { _env };
|
Timer::Connection _timer { _env };
|
||||||
|
|
||||||
Genode::Attached_rom_dataspace _config { _env, "config" };
|
Genode::Attached_rom_dataspace _config { _env, "config" };
|
||||||
|
|
||||||
Genode::Reconstructible<Verbose> _verbose { _config.xml() };
|
Genode::Reconstructible<Verbose> _verbose { _config.xml() };
|
||||||
|
|
||||||
Mouse _mouse { _pl050.aux_interface(), _session.event_queue(), _timer, *_verbose };
|
Mouse _mouse { _pl050.aux_interface(), _session.event_queue(), _timer, *_verbose };
|
||||||
Keyboard _keyboard { _pl050.kbd_interface(), _session.event_queue(), false, *_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 _mouse_irq { _env, _device_1.irq(),
|
||||||
Irq_handler _keyboard_irq { _env, PL050_KEYBD_IRQ, _pl050.kbd_interface(), _keyboard };
|
_pl050.aux_interface(), _mouse };
|
||||||
|
Irq_handler _keyboard_irq { _env, _device_0.irq(),
|
||||||
|
_pl050.kbd_interface(), _keyboard };
|
||||||
|
|
||||||
Led_state _capslock { _env, "capslock" },
|
Led_state _capslock { _env, "capslock" },
|
||||||
_numlock { _env, "numlock" },
|
_numlock { _env, "numlock" },
|
||||||
@ -94,4 +91,3 @@ struct Ps2::Main
|
|||||||
|
|
||||||
|
|
||||||
void Component::construct(Genode::Env &env) { static Ps2::Main main(env); }
|
void Component::construct(Genode::Env &env) { static Ps2::Main main(env); }
|
||||||
|
|
@ -16,7 +16,8 @@
|
|||||||
|
|
||||||
/* Genode includes */
|
/* Genode includes */
|
||||||
#include <os/ring_buffer.h>
|
#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 */
|
/* local includes */
|
||||||
#include "serial_interface.h"
|
#include "serial_interface.h"
|
||||||
@ -67,8 +68,8 @@ class Pl050
|
|||||||
_Channel &operator = (_Channel const &);
|
_Channel &operator = (_Channel const &);
|
||||||
|
|
||||||
Genode::Mutex _mutex { };
|
Genode::Mutex _mutex { };
|
||||||
Genode::Attached_io_mem_dataspace _io_mem;
|
Genode::Attached_dataspace _io_mem_ds;
|
||||||
volatile Genode::uint32_t *_reg_base;
|
volatile Genode::uint32_t * _reg_base;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return true if input is available
|
* Return true if input is available
|
||||||
@ -78,17 +79,11 @@ class Pl050
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/**
|
_Channel(Genode::Env & env,
|
||||||
* Constructor
|
Genode::Io_mem_dataspace_capability cap)
|
||||||
*
|
|
||||||
* \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)
|
|
||||||
:
|
:
|
||||||
_io_mem(env, phys_base, phys_size),
|
_io_mem_ds(env.rm(), cap),
|
||||||
_reg_base(_io_mem.local_addr<Genode::uint32_t>())
|
_reg_base(_io_mem_ds.local_addr<Genode::uint32_t>())
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -129,13 +124,11 @@ class Pl050
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
Pl050(Genode::Env &env,
|
Pl050(Genode::Env & env,
|
||||||
Genode::addr_t keyb_mmio_base,
|
Genode::Io_mem_dataspace_capability keyb_cap,
|
||||||
Genode::size_t keyb_mmio_size,
|
Genode::Io_mem_dataspace_capability mouse_cap) :
|
||||||
Genode::addr_t mouse_mmio_base,
|
_kbd(env, keyb_cap),
|
||||||
Genode::size_t mouse_mmio_size) :
|
_aux(env, mouse_cap)
|
||||||
_kbd(env, keyb_mmio_base, keyb_mmio_size),
|
|
||||||
_aux(env, mouse_mmio_base, mouse_mmio_size)
|
|
||||||
{
|
{
|
||||||
_kbd.enable_irq();
|
_kbd.enable_irq();
|
||||||
_aux.enable_irq();
|
_aux.enable_irq();
|
@ -1,4 +1,4 @@
|
|||||||
TARGET = pbxa9_ps2_drv
|
TARGET = pl050_input_drv
|
||||||
REQUIRES = arm_v7
|
REQUIRES = arm_v7
|
||||||
SRC_CC = main.cc
|
SRC_CC = main.cc
|
||||||
LIBS = base
|
LIBS = base
|
@ -15,10 +15,10 @@
|
|||||||
#ifndef _DRIVERS__NIC__SPEC__LAN9118__LAN9118_H_
|
#ifndef _DRIVERS__NIC__SPEC__LAN9118__LAN9118_H_
|
||||||
#define _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 <base/log.h>
|
||||||
#include <util/misc_math.h>
|
#include <util/misc_math.h>
|
||||||
#include <irq_session/connection.h>
|
#include <irq_session/client.h>
|
||||||
#include <timer_session/connection.h>
|
#include <timer_session/connection.h>
|
||||||
#include <nic/component.h>
|
#include <nic/component.h>
|
||||||
|
|
||||||
@ -74,11 +74,11 @@ class Lan9118 : public Nic::Session_component
|
|||||||
MAC_CSR_CMD_WRITE = (0 << 30),
|
MAC_CSR_CMD_WRITE = (0 << 30),
|
||||||
};
|
};
|
||||||
|
|
||||||
Genode::Attached_io_mem_dataspace _mmio;
|
Genode::Attached_dataspace _mmio;
|
||||||
volatile Genode::uint32_t *_reg_base;
|
volatile Genode::uint32_t *_reg_base;
|
||||||
Timer::Connection _timer;
|
Timer::Connection _timer;
|
||||||
Nic::Mac_address _mac_addr { };
|
Nic::Mac_address _mac_addr { };
|
||||||
Genode::Irq_connection _irq;
|
Genode::Irq_session_client _irq;
|
||||||
Genode::Signal_handler<Lan9118> _irq_handler;
|
Genode::Signal_handler<Lan9118> _irq_handler;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -304,17 +304,18 @@ class Lan9118 : public Nic::Session_component
|
|||||||
*
|
*
|
||||||
* \throw Device_not_supported
|
* \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 tx_buf_size,
|
||||||
Genode::size_t const rx_buf_size,
|
Genode::size_t const rx_buf_size,
|
||||||
Genode::Allocator &rx_block_md_alloc,
|
Genode::Allocator & rx_block_md_alloc,
|
||||||
Genode::Env &env)
|
Genode::Env & env)
|
||||||
: Session_component(tx_buf_size, rx_buf_size, Genode::CACHED,
|
: Session_component(tx_buf_size, rx_buf_size, Genode::CACHED,
|
||||||
rx_block_md_alloc, env),
|
rx_block_md_alloc, env),
|
||||||
_mmio(env, mmio_base, mmio_size),
|
_mmio(env.rm(), ds_cap),
|
||||||
_reg_base(_mmio.local_addr<Genode::uint32_t>()),
|
_reg_base(_mmio.local_addr<Genode::uint32_t>()),
|
||||||
_timer(env),
|
_timer(env),
|
||||||
_irq(env, irq),
|
_irq(irq_cap),
|
||||||
_irq_handler(env.ep(), *this, &Lan9118::_handle_irq)
|
_irq_handler(env.ep(), *this, &Lan9118::_handle_irq)
|
||||||
{
|
{
|
||||||
_irq.sigh(_irq_handler);
|
_irq.sigh(_irq_handler);
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#include <base/env.h>
|
#include <base/env.h>
|
||||||
#include <base/heap.h>
|
#include <base/heap.h>
|
||||||
#include <nic/component.h>
|
#include <nic/component.h>
|
||||||
|
#include <platform_session/connection.h>
|
||||||
#include <root/component.h>
|
#include <root/component.h>
|
||||||
|
|
||||||
/* driver code */
|
/* driver code */
|
||||||
@ -30,28 +31,9 @@ class Root : public Genode::Root_component<Lan9118, Genode::Single_client>
|
|||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
|
||||||
enum {
|
Genode::Env & _env;
|
||||||
|
Platform::Connection _platform { _env };
|
||||||
/**
|
Platform::Device_client _device { _platform.device_by_index(0) };
|
||||||
* 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 };
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
@ -75,7 +57,7 @@ class Root : public Genode::Root_component<Lan9118, Genode::Single_client>
|
|||||||
}
|
}
|
||||||
|
|
||||||
return new (Root::md_alloc())
|
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);
|
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)
|
Root(Genode::Env &env, Genode::Allocator &md_alloc)
|
||||||
: Genode::Root_component<Lan9118,
|
: Genode::Root_component<Lan9118,
|
||||||
Genode::Single_client>(env.ep(), md_alloc),
|
Genode::Single_client>(env.ep(), md_alloc),
|
||||||
_env(env)
|
_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);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user