2020-05-14 13:35:40 +00:00
|
|
|
/*
|
|
|
|
* \brief Client-side Platform-session interface
|
|
|
|
* \author Stefan Kalkowski
|
|
|
|
* \date 2020-04-28
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (C) 2020 Genode Labs GmbH
|
|
|
|
*
|
|
|
|
* This file is part of the Genode OS framework, which is distributed
|
|
|
|
* under the terms of the GNU Affero General Public License version 3.
|
|
|
|
*/
|
|
|
|
|
2021-12-22 11:04:09 +00:00
|
|
|
#ifndef _INCLUDE__PLATFORM_SESSION__CLIENT_H_
|
|
|
|
#define _INCLUDE__PLATFORM_SESSION__CLIENT_H_
|
2020-05-14 13:35:40 +00:00
|
|
|
|
|
|
|
#include <base/rpc_client.h>
|
2022-02-03 14:47:29 +00:00
|
|
|
#include <base/log.h>
|
2020-05-14 13:35:40 +00:00
|
|
|
#include <platform_session/capability.h>
|
|
|
|
|
2021-04-14 15:19:37 +00:00
|
|
|
namespace Platform { struct Client; }
|
2020-05-14 13:35:40 +00:00
|
|
|
|
|
|
|
|
2021-04-14 15:19:37 +00:00
|
|
|
struct Platform::Client : Genode::Rpc_client<Session>
|
2020-05-14 13:35:40 +00:00
|
|
|
{
|
|
|
|
Client(Session_capability session)
|
|
|
|
: Rpc_client<Session>(session) { }
|
|
|
|
|
|
|
|
Rom_session_capability devices_rom() override {
|
|
|
|
return call<Rpc_devices_rom>(); }
|
|
|
|
|
2021-04-14 15:19:37 +00:00
|
|
|
Capability<Device_interface> acquire_device(Device_name const &name) override {
|
|
|
|
return call<Rpc_acquire_device>(name); }
|
2020-05-14 13:35:40 +00:00
|
|
|
|
2021-04-16 13:08:21 +00:00
|
|
|
Capability<Device_interface> acquire_single_device() override {
|
|
|
|
return call<Rpc_acquire_single_device>(); }
|
|
|
|
|
2021-04-14 15:19:37 +00:00
|
|
|
void release_device(Capability<Device_interface> device) override {
|
2020-05-14 13:35:40 +00:00
|
|
|
call<Rpc_release_device>(device); }
|
|
|
|
|
2021-04-08 15:44:11 +00:00
|
|
|
Ram_dataspace_capability alloc_dma_buffer(size_t size, Cache cache) override {
|
|
|
|
return call<Rpc_alloc_dma_buffer>(size, cache); }
|
2020-05-14 13:35:40 +00:00
|
|
|
|
|
|
|
void free_dma_buffer(Ram_dataspace_capability cap) override {
|
|
|
|
call<Rpc_free_dma_buffer>(cap); }
|
|
|
|
|
2022-02-03 14:47:29 +00:00
|
|
|
addr_t dma_addr(Ram_dataspace_capability cap) override
|
|
|
|
{
|
|
|
|
addr_t const result = call<Rpc_dma_addr>(cap);
|
|
|
|
|
|
|
|
/* the platform driver may lack the 'managing_system' role */
|
|
|
|
if (!result)
|
|
|
|
warning("unable to obtain DMA address from platform driver");
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
2020-05-14 13:35:40 +00:00
|
|
|
};
|
|
|
|
|
2021-12-22 11:04:09 +00:00
|
|
|
#endif /* _INCLUDE__PLATFORM_SESSION__CLIENT_H_ */
|