Go to the documentation of this file.
18 #include <FreeNOS/User.h>
53 ERROR(
"failed to allocate consumer MemoryChannel");
61 ERROR(
"failed to allocate producer MemoryChannel");
91 ERROR(
"VMShare failed for PID " << pid <<
": result = " << (
int) r);
114 ERROR(
"failed to set producer virtual memory for PID " <<
115 pid <<
" to " << (
void *) prodAddr <<
116 ": result = " << (
int) memResult);
126 ERROR(
"failed to set consumer virtual memory for PID " <<
127 pid <<
" to " << (
void *) consAddr <<
128 ": result = " << (
int) memResult);
166 ERROR(
"failed to find producer for PID " << pid);
191 ERROR(
"failed to insert Request");
210 ERROR(
"failed to write to Channel for PID " << pid <<
": result = " << (
int) r);
225 for (
Size i = 0; i < count; i++)
253 ERROR(
"failed to connect to PID " << pid <<
": result = " << (
int) r);
270 ERROR(
"failed to connect to PID " << pid <<
": result = " << (
int) r);
282 ERROR(
"failed to find consumer for PID " << pid);
297 ERROR(
"failed to find producer for PID " << pid);
303 switch (ch->
write(buffer))
327 ERROR(
"syncSendTo failed to PID " << pid <<
": result = " << (
int) result);
334 ERROR(
"syncReceiveFrom failed from PID " << pid <<
": result = " << (
int) result);
Unidirectional point-to-point messaging channel.
static Size copy(void *dest, const void *src, Size count)
Copy memory from one place to another.
ChannelClient()
Constructor.
Size tagId
Share tag id is defined by the application.
Singleton design pattern: only one instance is allowed.
ProcessID pid
Remote process id for this share.
Result setVirtual(const Address data, const Address feedback, const bool hardReset=true)
Set memory pages by virtual address.
Index< Request, MaximumRequests > m_requests
Contains ongoing requests.
virtual void execute(void *parameter)=0
Execute the callback.
virtual Result receiveAny(void *buffer, const Size msgSize, ProcessID *pid)
Try to receive message from any channel.
Represents a callback function.
Iterate through a HashTable.
#define PAGESIZE
ARM uses 4K pages.
Type type
Message type is either a request or response.
u32 ProcessID
Process Identification Number.
virtual Result syncReceiveFrom(void *buffer, const Size msgSize, const ProcessID pid)
Synchronous receive from one process.
unsigned long Address
A memory address.
API::Result VMShare(const ProcessID pid, const API::Operation op, ProcessShares::MemoryShare *share)
Prototype for user applications.
Memory::Range range
Physical memory address range.
Channel * findProducer(const ProcessID pid, const Size msgSize)
Get producer for a process.
API::Result ProcessCtl(const ProcessID proc, const ProcessOperation op, const Address addr=0, const Address output=0)
Prototype for user applications.
CallbackFunction * callback
Size coreId
CoreId for the other process.
Channel * getConsumer(const ProcessID pid)
Get one consumer.
Result registerConsumer(const ProcessID pid, Channel *channel)
Register consumer channel.
virtual Result connect(const ProcessID pid, const Size msgSize)
Connect to a process.
virtual Result read(void *buffer)
Read a message.
const Size getMessageSize() const
Get message size.
virtual ~ChannelClient()
Destructor.
Holds an outgoing request.
#define DEBUG(msg)
Output a debug message to standard output.
static const Size MaxConnectRetries
Maximum number of retries for establishing new connection.
virtual Result write(const void *buffer)
Write a message.
Address phys
Physical address.
HashTable< ProcessID, Channel * > & getConsumers()
Get all consumers.
slong Error
Error code defined in Error.h.
virtual Result syncSendTo(const void *buffer, const Size msgSize, const ProcessID pid)
Synchronous send to one process.
#define NULL
NULL means zero.
unsigned int Size
Any sane size indicator cannot go negative.
virtual Result syncSendReceive(void *buffer, const Size msgSize, const ProcessID pid)
Synchronous send and receive to/from one process.
Unidirectional point-to-point channel using shared memory.
Size identifier
Optional request identifier.
Result registerProducer(const ProcessID pid, Channel *channel)
Register producer channel.
Client for using Channels on the local processor.
#define assert(exp)
Insert program diagnostics.
ChannelRegistry & getRegistry()
Get channel registry.
#define ERROR(msg)
Output an error message.
virtual Result initialize()
Initialize the ChannelClient.
unsigned char u8
Unsigned 8-bit number.
virtual Result sendRequest(const ProcessID pid, void *buffer, const Size msgSize, CallbackFunction *callback)
Send asynchronous request message.
Registration for Channels.
Address virt
Virtual address.
virtual bool hasCurrent() const
Check if there is a current item.
Channel * getProducer(const ProcessID pid)
Get one producer.
struct ChannelClient::Request Request
Holds an outgoing request.
Size size
Size in number of bytes.
Access access
Page access flags.
Channel * findConsumer(const ProcessID pid, const Size msgSize)
Get consumer for a process.
const ProcessID m_pid
Current Process ID.
virtual Result processResponse(const ProcessID pid, ChannelMessage *msg)
Process a response message.
ChannelRegistry m_registry
Contains registered channels.
Basic message format for sending on a Channel.