2011-12-22 15:19:25 +00:00
|
|
|
/*
|
|
|
|
* \brief Connection to ROM file service
|
|
|
|
* \author Norman Feske
|
|
|
|
* \date 2008-08-22
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
2017-02-20 12:23:52 +00:00
|
|
|
* Copyright (C) 2008-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__ROM_SESSION__CONNECTION_H_
|
|
|
|
#define _INCLUDE__ROM_SESSION__CONNECTION_H_
|
|
|
|
|
|
|
|
#include <rom_session/client.h>
|
|
|
|
#include <base/connection.h>
|
2016-05-12 12:58:51 +00:00
|
|
|
#include <base/log.h>
|
2011-12-22 15:19:25 +00:00
|
|
|
|
2015-03-04 20:12:14 +00:00
|
|
|
namespace Genode { class Rom_connection; }
|
|
|
|
|
|
|
|
|
2019-01-30 16:27:46 +00:00
|
|
|
struct Genode::Rom_connection : Connection<Rom_session>,
|
|
|
|
Rom_session_client
|
2015-03-04 20:12:14 +00:00
|
|
|
{
|
2019-01-30 16:27:46 +00:00
|
|
|
class Rom_connection_failed : public Service_denied { };
|
|
|
|
|
|
|
|
enum { RAM_QUOTA = 6*1024UL };
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Constructor
|
|
|
|
*
|
|
|
|
* \param label request label and name of ROM module
|
|
|
|
*
|
|
|
|
* \throw Rom_connection_failed
|
|
|
|
*/
|
|
|
|
Rom_connection(Env &env, const char *label)
|
|
|
|
try :
|
|
|
|
Connection<Rom_session>(env,
|
|
|
|
session(env.parent(),
|
|
|
|
"ram_quota=%ld, cap_quota=%ld, label=\"%s\"",
|
|
|
|
RAM_QUOTA, CAP_QUOTA, label)),
|
|
|
|
Rom_session_client(cap())
|
|
|
|
{ }
|
|
|
|
catch (...) {
|
|
|
|
error("Could not open ROM session for \"", label, "\"");
|
|
|
|
throw Rom_connection_failed();
|
|
|
|
}
|
2015-03-04 20:12:14 +00:00
|
|
|
};
|
2011-12-22 15:19:25 +00:00
|
|
|
|
|
|
|
#endif /* _INCLUDE__ROM_SESSION__CONNECTION_H_ */
|