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