The Inter Processor Communication(IPC) functions provide standalone and RTOS based support functions for sharing data between the M0 and M4 core.
Build procedure: LPCOpen 18xx/43xx build instructions
Submit bug reports for LPCOpen code here.
#define ipc_wait_event |
( |
|
evt, |
|
|
|
sem |
|
) |
| while ((evt)) |
#define ipc_wait_event_tout |
( |
|
evt, |
|
|
|
tout, |
|
|
|
sem |
|
) |
| |
Value:do { \
if (cnt + 5000 < cnt) {cnt += 5000; } \
if (evt) {tout = 0; } \
} while (0)
Definition at line 226 of file ipc_msg.c.
#define QUEUE_DATA_COUNT |
( |
|
q | ) |
((uint32_t) ((q)->head - (q)->tail)) |
This macro will get the number of items pending in q
Definition at line 56 of file ipc_msg.h.
Returned by dualcore IPC function when an attempt is made to fetch/pop an item from the Message Queue when the queue is empty.
Definition at line 112 of file ipc_msg.h.
Returned by dualcore IPC function when an push/pop is made to a queue which was not initialized using IPC_initMsgQueue()
Definition at line 119 of file ipc_msg.h.
Returned by dualcore IPC function when an attempt is made to insert item into the Message Queue when the queue is full.
Definition at line 104 of file ipc_msg.h.
Returned by dualcore IPC function when an item is successfully inserted into the Message Queue
Definition at line 96 of file ipc_msg.h.
#define QUEUE_IS_EMPTY |
( |
|
q | ) |
((q)->head == (q)->tail) |
This macro will evaluate to 1 if queue q is empty, 0 if it is not
Definition at line 66 of file ipc_msg.h.
This macro will evaluate to 1 if queue q is full, 0 if it is not
Definition at line 61 of file ipc_msg.h.
Returned by dualcore IPC function when a push/pop operation did not complete within a given time.
Definition at line 126 of file ipc_msg.h.
Returned by dualcore IPC function when an item is successfully fetched from Message Queue
Definition at line 89 of file ipc_msg.h.
void EVENT_IPC_Receive |
( |
void |
| ) |
|
Call-back function to handle IPC Message receive event.
- Returns
- None This is a weak function (hence can be overridden by the user's application with a function of same name. This call-back function will be called whenever there is a message received by the core that implements this function.
Definition at line 382 of file ipc_msg.c.
void IPC_initMsgQueue |
( |
void * |
data, |
|
|
int |
msgSize, |
|
|
int |
maxNoOfMsg |
|
) |
| |
Function to initialize the IPC message queue.
This function intializes the interprocessor communication message queue. IMPORTANT NOTE: MaxNoOfMsg must always be a power of 2.
- Parameters
-
data | : Pointer to the array of messages of size msgSize |
msgSize | : Size of the single data element in queue |
maxNoOfMsg | : Maximum number of items that can be stored in Queue |
- Returns
- None, will not return if there is error in given arguments
Definition at line 262 of file ipc_msg.c.
void IPC_IRQHandler |
( |
void |
| ) |
|
Interrupt handler for IPC interrupts.
- Returns
- None
Definition at line 392 of file ipc_msg.c.
static void ipc_misc_init |
( |
void |
| ) |
|
|
static |
void IPC_msgNotify |
( |
void |
| ) |
|
Function to send notificaton interrupt.
When called from the M0, it sends the notification interrupt to M4 and vice-versa.
- Returns
- None
Definition at line 256 of file ipc_msg.c.
int IPC_msgPending |
( |
int |
queue_write | ) |
|
Get number of pending items in queue.
This function will get the number of pending items in the queue. If this function is called by M4 core with param queue_write set to non zero then this function will return the number of messages waiting in M4's Push Queue that is yet to be popped by the M0 core, or vice versa. If this function is called by M4 core with param queue_write set to zero then it returns the number of elements that can be popped without waiting (in other words number of messages pending in the M0's Push queue that is yet to be popped by M4 core), or vice versa.
- Parameters
-
queue_write | : 1 - read number of elements in write queue, 0 - read number of elements in read queue |
- Returns
- Number of elements in queue
Definition at line 361 of file ipc_msg.c.
static INLINE int IPC_popMsg |
( |
void * |
data | ) |
|
|
static |
Function to pop the message from queue with wait.
The function will pop the data from the IPC queue. If the queue is empty, it will wait (blocking) till the data is available.
- Parameters
-
data | : Pointer to store popped data |
- Returns
- status : Pop status
Definition at line 214 of file ipc_msg.h.
int IPC_popMsgTout |
( |
void * |
data, |
|
|
int |
tout |
|
) |
| |
Function to read a message from queue with timeout.
This function will pop a message of size size, specified by IPC_initMsgQueue of the other core. If this function is called from M4 Core the message will be popped from M0 Queue and vice-versa.
- Parameters
-
data | : Pointer to store popped data |
tout | : non-zero value - timeout value in milliseconds, zero value - no blocking, negative value - blocking |
- Returns
- QUEUE_VALID on success, QUEUE_EMPTY or QUEUE_ERROR on failure, QUEUE_TIMEOUT when there is a timeout
Definition at line 320 of file ipc_msg.c.
static INLINE int IPC_pushMsg |
( |
const void * |
data | ) |
|
|
static |
Function to push the message into queue with wait.
The function to push the data to the IPC queue. If the queue is full, it will wait till data is pushed (blocking).
- Parameters
-
data | : Pointer to data to be pushed |
- Returns
- QUEUE_INSERT on success, QUEUE_ERROR on failure
Definition at line 200 of file ipc_msg.h.
int IPC_pushMsgTout |
( |
const void * |
data, |
|
|
int |
tout |
|
) |
| |
Function to push a message into queue with timeout.
This function will push an message of size size, specified by IPC_initMsgQueue. If this function is called from M4 Core the message will be pushed to M4 Queue and will be popped by M0, and vice-versa.
- Parameters
-
data | : Pointer to data to be pushed |
tout | : non-zero value - timeout value in milliseconds, zero value - no blocking, negative value - blocking |
- Returns
- QUEUE_INSERT on success, QUEUE_FULL or QUEUE_ERROR on failure, QUEUE_TIMEOUT when there is a timeout
Definition at line 287 of file ipc_msg.c.
static void ipc_send_signal |
( |
void |
| ) |
|
|
static |
const char* IPC_strerror |
( |
int |
errnum | ) |
|
Function to convert IPC error number to string.
This function returns the error string for the error value.
- Parameters
-
- Returns
- pointer to error string
Definition at line 405 of file ipc_msg.c.
static INLINE int IPC_tryPopMsg |
( |
void * |
data | ) |
|
|
static |
Function to pop the message from queue with no wait.
The function tries to pop the data from the IPC queue. If the queue is empty, it will return without blocking.
- Parameters
-
data | : Pointer to store popped data |
- Returns
- QUEUE_VALID on success, QUEUE_ERROR or QUEUE_EMPTY on failure
Definition at line 186 of file ipc_msg.h.
static INLINE int IPC_tryPushMsg |
( |
const void * |
data | ) |
|
|
static |
Function to push the message into queue with no wait.
The function tries to push the data to the IPC queue. If the queue is full, it will return without blocking. It is equivalent to calling IPC_pushMsgTout(data, 0).
- Parameters
-
data | : Pointer to data to be pushed |
- Returns
- QUEUE_INSERT on success, QUEUE_FULL or QUEUE_ERROR on failure
Definition at line 172 of file ipc_msg.h.
static void os_event_handler |
( |
void |
| ) |
|
|
static |