# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License.  You may obtain a copy of the License at
#
#  http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the License.
#

syscfg.defs:
    OS_MAIN_TASK_PRIO:
        description: 'Priority of initialization and main task'
        type: task_priority
        value: 127
    OS_MAIN_STACK_SIZE:
        description: 'Stack size of initialization and main task'
        value: 1024
    OS_CLI:
        description: 'CLI commands to inspect OS'
        value: 0
        restrictions:
            - SHELL_TASK
    OS_COREDUMP:
        description: 'Attempt to dump corefile when system crashes'
        value: 0
    OS_COREDUMP_CB:
        description: 'Calls a custom OS coredump callback function'
        value: 0
        restriction: 
            - 'OS_COREDUMP if 1'
    OS_CRASH_STACKTRACE:
        description: 'Attempt to print stack trace when system crashes.'
        value: 0
    OS_CRASH_RESTORE_REGS:
        description: 'Restore registers to pre-fault state on crash'
        value: 0
    OS_CRASH_LOG:
        description: >
            Write an entry to the reboot log when the system crashes.
        value: 0
    OS_WATCHDOG_MONITOR:
        description: >
            'Attempt to capture state of stuck system before HW watchdog fires.'
        value: 0
    OS_EVENTQ_MONITOR:
        description: >
            'Allow instrumentation for collecting time spent hendling events.'
        value: 0
    OS_SYSVIEW:
        description: 'Enable OS sysview tracing'
        value: 0
    OS_SCHEDULING:
        description: 'Whether OS will be started or not'
        value: 1
    OS_CTX_SW_STACK_CHECK:
        description: 'Whether to do stack sanity check during context switch'
        value: 0
    OS_CTX_SW_STACK_GUARD:
        description: 'How many os_stack_ts to keep as stack guard'
        value: 4
    OS_MEMPOOL_CHECK:
        description: 'Whether to do stack sanity check of mempool operations'
        value: 0
    OS_MEMPOOL_POISON:
        description: 'Whether to do write known pattern to freed memory'
        value: 0
    OS_MEMPOOL_GUARD:
        description: 'Insert guard area at the end of mempool'
        value: 0
    OS_CPUTIME_FREQ:
        description: 'Frequency of os cputime'
        value: 1000000
    OS_CPUTIME_TIMER_NUM:
        description: 'Timer number to use in OS CPUTime, 0 by default.'
        value: 0
    SANITY_INTERVAL:
        description: 'The interval (in milliseconds) at which the sanity checks should run, should be at least 200ms prior to watchdog'
        value: 15000
    WATCHDOG_INTERVAL:
        description: 'The interval (in milliseconds) at which the watchdog should reset if not tickled, in ms'
        value: 30000
    MSYS_1_BLOCK_COUNT:
        description: '1st system pool of mbufs; number of entries'
        value: 12
    MSYS_1_BLOCK_SIZE:
        description: '1st system pool of mbufs; size of an entry'
        value: 292
    MSYS_1_SANITY_MIN_COUNT:
        description: >
            Trigger a crash if the count of available mbufs in the 1st msys
            pool falls below this minimum for too long.  Set to 0 to disable.
        value: 0
    MSYS_2_BLOCK_COUNT:
        description: '2nd system pool of mbufs; number of entries'
        value: 0
    MSYS_2_BLOCK_SIZE:
        description: '2nd system pool of mbufs; size of an entry'
        value: 0
    MSYS_2_SANITY_MIN_COUNT:
        description: >
            Trigger a crash if the count of available mbufs in the 2st msys
            pool falls below this minimum for too long.  Set to 0 to disable.
        value: 0
    MSYS_SANITY_TIMEOUT:
        description: >
            The maximum duration that any msys pool can be low on mbufs before
            a crash is triggered (milliseconds).
        value: 60000
    FLOAT_USER:
        descriptiong: 'Enable float support for users'
        value: 0

    OS_SYSVIEW_TRACE_CALLOUT:
        description: >
            Enable tracing os_callout APIs by SystemView
        value: 1
    OS_SYSVIEW_TRACE_EVENTQ:
        description: >
            Enable tracing os_eventq APIs by SystemView
        value: 1
    OS_SYSVIEW_TRACE_MBUF:
        description: >
            Enable tracing os_mbuf APIs by SystemView
        value: 0
    OS_SYSVIEW_TRACE_MEMPOOL:
        description: >
            Enable tracing os_mempool APIs by SystemView
        value: 0
    OS_SYSVIEW_TRACE_MUTEX:
        description: >
            Enable tracing os_mutex APIs by SystemView
        value: 1
    OS_SYSVIEW_TRACE_SEM:
        description: >
            Enable tracing os_sem APIs by SystemView
        value: 1

    OS_DEBUG_MODE:
        description: >
            Enables various runtime error checks.  A failed assert is triggered
            on error detection.  Enabling this setting increases stack usage.
        value: 0

    OS_TICKS_PER_SEC:
        description: 'Desired ticks frequency in Hz'
        value:
        restrictions: $notnull

    OS_IDLE_TICKLESS_MS_MIN:
        description: >
            Minimum duration of tickless idle period in miliseconds.
        value: 100
    OS_IDLE_TICKLESS_MS_MAX:
        description: >
            Maximum duration of tickless idle period in miliseconds.
        value: 600000
    OS_TIME_DEBUG:
        description: >
            Enables debug runtime checks for time-related functionality.
        value: 0
    OS_EVENTQ_DEBUG:
        description: >
            Enables debug runtime checks for eventq-related functionality.
        value: 0

    OS_CRASH_FILE_LINE:
        description: >
            Include filename and line number in crash messages.  Aids in
            debugging, but increases text size.
        value: 0
    OS_SYSINIT_STAGE:
        description: >
            Sysinit stage for the Mynewt kernel.
        value: 0
    OS_ASSERT_CB:
        description: >
            If set, assert callback gets called inside __assert_func()
        value: 0
    OS_MAIN_TASK_SANITY_ITVL_MS:
        description: >
            Interval for sanity check on main task. Setting a 0 will disable
            sanity check on main task. Value is in milliseconds.
        value: 0
    OS_TASK_RUN_TIME_CPUTIME:
        description: >
            If set, run time is measured in cpu time ticks rather than OS time
            ticks.
        value: 0

syscfg.vals.OS_DEBUG_MODE:
    OS_CRASH_STACKTRACE: 1
    OS_CTX_SW_STACK_CHECK: 1
    OS_MEMPOOL_CHECK: 1
    OS_MEMPOOL_POISON: 1
    OS_TIME_DEBUG: 1
    OS_EVENTQ_DEBUG: 1

syscfg.restrictions:
    - "!OS_WATCHDOG_MONITOR || WATCHDOG_INTERVAL > 0"
