Rpc argument for a binary array?

robjsstewart at ...196... robjsstewart at ...196...
Mon Dec 22 19:29:43 CET 2014


Thanks, Norman. I totally missed the other constructor in Rpc_in_buffer in my rush to implement a Solution!

I'll use your suggestion on the small buffer object.

Bob

Sent from my android device.

-----Original Message-----
From: Norman Feske <norman.feske at ...1...>
To: genode-main at lists.sourceforge.net
Sent: Mon, 22 Dec 2014 10:44 AM
Subject: Re: Rpc argument for a binary array?

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.

Cheers
Norman

-- 
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

------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
_______________________________________________
genode-main mailing list
genode-main at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/genode-main
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.genode.org/pipermail/users/attachments/20141222/042e6afc/attachment.html>


More information about the users mailing list