Task
[Kernel]


数据结构

struct   tagTskInitParam
  Define the structure of the parameters used for task creation. 更多...
struct   tagTskInfo
  Task information structure. 更多...

宏定义

#define  LOS_ERRNO_TSK_NO_MEMORY   LOS_ERRNO_OS_FATAL(LOS_MOD_TSK, 0x00)
  Task error code: Insufficient memory for task creation.
#define  LOS_ERRNO_TSK_PTR_NULL   LOS_ERRNO_OS_ERROR(LOS_MOD_TSK, 0x01)
  Task error code: Null parameter.
#define  LOS_ERRNO_TSK_STKSZ_NOT_ALIGN   LOS_ERRNO_OS_ERROR(LOS_MOD_TSK, 0x02)
  Task error code: The task stack is not aligned.
#define  LOS_ERRNO_TSK_PRIOR_ERROR   LOS_ERRNO_OS_ERROR(LOS_MOD_TSK, 0x03)
  Task error code: Incorrect task priority.
#define  LOS_ERRNO_TSK_ENTRY_NULL   LOS_ERRNO_OS_ERROR(LOS_MOD_TSK, 0x04)
  Task error code: The task entrance is NULL.
#define  LOS_ERRNO_TSK_NAME_EMPTY   LOS_ERRNO_OS_ERROR(LOS_MOD_TSK, 0x05)
  Task error code: The task name is NULL.
#define  LOS_ERRNO_TSK_STKSZ_TOO_SMALL   LOS_ERRNO_OS_ERROR(LOS_MOD_TSK, 0x06)
  Task error code: The task stack size is too small.
#define  LOS_ERRNO_TSK_ID_INVALID   LOS_ERRNO_OS_ERROR(LOS_MOD_TSK, 0x07)
  Task error code: Invalid task ID.
#define  LOS_ERRNO_TSK_ALREADY_SUSPENDED   LOS_ERRNO_OS_ERROR(LOS_MOD_TSK, 0x08)
  Task error code: The task is already suspended.
#define  LOS_ERRNO_TSK_NOT_SUSPENDED   LOS_ERRNO_OS_ERROR(LOS_MOD_TSK, 0x09)
  Task error code: The task is not suspended.
#define  LOS_ERRNO_TSK_NOT_CREATED   LOS_ERRNO_OS_ERROR(LOS_MOD_TSK, 0x0a)
  Task error code: The task is not created.
#define  LOS_ERRNO_TSK_MSG_NONZERO   LOS_ERRNO_OS_ERROR(LOS_MOD_TSK, 0x0c)
  Task error code: The task message is nonzero.
#define  LOS_ERRNO_TSK_DELAY_IN_INT   LOS_ERRNO_OS_FATAL(LOS_MOD_TSK, 0x0d)
  Task error code: The task delay occurs during an interrupt.
#define  LOS_ERRNO_TSK_DELAY_IN_LOCK   LOS_ERRNO_OS_ERROR(LOS_MOD_TSK, 0x0e)
  Task error code: The task delay occurs when the task is locked.
#define  LOS_ERRNO_TSK_YIELD_INVALID_TASK   LOS_ERRNO_OS_ERROR(LOS_MOD_TSK, 0x0f)
  Task error code: The task that is being scheduled is invalid.
#define  LOS_ERRNO_TSK_YIELD_NOT_ENOUGH_TASK   LOS_ERRNO_OS_ERROR(LOS_MOD_TSK, 0x10)
  Task error code: Only one task or no task is available for scheduling.
#define  LOS_ERRNO_TSK_TCB_UNAVAILABLE   LOS_ERRNO_OS_ERROR(LOS_MOD_TSK, 0x11)
  Task error code: No free task control block is available.
#define  LOS_ERRNO_TSK_HOOK_NOT_MATCH   LOS_ERRNO_OS_ERROR(LOS_MOD_TSK, 0x12)
  Task error code: The task hook function is not matchable.
#define  LOS_ERRNO_TSK_HOOK_IS_FULL   LOS_ERRNO_OS_ERROR(LOS_MOD_TSK, 0x13)
  Task error code: The number of task hook functions exceeds the permitted upper limit.
#define  LOS_ERRNO_TSK_OPERATE_IDLE   LOS_ERRNO_OS_ERROR(LOS_MOD_TSK, 0x14)
  Task error code: The operation is performed on the idle task.
#define  LOS_ERRNO_TSK_SUSPEND_LOCKED   LOS_ERRNO_OS_FATAL(LOS_MOD_TSK, 0x15)
  Task error code: The task that is being suspended is locked.
#define  LOS_ERRNO_TSK_FREE_STACK_FAILED   LOS_ERRNO_OS_ERROR(LOS_MOD_TSK, 0x17)
  Task error code: The task stack fails to be freed.
#define  LOS_ERRNO_TSK_STKAREA_TOO_SMALL   LOS_ERRNO_OS_ERROR(LOS_MOD_TSK, 0x18)
  Task error code: The task stack area is too small.
#define  LOS_ERRNO_TSK_ACTIVE_FAILED   LOS_ERRNO_OS_FATAL(LOS_MOD_TSK, 0x19)
  Task error code: The task fails to be activated.
#define  LOS_ERRNO_TSK_CONFIG_TOO_MANY   LOS_ERRNO_OS_ERROR(LOS_MOD_TSK, 0x1a)
  Task error code: Too many task configuration items.
#define  LOS_ERRNO_TSK_CP_SAVE_AREA_NOT_ALIGN   LOS_ERRNO_OS_ERROR(LOS_MOD_TSK, 0x1b)
  Task error code:
#define  LOS_ERRNO_TSK_MSG_Q_TOO_MANY   LOS_ERRNO_OS_ERROR(LOS_MOD_TSK, 0x1d)
  Task error code:
#define  LOS_ERRNO_TSK_CP_SAVE_AREA_NULL   LOS_ERRNO_OS_ERROR(LOS_MOD_TSK, 0x1e)
  Task error code:
#define  LOS_ERRNO_TSK_SELF_DELETE_ERR   LOS_ERRNO_OS_ERROR(LOS_MOD_TSK, 0x1f)
  Task error code:
#define  LOS_ERRNO_TSK_STKSZ_TOO_LARGE   LOS_ERRNO_OS_ERROR(LOS_MOD_TSK, 0x20)
  Task error code: The task stack size is too large.
#define  LOS_ERRNO_TSK_SUSPEND_SWTMR_NOT_ALLOWED   LOS_ERRNO_OS_ERROR(LOS_MOD_TSK, 0x21)
  Task error code: Suspending software timer task is not allowed.
#define  LOS_ERRNO_TSK_OPERATE_SWTMR   LOS_ERRNO_OS_ERROR(LOS_MOD_TSK, 0x22)
  Task error code: The operation is performed on the software timer task.
#define  LOS_TASK_NAMELEN   32
  Task name length
#define  OS_TASK_SWITCH_INFO_COUNT   (0xA)
  Task switch information structure.

类型定义

typedef VOID(*  TSKSWITCHHOOK )(VOID)
  Define the type of the task switching hook function.
typedef VOID *(*  TSK_ENTRY_FUNC )(UINT32 uwArg)
  Define the type of a task entrance function.
typedef struct tagTskInitParam  TSK_INIT_PARAM_S
  Define the structure of the parameters used for task creation.
typedef struct tagTskInfo  TSK_INFO_S
  Task information structure.

函数

UINT32  LOS_TaskCreateOnly (UINT32 *puwTaskID, TSK_INIT_PARAM_S *pstInitParam)
  Create a task and suspend.
UINT32  LOS_TaskCreate (UINT32 *puwTaskID, TSK_INIT_PARAM_S *pstInitParam)
  Create a task.
UINT32  LOS_TaskResume (UINT32 uwTaskID)
  Resume a task.
UINT32  LOS_TaskSuspend (UINT32 uwTaskID)
  Suspend a task.
UINT32  LOS_TaskDelete (UINT32 uwTaskID)
  Delete a task.
UINT32  LOS_TaskDelay (UINT32 uwTick)
  Delay a task.
VOID  LOS_TaskLock (VOID)
  Lock the task scheduling.
VOID  LOS_TaskUnlock (VOID)
  Unlock the task scheduling.
UINT32  LOS_TaskPriSet (UINT32 uwTaskID, UINT16 usTaskPrio)
  Set a task priority.
UINT32  LOS_CurTaskPriSet (UINT16 usTaskPrio)
  Set the priority of the current running task to a specified priority.
UINT32  LOS_TaskYield (VOID)
  Change the scheduling sequence of tasks with the same priority.
UINT16  LOS_TaskPriGet (UINT32 uwTaskID)
  Obtain a task priority.
UINT32  LOS_CurTaskIDGet (VOID)
  Obtain current running task ID.
UINT32  LOS_NextTaskIDGet (VOID)
  Obtain next running task ID.
CHAR LOS_CurTaskNameGet (VOID)
  Obtain next running task ID.
UINT32  LOS_TaskInfoGet (UINT32 uwTaskID, TSK_INFO_S *pstTaskInfo)
  Obtain a task information structure.
UINT32  LOS_TaskStatusGet (UINT32 uwTaskID, UINT32 *puwTaskStatus)
  Obtain the task status.
UINT32  LOS_TaskSwitchInfoGet (UINT32 uwIdx, UINT32 *pTaskSwitchInfo)
  Obtain tasks switch info.
BOOL  LOS_TaskIsRunning (VOID)
  Obtain tasks schduling info.
UINT32  LOS_NewTaskIDGet (VOID)
  Obtain current new task ID.
CHAR LOS_TaskNameGet (UINT32 uwTaskID)
  Obtain current new task name.

变量

TSKSWITCHHOOK  g_pfnUsrTskSwitchHook
  User task switching hook function.