genode/os/src/drivers/sd_card/omap4/main.cc
Norman Feske 0f6110ea97 Let OMAP4 SD-card driver use DMA and interrupts
With this patch, the driver code gets complemented with DMA support.
The support for master DMA, in turn, cleared the way for using
interrupts to wait for the completion of transfers, which largely
relieves the CPU compared to the polling PIO mode. Consequently, the new
version has a much lower CPU footprint.

In the current version, both modes of operation PIO and DMA are
functional. However, PIO mode is retained for benchmarking purposes only
and will possibly be removed to keep the driver simple. It is disabled
in the driver's 'main.cc'.
2012-07-25 19:14:06 +02:00

55 lines
1.0 KiB
C++

/*
* \brief SD-card driver for OMAP4 platform
* \author Norman Feske
* \date 2012-07-03
*/
/* Genode includes */
#include <base/sleep.h>
#include <base/printf.h>
#include <cap_session/connection.h>
/* local includes */
#include <driver.h>
/*
* MMC1: IRQ 83
*/
int main(int argc, char **argv)
{
using namespace Genode;
printf("--- OMAP4 SD card driver ---\n");
/**
* Factory used by 'Block::Root' at session creation/destruction time
*/
struct Driver_factory : Block::Driver_factory
{
Block::Driver *create()
{
bool use_dma = true;
return new (env()->heap()) Block::Omap4_driver(use_dma);
}
void destroy(Block::Driver *driver)
{
Genode::destroy(env()->heap(),
static_cast<Block::Omap4_driver *>(driver));
}
} driver_factory;
enum { STACK_SIZE = 4096 };
static Cap_connection cap;
static Rpc_entrypoint ep(&cap, STACK_SIZE, "block_ep");
static Block::Root block_root(&ep, env()->heap(), driver_factory);
env()->parent()->announce(ep.manage(&block_root));
sleep_forever();
return 0;
}