# SPDX-License-Identifier: GPL-2.0

config MAIN_FUNCTION
	bool "call main function"
	depends on !SCHEDULER
	default n

menuconfig SCHEDULER
	bool "Scheduler"
	default y
	help
	  This will enlarge your system by about 294 bytes.
	  You will need to enable at least one of semapores, mutexes,
	  round-robin scheduling or fair scheduling
	  to be actually able to do anything useful with the scheduler.

config STACK_SIZE_FIXED
	bool "Fixed stack size"
	depends on SCHEDULER
	default y
	help
	  Use a different kthread_create API which selects the stack size.  If
	  the kernel is compiled with SMALL_SP, you will have to allocate your
	  task with kmalloc()

config STACK_SIZE_MAX
	int "Maximum stack size"
	depends on SCHEDULER
	depends on !STACK_SIZE_FIXED
	default 252
	range 40 512

config STACK_SIZE
	int "Stack size"
	depends on SCHEDULER
	depends on STACK_SIZE_FIXED
	default 128
	range 40 512

config MAX_PRIOS
	int "Maximum number of realtime priorities"
	depends on SCHEDULER
	default 8
	range 2 16

config USE_MUTEX
	bool "Implement mutual exclusion"
	depends on SCHEDULER
	default y
	help
	  This will enlarge your system by about 262 bytes.

config MUTEX_PI
	bool "Priority inheritance for mutexes"
	depends on USE_MUTEX
	default y
	help
	  This will enlarge your system by about 320 bytes.

config USE_SEMA
	bool "Implement Semaphores"
	depends on SCHEDULER
	default y
	help
	  This will enlarge your system by about 214 bytes.

config WAKE_SEMA_FROM_IRQ
	bool "Wake semaphores form irq handlers"
	depends on USE_SEMA && IRQ
	default n
	help
	  This will enlarge your kernel by about 212 bytes.

config SCHED_RR
	bool "Round-Robin scheduling"
	depends on SCHEDULER
	default n

#config PRIO_x_IS_RR
#	string "Formula to decide if prio x is RR or not"
#	depends on SCHED_RR
#	default "x & 1"

choice
	prompt "Time Slice Length"
	default GLOBAL_TIME_SLICES
	depends on SCHED_RR

config GLOBAL_TIME_SLICES
	bool "Global"

config PER_PRIO_TIME_SLICES
	bool "Per Priority"

config TIME_SLICES
	bool "Per Task"

endchoice

config SCHED_OTHER
	bool "Fair scheduling"
	depends on SCHEDULER
	default n
	select USE_CHANGE_PRIO

config USE_CHANGE_PRIO
	bool "Dynamically change a task's priority"
	depends on SCHEDULER
	default n

config TICK_TIMER
	bool
	select TIMER
	select DEL_TIMER
	depends on SCHEDULER
	default SCHED_RR || SCHED_OTHER

menuconfig TIMER
	bool "Timer support"
	default n
	depends on IRQ

choice
	prompt "Jiffies size"
	default JIFFIES_24BIT
	depends on TIMER

config JIFFIES_16BIT
	bool "16 bit"
	help
	  Warning: When running with 20MHz, dynamic tick and prescaler of 1024
	  (HZ=19531), this will lead to jiffies overflow in 3.35 seconds!
	  And values which are more than 1.6774 seconds in the future can appear
	  to be in the past, and vice versa.
	  If you never need to calculate times longer than a second, that's ok.
	  16 bit jiffies save 94 bytes of code (only timer.o and arch/timer.o)
	  compared to 24 bit.

config JIFFIES_24BIT
	bool "24 bit"
	help
	  24 bit jiffies save 72 bytes of code (only timer.o and arch/timer.o)
	  compared to 32 bit.

config JIFFIES_32BIT
	bool "32 bit"

endchoice

config DEL_TIMER
	bool "Support for del_timer"
	depends on TIMER
	default n

config MOD_TIMER
	bool "Support for mod_timer"
	depends on TIMER
	default n

config DYNAMIC_TICK
	bool "Dynamic Tick"
	depends on TIMER
	default n

config HZ
	int "Timer Tick Frequency in HZ"
	depends on TIMER && !DYNAMIC_TICK
	default 100

source "arch/$(ARCH)/Kconfig.timer"

config KMALLOC
	bool "Dynamic memory allocation"
