Migrate to Chibios 18 stable #631

chibi 18 style
This commit is contained in:
rusefi 2019-02-03 21:55:51 -05:00
parent 8da36d53dd
commit e53d0bc4d3
1 changed files with 65 additions and 15 deletions

View File

@ -1,5 +1,5 @@
/* /*
ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio ChibiOS - Copyright (C) 2006..2017 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -25,8 +25,8 @@
* @{ * @{
*/ */
#ifndef _CHCONF_H_ #ifndef CHCONF_H
#define _CHCONF_H_ #define CHCONF_H
#define _CHIBIOS_RT_CONF_ #define _CHIBIOS_RT_CONF_
@ -44,7 +44,9 @@
* @brief System time counter resolution. * @brief System time counter resolution.
* @note Allowed values are 16 or 32 bits. * @note Allowed values are 16 or 32 bits.
*/ */
#if !defined(CH_CFG_ST_RESOLUTION)
#define CH_CFG_ST_RESOLUTION 32 #define CH_CFG_ST_RESOLUTION 32
#endif
/** /**
* @brief System tick frequency. * @brief System tick frequency.
@ -61,7 +63,9 @@
* The value one is not valid, timeouts are rounded up to * The value one is not valid, timeouts are rounded up to
* this value. * this value.
*/ */
#if !defined(CH_CFG_ST_TIMEDELTA)
#define CH_CFG_ST_TIMEDELTA 0 #define CH_CFG_ST_TIMEDELTA 0
#endif
/** @} */ /** @} */
@ -84,7 +88,9 @@
* @note The round robin preemption is not supported in tickless mode and * @note The round robin preemption is not supported in tickless mode and
* must be set to zero in that case. * must be set to zero in that case.
*/ */
#if !defined(CH_CFG_TIME_QUANTUM)
#define CH_CFG_TIME_QUANTUM 20 #define CH_CFG_TIME_QUANTUM 20
#endif
/** /**
* @brief Managed RAM size. * @brief Managed RAM size.
@ -97,7 +103,9 @@
* provide the @p __heap_base__ and @p __heap_end__ symbols. * provide the @p __heap_base__ and @p __heap_end__ symbols.
* @note Requires @p CH_CFG_USE_MEMCORE. * @note Requires @p CH_CFG_USE_MEMCORE.
*/ */
#if !defined(CH_CFG_MEMCORE_SIZE)
#define CH_CFG_MEMCORE_SIZE 0x20000 #define CH_CFG_MEMCORE_SIZE 0x20000
#endif
/** /**
* @brief Idle thread automatic spawn suppression. * @brief Idle thread automatic spawn suppression.
@ -106,7 +114,9 @@
* function becomes the idle thread and must implement an * function becomes the idle thread and must implement an
* infinite loop. * infinite loop.
*/ */
#if !defined(CH_CFG_NO_IDLE_THREAD)
#define CH_CFG_NO_IDLE_THREAD FALSE #define CH_CFG_NO_IDLE_THREAD FALSE
#endif
/** @} */ /** @} */
@ -125,7 +135,9 @@
* @note This is not related to the compiler optimization options. * @note This is not related to the compiler optimization options.
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_OPTIMIZE_SPEED)
#define CH_CFG_OPTIMIZE_SPEED TRUE #define CH_CFG_OPTIMIZE_SPEED TRUE
#endif
/** @} */ /** @} */
@ -143,7 +155,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_TM)
#define CH_CFG_USE_TM FALSE #define CH_CFG_USE_TM FALSE
#endif
/** /**
* @brief Threads registry APIs. * @brief Threads registry APIs.
@ -151,7 +165,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_REGISTRY)
#define CH_CFG_USE_REGISTRY TRUE #define CH_CFG_USE_REGISTRY TRUE
#endif
/** /**
* @brief Threads synchronization APIs. * @brief Threads synchronization APIs.
@ -160,7 +176,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_WAITEXIT)
#define CH_CFG_USE_WAITEXIT TRUE #define CH_CFG_USE_WAITEXIT TRUE
#endif
/** /**
* @brief Semaphores APIs. * @brief Semaphores APIs.
@ -168,7 +186,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_SEMAPHORES)
#define CH_CFG_USE_SEMAPHORES TRUE #define CH_CFG_USE_SEMAPHORES TRUE
#endif
/** /**
* @brief Semaphores queuing mode. * @brief Semaphores queuing mode.
@ -179,7 +199,9 @@
* requirements. * requirements.
* @note Requires @p CH_CFG_USE_SEMAPHORES. * @note Requires @p CH_CFG_USE_SEMAPHORES.
*/ */
#if !defined(CH_CFG_USE_SEMAPHORES_PRIORITY)
#define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE #define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE
#endif
/** /**
* @brief Mutexes APIs. * @brief Mutexes APIs.
@ -187,7 +209,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_MUTEXES)
#define CH_CFG_USE_MUTEXES TRUE #define CH_CFG_USE_MUTEXES TRUE
#endif
/** /**
* @brief Enables recursive behavior on mutexes. * @brief Enables recursive behavior on mutexes.
@ -197,7 +221,9 @@
* @note The default is @p FALSE. * @note The default is @p FALSE.
* @note Requires @p CH_CFG_USE_MUTEXES. * @note Requires @p CH_CFG_USE_MUTEXES.
*/ */
#if !defined(CH_CFG_USE_MUTEXES_RECURSIVE)
#define CH_CFG_USE_MUTEXES_RECURSIVE FALSE #define CH_CFG_USE_MUTEXES_RECURSIVE FALSE
#endif
/** /**
* @brief Conditional Variables APIs. * @brief Conditional Variables APIs.
@ -207,7 +233,9 @@
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_MUTEXES. * @note Requires @p CH_CFG_USE_MUTEXES.
*/ */
#if !defined(CH_CFG_USE_CONDVARS)
#define CH_CFG_USE_CONDVARS TRUE #define CH_CFG_USE_CONDVARS TRUE
#endif
/** /**
* @brief Conditional Variables APIs with timeout. * @brief Conditional Variables APIs with timeout.
@ -217,7 +245,9 @@
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_CONDVARS. * @note Requires @p CH_CFG_USE_CONDVARS.
*/ */
#if !defined(CH_CFG_USE_CONDVARS_TIMEOUT)
#define CH_CFG_USE_CONDVARS_TIMEOUT TRUE #define CH_CFG_USE_CONDVARS_TIMEOUT TRUE
#endif
/** /**
* @brief Events Flags APIs. * @brief Events Flags APIs.
@ -225,7 +255,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_EVENTS)
#define CH_CFG_USE_EVENTS TRUE #define CH_CFG_USE_EVENTS TRUE
#endif
/** /**
* @brief Events Flags APIs with timeout. * @brief Events Flags APIs with timeout.
@ -235,7 +267,9 @@
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_EVENTS. * @note Requires @p CH_CFG_USE_EVENTS.
*/ */
#if !defined(CH_CFG_USE_EVENTS_TIMEOUT)
#define CH_CFG_USE_EVENTS_TIMEOUT TRUE #define CH_CFG_USE_EVENTS_TIMEOUT TRUE
#endif
/** /**
* @brief Synchronous Messages APIs. * @brief Synchronous Messages APIs.
@ -244,7 +278,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_MESSAGES)
#define CH_CFG_USE_MESSAGES TRUE #define CH_CFG_USE_MESSAGES TRUE
#endif
/** /**
* @brief Synchronous Messages queuing mode. * @brief Synchronous Messages queuing mode.
@ -255,7 +291,9 @@
* requirements. * requirements.
* @note Requires @p CH_CFG_USE_MESSAGES. * @note Requires @p CH_CFG_USE_MESSAGES.
*/ */
#if !defined(CH_CFG_USE_MESSAGES_PRIORITY)
#define CH_CFG_USE_MESSAGES_PRIORITY FALSE #define CH_CFG_USE_MESSAGES_PRIORITY FALSE
#endif
/** /**
* @brief Mailboxes APIs. * @brief Mailboxes APIs.
@ -282,7 +320,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_MEMCORE)
#define CH_CFG_USE_MEMCORE TRUE #define CH_CFG_USE_MEMCORE TRUE
#endif
/** /**
* @brief Heap Allocator APIs. * @brief Heap Allocator APIs.
@ -330,7 +370,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_STATISTICS)
#define CH_DBG_STATISTICS FALSE #define CH_DBG_STATISTICS FALSE
#endif
/** /**
* @brief Debug option, system state check. * @brief Debug option, system state check.
@ -339,7 +381,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_SYSTEM_STATE_CHECK)
#define CH_DBG_SYSTEM_STATE_CHECK TRUE #define CH_DBG_SYSTEM_STATE_CHECK TRUE
#endif
#define ON_LOCK_HOOK #define ON_LOCK_HOOK
#define ON_UNLOCK_HOOK #define ON_UNLOCK_HOOK
@ -353,7 +397,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_ENABLE_CHECKS)
#define CH_DBG_ENABLE_CHECKS FALSE #define CH_DBG_ENABLE_CHECKS FALSE
#endif
/** /**
* @brief Debug option, consistency checks. * @brief Debug option, consistency checks.
@ -363,14 +409,15 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_ENABLE_ASSERTS)
#define CH_DBG_ENABLE_ASSERTS FALSE #define CH_DBG_ENABLE_ASSERTS FALSE
#endif
/** /**
* @brief Debug option, trace buffer. * @brief Debug option, trace buffer.
* @details If enabled then the context switch circular trace buffer is * @details If enabled then the trace buffer is activated.
* activated.
* *
* @note The default is @p FALSE. * @note The default is @p CH_DBG_TRACE_MASK_DISABLED.
*/ */
#define CH_DBG_ENABLE_TRACE FALSE #define CH_DBG_ENABLE_TRACE FALSE
@ -384,7 +431,9 @@
* @note The default failure mode is to halt the system with the global * @note The default failure mode is to halt the system with the global
* @p panic_msg variable set to @p NULL. * @p panic_msg variable set to @p NULL.
*/ */
#if !defined(CH_DBG_ENABLE_STACK_CHECK)
#define CH_DBG_ENABLE_STACK_CHECK FALSE #define CH_DBG_ENABLE_STACK_CHECK FALSE
#endif
/** /**
* @brief Debug option, stacks initialization. * @brief Debug option, stacks initialization.
@ -394,7 +443,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_FILL_THREADS)
#define CH_DBG_FILL_THREADS FALSE #define CH_DBG_FILL_THREADS FALSE
#endif
/** /**
* @brief Debug option, threads profiling. * @brief Debug option, threads profiling.
@ -405,7 +456,9 @@
* @note This debug option is not currently compatible with the * @note This debug option is not currently compatible with the
* tickless mode. * tickless mode.
*/ */
#if !defined(CH_DBG_THREADS_PROFILING)
#define CH_DBG_THREADS_PROFILING TRUE #define CH_DBG_THREADS_PROFILING TRUE
#endif
/** @} */ /** @} */
@ -425,9 +478,9 @@
/** /**
* @brief Threads initialization hook. * @brief Threads initialization hook.
* @details User initialization code added to the @p chThdInit() API. * @details User initialization code added to the @p _thread_init() function.
* *
* @note It is invoked from within @p chThdInit() and implicitly from all * @note It is invoked from within @p _thread_init() and implicitly from all
* the threads creation APIs. * the threads creation APIs.
*/ */
#define CH_CFG_THREAD_INIT_HOOK(tp) { \ #define CH_CFG_THREAD_INIT_HOOK(tp) { \
@ -437,10 +490,6 @@
/** /**
* @brief Threads finalization hook. * @brief Threads finalization hook.
* @details User finalization code added to the @p chThdExit() API. * @details User finalization code added to the @p chThdExit() API.
*
* @note It is inserted into lock zone.
* @note It is also invoked when the threads simply return in order to
* terminate.
*/ */
#define CH_CFG_THREAD_EXIT_HOOK(tp) { \ #define CH_CFG_THREAD_EXIT_HOOK(tp) { \
/* Add threads finalization code here.*/ \ /* Add threads finalization code here.*/ \
@ -468,13 +517,14 @@
/* IRQ epilogue code here.*/ \ /* IRQ epilogue code here.*/ \
} }
/** /**
* @brief Idle thread enter hook. * @brief Idle thread enter hook.
* @note This hook is invoked within a critical zone, no OS functions * @note This hook is invoked within a critical zone, no OS functions
* should be invoked from here. * should be invoked from here.
* @note This macro can be used to activate a power saving mode. * @note This macro can be used to activate a power saving mode.
*/ */
#define CH_CFG_IDLE_ENTER_HOOK() { \ #define CH_CFG_IDLE_ENTER_HOOK() { \
/* Idle-enter code here.*/ \
} }
/** /**
@ -484,6 +534,7 @@
* @note This macro can be used to deactivate a power saving mode. * @note This macro can be used to deactivate a power saving mode.
*/ */
#define CH_CFG_IDLE_LEAVE_HOOK() { \ #define CH_CFG_IDLE_LEAVE_HOOK() { \
/* Idle-leave code here.*/ \
} }
/** /**
@ -526,13 +577,12 @@
/* Trace code here.*/ \ /* Trace code here.*/ \
} }
/** @} */ /** @} */
/*===========================================================================*/ /*===========================================================================*/
/* Port-specific settings (override port settings defaulted in chcore.h). */ /* Port-specific settings (override port settings defaulted in chcore.h). */
/*===========================================================================*/ /*===========================================================================*/
#endif /* _CHCONF_H_ */ #endif /* CHCONF_H */
/** @} */ /** @} */