test/fb_block_adapter: remove

The FB Block Adapter in os/src/test visualizes a block session via a
Framebuffer session. As far as I can see, it is not a test but rather
the base for a bump-in-the-wire component. However, for this role it
currently lacks a Block back-end. As it also would have to be updated to
use the new base API I removed it instead, leaving only its git
history as inspiration if someone needs such a component in the future.

Fixes #2245
Ref #1987
This commit is contained in:
Martin Stein 2017-01-19 18:52:40 +01:00 committed by Norman Feske
parent d5e57d15c8
commit ca38375107
2 changed files with 0 additions and 130 deletions

View File

@ -1,127 +0,0 @@
/*
* \brief Test for the block session server side
* \author Stefan Kalkowski
* \date 2010-07-06
*
* This test app provides the framebuffer it requests via framebuffer session
* as a block device.
*/
/*
* 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 General Public License version 2.
*/
#include <base/printf.h>
#include <framebuffer_session/connection.h>
#include <block/component.h>
class Driver : public Block::Driver
{
private:
enum { BLOCK_SIZE = 512 };
Framebuffer::Connection _fb;
Framebuffer::Mode _fb_mode;
Genode::Dataspace_capability _fb_cap;
Genode::Dataspace_client _fb_dsc;
Genode::addr_t _fb_addr;
Genode::size_t _fb_size;
public:
Driver(Genode::Ram_session &ram)
: Block::Driver(ram),
_fb_mode(_fb.mode()),
_fb_cap(_fb.dataspace()),
_fb_dsc(_fb_cap),
_fb_addr(Genode::env()->rm_session()->attach(_fb_cap)),
_fb_size(_fb_dsc.size()){}
/*******************************
** Block::Driver interface **
*******************************/
Genode::size_t block_size() { return BLOCK_SIZE; }
Block::sector_t block_count() { return _fb_size / BLOCK_SIZE; }
Block::Session::Operations ops()
{
Block::Session::Operations ops;
ops.set_operation(Block::Packet_descriptor::READ);
ops.set_operation(Block::Packet_descriptor::WRITE);
return ops;
}
void read(Block::sector_t block_number,
Genode::size_t block_count,
char *buffer,
Block::Packet_descriptor &packet)
{
/* sanity check block number */
if (block_number + block_count > _fb_size / BLOCK_SIZE) {
PWRN("Out of range: requested %ld blocks from block %llu",
block_count, block_number);
return;
}
Genode::size_t offset = block_number * BLOCK_SIZE;
Genode::size_t size = block_count * BLOCK_SIZE;
Genode::memcpy((void*)buffer, (void*)(_fb_addr + offset), size);
ack_packet(packet);
}
void write(Block::sector_t block_number,
Genode::size_t block_count,
char const *buffer,
Block::Packet_descriptor &packet)
{
/* sanity check block number */
if (block_number + block_count > _fb_size / BLOCK_SIZE) {
PWRN("Out of range: requested %ld blocks from block %llu",
block_count, block_number);
return;
}
Genode::size_t offset = block_number * BLOCK_SIZE;
Genode::size_t size = block_count * BLOCK_SIZE;
Genode::memcpy((void*)(_fb_addr + offset), (void*)buffer, size);
_fb.refresh(0, 0, _fb_mode.width(), _fb_mode.height());
ack_packet(packet);
}
};
struct Factory : Block::Driver_factory
{
Genode::Ram_session &ram;
Genode::Heap &heap;
Factory(Genode::Ram_session &ram, Genode::Heap &heap)
: ram(ram), heap(heap) {}
Block::Driver *create() { return new (&heap) Driver(ram); }
void destroy(Block::Driver *driver) { Genode::destroy(&heap, driver); }
};
struct Main
{
Genode::Env &env;
Genode::Heap heap { env.ram(), env.rm() };
struct Factory factory { env.ram(), heap };
Block::Root root { env.ep(), heap, env.rm(), factory };
Main(Genode::Env &env) : env(env) {
env.parent().announce(env.ep().manage(root)); }
};
void Component::construct(Genode::Env &env) { static Main m(env); }

View File

@ -1,3 +0,0 @@
TARGET = test-fb_blk_adapter
SRC_CC = main.cc
LIBS = base