Developer World
Spresense SDK v1.3.1
Macros | Functions
Functions
Collaboration diagram for Functions:

Macros

#define mptask_bindobj(t, o)   mptask_bind((t), (mpobj_t *)(o))
 

Functions

int mptask_init (mptask_t *task, const char *filename)
 
int mptask_init_secure (mptask_t *task, const char *filename)
 
int mptask_attr_init (mptask_attr_t *attr)
 
int mptask_destroy (mptask_t *task, bool force, int *exit_status)
 
int mptask_bind (mptask_t *task, mpobj_t *obj)
 
int mptask_setattr (mptask_t *task, const mptask_attr_t *attr)
 
int mptask_getattr (mptask_t *task, mptask_attr_t *attr)
 
int mptask_assign (mptask_t *task)
 
int mptask_assign_cpus (mptask_t *task, int ncpus)
 
cpuid_t mptask_getcpuid (mptask_t *task)
 
int mptask_getcpuidset (mptask_t *task, cpu_set_t *cpuids)
 
int mptask_exec (mptask_t *task)
 
int mptask_join (mptask_t *task, int *exit_status)
 

Detailed Description

Macro Definition Documentation

◆ mptask_bindobj

#define mptask_bindobj (   t,
 
)    mptask_bind((t), (mpobj_t *)(o))

Simple wrapper for mptask_bind()

Function Documentation

◆ mptask_assign()

int mptask_assign ( mptask_t task)

Assign CPU for MP task

mptask_assign() assigns CPU for running MP task. This function automatically call in mptask_exec() when not assigned.

Parameters
[in,out]taskMP task object.
Returns
On success, mptask_setattr() returns 0. On error, it returns an error number.
Return values
-EINVALInvalid argument
-ENOENTCPU can't be assigned

◆ mptask_assign_cpus()

int mptask_assign_cpus ( mptask_t task,
int  ncpus 
)

Assign CPUs for MP task

mptask_assign_cpus() assigns CPU for running MP task. This function is for secure binary only.

Parameters
[in,out]taskMP task object.
[in]ncpusNumber of CPUs to be assigned.
Returns
On success, mptask_setattr() returns 0. On error, it returns an error number.
Return values
-EINVALInvalid argument
-ENOENTCPU can't be assigned

◆ mptask_attr_init()

int mptask_attr_init ( mptask_attr_t attr)

Initialize MP task attribute data

mptask_atta_init() initialize MP task attribute data.

Parameters
[in,out]attrMP task attribute
Returns
On success, mptask_attr_init() returns 0. On error, it returns an error number.
Return values
-EINVALInvalid argument

◆ mptask_bind()

int mptask_bind ( mptask_t task,
mpobj_t obj 
)

Bind MP object to task

mptask_bind() binds MP objects (MP message queue, MP mutex and MP shared memory) to MP task. Bound objects will be notified when the worker is bring up. User can use mptask_bindobj() instead of mptask_bind().

Parameters
[in,out]taskMP task object.
[in]objBind MP object
Returns
On success, mptask_bind() returns 0. On error, it returns an error number.
Return values
-EINVALInvalid argument
-ENOENTBind object is full

◆ mptask_destroy()

int mptask_destroy ( mptask_t task,
bool  force,
int *  exit_status 
)

Destroy MP task

mptask_destroy() finishes MP task. User must be call when MP task finished. mptask_destroy() waits MP task exit by mptask_join() if MP task still running.

Parameters
[in,out]taskMP task object.
[in]forceIf true, shutdown MP task forcibly.
[out]exit_statusExit status of MP task
Returns
On success, mptask_destroy() returns 0.

◆ mptask_exec()

int mptask_exec ( mptask_t task)

Execute MP task

mptask_exec() load worker ELF or any other ELF programs, and execute it on assigned CPU. If user not assigned by mptask_assign(), then automatically assigned CPU from attribute.

Parameters
[in,out]taskMP task object.
Returns
On success, mptask_exec() returns 0. On error, it returns an error number.
Return values
-EINVALInvalid argument
-EPERMtask not initialized
-ENOENTCPU can't be assigned
-ENOMEMNo memory space left
-ESPIPEInsufficient space in file for section header table

◆ mptask_getattr()

int mptask_getattr ( mptask_t task,
mptask_attr_t attr 
)

Get MP task attribute

mptask_getattr() obtaining current MP task attribute.

Parameters
[in,out]taskMP task object.
[out]attrCurrent MP task attribute.
Returns
On success, mptask_setattr() returns 0. On error, it returns an error number.
Return values
-EINVALInvalid argument

◆ mptask_getcpuid()

cpuid_t mptask_getcpuid ( mptask_t task)

Get assigned CPU ID

mptask_getcpuid() returns assigned CPU ID for task.

Parameters
[in,out]taskMP task object.
Returns
On success, mptask_getcpuid() returns CPU ID (3-7). On error, it returns an error number.
Return values
-ENOENTCPU not assigned yet

◆ mptask_getcpuidset()

int mptask_getcpuidset ( mptask_t task,
cpu_set_t *  cpuids 
)

Get assigned CPU ID list

mptask_getcpuid() returns assigned CPU ID list for task. This API is used for secure binary. CPU ID list can be test with CPU_ISSET() macro.

Parameters
[in,out]taskMP task object.
[out]cpuidsAssigned CPU ID list
Returns
On success, mptask_getcpuid() returns CPU ID list. On error, it returns an error number.
Return values
-ENOENTCPU not assigned yet

◆ mptask_init()

int mptask_init ( mptask_t task,
const char *  filename 
)

Initialize MP task

Initialize MP task object. User must be call this function before using other MP task APIs.

Parameters
[in,out]taskMP task object
[in]filenameWorker program file name
Returns
On success, mptask_init() returns 0. On error, it returns an error number.
Return values
-EINVALInvalid argument
-ENOENTNo such file or directory

◆ mptask_init_secure()

int mptask_init_secure ( mptask_t task,
const char *  filename 
)

Initialize MP task for encrypted firmware

Initialize MP task object as encrypted firmware. User must be call this function before using other MP task APIs.

Parameters
[in,out]taskMP task object
[in]filenameWorker encrypted firmware name
Returns
On success, mptask_init_secure() returns 0. On error, it returns an error number.
Return values
-EINVALInvalid argument
-ENOENTNo such file or directory

◆ mptask_join()

int mptask_join ( mptask_t task,
int *  exit_status 
)

Wait for task exit

mptask_join() waits for MP task finish.

Parameters
[in,out]taskMP task object
[out]exit_statusExit status of MP task
Returns
On success, mptask_join() returns 0. On error, it returns an error number.
Return values
-EINVALInvalid argument
-EPERMMP task already not running

◆ mptask_setattr()

int mptask_setattr ( mptask_t task,
const mptask_attr_t attr 
)

Set MP task attribute

mptask_setattr() replaces MP task attribute by attr. This function is useful to change CPU affinity.

Parameters
[in,out]taskMP task object.
[in]attrMP task attribute.
Returns
On success, mptask_setattr() returns 0. On error, it returns an error number.
Return values
-EINVALInvalid argument