[CCC DEV] FFI question

Matt Jadud matt at jadud.com
Wed Jul 18 12:21:51 BST 2012

Hi Patrick,

The link did not come through.

On Wed, Jul 18, 2012 at 6:45 AM, Patrick Pelgrims
<patrick.pelgrims at lessius.eu> wrote:
> pages 247 an further it anounses SWI and FFI Blocking, Non-Blocking and
> Non-Blocking interruptable C function calls.
> Are those tree already implemented in the arduino transterpreter ?

There is a non-blocking interrupt handler that should serve as a
starting point for you.


We wrote a small C macro to make attaching basic interrupts easier:


It lives in the digital.module in the "Plumbing" library, and is our
digital.input process:


At a low level, we have provided


which you can use to connect to your own interrupts.

> We would like to use (non-)blocking function calls to set up inter processor
> communication emulating the good old transputer links.

That would be marvelous, and we'd love to roll that back in. My
suspicion is that you have everything you need to do it in place

Note that the speed of the VM on a 16MHz device means that they will
not be fast links. I do not believe I can run interrupt-driven serial
at a high rate of speed, and I forget where data starts to be lost.
Buffering may help, but my suspicion is that a busy enough Arduino
(read: many processes) will not be able to keep up with a fast serial
interrupt that is always ready.

> The link could be a serial interface with RX/TX communication buffer or a
> memory mapped DMA handled RX/TX communication buffer.

On processors with DMA (and, faster clocks), the latter is almost
certainly preferable.

> Any advices about how to incorporate such functionality is welcome.

Hopefully that helps. The paper


has some high-level discussion of the architecture behind this implementation.

Ask questions as necessary!


More information about the developers mailing list