parent
aa004cf211
commit
55cfa22ac9
|
@ -13,22 +13,22 @@
|
|||
*/
|
||||
|
||||
/* Genode includes */
|
||||
#include <base/printf.h>
|
||||
#include <base/sleep.h>
|
||||
#include <base/rpc_server.h>
|
||||
#include <base/attached_rom_dataspace.h>
|
||||
#include <base/component.h>
|
||||
#include <base/heap.h>
|
||||
#include <base/log.h>
|
||||
#include <io_mem_session/connection.h>
|
||||
#include <cap_session/connection.h>
|
||||
#include <timer_session/connection.h>
|
||||
#include <dataspace/client.h>
|
||||
#include <timer_session/connection.h>
|
||||
#include <framebuffer_session/framebuffer_session.h>
|
||||
#include <root/component.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 <video_memory.h>
|
||||
|
||||
|
||||
/***********************************************
|
||||
|
@ -52,7 +52,13 @@ namespace Framebuffer
|
|||
FRAMEBUFFER_SIZE = SCR_WIDTH*SCR_HEIGHT*BYTES_PER_PIXEL,
|
||||
};
|
||||
|
||||
class Session_component : public Genode::Rpc_object<Session>
|
||||
class Session_component;
|
||||
|
||||
using namespace Genode;
|
||||
class Main;
|
||||
}
|
||||
|
||||
class Framebuffer::Session_component : public Genode::Rpc_object<Framebuffer::Session>
|
||||
{
|
||||
private:
|
||||
|
||||
|
@ -99,11 +105,13 @@ namespace Framebuffer
|
|||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Session_component(void *regs_base, void *sys_regs_base,
|
||||
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)
|
||||
_sys_regs_base((Genode::addr_t)sys_regs_base),
|
||||
_timer(env)
|
||||
{
|
||||
using namespace Genode;
|
||||
|
||||
|
@ -172,61 +180,36 @@ namespace Framebuffer
|
|||
};
|
||||
|
||||
|
||||
class Root : public Genode::Root_component<Session_component>
|
||||
struct Framebuffer::Main
|
||||
{
|
||||
private:
|
||||
Env &_env;
|
||||
Entrypoint &_ep;
|
||||
|
||||
void *_lcd_regs_base;
|
||||
void *_sys_regs_base;
|
||||
Genode::Dataspace_capability _fb_ds_cap;
|
||||
|
||||
protected:
|
||||
|
||||
Session_component *_create_session(const char *args) override {
|
||||
return new (md_alloc()) Session_component(_lcd_regs_base,
|
||||
_sys_regs_base,
|
||||
_fb_ds_cap); }
|
||||
|
||||
public:
|
||||
|
||||
Root(Genode::Rpc_entrypoint *session_ep, Genode::Allocator *md_alloc,
|
||||
void *lcd_regs_base, void *sys_regs_base,
|
||||
Genode::Dataspace_capability fb_ds_cap)
|
||||
: Genode::Root_component<Session_component>(session_ep, md_alloc),
|
||||
_lcd_regs_base(lcd_regs_base), _sys_regs_base(sys_regs_base),
|
||||
_fb_ds_cap(fb_ds_cap) { }
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
using namespace Genode;
|
||||
|
||||
int main(int, char **)
|
||||
{
|
||||
printf("--- pl11x framebuffer driver ---\n");
|
||||
Heap _heap { _env.ram(), _env.rm() };
|
||||
|
||||
/* locally map LCD control registers */
|
||||
Io_mem_connection lcd_io_mem(PL11X_LCD_PHYS, PL11X_LCD_SIZE);
|
||||
void *lcd_base = env()->rm_session()->attach(lcd_io_mem.dataspace());
|
||||
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 */
|
||||
Io_mem_connection sys_mem(SP810_PHYS, SP810_SIZE);
|
||||
void *sys_base = env()->rm_session()->attach(sys_mem.dataspace());
|
||||
Io_mem_connection _sys_mem { SP810_PHYS, SP810_SIZE };
|
||||
void * _sys_base { _env.rm().attach(_sys_mem.dataspace()) };
|
||||
|
||||
enum { STACK_SIZE = 4096 };
|
||||
static Cap_connection cap;
|
||||
static Rpc_entrypoint ep(&cap, STACK_SIZE, "fb_ep");
|
||||
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) };
|
||||
|
||||
Dataspace_capability fb_ds_cap =
|
||||
Framebuffer::alloc_video_memory(Framebuffer::FRAMEBUFFER_SIZE);
|
||||
Main(Env &env) : _env(env), _ep(_env.ep())
|
||||
{
|
||||
log("--- pl11x framebuffer driver ---\n");
|
||||
|
||||
/*
|
||||
* Let the entry point serve the framebuffer and input root interfaces
|
||||
*/
|
||||
static Framebuffer::Root fb_root(&ep, env()->heap(), lcd_base, sys_base, fb_ds_cap);
|
||||
env()->parent()->announce(ep.manage(&fb_root));
|
||||
|
||||
sleep_forever();
|
||||
|
||||
return 0;
|
||||
/* announce service */
|
||||
_env.parent().announce(_ep.manage(_fb_root));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
void Component::construct(Genode::Env &env)
|
||||
{
|
||||
static Framebuffer::Main main(env);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
TARGET = fb_drv
|
||||
REQUIRES = pl11x pbxa9
|
||||
SRC_CC = main.cc video_memory.cc
|
||||
SRC_CC = main.cc
|
||||
LIBS = base
|
||||
INC_DIR += $(PRG_DIR)/..
|
||||
|
||||
|
|
|
@ -1,22 +0,0 @@
|
|||
/*
|
||||
* \brief PL11x video memory function for platform baseboard cortex-A9.
|
||||
* \author Stefan Kalkowski
|
||||
* \date 2011-11-15
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2011-2013 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
/* Genode includes */
|
||||
#include <base/env.h>
|
||||
|
||||
#include <pl11x_defs.h>
|
||||
#include <video_memory.h>
|
||||
|
||||
Genode::Dataspace_capability Framebuffer::alloc_video_memory(Genode::size_t sz) {
|
||||
return Genode::env()->ram_session()->alloc(sz);
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
/*
|
||||
* \brief Video memory allocator.
|
||||
* \author Stefan Kalkowski
|
||||
* \date 2011-11-15
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2011-2013 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
#ifndef _INCLUDE__VIDEOMEM_ALLOCATOR_H_
|
||||
#define _INCLUDE__VIDEOMEM_ALLOCATOR_H_
|
||||
|
||||
#include <base/stdint.h>
|
||||
#include <dataspace/capability.h>
|
||||
|
||||
namespace Framebuffer {
|
||||
|
||||
Genode::Dataspace_capability alloc_video_memory(Genode::size_t size);
|
||||
|
||||
}
|
||||
|
||||
#endif /* _INCLUDE__VIDEOMEM_ALLOCATOR_H_ */
|
Loading…
Reference in New Issue
Block a user