WS63 SDK 文档 7021f4f@fbb_ws63
ws63 和 ws63e 解决方案的 SDK 文档
载入中...
搜索中...
未找到
osal_task

函数

osal_taskosal_kthread_create (osal_kthread_handler handler, void *data, const char *name, unsigned int stack_size)
 Provides an interface for creating a thread and invokes kthread_run for creating a kernel thread.
 
int osal_kthread_set_priority (osal_task *task, unsigned int priority)
 Setting the priority of a thread.
 
void osal_kthread_set_affinity (osal_task *task, int cpu_mask)
 Setting the CPU Affinity of a Task.
 
int osal_kthread_should_stop (void)
 Check whether the thread is running.
 
int osal_kthread_wakeup_process (osal_task *task)
 This function is used to wake up a thread.
 
void osal_kthread_bind (osal_task *task, unsigned int cpu)
 Bind the created thread to run on the execution CPU core.
 
void osal_kthread_lock (void)
 Lock the task scheduling.
 
void osal_kthread_unlock (void)
 Unlock the task scheduling.
 
void osal_kthread_destroy (osal_task *task, unsigned int stop_flag)
 Used to destroy the threads you created.
 
void osal_kthread_schedule (unsigned int sleep_ns)
 In this state, it cannot be woken up by an external signal and can only be woken up by the kernel itself.
 
void osal_kthread_set_uninterrupt (void)
 Set the current thread to the Task_UNINTERRUPTIBLE state.
 
void osal_kthread_set_running (void)
 Set the current thread status to TASK_RUNNING.
 
void osal_cond_resched (void)
 Programs running in kernel mode can call osal_cond_resched to actively give up CPU resources.
 
void osal_schedule (void)
 This function put the current task back to the ready queue and try to do the schedule.
 
void osal_kneon_begin (void)
 Enabling NEON Algorithm Acceleration.
 
void osal_kneon_end (void)
 Disable NEON Algorithm Acceleration.
 
void osal_yield (void)
 Pause the current thread.
 
long osal_get_current_pid (void)
 Obtains the pid of the current thread.
 
long osal_get_current_tid (void)
 Obtains the tid of the current thread.
 
int osal_get_current_tgid (void)
 Obtains the tgid of the current thread.
 
char * osal_get_current_taskname (void)
 Obtains the name of a thread.
 
unsigned long osal_msleep (unsigned int msecs)
 sleep.
 
void osal_msleep_uninterruptible (unsigned int msecs)
 sleep safely even with waitqueue interruptions.
 
void osal_udelay (unsigned int usecs)
 spinning-delay in microsecond (us).
 
void osal_mdelay (unsigned int msecs)
 spinning-delay in millisecond (ms).
 
void osal_kthread_suspend (osal_task *task)
 Suspend a task.
 
void osal_kthread_resume (osal_task *task)
 Resume a task.
 

详细描述

函数说明

◆ osal_cond_resched()

void osal_cond_resched ( void  )

Programs running in kernel mode can call osal_cond_resched to actively give up CPU resources.

Description:
This prevents soft lockup or long scheduling delay caused by the program running in kernel mode for a long time.
Support System:
linux.

◆ osal_get_current_pid()

long osal_get_current_pid ( void  )

Obtains the pid of the current thread.

Description:
Obtains the pid of the current thread.
返回
pid of the current thread.
Support System:
linux liteos.

◆ osal_get_current_taskname()

char * osal_get_current_taskname ( void  )

Obtains the name of a thread.

Description:
Obtains the name of a thread.
返回
name of the current thread.
Support System:
linux.

◆ osal_get_current_tgid()

int osal_get_current_tgid ( void  )

Obtains the tgid of the current thread.

Description:
Obtains the tgid of the current thread.
返回
tgid of the current thread.
Support System:
linux.

◆ osal_get_current_tid()

long osal_get_current_tid ( void  )

Obtains the tid of the current thread.

Description:
Obtains the tid of the current thread.
返回
tid of the current thread.
Support System:
linux liteos seliteos.

◆ osal_kneon_begin()

void osal_kneon_begin ( void  )

Enabling NEON Algorithm Acceleration.

Description:
Enabling NEON Algorithm Acceleration.
注意
This interface work only when CONFIG_KERNEL_MODE_NEON is defined, Otherwise do nothing.
Support System:
linux.

◆ osal_kneon_end()

void osal_kneon_end ( void  )

Disable NEON Algorithm Acceleration.

Description:
Disable NEON Algorithm Acceleration.
注意
This interface work only when CONFIG_KERNEL_MODE_NEON is defined, Otherwise do nothing.
Support System:
linux.

◆ osal_kthread_bind()

void osal_kthread_bind ( osal_task task,
unsigned int  cpu 
)

Bind the created thread to run on the execution CPU core.

Description:
Bind the created thread to run on the execution CPU core.
参数
task[in] Thread you want to bind.
cpu[in] This kernel thread is bound to the CPU.
Support System:
linux.

◆ osal_kthread_create()

osal_task * osal_kthread_create ( osal_kthread_handler  handler,
void *  data,
const char *  name,
unsigned int  stack_size 
)

Provides an interface for creating a thread and invokes kthread_run for creating a kernel thread.

Description:
Provides an interface for creating a thread and invokes kthread_run for creating a kernel thread. If the size of the task stack to be created is less than or equal to MINIMAL_STACK_SIZE, set stack_size to MINIMAL_STACK_SIZE to specify the default size of the task stack. The stack size is determined by whether it is big enough to avoid task stack overflow.
参数
stack_size[in] Size of the stack space of the thread.
handler[in] Functions to be processed by the thread
data[in] Function handler data.
name[in] Thread name displayed.
返回值
osal_task*If the thread is successfully created, the pointer of the thread is returned.
NULLIf the thread fails to be created, NULL is returned.
Support System:
linux liteos freertos.

◆ osal_kthread_destroy()

void osal_kthread_destroy ( osal_task task,
unsigned int  stop_flag 
)

Used to destroy the threads you created.

Description:
Stops a specified kernel thread.
注意
osal_kthread_destroy will free memory of task, caller should clear pointer to be NULL. Note that if you want to destroy a thread, the thread cannot end before calling this function, Or something terrible will happen. When you call the Kthread_stop function, the thread function cannot be finished, otherwise it will oops. task may be free in api, task should be from osal_kthread_create.
参数
task[in] Threads you want to destroy.
stop_flag[in] Indicates whether the current thread exits. If the value of stop_flag is 0, The current thread does not exit. The stop flag is not 0.
Support System:
linux liteos freertos.

◆ osal_kthread_lock()

void osal_kthread_lock ( void  )

Lock the task scheduling.

Description:
This API is used to lock the task scheduling. Task switching will not occur if the task scheduling is locked.
注意
If the task scheduling is locked, but interrupts are not disabled, tasks are still able to be interrupted. One is added to the number of task scheduling locks if this API is called. The number of locks is decreased by one if the task scheduling is unlocked. Therefore, this API should be used together with osal_kthread_unlock.
Support System:
liteos freertos .

◆ osal_kthread_resume()

void osal_kthread_resume ( osal_task task)

Resume a task.

Description:
This API is used to resume a suspended task.
参数
task[in] Thread to be resumed.
Support System:
liteos.

◆ osal_kthread_schedule()

void osal_kthread_schedule ( unsigned int  sleep_ns)

In this state, it cannot be woken up by an external signal and can only be woken up by the kernel itself.

Description:
The current thread enters the Task_UNINTERRUPTIBLE state and cannot be woken up by external signals. The kernel wakes up the thread when the sleep time arrives.
参数
sleep_ns[in] Sleep time, units is nanosecond(ns).
Support System:
linux.

◆ osal_kthread_set_affinity()

void osal_kthread_set_affinity ( osal_task task,
int  cpu_mask 
)

Setting the CPU Affinity of a Task.

Description:
Setting the CPU Affinity of a Task.
参数
task[in] Thread to change
cpu_mask[in] Specifies the mask of the CPU.You can only choose one of the following OSAL_CPU_ALL, OSAL_CPU_0, OSAL_CPU_1, OSAL_CPU_2, OSAL_CPU_3.
Support System:
linux liteos .

◆ osal_kthread_set_priority()

int osal_kthread_set_priority ( osal_task task,
unsigned int  priority 
)

Setting the priority of a thread.

Description:
Sets the priority of the current thread.
参数
task[in] Threads to be prioritized.
priority[in] Priority to be set, It must be one of the following three priorities. OSAL_TASK_PRIORITY_HIGH, OSAL_TASK_PRIORITY_MIDDLE, OSAL_TASK_PRIORITY_LOW.
返回
OSAL_FAILURE/OSAL_SUCCESS.
Support System:
linux liteos freertos.

◆ osal_kthread_set_running()

void osal_kthread_set_running ( void  )

Set the current thread status to TASK_RUNNING.

Description:
The fact that the process is runnable does not mean that the process has actually been allocd to the CPU, it may wait until the scheduler selects it. This state simply ensures that the process can run as soon as it is selected by the CPU, without waiting for an external event.
Support System:
linux.

◆ osal_kthread_set_uninterrupt()

void osal_kthread_set_uninterrupt ( void  )

Set the current thread to the Task_UNINTERRUPTIBLE state.

Description:
In this state, it cannot be woken up by an external signal and can only be woken up by the kernel itself.
Support System:
linux.

◆ osal_kthread_should_stop()

int osal_kthread_should_stop ( void  )

Check whether the thread is running.

Description:
A function used to determine whether a thread in the kernel is still running.
返回值
0If one of the current threads continues to run in the kernel.
1If a current thread is stopped somewhere in the kernel by using kthread_stop(struct task_struct *).
Support System:
linux liteos.

◆ osal_kthread_suspend()

void osal_kthread_suspend ( osal_task task)

Suspend a task.

Description:
This API is used to suspend a specified task, and the task will be removed from the queue of ready tasks.
参数
task[in] Thread to be suspended.
Support System:
liteos.

◆ osal_kthread_unlock()

void osal_kthread_unlock ( void  )

Unlock the task scheduling.

Description:
This API is used to unlock the task scheduling. Calling this API will decrease the number of task locks by one. If a task is locked more than once, the task scheduling will be unlocked only when the number of locks becomes zero.
注意
The number of locks is decreased by one if this API is called. One is added to the number of task scheduling locks if the task scheduling is locked. Therefore, this API should be used together with osal_kthread_lock.
Support System:
liteos freertos.

◆ osal_kthread_wakeup_process()

int osal_kthread_wakeup_process ( osal_task task)

This function is used to wake up a thread.

Description:
This function is used to wake up a thread.
参数
task[in] Thread you want to wake up.
返回值
0If the wakeup is successful, 0 is returned.
-1If the wakeup fails, -1 is returned.
Support System:
linux.

◆ osal_mdelay()

void osal_mdelay ( unsigned int  msecs)

spinning-delay in millisecond (ms).

Description:
This API is used to delay in millisecond.
参数
msecs[in] Time in milliseconds to wait for.
Support System:
linux liteos freertos.

◆ osal_msleep()

unsigned long osal_msleep ( unsigned int  msecs)

sleep.

Description:
sleep.
参数
msecs[in] Time in milliseconds to sleep for.
返回
Returns 0 when the timer has expired otherwise the remaining time in ms will be returned.
Support System:
linux liteos freertos.

◆ osal_msleep_uninterruptible()

void osal_msleep_uninterruptible ( unsigned int  msecs)

sleep safely even with waitqueue interruptions.

Description:
sleep safely even with waitqueue interruptions.
参数
msecs[in] Time in milliseconds to sleep for.
Support System:
linux liteos.

◆ osal_schedule()

void osal_schedule ( void  )

This function put the current task back to the ready queue and try to do the schedule.

Description:
This function put the current task back to the ready queue and try to do the schedule.
Support System:
linux liteos freertos.

◆ osal_udelay()

void osal_udelay ( unsigned int  usecs)

spinning-delay in microsecond (us).

Description:
This API is used to delay in microsecond.
参数
usecs[in] Time in microseconds to wait for.
Support System:
linux liteos freertos.

◆ osal_yield()

void osal_yield ( void  )

Pause the current thread.

Description:
The time slice of the CPU of the current thread is released so that the running thread becomes ready again and contends for the scheduling right of the CPU again. It may be obtained, or it may be obtained by other threads.
Support System:
linux freertos.