MOS Source Code
Loading...
Searching...
No Matches
idle_task.c
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-3.0-or-later
2
3#include <mos/misc/setup.h>
5#include <mos/syslog/printk.h>
6#include <mos/tasks/kthread.h>
7#include <mos_stdio.h>
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);
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.c:17
static void idle_task(void *arg)
Definition idle_task.c:9
__nodiscard thread_t * 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.c:43
#define MOS_UNUSED(x)
Definition mos_global.h:64
int snprintf(char *__restrict str, size_t size, const char *__restrict format,...)
Definition mos_stdio.c:16
#define NULL
Definition pb_syshdr.h:46
#define pr_dinfo(feat, fmt,...)
Definition printk.h:28
#define pr_dinfo2(feat, fmt,...)
Definition printk.h:27
mos_platform_info_t *const platform_info
void platform_interrupt_enable()
void platform_cpu_idle()
#define MOS_INIT(_comp, _fn)
Definition setup.h:40
thread_t * idle_thread
idle thread for this CPU
Definition platform.h:96
struct mos_platform_info_t::cpu cpu
unsigned int u32
Definition types.h:21