2011-12-22 15:19:25 +00:00
|
|
|
/*
|
|
|
|
* \brief Client-side interface for packet-stream reception
|
|
|
|
* \author Norman Feske
|
|
|
|
* \date 2010-03-01
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
2017-02-20 12:23:52 +00:00
|
|
|
* Copyright (C) 2010-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__PACKET_STREAM_TX__CLIENT_H_
|
|
|
|
#define _INCLUDE__PACKET_STREAM_TX__CLIENT_H_
|
|
|
|
|
|
|
|
#include <packet_stream_tx/packet_stream_tx.h>
|
|
|
|
#include <base/rpc_client.h>
|
|
|
|
|
2015-03-04 20:12:14 +00:00
|
|
|
namespace Packet_stream_tx { template <typename> class Client; }
|
2011-12-22 15:19:25 +00:00
|
|
|
|
|
|
|
|
2015-03-04 20:12:14 +00:00
|
|
|
template <typename CHANNEL>
|
|
|
|
class Packet_stream_tx::Client : public Genode::Rpc_client<CHANNEL>
|
|
|
|
{
|
|
|
|
private:
|
2011-12-22 15:19:25 +00:00
|
|
|
|
2015-03-04 20:12:14 +00:00
|
|
|
/*
|
|
|
|
* Type shortcuts
|
|
|
|
*/
|
|
|
|
typedef Genode::Rpc_client<CHANNEL> Base;
|
|
|
|
typedef typename Base::Rpc_dataspace Rpc_dataspace;
|
|
|
|
typedef typename Base::Rpc_packet_avail Rpc_packet_avail;
|
|
|
|
typedef typename Base::Rpc_ready_to_ack Rpc_ready_to_ack;
|
|
|
|
typedef typename Base::Rpc_ready_to_submit Rpc_ready_to_submit;
|
|
|
|
typedef typename Base::Rpc_ack_avail Rpc_ack_avail;
|
2011-12-22 15:19:25 +00:00
|
|
|
|
2015-03-04 20:12:14 +00:00
|
|
|
/**
|
|
|
|
* Packet-stream source
|
|
|
|
*/
|
|
|
|
typename CHANNEL::Source _source;
|
2011-12-22 15:19:25 +00:00
|
|
|
|
2015-03-04 20:12:14 +00:00
|
|
|
public:
|
2011-12-22 15:19:25 +00:00
|
|
|
|
2015-03-04 20:12:14 +00:00
|
|
|
/**
|
|
|
|
* Constructor
|
|
|
|
*
|
|
|
|
* \param buffer_alloc allocator used for managing the
|
|
|
|
* transmission buffer
|
|
|
|
*/
|
|
|
|
Client(Genode::Capability<CHANNEL> channel_cap,
|
2016-07-22 08:05:52 +00:00
|
|
|
Genode::Region_map &rm,
|
|
|
|
Genode::Range_allocator &buffer_alloc)
|
2015-03-04 20:12:14 +00:00
|
|
|
:
|
|
|
|
Genode::Rpc_client<CHANNEL>(channel_cap),
|
2016-07-22 08:05:52 +00:00
|
|
|
_source(Base::template call<Rpc_dataspace>(), rm, buffer_alloc)
|
2015-03-04 20:12:14 +00:00
|
|
|
{
|
|
|
|
/* wire data-flow signals for the packet transmitter */
|
|
|
|
_source.register_sigh_packet_avail(Base::template call<Rpc_packet_avail>());
|
|
|
|
_source.register_sigh_ready_to_ack(Base::template call<Rpc_ready_to_ack>());
|
|
|
|
}
|
2011-12-22 15:19:25 +00:00
|
|
|
|
2019-02-14 21:39:08 +00:00
|
|
|
void sigh_ready_to_submit(Genode::Signal_context_capability sigh) override {
|
2015-03-04 20:12:14 +00:00
|
|
|
Base::template call<Rpc_ready_to_submit>(sigh); }
|
2011-12-22 15:19:25 +00:00
|
|
|
|
2019-02-14 21:39:08 +00:00
|
|
|
void sigh_ack_avail(Genode::Signal_context_capability sigh) override {
|
2015-03-04 20:12:14 +00:00
|
|
|
Base::template call<Rpc_ack_avail>(sigh); }
|
|
|
|
|
2019-02-14 21:39:08 +00:00
|
|
|
typename CHANNEL::Source *source() override { return &_source; }
|
2015-03-04 20:12:14 +00:00
|
|
|
};
|
2011-12-22 15:19:25 +00:00
|
|
|
|
|
|
|
#endif /* _INCLUDE__PACKET_STREAM_TX__CLIENT_H_ */
|