Files
RTOS/config/kernel_config.h
T
root ca13734bf0 Add full automotive RTOS project
Add kernel (Cortex-M0/M3/M4, Tricore, S32K, RISC-V ports), drivers,
middleware (CAN stack, diagnostics, safety), applications, board
support, build/test tooling, and documentation.
2026-08-23 03:35:29 -04:00

267 lines
7.6 KiB
C

/**
* @file kernel_config.h
* @brief Kernel configuration for Automotive RTOS
*/
#ifndef KERNEL_CONFIG_H
#define KERNEL_CONFIG_H
/* ============================================================================
* Kernel Version Information
* ============================================================================ */
#define KERNEL_VERSION_MAJOR 1
#define KERNEL_VERSION_MINOR 0
#define KERNEL_VERSION_PATCH 0
#define KERNEL_VERSION_STRING "1.0.0"
/* ============================================================================
* Basic Kernel Configuration
* ============================================================================ */
/* Maximum number of tasks */
#define MAX_TASKS 32
/* Maximum priority levels (0 = highest, 15 = lowest) */
#define MAX_PRIORITY_LEVELS 16
/* Idle task priority (lowest) */
#define IDLE_TASK_PRIORITY (MAX_PRIORITY_LEVELS - 1)
/* Maximum task name length */
#define MAX_TASK_NAME_LENGTH 16
/* System tick rate in Hz */
#define TICK_RATE_HZ 1000
/* Tick period in milliseconds */
#define TICK_PERIOD_MS (1000 / TICK_RATE_HZ)
/* ============================================================================
* Scheduler Configuration
* ============================================================================ */
/* Scheduler type */
#define SCHEDULER_TYPE SCHEDULER_PRIORITY_PREEMPTIVE
/* Enable round-robin scheduling for same priority tasks */
#define ENABLE_ROUND_ROBIN 1
/* Round-robin time slice in ticks */
#define ROUND_ROBIN_TIME_SLICE 10
/* Enable deadline monitoring */
#define ENABLE_DEADLINE_MONITORING 1
/* Maximum allowed deadline misses before fault */
#define MAX_DEADLINE_MISSES 10
/* ============================================================================
* Synchronization Primitives
* ============================================================================ */
/* Maximum number of semaphores */
#define MAX_SEMAPHORES 32
/* Maximum number of mutexes */
#define MAX_MUTEXES 16
/* Maximum number of message queues */
#define MAX_QUEUES 16
/* Maximum queue size */
#define MAX_QUEUE_SIZE 256
/* Maximum number of event groups */
#define MAX_EVENT_GROUPS 8
/* Maximum number of software timers */
#define MAX_TIMERS 16
/* ============================================================================
* Memory Management
* ============================================================================ */
/* Enable memory protection */
#define ENABLE_MEMORY_PROTECTION 1
/* Enable stack overflow detection */
#define ENABLE_STACK_CHECK 1
/* Stack fill pattern for overflow detection */
#define STACK_FILL_PATTERN 0xA5A5A5A5
/* Default task stack size */
#define DEFAULT_TASK_STACK_SIZE 1024
/* Minimum task stack size */
#define MIN_TASK_STACK_SIZE 256
/* Idle task stack size */
#define IDLE_TASK_STACK_SIZE 512
/* ISR stack size */
#define ISR_STACK_SIZE 2048
/* Heap size for dynamic allocation */
#define HEAP_SIZE 65536
/* Enable heap usage tracking */
#define ENABLE_HEAP_TRACKING 1
/* ============================================================================
* Interrupt Management
* ============================================================================ */
/* Maximum number of ISR handlers */
#define MAX_ISR_HANDLERS 128
/* Maximum interrupt nesting level */
#define MAX_INTERRUPT_NESTING 8
/* Kernel interrupt priority (highest) */
#define KERNEL_INTERRUPT_PRIORITY 0
/* System call interrupt priority */
#define SYSCALL_INTERRUPT_PRIORITY 1
/* PendSV interrupt priority (lowest) */
#define PENDSV_INTERRUPT_PRIORITY (MAX_PRIORITY_LEVELS - 1)
/* SysTick interrupt priority */
#define SYSTICK_INTERRUPT_PRIORITY (MAX_PRIORITY_LEVELS - 1)
/* ============================================================================
* Fault Handling
* ============================================================================ */
/* Enable fault handlers */
#define ENABLE_FAULT_HANDLERS 1
/* Enable hard fault handler */
#define ENABLE_HARD_FAULT_HANDLER 1
/* Enable bus fault handler */
#define ENABLE_BUS_FAULT_HANDLER 1
/* Enable usage fault handler */
#define ENABLE_USAGE_FAULT_HANDLER 1
/* Enable memory management fault handler */
#define ENABLE_MEM_FAULT_HANDLER 1
/* Maximum number of fault records */
#define MAX_FAULT_RECORDS 16
/* ============================================================================
* Debug and Trace
* ============================================================================ */
/* Enable debug output */
#define ENABLE_DEBUG_OUTPUT 1
/* Debug level (0=off, 1=error, 2=warning, 3=info, 4=debug) */
#define DEBUG_LEVEL 3
/* Enable trace functionality */
#define ENABLE_TRACE 0
/* Trace buffer size */
#define TRACE_BUFFER_SIZE 4096
/* Enable assertions */
#define ENABLE_ASSERT 1
/* Enable runtime statistics */
#define ENABLE_RUNTIME_STATS 1
/* ============================================================================
* Power Management
* ============================================================================ */
/* Enable power management */
#define ENABLE_POWER_MANAGEMENT 1
/* Enable sleep modes */
#define ENABLE_SLEEP_MODE 1
/* Enable deep sleep modes */
#define ENABLE_DEEP_SLEEP 0
/* Idle task uses WFI */
#define IDLE_TASK_USES_WFI 1
/* ============================================================================
* Safety Features
* ============================================================================ */
/* Enable watchdog integration */
#define ENABLE_WATCHDOG 1
/* Watchdog timeout in milliseconds */
#define WATCHDOG_TIMEOUT_MS 100
/* Enable task supervision */
#define ENABLE_TASK_SUPERVISION 1
/* Enable E2E protection */
#define ENABLE_E2E_PROTECTION 1
/* Enable memory ECC */
#define ENABLE_MEMORY_ECC 1
/* Enable clock monitoring */
#define ENABLE_CLOCK_MONITORING 1
/* Enable temperature monitoring */
#define ENABLE_TEMP_MONITORING 1
/* ============================================================================
* Communication
* ============================================================================ */
/* Enable CAN support */
#define ENABLE_CAN 1
/* Enable LIN support */
#define ENABLE_LIN 0
/* Enable FlexRay support */
#define ENABLE_FLEXRAY 0
/* Enable Ethernet support */
#define ENABLE_ETHERNET 0
/* ============================================================================
* Diagnostics
* ============================================================================ */
/* Enable UDS support */
#define ENABLE_UDS 1
/* Enable OBD-II support */
#define ENABLE_OBD_II 1
/* Enable DTC management */
#define ENABLE_DTC_MANAGEMENT 1
/* Maximum number of DTCs */
#define MAX_DTC_COUNT 100
/* ============================================================================
* Configuration Validation
* ============================================================================ */
#if MAX_TASKS > 255
#error "MAX_TASKS must be less than 256"
#endif
#if MAX_PRIORITY_LEVELS > 32
#error "MAX_PRIORITY_LEVELS must be less than 33"
#endif
#if TICK_RATE_HZ < 100 || TICK_RATE_HZ > 10000
#error "TICK_RATE_HZ must be between 100 and 10000"
#endif
#endif /* KERNEL_CONFIG_H */