Developer World
Spresense Arduino Library v3.3.0-b2e6327
MP Library API

Multi-Processor Communication API. More...

Classes

class  MPClass
 This is the interface for MP (Multi-Processor). More...
 

Macros

#define MPDBG(format, ...)
 
#define MPERR(format, ...)   printf("ERROR: " format, ##__VA_ARGS__)
 
#define KEY_SHM   1
 
#define KEY_MQ   2
 
#define MP_RECV_BLOCKING   (0)
 
#define MP_RECV_POLLING   (MPMQ_NONBLOCK)
 
#define MP_GET_CPUID()   (*(volatile int *)0x4e002040)
 
#define MP_MAX_SUBID   6
 
#define MPLOG_PREFIX   "[Main] "
 
#define MPLog(fmt, ...)
 

Functions

template<typename T >
int MPClass::SendObject (T &t, int subid)
 Send any object to the other processor. More...
 
template<typename T >
int MPClass::RecvObject (T &t, int subid)
 Receive any object from the other processor. More...
 

Variables

MPClass MP
 

Detailed Description

Multi-Processor Communication API.

Macro Definition Documentation

◆ MPLog

#define MPLog (   fmt,
  ... 
)
Value:
do { \
irqstate_t flags; \
flags = printlock(); \
sync_printf(MPLOG_PREFIX fmt, ##__VA_ARGS__); \
printunlock(flags); \
} while (0)

Function Documentation

◆ SendObject()

template<typename T >
int MPClass::SendObject ( T &  t,
int  subid 
)

Send any object to the other processor.

Parameters
[in]t- reference to user-defined object
[in]subid- SubCore number(1~5) to send any message. If core is SubCore, send to MainCore by default.
Returns
error code. It returns minus value on failure.
Return values
-22(-EINVAL)Invalid argument
-19(-ENODEV)No such SubCore program

The size of object must be 128 bytes or less.

◆ RecvObject()

template<typename T >
int MPClass::RecvObject ( T &  t,
int  subid 
)

Receive any object from the other processor.

Parameters
[out]t- reference to user-defined object
[in]subid- SubCore number(1~5) to receive any message. If core is SubCore, receive from MainCore by default.
Returns
msgid or error code. It returns minus value on failure.
Return values
-22(-EINVAL)Invalid argument
-19(-ENODEV)No such SubCore program
-116(-ETIMEDOUT)Timeout to receive from other core

The size of object must be 128 bytes or less.