10#define __OSAL_TASK_H__
18#if defined(__LITEOS__) || defined(__FREERTOS__)
19#define OSAL_TASK_PRIORITY_ABOVE_HIGH 2
20#define OSAL_TASK_PRIORITY_HIGH 3
21#define OSAL_TASK_PRIORITY_BELOW_HIGH 4
22#define OSAL_TASK_PRIORITY_ABOVE_MIDDLE 5
23#define OSAL_TASK_PRIORITY_MIDDLE 6
24#define OSAL_TASK_PRIORITY_BELOW_MIDDLE 7
25#define OSAL_TASK_PRIORITY_ABOVE_LOW 8
26#define OSAL_TASK_PRIORITY_LOW 10
27#define OSAL_TASK_PRIORITY_BELOW_LOW 11
28#elif defined(__KERNEL__)
29#define OSAL_TASK_PRIORITY_ABOVE_HIGH 99
30#define OSAL_TASK_PRIORITY_HIGH 90
31#define OSAL_TASK_PRIORITY_BELOW_HIGH 80
32#define OSAL_TASK_PRIORITY_ABOVE_MIDDLE 70
33#define OSAL_TASK_PRIORITY_MIDDLE 60
34#define OSAL_TASK_PRIORITY_BELOW_MIDDLE 50
35#define OSAL_TASK_PRIORITY_ABOVE_LOW 40
36#define OSAL_TASK_PRIORITY_LOW 30
37#define OSAL_TASK_PRIORITY_BELOW_LOW 20
39#define OSAL_TASK_PRIORITY_ABOVE_HIGH 2
40#define OSAL_TASK_PRIORITY_HIGH 3
41#define OSAL_TASK_PRIORITY_BELOW_HIGH 4
42#define OSAL_TASK_PRIORITY_ABOVE_MIDDLE 5
43#define OSAL_TASK_PRIORITY_MIDDLE 6
44#define OSAL_TASK_PRIORITY_BELOW_MIDDLE 7
45#define OSAL_TASK_PRIORITY_ABOVE_LOW 8
46#define OSAL_TASK_PRIORITY_LOW 10
47#define OSAL_TASK_PRIORITY_BELOW_LOW 11
void osal_kneon_begin(void)
Enabling NEON Algorithm Acceleration.
Definition osal_task.c:170
long osal_get_current_pid(void)
Obtains the pid of the current thread.
Definition osal_task.c:192
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_destroy(osal_task *task, unsigned int stop_flag)
Used to destroy the threads you created.
Definition osal_task.c:91
void osal_kthread_set_affinity(osal_task *task, int cpu_mask)
Setting the CPU Affinity of a Task.
Definition osal_task.c:80
long osal_get_current_tid(void)
Obtains the tid of the current thread.
Definition osal_task.c:181
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 its...
Definition osal_task.c:143
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.
Definition osal_task.c:197
void osal_kneon_end(void)
Disable NEON Algorithm Acceleration.
Definition osal_task.c:175
void osal_kthread_suspend(osal_task *task)
Suspend a task.
Definition osal_task.c:111
void osal_udelay(unsigned int usecs)
spinning-delay in microsecond (us).
Definition osal_task.c:208
void osal_kthread_lock(void)
Lock the task scheduling.
Definition osal_task.c:70
void osal_kthread_set_uninterrupt(void)
Set the current thread to the Task_UNINTERRUPTIBLE state.
Definition osal_task.c:149
void osal_yield(void)
Pause the current thread.
Definition osal_task.c:164
void osal_kthread_unlock(void)
Unlock the task scheduling.
Definition osal_task.c:75
void osal_kthread_set_running(void)
Set the current thread status to TASK_RUNNING.
Definition osal_task.c:154
void osal_mdelay(unsigned int msecs)
spinning-delay in millisecond (ms).
Definition osal_task.c:213
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.
Definition osal_task.c:19
void osal_cond_resched(void)
Programs running in kernel mode can call osal_cond_resched to actively give up CPU resources.
Definition osal_task.c:159
int osal_kthread_set_priority(osal_task *task, unsigned int priority)
Setting the priority of a thread.
Definition osal_task.c:56
void osal_schedule(void)
This function put the current task back to the ready queue and try to do the schedule.
Definition osal_task.c:106
void osal_msleep_uninterruptible(unsigned int msecs)
sleep safely even with waitqueue interruptions.
Definition osal_task.c:203
void osal_kthread_resume(osal_task *task)
Resume a task.
Definition osal_task.c:127
int osal_kthread_should_stop(void)
Check whether the thread is running.
Definition osal_task.c:86
int(* osal_kthread_handler)(void *data)
Definition osal_task.h:52
Definition osal_task.h:49
void * task
Definition osal_task.h:50
Definition hal_uart_v151_regs_def.h:38