Eliminate public use of non-public task structure
Revises several trivial task APIs to avoid exposure of task object internal fields. Change-Id: Iefa8028042dff1abd1f447eb1cc1ee49f0c2eda5 Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
This commit is contained in:
parent
b9e5ff8f9e
commit
4a56570f9c
2 changed files with 67 additions and 7 deletions
|
@ -37,8 +37,6 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern struct k_proc *_k_current_task;
|
||||
|
||||
/*
|
||||
* The following task groups are reserved for system use.
|
||||
* SysGen automatically generates corresponding TASKGROUPs with reserved
|
||||
|
@ -85,16 +83,18 @@ extern int task_offload_to_fiber(int (*)(), void *);
|
|||
extern void KS_TaskSetSwitchCallBack(taskswitchcallbackfunc func);
|
||||
#endif
|
||||
|
||||
#define task_id_get() (_k_current_task->Ident)
|
||||
#define task_priority_get() (_k_current_task->Prio)
|
||||
extern ktask_t task_id_get();
|
||||
extern kpriority_t task_priority_get();
|
||||
|
||||
#define task_start(t) _task_ioctl(t, TASK_START)
|
||||
#define task_abort(t) _task_ioctl(t, TASK_ABORT)
|
||||
#define task_suspend(t) _task_ioctl(t, TASK_SUSPEND)
|
||||
#define task_resume(t) _task_ioctl(t, TASK_RESUME)
|
||||
|
||||
#define task_group_mask_get() (_k_current_task->Group)
|
||||
#define task_group_join(g) (_k_current_task->Group |= g)
|
||||
#define task_group_leave(g) (_k_current_task->Group &= ~g)
|
||||
extern uint32_t task_group_mask_get();
|
||||
extern void task_group_join(uint32_t groups);
|
||||
extern void task_group_leave(uint32_t groups);
|
||||
|
||||
#define task_group_start(g) _task_group_ioctl(g, TASK_GROUP_START)
|
||||
#define task_group_abort(g) _task_group_ioctl(g, TASK_GROUP_ABORT)
|
||||
#define task_group_suspend(g) _task_group_ioctl(g, TASK_GROUP_SUSPEND)
|
||||
|
|
|
@ -42,6 +42,18 @@
|
|||
#include <start_task_arch.h>
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* task_id_get - get task identifer
|
||||
*
|
||||
* RETURNS: identifier for current task
|
||||
*/
|
||||
|
||||
ktask_t task_id_get(void)
|
||||
{
|
||||
return _k_current_task->Ident;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* reset_state_bit - reset the specified task state bits
|
||||
|
@ -434,6 +446,54 @@ void _task_group_ioctl(ktask_group_t group, /* task group */
|
|||
KERNEL_ENTRY(&A);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* task_group_mask_get - get task groups for task
|
||||
*
|
||||
* RETURNS: task groups associated with current task
|
||||
*/
|
||||
|
||||
kpriority_t task_group_mask_get(void)
|
||||
{
|
||||
return _k_current_task->Group;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* task_group_join - add task to task group(s)
|
||||
*
|
||||
* RETURNS: N/A
|
||||
*/
|
||||
|
||||
void task_group_join(uint32_t groups)
|
||||
{
|
||||
_k_current_task->Group |= groups;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* task_group_leave - remove task from task group(s)
|
||||
*
|
||||
* RETURNS: N/A
|
||||
*/
|
||||
|
||||
void task_group_leave(uint32_t groups)
|
||||
{
|
||||
_k_current_task->Group &= ~groups;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* task_priority_get - get task priority
|
||||
*
|
||||
* RETURNS: priority of current task
|
||||
*/
|
||||
|
||||
kpriority_t task_priority_get(void)
|
||||
{
|
||||
return _k_current_task->Prio;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* _k_task_priority_set - handle task set priority request
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue