mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-18 13:26:27 +00:00
lx_emul: handle pin controller irqs
Register Global_irq_controller as Device so interrupts get forwarded to irqchip.c code. Otherwise, pin-controller interrupts will get lost. Fixed #5363 Related #5356
This commit is contained in:
parent
a148dc5cb4
commit
77d53f13ca
@ -142,6 +142,16 @@ class Lx_kit::Device : List<Device>::Element
|
||||
void _for_each_clock(FN const & fn) {
|
||||
for (Clock * c = _clocks.first(); c; c = c->next()) fn(*c); }
|
||||
|
||||
protected:
|
||||
|
||||
Device(Platform::Connection &plat,
|
||||
Name name)
|
||||
:
|
||||
_platform(plat), _name(name), _type("")
|
||||
{ }
|
||||
|
||||
virtual ~Device() { }
|
||||
|
||||
public:
|
||||
|
||||
const char * compatible();
|
||||
@ -171,7 +181,8 @@ class Lx_kit::Device : List<Device>::Element
|
||||
bool irq_unmask(unsigned irq);
|
||||
void irq_mask(unsigned irq);
|
||||
void irq_ack(unsigned irq);
|
||||
int pending_irq();
|
||||
|
||||
virtual int pending_irq();
|
||||
|
||||
bool read_config(unsigned reg, unsigned len, unsigned *val);
|
||||
bool write_config(unsigned reg, unsigned len, unsigned val);
|
||||
@ -210,6 +221,8 @@ class Lx_kit::Device_list : List<Device>
|
||||
Device_list(Entrypoint & ep,
|
||||
Heap & heap,
|
||||
Platform::Connection & platform);
|
||||
|
||||
void insert(Device const *device) { List<Device>::insert(device); }
|
||||
};
|
||||
|
||||
#endif /* _LX_KIT__DEVICE_H_ */
|
||||
|
@ -24,19 +24,25 @@ namespace {
|
||||
|
||||
using namespace Genode;
|
||||
|
||||
class Global_irq_controller : Noncopyable
|
||||
class Global_irq_controller : Lx_kit::Device, Noncopyable
|
||||
{
|
||||
private:
|
||||
|
||||
Lx_kit::Env &_env;
|
||||
|
||||
unsigned _pending_irq = 0;
|
||||
int _pending_irq { -1 };
|
||||
|
||||
public:
|
||||
|
||||
struct Number { unsigned value; };
|
||||
|
||||
Global_irq_controller(Lx_kit::Env &env) : _env(env) { }
|
||||
Global_irq_controller(Lx_kit::Env &env)
|
||||
:
|
||||
Lx_kit::Device(env.platform, "pin_irq"),
|
||||
_env(env)
|
||||
{
|
||||
_env.devices.insert(this);
|
||||
}
|
||||
|
||||
void trigger_irq(Number number)
|
||||
{
|
||||
@ -45,6 +51,14 @@ namespace {
|
||||
_env.scheduler.unblock_irq_handler();
|
||||
_env.scheduler.schedule();
|
||||
}
|
||||
|
||||
int pending_irq() override
|
||||
{
|
||||
int irq = _pending_irq;
|
||||
_pending_irq = -1;
|
||||
|
||||
return irq;
|
||||
}
|
||||
};
|
||||
|
||||
using Pin_name = Session_label;
|
||||
|
Loading…
Reference in New Issue
Block a user