2011-12-22 15:19:25 +00:00
|
|
|
/*
|
|
|
|
* \brief IRQ session interface
|
|
|
|
* \author Christian Helmuth
|
2015-03-17 12:28:20 +00:00
|
|
|
* \author Martin Stein
|
2011-12-22 15:19:25 +00:00
|
|
|
* \date 2007-09-13
|
|
|
|
*
|
|
|
|
* An open IRQ session represents a valid IRQ attachment/association.
|
|
|
|
* Initially, the interrupt is masked and will only occur if enabled. This is
|
2015-03-17 14:41:47 +00:00
|
|
|
* done by calling ack_irq().
|
2011-12-22 15:19:25 +00:00
|
|
|
*
|
|
|
|
* Disassociation from an IRQ is done by closing the session.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
2017-02-20 12:23:52 +00:00
|
|
|
* Copyright (C) 2007-2017 Genode Labs GmbH
|
2011-12-22 15:19:25 +00:00
|
|
|
*
|
|
|
|
* This file is part of the Genode OS framework, which is distributed
|
2017-02-20 12:23:52 +00:00
|
|
|
* under the terms of the GNU Affero General Public License version 3.
|
2011-12-22 15:19:25 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _INCLUDE__IRQ_SESSION__IRQ_SESSION_H_
|
|
|
|
#define _INCLUDE__IRQ_SESSION__IRQ_SESSION_H_
|
|
|
|
|
2015-03-17 14:41:47 +00:00
|
|
|
#include <base/signal.h>
|
2011-12-22 15:19:25 +00:00
|
|
|
#include <base/capability.h>
|
|
|
|
#include <session/session.h>
|
|
|
|
|
2015-03-17 12:28:20 +00:00
|
|
|
namespace Genode {
|
|
|
|
struct Irq_session;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-03-04 20:12:14 +00:00
|
|
|
struct Genode::Irq_session : Session
|
|
|
|
{
|
2015-04-27 10:17:20 +00:00
|
|
|
struct Info {
|
|
|
|
enum Type { INVALID, MSI } type;
|
|
|
|
unsigned long address;
|
|
|
|
unsigned long value;
|
|
|
|
};
|
|
|
|
|
2015-03-04 20:12:14 +00:00
|
|
|
/**
|
|
|
|
* Interrupt trigger
|
|
|
|
*/
|
|
|
|
enum Trigger { TRIGGER_UNCHANGED = 0, TRIGGER_LEVEL, TRIGGER_EDGE };
|
2012-10-05 12:23:59 +00:00
|
|
|
|
2015-03-04 20:12:14 +00:00
|
|
|
/**
|
|
|
|
* Interrupt trigger polarity
|
|
|
|
*/
|
|
|
|
enum Polarity { POLARITY_UNCHANGED = 0, POLARITY_HIGH, POLARITY_LOW };
|
2012-10-05 12:23:59 +00:00
|
|
|
|
2015-03-17 12:28:20 +00:00
|
|
|
/**
|
|
|
|
* Destructor
|
|
|
|
*/
|
2015-03-04 20:12:14 +00:00
|
|
|
virtual ~Irq_session() { }
|
2011-12-22 15:19:25 +00:00
|
|
|
|
2015-03-17 12:28:20 +00:00
|
|
|
/**
|
2015-03-17 14:41:47 +00:00
|
|
|
* Acknowledge handling of last interrupt - re-enables interrupt reception
|
2015-03-17 12:28:20 +00:00
|
|
|
*/
|
2015-03-17 14:41:47 +00:00
|
|
|
virtual void ack_irq() = 0;
|
2011-12-22 15:19:25 +00:00
|
|
|
|
2015-03-17 12:28:20 +00:00
|
|
|
/**
|
2015-03-17 14:41:47 +00:00
|
|
|
* Register irq signal handler
|
2015-03-17 12:28:20 +00:00
|
|
|
*/
|
2015-03-17 14:41:47 +00:00
|
|
|
virtual void sigh(Genode::Signal_context_capability sigh) = 0;
|
2015-03-17 12:28:20 +00:00
|
|
|
|
2015-04-27 10:17:20 +00:00
|
|
|
/**
|
|
|
|
* Request information about IRQ, e.g. on x86 request MSI address and
|
|
|
|
* MSI value to be programmed to device specific PCI registers.
|
|
|
|
*/
|
|
|
|
virtual Info info() = 0;
|
|
|
|
|
2015-03-17 12:28:20 +00:00
|
|
|
/*************
|
|
|
|
** Session **
|
|
|
|
*************/
|
|
|
|
|
2017-05-24 12:41:19 +00:00
|
|
|
/**
|
|
|
|
* \noapi
|
|
|
|
*/
|
2015-03-17 12:28:20 +00:00
|
|
|
static const char * service_name() { return "IRQ"; }
|
|
|
|
|
2023-03-03 11:07:28 +00:00
|
|
|
enum { CAP_QUOTA = 3, RAM_QUOTA = 6*1024 };
|
2017-05-07 20:03:25 +00:00
|
|
|
|
2011-12-22 15:19:25 +00:00
|
|
|
|
2015-03-04 20:12:14 +00:00
|
|
|
/*********************
|
|
|
|
** RPC declaration **
|
|
|
|
*********************/
|
2011-12-22 15:19:25 +00:00
|
|
|
|
2015-03-17 14:41:47 +00:00
|
|
|
GENODE_RPC(Rpc_ack_irq, void, ack_irq);
|
|
|
|
GENODE_RPC(Rpc_sigh, void, sigh, Genode::Signal_context_capability);
|
2015-04-27 10:17:20 +00:00
|
|
|
GENODE_RPC(Rpc_info, Info, info);
|
|
|
|
GENODE_RPC_INTERFACE(Rpc_ack_irq, Rpc_sigh, Rpc_info);
|
2015-03-04 20:12:14 +00:00
|
|
|
};
|
2011-12-22 15:19:25 +00:00
|
|
|
|
base: avoid use of deprecated base/printf.h
Besides adapting the components to the use of base/log.h, the patch
cleans up a few base headers, i.e., it removes unused includes from
root/component.h, specifically base/heap.h and
ram_session/ram_session.h. Hence, components that relied on the implicit
inclusion of those headers have to manually include those headers now.
While adjusting the log messages, I repeatedly stumbled over the problem
that printing char * arguments is ambiguous. It is unclear whether to
print the argument as pointer or null-terminated string. To overcome
this problem, the patch introduces a new type 'Cstring' that allows the
caller to express that the argument should be handled as null-terminated
string. As a nice side effect, with this type in place, the optional len
argument of the 'String' class could be removed. Instead of supplying a
pair of (char const *, size_t), the constructor accepts a 'Cstring'.
This, in turn, clears the way let the 'String' constructor use the new
output mechanism to assemble a string from multiple arguments (and
thereby getting rid of snprintf within Genode in the near future).
To enforce the explicit resolution of the char * ambiguity, the 'char *'
overload of the 'print' function is marked as deleted.
Issue #1987
2016-07-13 17:07:09 +00:00
|
|
|
|
|
|
|
namespace Genode {
|
|
|
|
|
|
|
|
static inline void print(Output &out, Irq_session::Trigger value)
|
|
|
|
{
|
|
|
|
switch (value) {
|
|
|
|
case Irq_session::TRIGGER_UNCHANGED: print(out, "UNCHANGED"); break;
|
|
|
|
case Irq_session::TRIGGER_LEVEL: print(out, "LEVEL"); break;
|
|
|
|
case Irq_session::TRIGGER_EDGE: print(out, "EDGE"); break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void print(Output &out, Irq_session::Polarity value)
|
|
|
|
{
|
|
|
|
switch (value) {
|
|
|
|
case Irq_session::POLARITY_UNCHANGED: print(out, "UNCHANGED"); break;
|
|
|
|
case Irq_session::POLARITY_HIGH: print(out, "HIGH"); break;
|
|
|
|
case Irq_session::POLARITY_LOW: print(out, "LOW"); break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-12-22 15:19:25 +00:00
|
|
|
#endif /* _INCLUDE__IRQ_SESSION__IRQ_SESSION_H_ */
|