[Vm-dev] FFI callback for interrupts in Raspberry
dionisiydk at gmail.com
Mon Feb 19 15:32:30 UTC 2018
2018-02-19 16:20 GMT+01:00 Eliot Miranda <eliot.miranda at gmail.com>:
> Hi Denis,
> On Feb 19, 2018, at 6:35 AM, Denis Kudriashov <dionisiydk at gmail.com>
> I am experimenting with interrupt callbacks on Rasperry. I am using
> WiringPi library which allows to set the function which should be called
> when value of particular pin is changed.
> But instead of callback execution I got following message in the console:
> Warning; callback failed to own the VM
> So VM is not crashed. But every interrupt produces such message.
> Is it related to the fact that callback is triggered from the
> thread different from VM? (I not sure about such detail, just guessing)
> Indeed it is. You would need to either
At least VM do not crash. This is nice.
> - arrange that interrupts are delivered on the VM thread, e.g. by
> responding to the interrupt on the foreign thread by queueing the
> information, and using the external semaphore support to inform the image
> of the interrupt
> - help us finish the threaded FFI so that the callback can be received
> from the foreign thread
> - find out how a SqueakNOS VM handles receiving an interrupt at any time,
> or specific times (IIRC the Digitalk VM required the image to execute an
> enableInterrupts and a disableInterrupts bytecode around code that was
> executed when the VM is used n a state to take interrupts.
> The thing I do not understand about SqueakNOS and responding to an
> interrupt at an arbitrary time is how one expects to deal with handling an
> interrupt during some sequence of instructions that is between suspension
> points, such as mid way through a store check which is adding an object to
> the remembered set, or mid way through a message lookup. Does SqueakNOS
> actually use the enable/disable interrupts approach?
> Denis, can you describe the callbacks in more detail? What is their
> favorite nation? Must they be responded to immediately?
Signature is very simple:
int wiringPiISR (int pin, int edgeType, void (*function)(void)) ;
I just checked how VM works in that case. It is not critical. Normally I
just poll pin value.
> Best regards
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Vm-dev