base: unify some irq_session headers

remove repos/base-*/include/irq_session headers and use only a unification
from   repos/base/include/irq_session

first step

Issue #1456
This commit is contained in:
Alexander Boettcher 2015-03-17 13:28:20 +01:00 committed by Christian Helmuth
parent 2002e1ccba
commit e2cbc7c5b3
23 changed files with 161 additions and 157 deletions

View File

@ -2,6 +2,7 @@ SRC_CC += console/log_console.cc
SRC_CC += cpu/cache.cc
SRC_CC += env/env.cc env/context_area.cc env/reinitialize.cc
SRC_CC += thread/thread_start.cc
SRC_CC += irq/platform.cc
INC_DIR += $(BASE_DIR)/src/base/env
INC_DIR += $(REP_DIR)/include/codezero/dummies

View File

@ -64,7 +64,8 @@ namespace Genode {
** Irq session interface **
***************************/
void wait_for_irq();
void wait_for_irq();
Irq_signal signal();
};
}

View File

@ -70,3 +70,9 @@ Irq_session_component::~Irq_session_component()
PERR("not yet implemented");
}
Irq_signal Irq_session_component::signal()
{
PDBG("not implemented;");
return Irq_signal();
}

View File

@ -10,6 +10,7 @@ SRC_CC += console/log_console.cc
SRC_CC += cpu/cache.cc
SRC_CC += env/env.cc env/context_area.cc env/reinitialize.cc
SRC_CC += thread/thread_start.cc
SRC_CC += irq/platform.cc
INC_DIR += $(BASE_DIR)/src/base/env

View File

@ -120,3 +120,9 @@ Irq_session_component::~Irq_session_component()
PERR("Implement me, immediately!");
}
Irq_signal Irq_session_component::signal()
{
PDBG("not implemented;");
return Irq_signal();
}

View File

@ -11,6 +11,7 @@ SRC_CC += cpu/cache.cc
SRC_CC += env/env.cc env/context_area.cc env/reinitialize.cc \
env/cap_map_remove.cc env/cap_alloc.cc
SRC_CC += thread/thread_start.cc
SRC_CC += irq/platform.cc
INC_DIR += $(BASE_DIR)/src/base/env

View File

@ -70,7 +70,8 @@ namespace Genode {
** Irq session interface **
***************************/
void wait_for_irq();
void wait_for_irq();
Irq_signal signal();
};
}

View File

@ -220,6 +220,13 @@ Irq_session_component::~Irq_session_component() {
_proxy->remove_sharer(); }
Irq_signal Irq_session_component::signal()
{
PDBG("not implemented;");
return Irq_signal();
}
/***************************************
** Interrupt handler implemtentation **
***************************************/

View File

@ -1,62 +0,0 @@
/*
* \brief Client-side IRQ session interface
* \author Martin Stein
* \date 2013-10-24
*/
/*
* Copyright (C) 2013 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.
*/
#ifndef _IRQ_SESSION__CLIENT_H_
#define _IRQ_SESSION__CLIENT_H_
/* Genode includes */
#include <irq_session/capability.h>
#include <base/rpc_client.h>
namespace Genode
{
/**
* Client-side IRQ session interface
*/
struct Irq_session_client : Rpc_client<Irq_session>
{
/*
* FIXME: This is used only client-internal and could thus be protected.
*/
Irq_signal const irq_signal;
/**
* Constructor
*
* \param session pointer to the session backend
*/
explicit Irq_session_client(Irq_session_capability const & session)
:
Rpc_client<Irq_session>(session),
irq_signal(signal())
{ }
/*****************
** Irq_session **
*****************/
Irq_signal signal() { return call<Rpc_signal>(); }
void wait_for_irq()
{
while (Kernel::await_signal(irq_signal.receiver_id,
irq_signal.context_id))
{
PERR("failed to receive interrupt");
}
}
};
}
#endif /* _IRQ_SESSION__CLIENT_H_ */

View File

@ -1,82 +0,0 @@
/*
* \brief IRQ session interface
* \author Martin Stein
* \date 2013-10-24
*/
/*
* Copyright (C) 2013 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.
*/
#ifndef _IRQ_SESSION__IRQ_SESSION_H_
#define _IRQ_SESSION__IRQ_SESSION_H_
/* Genode includes */
#include <base/capability.h>
#include <session/session.h>
namespace Genode
{
/**
* Information that enables a user to await and ack an IRQ directly
*/
struct Irq_signal
{
unsigned receiver_id;
unsigned context_id;
};
/**
* IRQ session interface
*/
struct Irq_session : Session
{
/**
* Interrupt trigger
*/
enum Trigger { TRIGGER_UNCHANGED = 0, TRIGGER_LEVEL, TRIGGER_EDGE };
/**
* Interrupt trigger polarity
*/
enum Polarity { POLARITY_UNCHANGED = 0, POLARITY_HIGH, POLARITY_LOW };
/**
* Destructor
*/
virtual ~Irq_session() { }
/**
* Await the next occurence of the interrupt of this session
*/
virtual void wait_for_irq() = 0;
/**
* Get information for direct interrupt handling
*
* FIXME: This is used only client-internal and could thus be protected.
*/
virtual Irq_signal signal() = 0;
/*************
** Session **
*************/
static const char * service_name() { return "IRQ"; }
/*********************
** RPC declaration **
*********************/
GENODE_RPC(Rpc_wait_for_irq, void, wait_for_irq);
GENODE_RPC(Rpc_signal, Irq_signal, signal);
GENODE_RPC_INTERFACE(Rpc_wait_for_irq, Rpc_signal);
};
}
#endif /* _IRQ_SESSION__IRQ_SESSION_H_ */

View File

@ -15,6 +15,7 @@ SRC_CC += env/context_area.cc
SRC_CC += env/reinitialize.cc
SRC_CC += thread/thread.cc
SRC_CC += thread/start.cc
SRC_CC += irq/platform.cc
# add include paths
INC_DIR += $(BASE_DIR)/src/base/env

View File

@ -0,0 +1,23 @@
/*
* \brief Client-side IRQ session interface - specific for base-hw
* \author Martin Stein
* \date 2013-10-24
*/
/*
* Copyright (C) 2013-2015 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 <irq_session/client.h>
void Genode::Irq_session_client::wait_for_irq()
{
while (Kernel::await_signal(irq_signal.receiver_id,
irq_signal.context_id))
{
PERR("failed to receive interrupt");
}
}

View File

@ -10,6 +10,7 @@ SRC_CC += console/log_console.cc
SRC_CC += cpu/cache.cc
SRC_CC += env/env.cc env/context_area.cc env/reinitialize.cc
SRC_CC += thread/thread_nova.cc
SRC_CC += irq/platform.cc
INC_DIR += $(BASE_DIR)/src/base/env

View File

@ -67,7 +67,8 @@ namespace Genode {
** Irq session interface **
***************************/
void wait_for_irq();
void wait_for_irq();
Irq_signal signal();
};
}

View File

@ -203,3 +203,10 @@ Irq_session_component::Irq_session_component(Cap_session *cap_session,
Irq_session_component::~Irq_session_component() { }
Irq_signal Irq_session_component::signal()
{
PDBG("not implemented;");
return Irq_signal();
}

View File

@ -2,6 +2,7 @@ SRC_CC += console/log_console.cc
SRC_CC += cpu/cache.cc
SRC_CC += env/env.cc env/context_area.cc env/reinitialize.cc
SRC_CC += thread/thread_start.cc
SRC_CC += irq/platform.cc
vpath %.cc $(REP_DIR)/src/base
vpath %.cc $(BASE_DIR)/src/base

View File

@ -175,3 +175,9 @@ Irq_session_component::~Irq_session_component()
/* TODO del_sharer() resp. put_sharer() */
}
Irq_signal Irq_session_component::signal()
{
PDBG("not implemented;");
return Irq_signal();
}

View File

@ -10,6 +10,7 @@ SRC_CC += console/log_console.cc
SRC_CC += cpu/cache.cc
SRC_CC += env/env.cc env/context_area.cc env/reinitialize.cc
SRC_CC += thread/thread_start.cc
SRC_CC += irq/platform.cc
INC_DIR += $(BASE_DIR)/src/base/env

View File

@ -132,3 +132,9 @@ Irq_session_component::~Irq_session_component()
}
}
Irq_signal Irq_session_component::signal()
{
PDBG("not implemented;");
return Irq_signal();
}

View File

@ -1,6 +1,7 @@
/*
* \brief Client-side IRQ session interface
* \author Christian Helmuth
* \author Martin Stein
* \date 2007-09-13
*/
@ -14,18 +15,41 @@
#ifndef _INCLUDE__IRQ_SESSION__CLIENT_H_
#define _INCLUDE__IRQ_SESSION__CLIENT_H_
/* Genode includes */
#include <irq_session/capability.h>
#include <base/rpc_client.h>
namespace Genode { struct Irq_session_client; }
/**
* Client-side IRQ session interface
*/
struct Genode::Irq_session_client : Rpc_client<Irq_session>
{
explicit Irq_session_client(Irq_session_capability session)
: Rpc_client<Irq_session>(session) { }
/*
* FIXME: This is used only client-internal and could thus be protected.
*/
Irq_signal const irq_signal;
void wait_for_irq() override { call<Rpc_wait_for_irq>(); }
/**
* Constructor
*
* \param session pointer to the session backend
*/
explicit Irq_session_client(Irq_session_capability const & session)
:
Rpc_client<Irq_session>(session),
irq_signal(signal())
{ }
/*****************
** Irq_session **
*****************/
Irq_signal signal() override { return call<Rpc_signal>(); }
void wait_for_irq() override;
};
#endif /* _INCLUDE__IRQ_SESSION__CLIENT_H_ */

View File

@ -1,6 +1,7 @@
/*
* \brief IRQ session interface
* \author Christian Helmuth
* \author Martin Stein
* \date 2007-09-13
*
* An open IRQ session represents a valid IRQ attachment/association.
@ -12,7 +13,7 @@
*/
/*
* Copyright (C) 2007-2013 Genode Labs GmbH
* Copyright (C) 2007-2015 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.
@ -24,7 +25,20 @@
#include <base/capability.h>
#include <session/session.h>
namespace Genode { struct Irq_session; }
namespace Genode {
struct Irq_session;
struct Irq_signal;
}
/**
* Information that enables a user to await and ack an IRQ directly
*/
struct Genode::Irq_signal
{
unsigned receiver_id;
unsigned context_id;
};
struct Genode::Irq_session : Session
@ -39,19 +53,38 @@ struct Genode::Irq_session : Session
*/
enum Polarity { POLARITY_UNCHANGED = 0, POLARITY_HIGH, POLARITY_LOW };
static const char *service_name() { return "IRQ"; }
/**
* Destructor
*/
virtual ~Irq_session() { }
/**
* Await the next occurence of the interrupt of this session
*/
virtual void wait_for_irq() = 0;
/**
* Get information for direct interrupt handling
*
* FIXME: This is used only client-internal and could thus be protected.
*/
virtual Irq_signal signal() = 0;
/*************
** Session **
*************/
static const char * service_name() { return "IRQ"; }
/*********************
** RPC declaration **
*********************/
GENODE_RPC(Rpc_wait_for_irq, void, wait_for_irq);
GENODE_RPC_INTERFACE(Rpc_wait_for_irq);
GENODE_RPC(Rpc_signal, Irq_signal, signal);
GENODE_RPC_INTERFACE(Rpc_wait_for_irq, Rpc_signal);
};
#endif /* _INCLUDE__IRQ_SESSION__IRQ_SESSION_H_ */

View File

@ -0,0 +1,19 @@
/*
* \brief Generic implementation parts of the irq framework which are
* implemented platform specifically, e.g. base-hw.
* \author Alexander Boettcher
*/
/*
* Copyright (C) 2015 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 <irq_session/client.h>
void Genode::Irq_session_client::wait_for_irq()
{
call<Rpc_wait_for_irq>();
}

View File

@ -133,7 +133,8 @@ namespace Genode {
** Irq session interface **
***************************/
void wait_for_irq();
void wait_for_irq();
Irq_signal signal();
};
}