os: name lan9118 nic driver explicitly

* it is not dependent on pbxa9 anymore, but configureable
* rename it to lan9118_nic_drv

Ref #2190
This commit is contained in:
Stefan Kalkowski 2019-04-12 20:01:30 +02:00 committed by Christian Helmuth
parent dcc28b65cb
commit 312499a1ef
4 changed files with 22 additions and 19 deletions

View File

@ -71,9 +71,6 @@ namespace Pbxa9 {
KMI_0_IRQ = 52,
KMI_1_IRQ = 53,
/* LAN */
ETHERNET_IRQ = 60,
/* SD card */
PL180_IRQ_0 = 49,
PL180_IRQ_1 = 50,

View File

@ -16,12 +16,12 @@
*/
/* Genode includes */
#include <base/attached_rom_dataspace.h>
#include <base/component.h>
#include <base/env.h>
#include <base/heap.h>
#include <nic/component.h>
#include <root/component.h>
#include <drivers/defs/pbxa9.h>
/* driver code */
#include <lan9118.h>
@ -33,25 +33,25 @@ class Root : public Genode::Root_component<Lan9118, Genode::Single_client>
enum {
/**
* Base address of MMIO resource
* If no resource addresses are given, we take these Realview
* platform addresses as default ones.
*/
LAN9118_PHYS = 0x4e000000,
REALVIEW_MMIO_BASE = 0x4e000000,
REALVIEW_IRQ = 60,
/**
* Size of MMIO resource
*
* On the RealView platform, the device spans actually a much larger
* resource. However, only the first page is used.
* The device spans actually a much larger
* resource. However, only the first page is needed.
*/
LAN9118_SIZE = 0x1000,
/**
* Interrupt line
*/
LAN9118_IRQ = Pbxa9::ETHERNET_IRQ,
LAN9118_MMIO_SIZE = 0x1000,
};
Genode::Env &_env;
Genode::Env &_env;
Genode::Attached_rom_dataspace _config { _env, "config" };
Genode::addr_t _mmio_base { REALVIEW_MMIO_BASE };
unsigned _irq { REALVIEW_IRQ };
protected:
@ -80,7 +80,7 @@ class Root : public Genode::Root_component<Lan9118, Genode::Single_client>
}
return new (Root::md_alloc())
Lan9118(LAN9118_PHYS, LAN9118_SIZE, LAN9118_IRQ,
Lan9118(_mmio_base, LAN9118_MMIO_SIZE, _irq,
tx_buf_size, rx_buf_size, *md_alloc(), _env);
}
@ -89,7 +89,13 @@ 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) { }
_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);
}
};

View File

@ -1,5 +1,5 @@
REQUIRES = pbxa9
TARGET = nic_drv
REQUIRES = arm_v7
TARGET = lan9118_nic_drv
SRC_CC = main.cc
LIBS = base
INC_DIR += $(PRG_DIR)