Rpc argument for a binary array?

Norman Feske norman.feske at ...1...
Mon Dec 22 16:44:34 CET 2014

Hi Bob,

> Is there a mechanism for passing an array of 8_bit  register values in
> RPC calls when using base-hw? I see the Rpc_in_buffer class but that's
> designed for string arrays not arbitrary binary value arrays.
> The use case is for implementing an I2C server which has multiple
> clients each of which implements a specific device on the I2C bus. I2C
> supports any length of data transfer but practically I don't see more
> than a dozen bytes being transferred in one contiguous block.

in general, 'Rpc_in_buffer' accepts arbitrary binary data if you specify
the pointer to the buffer and the buffer size as constructor arguments.
However, since you mentioned that the number of bytes transmitted per
RPC call is rather small, I would simply define the argument type as
follows (using an upper bound as array boundary):

  struct I2c_message
    unsigned char bytes[12];

If you specify an argument of type 'I2c_message' for an RPC function,
the array will be copied as is. In contrast to the use of an
'Rpc_in_buffer', this 'I2c_message' type would work for both ways
passing it as argument or as return value.


Dr.-Ing. Norman Feske
Genode Labs

http://www.genode-labs.com · http://genode.org

Genode Labs GmbH · Amtsgericht Dresden · HRB 28424 · Sitz Dresden
Geschäftsführer: Dr.-Ing. Norman Feske, Christian Helmuth

More information about the users mailing list