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) |
cpuid_t | mptask_getsubcoreid (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) |
#define mptask_bindobj | ( | t, | |
o | |||
) | mptask_bind((t), (mpobj_t *)(o)) |
Simple wrapper for mptask_bind()
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.
[in,out] | task | MP task object |
[in] | filename | Worker program file name |
-EINVAL | Invalid argument |
-ENOENT | No such file or directory |
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.
[in,out] | task | MP task object |
[in] | filename | Worker encrypted firmware name |
-EINVAL | Invalid argument |
-ENOENT | No such file or directory |
int mptask_attr_init | ( | mptask_attr_t * | attr | ) |
Initialize MP task attribute data
mptask_atta_init() initialize MP task attribute data.
[in,out] | attr | MP task attribute |
-EINVAL | Invalid argument |
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.
[in,out] | task | MP task object. |
[in] | force | If true, shutdown MP task forcibly. |
[out] | exit_status | Exit status of MP task |
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().
[in,out] | task | MP task object. |
[in] | obj | Bind MP object |
-EINVAL | Invalid argument |
-ENOENT | Bind object is full |
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.
[in,out] | task | MP task object. |
[in] | attr | MP task attribute. |
-EINVAL | Invalid argument |
int mptask_getattr | ( | mptask_t * | task, |
mptask_attr_t * | attr | ||
) |
Get MP task attribute
mptask_getattr() obtaining current MP task attribute.
[in,out] | task | MP task object. |
[out] | attr | Current MP task attribute. |
-EINVAL | Invalid argument |
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.
[in,out] | task | MP task object. |
-EINVAL | Invalid argument |
-ENOENT | CPU can't be assigned |
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.
[in,out] | task | MP task object. |
[in] | ncpus | Number of CPUs to be assigned. |
-EINVAL | Invalid argument |
-ENOENT | CPU can't be assigned |
Get assigned CPU ID
mptask_getcpuid() returns assigned CPU ID for task.
[in,out] | task | MP task object. |
-ENOENT | CPU not assigned yet |
Get assigned sub core ID
mptask_getsubcoreid() returns assigned sub core ID for task.
[in,out] | task | MP task object. |
-ENOENT | CPU not assigned yet |
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.
[in,out] | task | MP task object. |
[out] | cpuids | Assigned CPU ID list |
-ENOENT | CPU not assigned yet |
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.
[in,out] | task | MP task object. |
-EINVAL | Invalid argument |
-EPERM | task not initialized |
-ENOENT | CPU can't be assigned |
-ENOMEM | No memory space left |
-ESPIPE | Insufficient space in file for section header table |
int mptask_join | ( | mptask_t * | task, |
int * | exit_status | ||
) |
Wait for task exit
mptask_join() waits for MP task finish.
[in,out] | task | MP task object |
[out] | exit_status | Exit status of MP task |
-EINVAL | Invalid argument |
-EPERM | MP task already not running |