Soletta™ Framework
Framework for making IoT devices

Full online documentation | C API Index
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Functions
IPM

Inter Processor Messaging API for Soletta. More...

Functions

uint32_t sol_ipm_get_max_id (void)
 Get maximum IPM message ID for the platform. More...
 
int sol_ipm_send (uint32_t id, struct sol_blob *message)
 Send IPM message. More...
 
int sol_ipm_set_consumed_callback (uint32_t id, void(*message_consumed_cb)(void *cb_data, uint32_t id, struct sol_blob *message), const void *data)
 Set callback to be called when sent messaged is consumed. More...
 
int sol_ipm_set_receiver (uint32_t id, void(*receive_cb)(void *cb_data, uint32_t id, struct sol_blob *message), const void *data)
 Set receiver to IPM messages. More...
 

Detailed Description

Inter Processor Messaging API for Soletta.

Some platforms may have more than one core available to use. This API provides a way to send data from one to another, assuming shared memory among cores and a mechanism to send messages from one core to another, like mailbox.

Function Documentation

uint32_t sol_ipm_get_max_id ( void  )

Get maximum IPM message ID for the platform.

Some platforms limit maximum number that can be used for message ID. This function retrieves such value.

Returns
Maximum message ID on current platform. If return 0, an error happened.
Attention
Soletta reserves id 0 - do not use it.
int sol_ipm_send ( uint32_t  id,
struct sol_blob message 
)

Send IPM message.

Sends messages with id id.

Parameters
idid of message. Only receivers listening to the same id will receive this message.
messagemessage to be sent.
Returns
0 on success. Negative number otherwise
See Also
sol_ipm_set_consumed_callback
Attention
Soletta reserves id 0 - do not use it.
int sol_ipm_set_consumed_callback ( uint32_t  id,
void(*)(void *cb_data, uint32_t id, struct sol_blob *message message_consumed_cb,
const void *  data 
)

Set callback to be called when sent messaged is consumed.

When remote core unrefs its last reference to message, this callback is called to inform that message was consumed - so it can, for instance, perform some cleanup tasks or logging.

Parameters
idid of messages that whose consumption will be listened to.
message_consumed_cbcallback to be called when receiver consumed this message. This happens when last reference to it is gone. If NULL, deletes current callback for id.
datauser defined data to be sent to message_consumed_cb.
Returns
0 on success. Negative number otherwise.
See Also
sol_ipm_send
Note
One can not override a current consumed callback. To change current callback for a given id, one must first set callback to NULL. This is so to avoid accidentally changing callback.
Attention
Soletta reserves id 0 - do not use it.
int sol_ipm_set_receiver ( uint32_t  id,
void(*)(void *cb_data, uint32_t id, struct sol_blob *message receive_cb,
const void *  data 
)

Set receiver to IPM messages.

Receives messages sent with id id on callback receive_cb. Message content is on callback parameter message.

Parameters
idid of messages to listen to. Only messages sent with id will be sent to this receiver.
receive_cbcallback to be called with message sent with id. If NULL, deletes a previously set callback.
datauser defined data that will be sent to callback cb
Returns
0 if receiver was set (or unset if receive_cb is NULL). Negative number otherwise.
See Also
sol_blob
sol_ipm_send
Note
message received is a sol_blob. Only when all references to this blob are gone sender will receive its consumed confirmation.
One can not override a current receiver callback. To change current callback for a given id, one must first set callback to NULL. This is so to avoid accidentally changing callback.
Attention
Soletta reserves id 0 - do not use it.