Go to the source code of this file.
◆ icmsg_buf_init()
struct icmsg_buf * icmsg_buf_init |
( |
void * |
buf, |
|
|
size_t |
blen |
|
) |
| |
Initialize inter core messaging buffer.
This function initializes inter core messaging buffer on top of dedicated memory region.
- Parameters
-
buf | Pointer to a memory region on which buffer is created. |
blen | Length of the buffer. Must be large enough to contain the internal structure and at least two bytes of data (one is reserved for written messages length). |
- Return values
-
struct | icmsg_buf* Pointer to the created buffer. The pointer points to the same address as buf. |
◆ icmsg_buf_read()
Read specified amount of data from the inter core messaging buffer.
Single read allows to read the message send by the single write. The provided buf must be big enough to store the whole message.
- Parameters
-
ib | A icmsg buffer to which data are to be written |
buf | Data pointer to which read data will be written. If NULL, len of stored message is returned. |
len | Number of bytes to be read from the icmsg buffer. |
- Return values
-
int | Bytes read, negative error code on fail. Bytes to be read, if buf == NULL. -ENOMEM, if message can not fit in provided buf. -EAGAIN, if not whole message is ready yet. |
◆ icmsg_buf_write()
Write specified amount of data to the inter core messaging buffer.
- Parameters
-
ib | A icmsg buffer to which to write. |
buf | Pointer to the data to be written to icmsg buffer. |
len | Number of bytes to be written to the icmsg buffer. |
- Return values
-
int | Number of bytes written, negative error code on fail. -EINVAL, if len == 0. -ENOMEM, if len is bigger than the icmsg buffer can fit. |