menu "Kernel feature"
    menu "separate compile(choose none for compile once)"
        config SEPARATE_COMPILE
        bool
        default n

        config COMPILER_APP
            bool "only compile application"
            default n
            select USER_APPLICATION
            select SEPARATE_COMPILE
            choice 
                prompt "select the startup site of APP "
                default APP_STARTUP_FROM_FLASH

                config APP_STARTUP_FROM_SDCARD
                    bool "app start from sd card"

                config APP_STARTUP_FROM_FLASH
                    bool "app start from flash"
            endchoice
            

        config COMPILER_KERNEL
            bool "only compile kernel"
            default n
            select SEPARATE_COMPILE
    endmenu

    menu "Memory Management"
        config KERNEL_MEMBLOCK
            bool "Using gather block"
            default n
        config MEM_ALIGN_SIZE
            int "Alignment size for CPU architecture data access"
            default 8
            help
                Alignment size for CPU architecture data access

        config MEM_EXTERN_SRAM
            bool "Using extern memory"
            default n

        config MM_PAGE_SIZE
            int "Config memory page size"
            default 4096
            help
               config memory page size
        menu "Using small memory allocator"
            config KERNEL_SMALL_MEM_ALLOC
               bool "Using small memory allocator"
               default y
            if KERNEL_SMALL_MEM_ALLOC
            config SMALL_NUMBER_32B
                int "Config 32B small memory number"
                range 1 256
                default 64
            config SMALL_NUMBER_64B
                int "Config 64B small memory number"
                range 1 128
                default 32
            endif
        endmenu
    endmenu

    menu "Task feature"
        config USER_APPLICATION
            bool "start system application"
            default y

        config  TASK_ISOLATION
            bool "Enable task isolation"
            default n
            select SEPARATE_COMPILE
            select COMPILER_APP
            select COMPILER_KERNEL
            help
                Enable task isolation

        menu "Inter-Task communication"
            config KERNEL_SEMAPHORE
                bool "Enable semaphore"
                default y

            config KERNEL_MUTEX
                bool "Enable mutex"
                default y

            config KERNEL_EVENT
                bool "Enable event"
                default y

            config KERNEL_MESSAGEQUEUE
                bool "Enable message queue"
                default y

            config KERNEL_SOFTTIMER
                bool "Enable softtimer "
                select KERNEL_WORKQUEUE
                default y
        endmenu

        choice 
            prompt "Scheduler Policy Set"
            default SCHED_POLICY_RR_REMAINSLICE

            config SCHED_POLICY_RR_REMAINSLICE
                bool "config scheduler policy as RR REMAINSLICE"

            config SCHED_POLICY_RR
                bool "config scheduler policy as RR "

            config SCHED_POLICY_FIFO
                bool "config scheduler policy as FIFO"
        endchoice

        choice
            prompt "The maximal level value of priority of task"
            default KTASK_PRIORITY_32

            config KTASK_PRIORITY_8
                bool "8"

            config KTASK_PRIORITY_32
                bool "32"

            config KTASK_PRIORITY_256
                bool "256"
        endchoice

    config KTASK_PRIORITY_MAX
        int
        default 8   if KTASK_PRIORITY_8
        default 32  if KTASK_PRIORITY_32
        default 256 if KTASK_PRIORITY_256

    config TICK_PER_SECOND
        int "Tick frequency, Hz"
        range 10 1000
        default 100
        help
            System's tick frequency, Hz.

    config KERNEL_STACK_OVERFLOW_CHECK
        bool "Using stack overflow checking"
        default y
        help
            Enable task stack overflow checking. The stack overflow is checking when
            each task switch.

    config IDLE_KTASK_STACKSIZE
        int "The stack size of idle task"
        default 1024

    config ZOMBIE_KTASK_STACKSIZE
        int "The stack size of zombie_recycle task"
        default 2048

    endmenu
    
    menu "Kernel Console"
        config KERNEL_CONSOLE
            bool "config enable console"
            default y

        if KERNEL_CONSOLE
            config KERNEL_BANNER
                bool "config system banner print"
                default y

            config KERNEL_CONSOLEBUF_SIZE
                int "default buffer size for console log printf"
                default 128
        endif
    endmenu

    menu "Kernel Hook"
        menuconfig KERNEL_HOOK
            bool "Enable system hook"
            default n
            help
                Enable the hook function when system running, such as idle task hook,
                task context switch etc.

            if KERNEL_HOOK
                menuconfig KERNEL_IDLE_HOOK
                    bool "Enable IDLE Task hook"
                    default y 

                if KERNEL_IDLE_HOOK
                    config IDEL_HOOK_LIST_SIZE
                        int "The max size of idle hook list"
                        default 4
                        range 1 16
                        help
                            The system has a hook list. This is the hook list size.
                endif
            endif
    endmenu

    source "$KERNEL_DIR/tool/shell/Kconfig"

    menu "Kernel data structure Manage"
        menuconfig KERNEL_QUEUEMANAGE
            bool "Config Kernel Queue Manage"
            default y

            if KERNEL_QUEUEMANAGE
                config KERNEL_WORKQUEUE
                    bool "Config kernel work queue"
                    default y

                    if KERNEL_WORKQUEUE
                        config WORKQUEUE_KTASK_STACKSIZE
                            int "The stack size for workqueue task"
                            default 2048

                        config WORKQUEUE_KTASK_PRIORITY
                                int
                                default 6  if KTASK_PRIORITY_8
                                default 23  if KTASK_PRIORITY_32
                                default 128  if KTASK_PRIORITY_256
                        config QUEUE_MAX
                                int "Config the max queue length"
                                default 16
                    endif
                
                config KERNEL_WAITQUEUE
                    bool "Config kernel wait queue"
                    default y

                config KERNEL_DATAQUEUE
                    bool "Config kernel data queue"
                    default y
            endif

        config KERNEL_CIRCULAR_AREA
        bool "Config Kernel Circular Area"
        default n

        config KERNEL_AVL_TREE
        bool "Config Kernel AVL Tree"
        default n
    endmenu

    menu "Kernel components init"
        menuconfig KERNEL_COMPONENTS_INIT
            bool "Use components automatically initialization"
            default y

            if KERNEL_COMPONENTS_INIT
                config ENV_INIT_KTASK_STACK_SIZE
                    int "Set env init task stack size"
                    default 8192

                menuconfig KERNEL_USER_MAIN
                    bool "The main() function as user entry function"
                    default y
            endif
    endmenu

    config NAME_NUM_MAX
        int "The maximal size of kernel object name"
        range 2 32
        default 32
        help
            Each kernel object, such as task has a name,
            the NAME_NUM_MAX is the maximal size of this name.

    menuconfig KERNEL_DEBUG
        bool "Enable debugging features"
        default n

        if KERNEL_DEBUG
            config DEBUG_INIT_CONFIG
                bool "Enable debugging of components initialization"
                default y

            config KDYN_LOG_DBG
                bool "Enable DYNAMIC [DBG] LOG"
                default y

            config DBG_INIT
                int
                default 1 if DEBUG_INIT_CONFIG
        endif

    menuconfig ARCH_SMP
        bool "Enable SMP(Symmetric multiprocessing)"
        default n
        help
            This option should be selected by machines which have an SMP-
            capable CPU.
            The only effect of this option is to make the SMP-related
            options available to the user for configuration.

        config CPU_NUMBERS
        int "Number of CPUs"
        default 2
        depends on ARCH_SMP
        help
            Number of CPUs in the system
    menu "hash table config"
        menuconfig ID_HTABLE_SIZE
            int "ID hash table size"
            range 1 256
            default 16
            help
                Size of the hash table that ID manager uses internally
        menuconfig ID_NUM_MAX
            int "ID num max"
            range 16 256
            default 128
            help
                max num of the ID manager
    endmenu
    

source "$KERNEL_DIR/kernel/kernel_test/Kconfig"

endmenu
