# Kconfig - microkernel configuration options

#
# Copyright (c) 2014-2015 Wind River Systems, Inc.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1) Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
# 2) Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# 3) Neither the name of Wind River Systems nor the names of its contributors
# may be used to endorse or promote products derived from this software without
# specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#

menu "Microkernel Options"

config MICROKERNEL_SERVER_STACK_SIZE
	int
	prompt "Microkernel server fiber (K_swapper) stack size"
	default 1024
	depends on MICROKERNEL
	help
	This option specifies the size of the stack used by the microkernel
	server fiber, whose entry point is K_swapper().  This must be able
	to handle the deepest call stack for internal handling of microkernel

config MICROKERNEL_SERVER_PRIORITY
	int
	prompt "Priority of the kernel service fiber"
	default 0
	depends on MICROKERNEL
	help
	Priority of the microkernel server fiber that performs
	kernel requests and task scheduling assignments.

config PRIORITY_CEILING
	int
	prompt "Maximum priority for priority inheritance algorithm"
	default 0
	depends on MICROKERNEL
	help
	The highest task priority for the mutex priority inheritance
	algorithm.
	A task of low priority holding a mutex will see its priority
	bumped to the priority of a task trying to acquire the mutex.
	This option puts an upper boundary to the priority a task may
	get bumped to.

config COMMAND_STACK_SIZE
	int
	prompt "K_swapper command stack size (in packets)"
	default 64
	depends on MICROKERNEL
	help
	This option specifies the maximum number of command packets that
	can be queued up for processing by the kernel's K_swapper fiber.

config NUM_COMMAND_PACKETS
	int
	prompt "Number of command packets"
	default 16
	depends on MICROKERNEL
	help
	This option specifies the number of packets in the command packet pool.
	This pool needs to be large enough to accommodate all in-flight
	asynchronous command requests as well as those internally issued by
	the microkernel server fiber (K_swapper).

config NUM_TIMER_PACKETS
	int
	prompt "Number of timer packets" if SYS_CLOCK_EXISTS
	default 0 if !SYS_CLOCK_EXISTS
	default 10
	depends on MICROKERNEL
	help
	This option specifies the number of timer packets to create. Each
	explicit and implicit timer usage consumes one timer packet.

config  NUM_TASK_PRIORITIES
	int
	prompt "Number of task priorities"
	default 16
	range 1 256
	depends on MICROKERNEL
	help
	This option specifies the number of task priorities supported by the
	task scheduler. Specifying "N" provides support for task priorities
	ranging from 0 (highest) through N-2; task priority N-1 (lowest) is
	reserved for the kernel's idle task.

config	WORKLOAD_MONITOR
	bool
	prompt "Workload monitoring [EXPERIMENTAL]"
	default y
	depends on MICROKERNEL && EXPERIMENTAL
	help
	This option instructs the kernel to record the percentage of time
	the system is doing useful work (i.e. is not idle).

config	MAX_NUM_TASK_IRQS
	int
	prompt "Number of task IRQ objects"
	default 0
	depends on MICROKERNEL
	help
	This option specifies the maximum number of IRQs that may be
	utilized by task level device drivers. A value of zero disables
	this feature.

menu "Timer API Options"

config TIMESLICING
	bool
	prompt "Task time slicing"
	default y
	depends on MICROKERNEL && SYS_CLOCK_EXISTS
	help
	This option enables time slicing between tasks of equal priority.

config TIMESLICE_SIZE
	int
	prompt "Time slice size (in ticks)"
	default 0
	depends on TIMESLICING
	help
	This option specifies the maximum amount of time a task can execute
	before other tasks of equal priority are given an opportunity to run.
	A time slice size of zero means "no limit" (i.e. an infinitely large
	time slice).

config  TIMESLICE_PRIORITY
	int
	prompt "Time slicing task priority threshold"
	default 0
	depends on TIMESLICING
	help
	This option specifies the task priority level at which time slicing
	takes effect; tasks having a higher priority than this threshold
	are not subject to time slicing. A threshold level of zero means
	that all tasks are potentially subject to time slicing.
endmenu

config  TASK_MONITOR
	bool
	prompt "Task monitoring [EXPERIMENTAL]"
	default n
	depends on MICROKERNEL
	help
	This option instructs the kernel to record significant task
	activities. These can include: task switches, task state changes,
	kernel service requests, and the signalling of events.

config  TASK_MONITOR_CAPACITY
	int
	prompt "Trace buffer capacity (# of entries)"
	default 300
	depends on TASK_MONITOR
	help
	This option specifies the number of entries in the task monitor's
	trace buffer. Each entry requires 12 bytes.

config  TASK_MONITOR_MASK
	int
	prompt "Trace buffer mask"
	default 15
	depends on TASK_MONITOR
	help
	This option specifies which task execution activities are captured
	in the task monitor's trace buffer. The following values can be
	OR-ed together to form the mask:
		1 (MON_TSWAP): task switch
		2 (MON_STATE): task state change
		4 (MON_KSERV): task execution of kernel APIs
		8 (MON_EVENT): task event signalled

config ADVANCED_POWER_MANAGEMENT
	bool
	prompt "Advanced power management"
	default n
	depends on MICROKERNEL
	help
	This option enables the platform to implement extra power management
	policies whenever the kernel becomes idle. The kernel invokes
	_sys_power_save_idle() to inform the power management subsystem of the
	number of ticks until the next kernel timer is due to expire.

menu "Advanced Power Management Features"
	depends on MICROKERNEL && ADVANCED_POWER_MANAGEMENT && ADVANCED_IDLE_SUPPORTED

config  ADVANCED_IDLE
	bool
	prompt "Advanced idle state"
	default n
	depends on ADVANCED_POWER_MANAGEMENT && ADVANCED_IDLE_SUPPORTED
	help
	This option enables the kernel to interface to a custom advanced idle
	power saving manager. This permits the system to enter a custom
	power saving state when the kernel becomes idle for extended periods,
	and then to restore the system to its previous state (rather than
	booting up from scratch) when the kernel is re-activated.

config ADV_IDLE_STACK_SIZE
	int
	prompt "Advanced idle state stack size"
	default 16
	depends on ADVANCED_IDLE
	help
	This option defines the size of the separate stack used during the
	system state check while the booting up. A separate stack is used
	to avoid memory corruption on the system re-activation from power
	down mode. The stack size must be large enough to hold the return
	address (4 bytes) and the _AdvIdleCheckSleep() stack frame.

endmenu

endmenu
