MOS Source Code
Loading...
Searching...
No Matches
idle_task.cpp
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-3.0-or-later
2
3#include <mos/misc/setup.hpp>
7#include <mos_stdio.hpp>
8
9static void idle_task(void *arg)
10{
11 MOS_UNUSED(arg);
13 while (true)
15}
16
17static void create_idle_task()
18{
19 pr_dinfo2(process, "creating the idle task...");
20
21 for (u32 i = 0; i < platform_info->num_cpus; i++)
22 {
23 char namebuf[32];
24 snprintf(namebuf, sizeof(namebuf), "idle-%u", i);
25 pr_dinfo(process, "creating the idle task for CPU %u", i);
26 const auto t = kthread_create_no_sched(idle_task, NULL, namebuf);
27 platform_info->cpu.percpu_value[i].idle_thread = t;
28 // ! scheduler will switch to this thread if no other threads are available, thus scheduler_add_thread isn't called
29 // thread_set_cpu(t, i);
30 MOS_UNUSED(t);
31 }
32}
33
static void create_idle_task()
Definition idle_task.cpp:17
static void idle_task(void *arg)
Definition idle_task.cpp:9
__nodiscard Thread * kthread_create_no_sched(thread_entry_t entry, void *arg, const char *name)
Create a kernel thread, but do not add it to the scheduler.
Definition kthread.cpp:44
#define MOS_UNUSED(x)
Definition mos_global.h:65
int snprintf(char *__restrict str, size_t size, const char *__restrict format,...)
Definition mos_stdio.cpp:16
#define NULL
Definition pb_syshdr.h:46
#define pr_dinfo(feat, fmt,...)
Definition printk.hpp:28
#define pr_dinfo2(feat, fmt,...)
Definition printk.hpp:27
mos_platform_info_t *const platform_info
void platform_interrupt_enable()
void platform_cpu_idle()
#define MOS_INIT(_comp, _fn)
Definition setup.hpp:38
unsigned int u32
Definition types.h:17