Renamed or added prefix to all hernel configuration options.

git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/kernel_3_dev@6010 35acf78f-673a-0410-8e92-d51de3d6d3f4
master
gdisirio 2013-07-20 10:12:44 +00:00
parent dc7b36df31
commit 49d71a01ab
106 changed files with 578 additions and 615 deletions

View File

@ -40,8 +40,20 @@
* @details Frequency of the system timer that drives the system ticks. This * @details Frequency of the system timer that drives the system ticks. This
* setting also defines the system tick time unit. * setting also defines the system tick time unit.
*/ */
#if !defined(CH_FREQUENCY) || defined(__DOXYGEN__) #if !defined(CH_CFG_FREQUENCY) || defined(__DOXYGEN__)
#define CH_FREQUENCY 1000 #define CH_CFG_FREQUENCY 1000
#endif
/**
* @brief Time delta constant for the tick-less mode.
* @note If this value is zero then the system uses the classic
* periodic tick. This value represents the minimum number
* of ticks that is safe to specify in a timeout directive.
* The value one is not valid, timeouts are rounded up to
* this value.
*/
#if !defined(CH_CFG_TIMEDELTA) || defined(__DOXYGEN__)
#define CH_CFG_TIMEDELTA 0
#endif #endif
/** /**
@ -51,12 +63,13 @@
* disables the preemption for threads with equal priority and the * disables the preemption for threads with equal priority and the
* round robin becomes cooperative. Note that higher priority * round robin becomes cooperative. Note that higher priority
* threads can still preempt, the kernel is always preemptive. * threads can still preempt, the kernel is always preemptive.
*
* @note Disabling the round robin preemption makes the kernel more compact * @note Disabling the round robin preemption makes the kernel more compact
* and generally faster. * and generally faster.
* @note The round robin preemption is not supported in tickless mode and
* must be set to zero in that case.
*/ */
#if !defined(CH_TIME_QUANTUM) || defined(__DOXYGEN__) #if !defined(CH_CFG_TIME_QUANTUM) || defined(__DOXYGEN__)
#define CH_TIME_QUANTUM 20 #define CH_CFG_TIME_QUANTUM 20
#endif #endif
/** /**
@ -68,10 +81,10 @@
* *
* @note In order to let the OS manage the whole RAM the linker script must * @note In order to let the OS manage the whole RAM the linker script must
* provide the @p __heap_base__ and @p __heap_end__ symbols. * provide the @p __heap_base__ and @p __heap_end__ symbols.
* @note Requires @p CH_USE_MEMCORE. * @note Requires @p CH_CFG_USE_MEMCORE.
*/ */
#if !defined(CH_MEMCORE_SIZE) || defined(__DOXYGEN__) #if !defined(CH_CFG_MEMCORE_SIZE) || defined(__DOXYGEN__)
#define CH_MEMCORE_SIZE 0 #define CH_CFG_MEMCORE_SIZE 0
#endif #endif
/** /**
@ -87,8 +100,8 @@
* @note Unless an idle thread is spawned the @p main() thread must not * @note Unless an idle thread is spawned the @p main() thread must not
* enter a sleep state. * enter a sleep state.
*/ */
#if !defined(CH_NO_IDLE_THREAD) || defined(__DOXYGEN__) #if !defined(CH_CFG_NO_IDLE_THREAD) || defined(__DOXYGEN__)
#define CH_NO_IDLE_THREAD FALSE #define CH_CFG_NO_IDLE_THREAD FALSE
#endif #endif
/** @} */ /** @} */
@ -108,8 +121,8 @@
* @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_OPTIMIZE_SPEED) || defined(__DOXYGEN__) #if !defined(CH_CFG_OPTIMIZE_SPEED) || defined(__DOXYGEN__)
#define CH_OPTIMIZE_SPEED TRUE #define CH_CFG_OPTIMIZE_SPEED TRUE
#endif #endif
/** @} */ /** @} */
@ -127,8 +140,8 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_USE_REGISTRY) || defined(__DOXYGEN__) #if !defined(CH_CFG_USE_REGISTRY) || defined(__DOXYGEN__)
#define CH_USE_REGISTRY TRUE #define CH_CFG_USE_REGISTRY TRUE
#endif #endif
/** /**
@ -138,8 +151,8 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_USE_WAITEXIT) || defined(__DOXYGEN__) #if !defined(CH_CFG_USE_WAITEXIT) || defined(__DOXYGEN__)
#define CH_USE_WAITEXIT TRUE #define CH_CFG_USE_WAITEXIT TRUE
#endif #endif
/** /**
@ -148,8 +161,8 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_USE_SEMAPHORES) || defined(__DOXYGEN__) #if !defined(CH_CFG_USE_SEMAPHORES) || defined(__DOXYGEN__)
#define CH_USE_SEMAPHORES TRUE #define CH_CFG_USE_SEMAPHORES TRUE
#endif #endif
/** /**
@ -157,23 +170,12 @@
* @details If enabled then the threads are enqueued on semaphores by * @details If enabled then the threads are enqueued on semaphores by
* priority rather than in FIFO order. * priority rather than in FIFO order.
* *
* @note The default is @p FALSE. Enable this if you have special requirements. * @note The default is @p FALSE. Enable this if you have special
* @note Requires @p CH_USE_SEMAPHORES. * requirements.
* @note Requires @p CH_CFG_USE_SEMAPHORES.
*/ */
#if !defined(CH_USE_SEMAPHORES_PRIORITY) || defined(__DOXYGEN__) #if !defined(CH_CFG_USE_SEMAPHORES_PRIORITY) || defined(__DOXYGEN__)
#define CH_USE_SEMAPHORES_PRIORITY FALSE #define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE
#endif
/**
* @brief Atomic semaphore API.
* @details If enabled then the semaphores the @p chSemSignalWait() API
* is included in the kernel.
*
* @note The default is @p TRUE.
* @note Requires @p CH_USE_SEMAPHORES.
*/
#if !defined(CH_USE_SEMSW) || defined(__DOXYGEN__)
#define CH_USE_SEMSW TRUE
#endif #endif
/** /**
@ -182,8 +184,8 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_USE_MUTEXES) || defined(__DOXYGEN__) #if !defined(CH_CFG_USE_MUTEXES) || defined(__DOXYGEN__)
#define CH_USE_MUTEXES TRUE #define CH_CFG_USE_MUTEXES TRUE
#endif #endif
/** /**
@ -192,10 +194,10 @@
* in the kernel. * in the kernel.
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_USE_MUTEXES. * @note Requires @p CH_CFG_USE_MUTEXES.
*/ */
#if !defined(CH_USE_CONDVARS) || defined(__DOXYGEN__) #if !defined(CH_CFG_USE_CONDVARS) || defined(__DOXYGEN__)
#define CH_USE_CONDVARS TRUE #define CH_CFG_USE_CONDVARS TRUE
#endif #endif
/** /**
@ -204,10 +206,10 @@
* specification are included in the kernel. * specification are included in the kernel.
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_USE_CONDVARS. * @note Requires @p CH_CFG_USE_CONDVARS.
*/ */
#if !defined(CH_USE_CONDVARS_TIMEOUT) || defined(__DOXYGEN__) #if !defined(CH_CFG_USE_CONDVARS_TIMEOUT) || defined(__DOXYGEN__)
#define CH_USE_CONDVARS_TIMEOUT TRUE #define CH_CFG_USE_CONDVARS_TIMEOUT TRUE
#endif #endif
/** /**
@ -216,8 +218,8 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_USE_EVENTS) || defined(__DOXYGEN__) #if !defined(CH_CFG_USE_EVENTS) || defined(__DOXYGEN__)
#define CH_USE_EVENTS TRUE #define CH_CFG_USE_EVENTS TRUE
#endif #endif
/** /**
@ -226,10 +228,10 @@
* are included in the kernel. * are included in the kernel.
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_USE_EVENTS. * @note Requires @p CH_CFG_USE_EVENTS.
*/ */
#if !defined(CH_USE_EVENTS_TIMEOUT) || defined(__DOXYGEN__) #if !defined(CH_CFG_USE_EVENTS_TIMEOUT) || defined(__DOXYGEN__)
#define CH_USE_EVENTS_TIMEOUT TRUE #define CH_CFG_USE_EVENTS_TIMEOUT TRUE
#endif #endif
/** /**
@ -239,8 +241,8 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_USE_MESSAGES) || defined(__DOXYGEN__) #if !defined(CH_CFG_USE_MESSAGES) || defined(__DOXYGEN__)
#define CH_USE_MESSAGES TRUE #define CH_CFG_USE_MESSAGES TRUE
#endif #endif
/** /**
@ -248,11 +250,12 @@
* @details If enabled then messages are served by priority rather than in * @details If enabled then messages are served by priority rather than in
* FIFO order. * FIFO order.
* *
* @note The default is @p FALSE. Enable this if you have special requirements. * @note The default is @p FALSE. Enable this if you have special
* @note Requires @p CH_USE_MESSAGES. * requirements.
* @note Requires @p CH_CFG_USE_MESSAGES.
*/ */
#if !defined(CH_USE_MESSAGES_PRIORITY) || defined(__DOXYGEN__) #if !defined(CH_CFG_USE_MESSAGES_PRIORITY) || defined(__DOXYGEN__)
#define CH_USE_MESSAGES_PRIORITY FALSE #define CH_CFG_USE_MESSAGES_PRIORITY FALSE
#endif #endif
/** /**
@ -261,10 +264,10 @@
* included in the kernel. * included in the kernel.
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_USE_SEMAPHORES. * @note Requires @p CH_CFG_USE_SEMAPHORES.
*/ */
#if !defined(CH_USE_MAILBOXES) || defined(__DOXYGEN__) #if !defined(CH_CFG_USE_MAILBOXES) || defined(__DOXYGEN__)
#define CH_USE_MAILBOXES TRUE #define CH_CFG_USE_MAILBOXES TRUE
#endif #endif
/** /**
@ -273,8 +276,8 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_USE_QUEUES) || defined(__DOXYGEN__) #if !defined(CH_CFG_USE_QUEUES) || defined(__DOXYGEN__)
#define CH_USE_QUEUES TRUE #define CH_CFG_USE_QUEUES TRUE
#endif #endif
/** /**
@ -284,8 +287,8 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_USE_MEMCORE) || defined(__DOXYGEN__) #if !defined(CH_CFG_USE_MEMCORE) || defined(__DOXYGEN__)
#define CH_USE_MEMCORE TRUE #define CH_CFG_USE_MEMCORE TRUE
#endif #endif
/** /**
@ -294,12 +297,12 @@
* in the kernel. * in the kernel.
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_USE_MEMCORE and either @p CH_USE_MUTEXES or * @note Requires @p CH_CFG_USE_MEMCORE and either @p CH_CFG_USE_MUTEXES or
* @p CH_USE_SEMAPHORES. * @p CH_CFG_USE_SEMAPHORES.
* @note Mutexes are recommended. * @note Mutexes are recommended.
*/ */
#if !defined(CH_USE_HEAP) || defined(__DOXYGEN__) #if !defined(CH_CFG_USE_HEAP) || defined(__DOXYGEN__)
#define CH_USE_HEAP TRUE #define CH_CFG_USE_HEAP TRUE
#endif #endif
/** /**
@ -309,8 +312,8 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_USE_MEMPOOLS) || defined(__DOXYGEN__) #if !defined(CH_CFG_USE_MEMPOOLS) || defined(__DOXYGEN__)
#define CH_USE_MEMPOOLS TRUE #define CH_CFG_USE_MEMPOOLS TRUE
#endif #endif
/** /**
@ -319,11 +322,11 @@
* in the kernel. * in the kernel.
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_USE_WAITEXIT. * @note Requires @p CH_CFG_USE_WAITEXIT.
* @note Requires @p CH_USE_HEAP and/or @p CH_USE_MEMPOOLS. * @note Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS.
*/ */
#if !defined(CH_USE_DYNAMIC) || defined(__DOXYGEN__) #if !defined(CH_CFG_USE_DYNAMIC) || defined(__DOXYGEN__)
#define CH_USE_DYNAMIC TRUE #define CH_CFG_USE_DYNAMIC TRUE
#endif #endif
/** @} */ /** @} */
@ -343,7 +346,7 @@
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_SYSTEM_STATE_CHECK) || defined(__DOXYGEN__) #if !defined(CH_DBG_SYSTEM_STATE_CHECK) || defined(__DOXYGEN__)
#define CH_DBG_SYSTEM_STATE_CHECK FALSE #define CH_DBG_SYSTEM_STATE_CHECK FALSE
#endif #endif
/** /**
@ -354,7 +357,7 @@
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_ENABLE_CHECKS) || defined(__DOXYGEN__) #if !defined(CH_DBG_ENABLE_CHECKS) || defined(__DOXYGEN__)
#define CH_DBG_ENABLE_CHECKS FALSE #define CH_DBG_ENABLE_CHECKS FALSE
#endif #endif
/** /**
@ -366,7 +369,7 @@
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_ENABLE_ASSERTS) || defined(__DOXYGEN__) #if !defined(CH_DBG_ENABLE_ASSERTS) || defined(__DOXYGEN__)
#define CH_DBG_ENABLE_ASSERTS FALSE #define CH_DBG_ENABLE_ASSERTS FALSE
#endif #endif
/** /**
@ -377,7 +380,7 @@
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_ENABLE_TRACE) || defined(__DOXYGEN__) #if !defined(CH_DBG_ENABLE_TRACE) || defined(__DOXYGEN__)
#define CH_DBG_ENABLE_TRACE FALSE #define CH_DBG_ENABLE_TRACE FALSE
#endif #endif
/** /**
@ -391,7 +394,7 @@
* @p panic_msg variable set to @p NULL. * @p panic_msg variable set to @p NULL.
*/ */
#if !defined(CH_DBG_ENABLE_STACK_CHECK) || defined(__DOXYGEN__) #if !defined(CH_DBG_ENABLE_STACK_CHECK) || defined(__DOXYGEN__)
#define CH_DBG_ENABLE_STACK_CHECK FALSE #define CH_DBG_ENABLE_STACK_CHECK FALSE
#endif #endif
/** /**
@ -403,7 +406,7 @@
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_FILL_THREADS) || defined(__DOXYGEN__) #if !defined(CH_DBG_FILL_THREADS) || defined(__DOXYGEN__)
#define CH_DBG_FILL_THREADS FALSE #define CH_DBG_FILL_THREADS FALSE
#endif #endif
/** /**
@ -416,7 +419,7 @@
* some test cases into the test suite. * some test cases into the test suite.
*/ */
#if !defined(CH_DBG_THREADS_PROFILING) || defined(__DOXYGEN__) #if !defined(CH_DBG_THREADS_PROFILING) || defined(__DOXYGEN__)
#define CH_DBG_THREADS_PROFILING TRUE #define CH_DBG_THREADS_PROFILING TRUE
#endif #endif
/** @} */ /** @} */
@ -432,8 +435,8 @@
* @brief Threads descriptor structure extension. * @brief Threads descriptor structure extension.
* @details User fields added to the end of the @p thread_t structure. * @details User fields added to the end of the @p thread_t structure.
*/ */
#if !defined(THREAD_EXT_FIELDS) || defined(__DOXYGEN__) #if !defined(CH_CFG_THREAD_EXTRA_FIELDS) || defined(__DOXYGEN__)
#define THREAD_EXT_FIELDS \ #define CH_CFG_THREAD_EXTRA_FIELDS \
/* Add threads custom fields here.*/ /* Add threads custom fields here.*/
#endif #endif
@ -444,8 +447,8 @@
* @note It is invoked from within @p chThdInit() and implicitly from all * @note It is invoked from within @p chThdInit() and implicitly from all
* the threads creation APIs. * the threads creation APIs.
*/ */
#if !defined(THREAD_EXT_INIT_HOOK) || defined(__DOXYGEN__) #if !defined(CH_CFG_THREAD_INIT_HOOK) || defined(__DOXYGEN__)
#define THREAD_EXT_INIT_HOOK(tp) { \ #define CH_CFG_THREAD_INIT_HOOK(tp) { \
/* Add threads initialization code here.*/ \ /* Add threads initialization code here.*/ \
} }
#endif #endif
@ -458,8 +461,8 @@
* @note It is also invoked when the threads simply return in order to * @note It is also invoked when the threads simply return in order to
* terminate. * terminate.
*/ */
#if !defined(THREAD_EXT_EXIT_HOOK) || defined(__DOXYGEN__) #if !defined(CH_CFG_THREAD_EXIT_HOOK) || defined(__DOXYGEN__)
#define THREAD_EXT_EXIT_HOOK(tp) { \ #define CH_CFG_THREAD_EXIT_HOOK(tp) { \
/* Add threads finalization code here.*/ \ /* Add threads finalization code here.*/ \
} }
#endif #endif
@ -468,8 +471,8 @@
* @brief Context switch hook. * @brief Context switch hook.
* @details This hook is invoked just before switching between threads. * @details This hook is invoked just before switching between threads.
*/ */
#if !defined(THREAD_CONTEXT_SWITCH_HOOK) || defined(__DOXYGEN__) #if !defined(CH_CFG_CONTEXT_SWITCH_HOOK) || defined(__DOXYGEN__)
#define THREAD_CONTEXT_SWITCH_HOOK(ntp, otp) { \ #define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) { \
/* System halt code here.*/ \ /* System halt code here.*/ \
} }
#endif #endif
@ -478,8 +481,8 @@
* @brief Idle Loop hook. * @brief Idle Loop hook.
* @details This hook is continuously invoked by the idle thread loop. * @details This hook is continuously invoked by the idle thread loop.
*/ */
#if !defined(IDLE_LOOP_HOOK) || defined(__DOXYGEN__) #if !defined(CH_CFG_IDLE_LOOP_HOOK) || defined(__DOXYGEN__)
#define IDLE_LOOP_HOOK() { \ #define CH_CFG_IDLE_LOOP_HOOK() { \
/* Idle loop code here.*/ \ /* Idle loop code here.*/ \
} }
#endif #endif
@ -489,8 +492,8 @@
* @details This hook is invoked in the system tick handler immediately * @details This hook is invoked in the system tick handler immediately
* after processing the virtual timers queue. * after processing the virtual timers queue.
*/ */
#if !defined(SYSTEM_TICK_EVENT_HOOK) || defined(__DOXYGEN__) #if !defined(CH_CFG_SYSTEM_TICK_HOOK) || defined(__DOXYGEN__)
#define SYSTEM_TICK_EVENT_HOOK() { \ #define CH_CFG_SYSTEM_TICK_HOOK() { \
/* System tick event code here.*/ \ /* System tick event code here.*/ \
} }
#endif #endif
@ -500,8 +503,8 @@
* @details This hook is invoked in case to a system halting error before * @details This hook is invoked in case to a system halting error before
* the system is halted. * the system is halted.
*/ */
#if !defined(SYSTEM_HALT_HOOK) || defined(__DOXYGEN__) #if !defined(CH_CFG_SYSTEM_HALT_HOOK) || defined(__DOXYGEN__)
#define SYSTEM_HALT_HOOK() { \ #define CH_CFG_SYSTEM_HALT_HOOK() { \
/* System halt code here.*/ \ /* System halt code here.*/ \
} }
#endif #endif

View File

@ -64,8 +64,8 @@
/* Derived constants and error checks. */ /* Derived constants and error checks. */
/*===========================================================================*/ /*===========================================================================*/
#if ADC_USE_MUTUAL_EXCLUSION && !CH_USE_MUTEXES && !CH_USE_SEMAPHORES #if ADC_USE_MUTUAL_EXCLUSION && !CH_CFG_USE_MUTEXES && !CH_CFG_USE_SEMAPHORES
#error "ADC_USE_MUTUAL_EXCLUSION requires CH_USE_MUTEXES and/or CH_USE_SEMAPHORES" #error "ADC_USE_MUTUAL_EXCLUSION requires CH_CFG_USE_MUTEXES and/or CH_CFG_USE_SEMAPHORES"
#endif #endif
/*===========================================================================*/ /*===========================================================================*/

View File

@ -89,8 +89,8 @@
/* Derived constants and error checks. */ /* Derived constants and error checks. */
/*===========================================================================*/ /*===========================================================================*/
#if !CH_USE_SEMAPHORES || !CH_USE_EVENTS #if !CH_CFG_USE_SEMAPHORES || !CH_CFG_USE_EVENTS
#error "CAN driver requires CH_USE_SEMAPHORES and CH_USE_EVENTS" #error "CAN driver requires CH_CFG_USE_SEMAPHORES and CH_CFG_USE_EVENTS"
#endif #endif
/*===========================================================================*/ /*===========================================================================*/

View File

@ -69,8 +69,8 @@
/* Derived constants and error checks. */ /* Derived constants and error checks. */
/*===========================================================================*/ /*===========================================================================*/
#if I2C_USE_MUTUAL_EXCLUSION && !CH_USE_MUTEXES && !CH_USE_SEMAPHORES #if I2C_USE_MUTUAL_EXCLUSION && !CH_CFG_USE_MUTEXES && !CH_CFG_USE_SEMAPHORES
#error "I2C_USE_MUTUAL_EXCLUSION requires CH_USE_MUTEXES and/or CH_USE_SEMAPHORES" #error "I2C_USE_MUTUAL_EXCLUSION requires CH_CFG_USE_MUTEXES and/or CH_CFG_USE_SEMAPHORES"
#endif #endif
/*===========================================================================*/ /*===========================================================================*/

View File

@ -199,7 +199,7 @@ typedef struct {
#define chnReadTimeout(ip, bp, n, time) ((ip)->vmt->readt(ip, bp, n, time)) #define chnReadTimeout(ip, bp, n, time) ((ip)->vmt->readt(ip, bp, n, time))
/** @} */ /** @} */
#if CH_USE_EVENTS || defined(__DOXYGEN__) #if CH_CFG_USE_EVENTS || defined(__DOXYGEN__)
/** /**
* @name I/O status flags added to the event listener * @name I/O status flags added to the event listener
* @{ * @{
@ -287,7 +287,7 @@ typedef struct {
} }
/** @} */ /** @} */
#endif /* CH_USE_EVENTS */ #endif /* CH_CFG_USE_EVENTS */
#endif /* _IO_CHANNEL_H_ */ #endif /* _IO_CHANNEL_H_ */

View File

@ -61,12 +61,12 @@
/* Derived constants and error checks. */ /* Derived constants and error checks. */
/*===========================================================================*/ /*===========================================================================*/
#if !CH_USE_SEMAPHORES || !CH_USE_EVENTS #if !CH_CFG_USE_SEMAPHORES || !CH_CFG_USE_EVENTS
#error "the MAC driver requires CH_USE_SEMAPHORES" #error "the MAC driver requires CH_CFG_USE_SEMAPHORES"
#endif #endif
#if MAC_USE_EVENTS && !CH_USE_EVENTS #if MAC_USE_EVENTS && !CH_CFG_USE_EVENTS
#error "the MAC driver requires CH_USE_EVENTS" #error "the MAC driver requires CH_CFG_USE_EVENTS"
#endif #endif
/*===========================================================================*/ /*===========================================================================*/

View File

@ -65,8 +65,8 @@
/* Derived constants and error checks. */ /* Derived constants and error checks. */
/*===========================================================================*/ /*===========================================================================*/
#if !HAL_USE_SPI || !SPI_USE_WAIT || !CH_USE_EVENTS #if !HAL_USE_SPI || !SPI_USE_WAIT || !CH_CFG_USE_EVENTS
#error "MMC_SPI driver requires HAL_USE_SPI, SPI_USE_WAIT and CH_USE_EVENTS" #error "MMC_SPI driver requires HAL_USE_SPI, SPI_USE_WAIT and CH_CFG_USE_EVENTS"
#endif #endif
/*===========================================================================*/ /*===========================================================================*/

View File

@ -79,8 +79,8 @@
/* Derived constants and error checks. */ /* Derived constants and error checks. */
/*===========================================================================*/ /*===========================================================================*/
#if !CH_USE_QUEUES && !CH_USE_EVENTS #if !CH_CFG_USE_QUEUES && !CH_CFG_USE_EVENTS
#error "Serial Driver requires CH_USE_QUEUES and CH_USE_EVENTS" #error "Serial Driver requires CH_CFG_USE_QUEUES and CH_CFG_USE_EVENTS"
#endif #endif
/*===========================================================================*/ /*===========================================================================*/

View File

@ -99,9 +99,9 @@
/* Derived constants and error checks. */ /* Derived constants and error checks. */
/*===========================================================================*/ /*===========================================================================*/
#if !HAL_USE_USB || !CH_USE_QUEUES || !CH_USE_EVENTS #if !HAL_USE_USB || !CH_CFG_USE_QUEUES || !CH_CFG_USE_EVENTS
#error "Serial over USB Driver requires HAL_USE_USB, CH_USE_QUEUES, " #error "Serial over USB Driver requires HAL_USE_USB, CH_CFG_USE_QUEUES, "
"CH_USE_EVENTS" "CH_CFG_USE_EVENTS"
#endif #endif
/*===========================================================================*/ /*===========================================================================*/

View File

@ -64,8 +64,8 @@
/* Derived constants and error checks. */ /* Derived constants and error checks. */
/*===========================================================================*/ /*===========================================================================*/
#if SPI_USE_MUTUAL_EXCLUSION && !CH_USE_MUTEXES && !CH_USE_SEMAPHORES #if SPI_USE_MUTUAL_EXCLUSION && !CH_CFG_USE_MUTEXES && !CH_CFG_USE_SEMAPHORES
#error "SPI_USE_MUTUAL_EXCLUSION requires CH_USE_MUTEXES and/or CH_USE_SEMAPHORES" #error "SPI_USE_MUTUAL_EXCLUSION requires CH_CFG_USE_MUTEXES and/or CH_CFG_USE_SEMAPHORES"
#endif #endif
/*===========================================================================*/ /*===========================================================================*/

View File

@ -257,12 +257,12 @@ struct ADCDriver {
Thread *thread; Thread *thread;
#endif #endif
#if ADC_USE_MUTUAL_EXCLUSION || defined(__DOXYGEN__) #if ADC_USE_MUTUAL_EXCLUSION || defined(__DOXYGEN__)
#if CH_USE_MUTEXES || defined(__DOXYGEN__) #if CH_CFG_USE_MUTEXES || defined(__DOXYGEN__)
/** /**
* @brief Mutex protecting the peripheral. * @brief Mutex protecting the peripheral.
*/ */
Mutex mutex; Mutex mutex;
#elif CH_USE_SEMAPHORES #elif CH_CFG_USE_SEMAPHORES
Semaphore semaphore; Semaphore semaphore;
#endif #endif
#endif /* ADC_USE_MUTUAL_EXCLUSION */ #endif /* ADC_USE_MUTUAL_EXCLUSION */

View File

@ -137,12 +137,12 @@ struct I2CDriver{
*/ */
size_t txbytes; size_t txbytes;
#if I2C_USE_MUTUAL_EXCLUSION || defined(__DOXYGEN__) #if I2C_USE_MUTUAL_EXCLUSION || defined(__DOXYGEN__)
#if CH_USE_MUTEXES || defined(__DOXYGEN__) #if CH_CFG_USE_MUTEXES || defined(__DOXYGEN__)
/** /**
* @brief Mutex protecting the bus. * @brief Mutex protecting the bus.
*/ */
Mutex mutex; Mutex mutex;
#elif CH_USE_SEMAPHORES #elif CH_CFG_USE_SEMAPHORES
Semaphore semaphore; Semaphore semaphore;
#endif #endif
#endif /* I2C_USE_MUTUAL_EXCLUSION */ #endif /* I2C_USE_MUTUAL_EXCLUSION */

View File

@ -159,12 +159,12 @@ struct SPIDriver {
Thread *thread; Thread *thread;
#endif /* SPI_USE_WAIT */ #endif /* SPI_USE_WAIT */
#if SPI_USE_MUTUAL_EXCLUSION || defined(__DOXYGEN__) #if SPI_USE_MUTUAL_EXCLUSION || defined(__DOXYGEN__)
#if CH_USE_MUTEXES || defined(__DOXYGEN__) #if CH_CFG_USE_MUTEXES || defined(__DOXYGEN__)
/** /**
* @brief Mutex protecting the bus. * @brief Mutex protecting the bus.
*/ */
Mutex mutex; Mutex mutex;
#elif CH_USE_SEMAPHORES #elif CH_CFG_USE_SEMAPHORES
Semaphore semaphore; Semaphore semaphore;
#endif #endif
#endif /* SPI_USE_MUTUAL_EXCLUSION */ #endif /* SPI_USE_MUTUAL_EXCLUSION */

View File

@ -125,12 +125,12 @@ struct I2CDriver {
*/ */
i2cflags_t errors; i2cflags_t errors;
#if I2C_USE_MUTUAL_EXCLUSION || defined(__DOXYGEN__) #if I2C_USE_MUTUAL_EXCLUSION || defined(__DOXYGEN__)
#if CH_USE_MUTEXES || defined(__DOXYGEN__) #if CH_CFG_USE_MUTEXES || defined(__DOXYGEN__)
/** /**
* @brief Mutex protecting the bus. * @brief Mutex protecting the bus.
*/ */
Mutex mutex; Mutex mutex;
#elif CH_USE_SEMAPHORES #elif CH_CFG_USE_SEMAPHORES
Semaphore semaphore; Semaphore semaphore;
#endif #endif
#endif /* I2C_USE_MUTUAL_EXCLUSION */ #endif /* I2C_USE_MUTUAL_EXCLUSION */

View File

@ -54,7 +54,7 @@ void hal_lld_init(void) {
/* SysTick initialization using the system clock.*/ /* SysTick initialization using the system clock.*/
nvicSetSystemHandlerPriority(HANDLER_SYSTICK, CORTEX_PRIORITY_SYSTICK); nvicSetSystemHandlerPriority(HANDLER_SYSTICK, CORTEX_PRIORITY_SYSTICK);
SysTick->LOAD = LPC_SYSCLK / CH_FREQUENCY - 1; SysTick->LOAD = LPC_SYSCLK / CH_CFG_FREQUENCY - 1;
SysTick->VAL = 0; SysTick->VAL = 0;
SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk | SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk |
SysTick_CTRL_ENABLE_Msk | SysTick_CTRL_ENABLE_Msk |

View File

@ -235,12 +235,12 @@ struct SPIDriver {
Thread *thread; Thread *thread;
#endif /* SPI_USE_WAIT */ #endif /* SPI_USE_WAIT */
#if SPI_USE_MUTUAL_EXCLUSION || defined(__DOXYGEN__) #if SPI_USE_MUTUAL_EXCLUSION || defined(__DOXYGEN__)
#if CH_USE_MUTEXES || defined(__DOXYGEN__) #if CH_CFG_USE_MUTEXES || defined(__DOXYGEN__)
/** /**
* @brief Mutex protecting the bus. * @brief Mutex protecting the bus.
*/ */
Mutex mutex; Mutex mutex;
#elif CH_USE_SEMAPHORES #elif CH_CFG_USE_SEMAPHORES
Semaphore semaphore; Semaphore semaphore;
#endif #endif
#endif /* SPI_USE_MUTUAL_EXCLUSION */ #endif /* SPI_USE_MUTUAL_EXCLUSION */

View File

@ -59,7 +59,7 @@ void hal_lld_init(void) {
/* SysTick initialization using the system clock.*/ /* SysTick initialization using the system clock.*/
nvicSetSystemHandlerPriority(HANDLER_SYSTICK, CORTEX_PRIORITY_SYSTICK); nvicSetSystemHandlerPriority(HANDLER_SYSTICK, CORTEX_PRIORITY_SYSTICK);
SysTick->LOAD = LPC11xx_SYSCLK / CH_FREQUENCY - 1; SysTick->LOAD = LPC11xx_SYSCLK / CH_CFG_FREQUENCY - 1;
SysTick->VAL = 0; SysTick->VAL = 0;
SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk | SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk |
SysTick_CTRL_ENABLE_Msk | SysTick_CTRL_ENABLE_Msk |

View File

@ -138,12 +138,12 @@ struct I2CDriver {
*/ */
i2cflags_t errors; i2cflags_t errors;
#if I2C_USE_MUTUAL_EXCLUSION || defined(__DOXYGEN__) #if I2C_USE_MUTUAL_EXCLUSION || defined(__DOXYGEN__)
#if CH_USE_MUTEXES || defined(__DOXYGEN__) #if CH_CFG_USE_MUTEXES || defined(__DOXYGEN__)
/** /**
* @brief Mutex protecting the bus. * @brief Mutex protecting the bus.
*/ */
Mutex mutex; Mutex mutex;
#elif CH_USE_SEMAPHORES #elif CH_CFG_USE_SEMAPHORES
Semaphore semaphore; Semaphore semaphore;
#endif #endif
#endif /* I2C_USE_MUTUAL_EXCLUSION */ #endif /* I2C_USE_MUTUAL_EXCLUSION */

View File

@ -263,12 +263,12 @@ struct SPIDriver {
Thread *thread; Thread *thread;
#endif /* SPI_USE_WAIT */ #endif /* SPI_USE_WAIT */
#if SPI_USE_MUTUAL_EXCLUSION || defined(__DOXYGEN__) #if SPI_USE_MUTUAL_EXCLUSION || defined(__DOXYGEN__)
#if CH_USE_MUTEXES || defined(__DOXYGEN__) #if CH_CFG_USE_MUTEXES || defined(__DOXYGEN__)
/** /**
* @brief Mutex protecting the bus. * @brief Mutex protecting the bus.
*/ */
Mutex mutex; Mutex mutex;
#elif CH_USE_SEMAPHORES #elif CH_CFG_USE_SEMAPHORES
Semaphore semaphore; Semaphore semaphore;
#endif #endif
#endif /* SPI_USE_MUTUAL_EXCLUSION */ #endif /* SPI_USE_MUTUAL_EXCLUSION */

View File

@ -54,7 +54,7 @@ void hal_lld_init(void) {
/* SysTick initialization using the system clock.*/ /* SysTick initialization using the system clock.*/
nvicSetSystemHandlerPriority(HANDLER_SYSTICK, CORTEX_PRIORITY_SYSTICK); nvicSetSystemHandlerPriority(HANDLER_SYSTICK, CORTEX_PRIORITY_SYSTICK);
SysTick->LOAD = LPC122x_SYSCLK / CH_FREQUENCY - 1; SysTick->LOAD = LPC122x_SYSCLK / CH_CFG_FREQUENCY - 1;
SysTick->VAL = 0; SysTick->VAL = 0;
SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk | SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk |
SysTick_CTRL_ENABLE_Msk | SysTick_CTRL_ENABLE_Msk |

View File

@ -138,12 +138,12 @@ struct I2CDriver {
*/ */
i2cflags_t errors; i2cflags_t errors;
#if I2C_USE_MUTUAL_EXCLUSION || defined(__DOXYGEN__) #if I2C_USE_MUTUAL_EXCLUSION || defined(__DOXYGEN__)
#if CH_USE_MUTEXES || defined(__DOXYGEN__) #if CH_CFG_USE_MUTEXES || defined(__DOXYGEN__)
/** /**
* @brief Mutex protecting the bus. * @brief Mutex protecting the bus.
*/ */
Mutex mutex; Mutex mutex;
#elif CH_USE_SEMAPHORES #elif CH_CFG_USE_SEMAPHORES
Semaphore semaphore; Semaphore semaphore;
#endif #endif
#endif /* I2C_USE_MUTUAL_EXCLUSION */ #endif /* I2C_USE_MUTUAL_EXCLUSION */

View File

@ -209,12 +209,12 @@ struct SPIDriver {
Thread *thread; Thread *thread;
#endif /* SPI_USE_WAIT */ #endif /* SPI_USE_WAIT */
#if SPI_USE_MUTUAL_EXCLUSION || defined(__DOXYGEN__) #if SPI_USE_MUTUAL_EXCLUSION || defined(__DOXYGEN__)
#if CH_USE_MUTEXES || defined(__DOXYGEN__) #if CH_CFG_USE_MUTEXES || defined(__DOXYGEN__)
/** /**
* @brief Mutex protecting the bus. * @brief Mutex protecting the bus.
*/ */
Mutex mutex; Mutex mutex;
#elif CH_USE_SEMAPHORES #elif CH_CFG_USE_SEMAPHORES
Semaphore semaphore; Semaphore semaphore;
#endif #endif
#endif /* SPI_USE_MUTUAL_EXCLUSION */ #endif /* SPI_USE_MUTUAL_EXCLUSION */

View File

@ -59,7 +59,7 @@ void hal_lld_init(void) {
/* SysTick initialization using the system clock.*/ /* SysTick initialization using the system clock.*/
nvicSetSystemHandlerPriority(HANDLER_SYSTICK, CORTEX_PRIORITY_SYSTICK); nvicSetSystemHandlerPriority(HANDLER_SYSTICK, CORTEX_PRIORITY_SYSTICK);
SysTick->LOAD = LPC13xx_SYSCLK / CH_FREQUENCY - 1; SysTick->LOAD = LPC13xx_SYSCLK / CH_CFG_FREQUENCY - 1;
SysTick->VAL = 0; SysTick->VAL = 0;
SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk | SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk |
SysTick_CTRL_ENABLE_Msk | SysTick_CTRL_ENABLE_Msk |

View File

@ -263,12 +263,12 @@ struct SPIDriver {
Thread *thread; Thread *thread;
#endif /* SPI_USE_WAIT */ #endif /* SPI_USE_WAIT */
#if SPI_USE_MUTUAL_EXCLUSION || defined(__DOXYGEN__) #if SPI_USE_MUTUAL_EXCLUSION || defined(__DOXYGEN__)
#if CH_USE_MUTEXES || defined(__DOXYGEN__) #if CH_CFG_USE_MUTEXES || defined(__DOXYGEN__)
/** /**
* @brief Mutex protecting the bus. * @brief Mutex protecting the bus.
*/ */
Mutex mutex; Mutex mutex;
#elif CH_USE_SEMAPHORES #elif CH_CFG_USE_SEMAPHORES
Semaphore semaphore; Semaphore semaphore;
#endif #endif
#endif /* SPI_USE_MUTUAL_EXCLUSION */ #endif /* SPI_USE_MUTUAL_EXCLUSION */

View File

@ -135,12 +135,12 @@ struct SPIDriver {
Thread *thread; Thread *thread;
#endif /* SPI_USE_WAIT */ #endif /* SPI_USE_WAIT */
#if SPI_USE_MUTUAL_EXCLUSION || defined(__DOXYGEN__) #if SPI_USE_MUTUAL_EXCLUSION || defined(__DOXYGEN__)
#if CH_USE_MUTEXES || defined(__DOXYGEN__) #if CH_CFG_USE_MUTEXES || defined(__DOXYGEN__)
/** /**
* @brief Mutex protecting the bus. * @brief Mutex protecting the bus.
*/ */
Mutex mutex; Mutex mutex;
#elif CH_USE_SEMAPHORES #elif CH_CFG_USE_SEMAPHORES
Semaphore semaphore; Semaphore semaphore;
#endif #endif
#endif /* SPI_USE_MUTUAL_EXCLUSION */ #endif /* SPI_USE_MUTUAL_EXCLUSION */

View File

@ -54,7 +54,7 @@ void hal_lld_init(void) {
/* SysTick initialization using the system clock.*/ /* SysTick initialization using the system clock.*/
nvicSetSystemHandlerPriority(HANDLER_SYSTICK, CORTEX_PRIORITY_SYSTICK); nvicSetSystemHandlerPriority(HANDLER_SYSTICK, CORTEX_PRIORITY_SYSTICK);
SysTick->LOAD = LPC8xx_SYSCLK / CH_FREQUENCY - 1; SysTick->LOAD = LPC8xx_SYSCLK / CH_CFG_FREQUENCY - 1;
SysTick->VAL = 0; SysTick->VAL = 0;
SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk | SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk |
SysTick_CTRL_ENABLE_Msk | SysTick_CTRL_ENABLE_Msk |

View File

@ -209,12 +209,12 @@ struct SPIDriver {
Thread *thread; Thread *thread;
#endif /* SPI_USE_WAIT */ #endif /* SPI_USE_WAIT */
#if SPI_USE_MUTUAL_EXCLUSION || defined(__DOXYGEN__) #if SPI_USE_MUTUAL_EXCLUSION || defined(__DOXYGEN__)
#if CH_USE_MUTEXES || defined(__DOXYGEN__) #if CH_CFG_USE_MUTEXES || defined(__DOXYGEN__)
/** /**
* @brief Mutex protecting the bus. * @brief Mutex protecting the bus.
*/ */
Mutex mutex; Mutex mutex;
#elif CH_USE_SEMAPHORES #elif CH_CFG_USE_SEMAPHORES
Semaphore semaphore; Semaphore semaphore;
#endif #endif
#endif /* SPI_USE_MUTUAL_EXCLUSION */ #endif /* SPI_USE_MUTUAL_EXCLUSION */

View File

@ -38,7 +38,7 @@
/*===========================================================================*/ /*===========================================================================*/
static struct timeval nextcnt; static struct timeval nextcnt;
static struct timeval tick = {0, 1000000 / CH_FREQUENCY}; static struct timeval tick = {0, 1000000 / CH_CFG_FREQUENCY};
/*===========================================================================*/ /*===========================================================================*/
/* Driver local functions. */ /* Driver local functions. */

View File

@ -90,7 +90,7 @@ void hal_lld_init(void) {
INTC.PSR[59].R = SPC5_PIT0_IRQ_PRIORITY; INTC.PSR[59].R = SPC5_PIT0_IRQ_PRIORITY;
halSPCSetPeripheralClockMode(92, halSPCSetPeripheralClockMode(92,
SPC5_ME_PCTL_RUN(2) | SPC5_ME_PCTL_LP(2)); SPC5_ME_PCTL_RUN(2) | SPC5_ME_PCTL_LP(2));
reg = halSPCGetSystemClock() / CH_FREQUENCY - 1; reg = halSPCGetSystemClock() / CH_CFG_FREQUENCY - 1;
PIT.PITMCR.R = 1; /* PIT clock enabled, stop while debugging. */ PIT.PITMCR.R = 1; /* PIT clock enabled, stop while debugging. */
PIT.CH[0].LDVAL.R = reg; PIT.CH[0].LDVAL.R = reg;
PIT.CH[0].CVAL.R = reg; PIT.CH[0].CVAL.R = reg;

View File

@ -90,7 +90,7 @@ void hal_lld_init(void) {
INTC.PSR[59].R = SPC5_PIT0_IRQ_PRIORITY; INTC.PSR[59].R = SPC5_PIT0_IRQ_PRIORITY;
halSPCSetPeripheralClockMode(92, halSPCSetPeripheralClockMode(92,
SPC5_ME_PCTL_RUN(2) | SPC5_ME_PCTL_LP(2)); SPC5_ME_PCTL_RUN(2) | SPC5_ME_PCTL_LP(2));
reg = halSPCGetSystemClock() / CH_FREQUENCY - 1; reg = halSPCGetSystemClock() / CH_CFG_FREQUENCY - 1;
PIT.PITMCR.R = 1; /* PIT clock enabled, stop while debugging. */ PIT.PITMCR.R = 1; /* PIT clock enabled, stop while debugging. */
PIT.CH[0].LDVAL.R = reg; PIT.CH[0].LDVAL.R = reg;
PIT.CH[0].CVAL.R = reg; PIT.CH[0].CVAL.R = reg;

View File

@ -90,7 +90,7 @@ void hal_lld_init(void) {
INTC.PSR[59].R = SPC5_PIT0_IRQ_PRIORITY; INTC.PSR[59].R = SPC5_PIT0_IRQ_PRIORITY;
halSPCSetPeripheralClockMode(92, halSPCSetPeripheralClockMode(92,
SPC5_ME_PCTL_RUN(2) | SPC5_ME_PCTL_LP(2)); SPC5_ME_PCTL_RUN(2) | SPC5_ME_PCTL_LP(2));
reg = halSPCGetSystemClock() / CH_FREQUENCY - 1; reg = halSPCGetSystemClock() / CH_CFG_FREQUENCY - 1;
PIT.PITMCR.R = 1; /* PIT clock enabled, stop while debugging. */ PIT.PITMCR.R = 1; /* PIT clock enabled, stop while debugging. */
PIT.CH[0].LDVAL.R = reg; PIT.CH[0].LDVAL.R = reg;
PIT.CH[0].CVAL.R = reg; PIT.CH[0].CVAL.R = reg;

View File

@ -77,7 +77,7 @@ void hal_lld_init(void) {
/* Downcounter timer initialized for system tick use, TB enabled for debug /* Downcounter timer initialized for system tick use, TB enabled for debug
and measurements.*/ and measurements.*/
n = SPC5_SYSCLK / CH_FREQUENCY; n = SPC5_SYSCLK / CH_CFG_FREQUENCY;
asm volatile ("li %%r3, 0 \t\n" asm volatile ("li %%r3, 0 \t\n"
"mtspr 284, %%r3 \t\n" /* Clear TBL register. */ "mtspr 284, %%r3 \t\n" /* Clear TBL register. */
"mtspr 285, %%r3 \t\n" /* Clear TBU register. */ "mtspr 285, %%r3 \t\n" /* Clear TBU register. */

View File

@ -89,7 +89,7 @@ void hal_lld_init(void) {
/* Decrementer timer initialized for system tick use, note, it is /* Decrementer timer initialized for system tick use, note, it is
initialized here because in the OSAL layer the system clock frequency initialized here because in the OSAL layer the system clock frequency
is not yet known.*/ is not yet known.*/
n = SPC5_SYSCLK / CH_FREQUENCY; n = SPC5_SYSCLK / CH_CFG_FREQUENCY;
asm volatile ("mtspr 22, %[n] \t\n" /* Init. DEC register. */ asm volatile ("mtspr 22, %[n] \t\n" /* Init. DEC register. */
"mtspr 54, %[n] \t\n" /* Init. DECAR register.*/ "mtspr 54, %[n] \t\n" /* Init. DECAR register.*/
"lis %%r3, 0x0440 \t\n" /* DIE ARE bits. */ "lis %%r3, 0x0440 \t\n" /* DIE ARE bits. */

View File

@ -62,7 +62,7 @@ void hal_lld_init(void) {
/* Decrementer timer initialized for system tick use, note, it is /* Decrementer timer initialized for system tick use, note, it is
initialized here because in the OSAL layer the system clock frequency initialized here because in the OSAL layer the system clock frequency
is not yet known.*/ is not yet known.*/
n = halSPCGetSystemClock() / CH_FREQUENCY; n = halSPCGetSystemClock() / CH_CFG_FREQUENCY;
asm volatile ("mtspr 22, %[n] \t\n" /* Init. DEC register. */ asm volatile ("mtspr 22, %[n] \t\n" /* Init. DEC register. */
"mtspr 54, %[n] \t\n" /* Init. DECAR register.*/ "mtspr 54, %[n] \t\n" /* Init. DECAR register.*/
"lis %%r3, 0x0440 \t\n" /* DIE ARE bits. */ "lis %%r3, 0x0440 \t\n" /* DIE ARE bits. */

View File

@ -438,12 +438,12 @@ struct SPIDriver {
Thread *thread; Thread *thread;
#endif /* SPI_USE_WAIT */ #endif /* SPI_USE_WAIT */
#if SPI_USE_MUTUAL_EXCLUSION || defined(__DOXYGEN__) #if SPI_USE_MUTUAL_EXCLUSION || defined(__DOXYGEN__)
#if CH_USE_MUTEXES || defined(__DOXYGEN__) #if CH_CFG_USE_MUTEXES || defined(__DOXYGEN__)
/** /**
* @brief Mutex protecting the bus. * @brief Mutex protecting the bus.
*/ */
Mutex mutex; Mutex mutex;
#elif CH_USE_SEMAPHORES #elif CH_CFG_USE_SEMAPHORES
Semaphore semaphore; Semaphore semaphore;
#endif #endif
#endif /* SPI_USE_MUTUAL_EXCLUSION */ #endif /* SPI_USE_MUTUAL_EXCLUSION */

View File

@ -585,12 +585,12 @@ struct ADCDriver {
Thread *thread; Thread *thread;
#endif #endif
#if ADC_USE_MUTUAL_EXCLUSION || defined(__DOXYGEN__) #if ADC_USE_MUTUAL_EXCLUSION || defined(__DOXYGEN__)
#if CH_USE_MUTEXES || defined(__DOXYGEN__) #if CH_CFG_USE_MUTEXES || defined(__DOXYGEN__)
/** /**
* @brief Mutex protecting the peripheral. * @brief Mutex protecting the peripheral.
*/ */
Mutex mutex; Mutex mutex;
#elif CH_USE_SEMAPHORES #elif CH_CFG_USE_SEMAPHORES
Semaphore semaphore; Semaphore semaphore;
#endif #endif
#endif /* ADC_USE_MUTUAL_EXCLUSION */ #endif /* ADC_USE_MUTUAL_EXCLUSION */

View File

@ -365,12 +365,12 @@ struct I2CDriver {
*/ */
i2cflags_t errors; i2cflags_t errors;
#if I2C_USE_MUTUAL_EXCLUSION || defined(__DOXYGEN__) #if I2C_USE_MUTUAL_EXCLUSION || defined(__DOXYGEN__)
#if CH_USE_MUTEXES || defined(__DOXYGEN__) #if CH_CFG_USE_MUTEXES || defined(__DOXYGEN__)
/** /**
* @brief Mutex protecting the bus. * @brief Mutex protecting the bus.
*/ */
Mutex mutex; Mutex mutex;
#elif CH_USE_SEMAPHORES #elif CH_CFG_USE_SEMAPHORES
Semaphore semaphore; Semaphore semaphore;
#endif #endif
#endif /* I2C_USE_MUTUAL_EXCLUSION */ #endif /* I2C_USE_MUTUAL_EXCLUSION */

View File

@ -243,12 +243,12 @@ struct I2CDriver{
*/ */
i2cflags_t errors; i2cflags_t errors;
#if I2C_USE_MUTUAL_EXCLUSION || defined(__DOXYGEN__) #if I2C_USE_MUTUAL_EXCLUSION || defined(__DOXYGEN__)
#if CH_USE_MUTEXES || defined(__DOXYGEN__) #if CH_CFG_USE_MUTEXES || defined(__DOXYGEN__)
/** /**
* @brief Mutex protecting the bus. * @brief Mutex protecting the bus.
*/ */
Mutex mutex; Mutex mutex;
#elif CH_USE_SEMAPHORES #elif CH_CFG_USE_SEMAPHORES
Semaphore semaphore; Semaphore semaphore;
#endif #endif
#endif /* I2C_USE_MUTUAL_EXCLUSION */ #endif /* I2C_USE_MUTUAL_EXCLUSION */

View File

@ -331,12 +331,12 @@ struct SPIDriver{
Thread *thread; Thread *thread;
#endif /* SPI_USE_WAIT */ #endif /* SPI_USE_WAIT */
#if SPI_USE_MUTUAL_EXCLUSION || defined(__DOXYGEN__) #if SPI_USE_MUTUAL_EXCLUSION || defined(__DOXYGEN__)
#if CH_USE_MUTEXES || defined(__DOXYGEN__) #if CH_CFG_USE_MUTEXES || defined(__DOXYGEN__)
/** /**
* @brief Mutex protecting the bus. * @brief Mutex protecting the bus.
*/ */
Mutex mutex; Mutex mutex;
#elif CH_USE_SEMAPHORES #elif CH_CFG_USE_SEMAPHORES
Semaphore semaphore; Semaphore semaphore;
#endif #endif
#endif /* SPI_USE_MUTUAL_EXCLUSION */ #endif /* SPI_USE_MUTUAL_EXCLUSION */

View File

@ -344,12 +344,12 @@ struct SPIDriver{
Thread *thread; Thread *thread;
#endif /* SPI_USE_WAIT */ #endif /* SPI_USE_WAIT */
#if SPI_USE_MUTUAL_EXCLUSION || defined(__DOXYGEN__) #if SPI_USE_MUTUAL_EXCLUSION || defined(__DOXYGEN__)
#if CH_USE_MUTEXES || defined(__DOXYGEN__) #if CH_CFG_USE_MUTEXES || defined(__DOXYGEN__)
/** /**
* @brief Mutex protecting the bus. * @brief Mutex protecting the bus.
*/ */
Mutex mutex; Mutex mutex;
#elif CH_USE_SEMAPHORES #elif CH_CFG_USE_SEMAPHORES
Semaphore semaphore; Semaphore semaphore;
#endif #endif
#endif /* SPI_USE_MUTUAL_EXCLUSION */ #endif /* SPI_USE_MUTUAL_EXCLUSION */

View File

@ -267,12 +267,12 @@ struct ADCDriver {
Thread *thread; Thread *thread;
#endif #endif
#if ADC_USE_MUTUAL_EXCLUSION || defined(__DOXYGEN__) #if ADC_USE_MUTUAL_EXCLUSION || defined(__DOXYGEN__)
#if CH_USE_MUTEXES || defined(__DOXYGEN__) #if CH_CFG_USE_MUTEXES || defined(__DOXYGEN__)
/** /**
* @brief Mutex protecting the peripheral. * @brief Mutex protecting the peripheral.
*/ */
Mutex mutex; Mutex mutex;
#elif CH_USE_SEMAPHORES #elif CH_CFG_USE_SEMAPHORES
Semaphore semaphore; Semaphore semaphore;
#endif #endif
#endif /* ADC_USE_MUTUAL_EXCLUSION */ #endif /* ADC_USE_MUTUAL_EXCLUSION */

View File

@ -104,7 +104,7 @@ void hal_lld_init(void) {
rccResetAPB2(~RCC_APB2RSTR_DBGMCURST); rccResetAPB2(~RCC_APB2RSTR_DBGMCURST);
/* SysTick initialization using the system clock.*/ /* SysTick initialization using the system clock.*/
SysTick->LOAD = STM32_HCLK / CH_FREQUENCY - 1; SysTick->LOAD = STM32_HCLK / CH_CFG_FREQUENCY - 1;
SysTick->VAL = 0; SysTick->VAL = 0;
SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk | SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk |
SysTick_CTRL_ENABLE_Msk | SysTick_CTRL_ENABLE_Msk |

View File

@ -279,12 +279,12 @@ struct ADCDriver {
Thread *thread; Thread *thread;
#endif #endif
#if ADC_USE_MUTUAL_EXCLUSION || defined(__DOXYGEN__) #if ADC_USE_MUTUAL_EXCLUSION || defined(__DOXYGEN__)
#if CH_USE_MUTEXES || defined(__DOXYGEN__) #if CH_CFG_USE_MUTEXES || defined(__DOXYGEN__)
/** /**
* @brief Mutex protecting the peripheral. * @brief Mutex protecting the peripheral.
*/ */
Mutex mutex; Mutex mutex;
#elif CH_USE_SEMAPHORES #elif CH_CFG_USE_SEMAPHORES
Semaphore semaphore; Semaphore semaphore;
#endif #endif
#endif /* ADC_USE_MUTUAL_EXCLUSION */ #endif /* ADC_USE_MUTUAL_EXCLUSION */

View File

@ -103,7 +103,7 @@ void hal_lld_init(void) {
rccResetAPB2(0xFFFFFFFF); rccResetAPB2(0xFFFFFFFF);
/* SysTick initialization using the system clock.*/ /* SysTick initialization using the system clock.*/
SysTick->LOAD = STM32_HCLK / CH_FREQUENCY - 1; SysTick->LOAD = STM32_HCLK / CH_CFG_FREQUENCY - 1;
SysTick->VAL = 0; SysTick->VAL = 0;
SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk | SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk |
SysTick_CTRL_ENABLE_Msk | SysTick_CTRL_ENABLE_Msk |

View File

@ -478,12 +478,12 @@ struct ADCDriver {
Thread *thread; Thread *thread;
#endif #endif
#if ADC_USE_MUTUAL_EXCLUSION || defined(__DOXYGEN__) #if ADC_USE_MUTUAL_EXCLUSION || defined(__DOXYGEN__)
#if CH_USE_MUTEXES || defined(__DOXYGEN__) #if CH_CFG_USE_MUTEXES || defined(__DOXYGEN__)
/** /**
* @brief Mutex protecting the peripheral. * @brief Mutex protecting the peripheral.
*/ */
Mutex mutex; Mutex mutex;
#elif CH_USE_SEMAPHORES #elif CH_CFG_USE_SEMAPHORES
Semaphore semaphore; Semaphore semaphore;
#endif #endif
#endif /* ADC_USE_MUTUAL_EXCLUSION */ #endif /* ADC_USE_MUTUAL_EXCLUSION */

View File

@ -104,7 +104,7 @@ void hal_lld_init(void) {
rccResetAPB2(0xFFFFFFFF); rccResetAPB2(0xFFFFFFFF);
/* SysTick initialization using the system clock.*/ /* SysTick initialization using the system clock.*/
SysTick->LOAD = STM32_HCLK / CH_FREQUENCY - 1; SysTick->LOAD = STM32_HCLK / CH_CFG_FREQUENCY - 1;
SysTick->VAL = 0; SysTick->VAL = 0;
SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk | SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk |
SysTick_CTRL_ENABLE_Msk | SysTick_CTRL_ENABLE_Msk |

View File

@ -524,12 +524,12 @@ struct ADCDriver {
Thread *thread; Thread *thread;
#endif #endif
#if ADC_USE_MUTUAL_EXCLUSION || defined(__DOXYGEN__) #if ADC_USE_MUTUAL_EXCLUSION || defined(__DOXYGEN__)
#if CH_USE_MUTEXES || defined(__DOXYGEN__) #if CH_CFG_USE_MUTEXES || defined(__DOXYGEN__)
/** /**
* @brief Mutex protecting the peripheral. * @brief Mutex protecting the peripheral.
*/ */
Mutex mutex; Mutex mutex;
#elif CH_USE_SEMAPHORES #elif CH_CFG_USE_SEMAPHORES
Semaphore semaphore; Semaphore semaphore;
#endif #endif
#endif /* ADC_USE_MUTUAL_EXCLUSION */ #endif /* ADC_USE_MUTUAL_EXCLUSION */

View File

@ -104,7 +104,7 @@ void hal_lld_init(void) {
rccResetAPB2(0xFFFFFFFF); rccResetAPB2(0xFFFFFFFF);
/* SysTick initialization using the system clock.*/ /* SysTick initialization using the system clock.*/
SysTick->LOAD = STM32_HCLK / CH_FREQUENCY - 1; SysTick->LOAD = STM32_HCLK / CH_CFG_FREQUENCY - 1;
SysTick->VAL = 0; SysTick->VAL = 0;
SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk | SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk |
SysTick_CTRL_ENABLE_Msk | SysTick_CTRL_ENABLE_Msk |

View File

@ -440,12 +440,12 @@ struct ADCDriver {
Thread *thread; Thread *thread;
#endif #endif
#if ADC_USE_MUTUAL_EXCLUSION || defined(__DOXYGEN__) #if ADC_USE_MUTUAL_EXCLUSION || defined(__DOXYGEN__)
#if CH_USE_MUTEXES || defined(__DOXYGEN__) #if CH_CFG_USE_MUTEXES || defined(__DOXYGEN__)
/** /**
* @brief Mutex protecting the peripheral. * @brief Mutex protecting the peripheral.
*/ */
Mutex mutex; Mutex mutex;
#elif CH_USE_SEMAPHORES #elif CH_CFG_USE_SEMAPHORES
Semaphore semaphore; Semaphore semaphore;
#endif #endif
#endif /* ADC_USE_MUTUAL_EXCLUSION */ #endif /* ADC_USE_MUTUAL_EXCLUSION */

View File

@ -102,7 +102,7 @@ void hal_lld_init(void) {
rccResetAPB2(~0); rccResetAPB2(~0);
/* SysTick initialization using the system clock.*/ /* SysTick initialization using the system clock.*/
SysTick->LOAD = STM32_HCLK / CH_FREQUENCY - 1; SysTick->LOAD = STM32_HCLK / CH_CFG_FREQUENCY - 1;
SysTick->VAL = 0; SysTick->VAL = 0;
SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk | SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk |
SysTick_CTRL_ENABLE_Msk | SysTick_CTRL_ENABLE_Msk |

View File

@ -346,12 +346,12 @@ struct ADCDriver {
Thread *thread; Thread *thread;
#endif #endif
#if ADC_USE_MUTUAL_EXCLUSION || defined(__DOXYGEN__) #if ADC_USE_MUTUAL_EXCLUSION || defined(__DOXYGEN__)
#if CH_USE_MUTEXES || defined(__DOXYGEN__) #if CH_CFG_USE_MUTEXES || defined(__DOXYGEN__)
/** /**
* @brief Mutex protecting the peripheral. * @brief Mutex protecting the peripheral.
*/ */
Mutex mutex; Mutex mutex;
#elif CH_USE_SEMAPHORES #elif CH_CFG_USE_SEMAPHORES
Semaphore semaphore; Semaphore semaphore;
#endif #endif
#endif /* ADC_USE_MUTUAL_EXCLUSION */ #endif /* ADC_USE_MUTUAL_EXCLUSION */

View File

@ -99,7 +99,7 @@ void hal_lld_init(void) {
rccResetAPB2(~0); rccResetAPB2(~0);
/* SysTick initialization using the system clock.*/ /* SysTick initialization using the system clock.*/
SysTick->LOAD = STM32_HCLK / CH_FREQUENCY - 1; SysTick->LOAD = STM32_HCLK / CH_CFG_FREQUENCY - 1;
SysTick->VAL = 0; SysTick->VAL = 0;
SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk | SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk |
SysTick_CTRL_ENABLE_Msk | SysTick_CTRL_ENABLE_Msk |

View File

@ -119,12 +119,12 @@ struct SPIDriver {
Thread *thread; Thread *thread;
#endif /* SPI_USE_WAIT */ #endif /* SPI_USE_WAIT */
#if SPI_USE_MUTUAL_EXCLUSION || defined(__DOXYGEN__) #if SPI_USE_MUTUAL_EXCLUSION || defined(__DOXYGEN__)
#if CH_USE_MUTEXES || defined(__DOXYGEN__) #if CH_CFG_USE_MUTEXES || defined(__DOXYGEN__)
/** /**
* @brief Mutex protecting the bus. * @brief Mutex protecting the bus.
*/ */
Mutex mutex; Mutex mutex;
#elif CH_USE_SEMAPHORES #elif CH_CFG_USE_SEMAPHORES
Semaphore semaphore; Semaphore semaphore;
#endif #endif
#endif /* SPI_USE_MUTUAL_EXCLUSION */ #endif /* SPI_USE_MUTUAL_EXCLUSION */

View File

@ -64,7 +64,7 @@ void hal_lld_init(void) {
printf("QueryPerformanceFrequency() error"); printf("QueryPerformanceFrequency() error");
exit(1); exit(1);
} }
slice.QuadPart /= CH_FREQUENCY; slice.QuadPart /= CH_CFG_FREQUENCY;
QueryPerformanceCounter(&nextcnt); QueryPerformanceCounter(&nextcnt);
nextcnt.QuadPart += slice.QuadPart; nextcnt.QuadPart += slice.QuadPart;

View File

@ -81,7 +81,7 @@ void adcObjectInit(ADCDriver *adcp) {
adcp->thread = NULL; adcp->thread = NULL;
#endif /* ADC_USE_WAIT */ #endif /* ADC_USE_WAIT */
#if ADC_USE_MUTUAL_EXCLUSION #if ADC_USE_MUTUAL_EXCLUSION
#if CH_USE_MUTEXES #if CH_CFG_USE_MUTEXES
chMtxInit(&adcp->mutex); chMtxInit(&adcp->mutex);
#else #else
chSemInit(&adcp->semaphore, 1); chSemInit(&adcp->semaphore, 1);
@ -309,9 +309,9 @@ void adcAcquireBus(ADCDriver *adcp) {
chDbgCheck(adcp != NULL, "adcAcquireBus"); chDbgCheck(adcp != NULL, "adcAcquireBus");
#if CH_USE_MUTEXES #if CH_CFG_USE_MUTEXES
chMtxLock(&adcp->mutex); chMtxLock(&adcp->mutex);
#elif CH_USE_SEMAPHORES #elif CH_CFG_USE_SEMAPHORES
chSemWait(&adcp->semaphore); chSemWait(&adcp->semaphore);
#endif #endif
} }
@ -329,10 +329,10 @@ void adcReleaseBus(ADCDriver *adcp) {
chDbgCheck(adcp != NULL, "adcReleaseBus"); chDbgCheck(adcp != NULL, "adcReleaseBus");
#if CH_USE_MUTEXES #if CH_CFG_USE_MUTEXES
(void)adcp; (void)adcp;
chMtxUnlock(); chMtxUnlock();
#elif CH_USE_SEMAPHORES #elif CH_CFG_USE_SEMAPHORES
chSemSignal(&adcp->semaphore); chSemSignal(&adcp->semaphore);
#endif #endif
} }

View File

@ -78,11 +78,11 @@ void i2cObjectInit(I2CDriver *i2cp) {
i2cp->config = NULL; i2cp->config = NULL;
#if I2C_USE_MUTUAL_EXCLUSION #if I2C_USE_MUTUAL_EXCLUSION
#if CH_USE_MUTEXES #if CH_CFG_USE_MUTEXES
chMtxInit(&i2cp->mutex); chMtxInit(&i2cp->mutex);
#else #else
chSemInit(&i2cp->semaphore, 1); chSemInit(&i2cp->semaphore, 1);
#endif /* CH_USE_MUTEXES */ #endif /* CH_CFG_USE_MUTEXES */
#endif /* I2C_USE_MUTUAL_EXCLUSION */ #endif /* I2C_USE_MUTUAL_EXCLUSION */
#if defined(I2C_DRIVER_EXT_INIT_HOOK) #if defined(I2C_DRIVER_EXT_INIT_HOOK)
@ -270,9 +270,9 @@ void i2cAcquireBus(I2CDriver *i2cp) {
chDbgCheck(i2cp != NULL, "i2cAcquireBus"); chDbgCheck(i2cp != NULL, "i2cAcquireBus");
#if CH_USE_MUTEXES #if CH_CFG_USE_MUTEXES
chMtxLock(&i2cp->mutex); chMtxLock(&i2cp->mutex);
#elif CH_USE_SEMAPHORES #elif CH_CFG_USE_SEMAPHORES
chSemWait(&i2cp->semaphore); chSemWait(&i2cp->semaphore);
#endif #endif
} }
@ -290,9 +290,9 @@ void i2cReleaseBus(I2CDriver *i2cp) {
chDbgCheck(i2cp != NULL, "i2cReleaseBus"); chDbgCheck(i2cp != NULL, "i2cReleaseBus");
#if CH_USE_MUTEXES #if CH_CFG_USE_MUTEXES
chMtxUnlock(); chMtxUnlock();
#elif CH_USE_SEMAPHORES #elif CH_CFG_USE_SEMAPHORES
chSemSignal(&i2cp->semaphore); chSemSignal(&i2cp->semaphore);
#endif #endif
} }

View File

@ -78,7 +78,7 @@ void spiObjectInit(SPIDriver *spip) {
spip->thread = NULL; spip->thread = NULL;
#endif /* SPI_USE_WAIT */ #endif /* SPI_USE_WAIT */
#if SPI_USE_MUTUAL_EXCLUSION #if SPI_USE_MUTUAL_EXCLUSION
#if CH_USE_MUTEXES #if CH_CFG_USE_MUTEXES
chMtxInit(&spip->mutex); chMtxInit(&spip->mutex);
#else #else
chSemInit(&spip->semaphore, 1); chSemInit(&spip->semaphore, 1);
@ -405,9 +405,9 @@ void spiAcquireBus(SPIDriver *spip) {
chDbgCheck(spip != NULL, "spiAcquireBus"); chDbgCheck(spip != NULL, "spiAcquireBus");
#if CH_USE_MUTEXES #if CH_CFG_USE_MUTEXES
chMtxLock(&spip->mutex); chMtxLock(&spip->mutex);
#elif CH_USE_SEMAPHORES #elif CH_CFG_USE_SEMAPHORES
chSemWait(&spip->semaphore); chSemWait(&spip->semaphore);
#endif #endif
} }
@ -425,10 +425,10 @@ void spiReleaseBus(SPIDriver *spip) {
chDbgCheck(spip != NULL, "spiReleaseBus"); chDbgCheck(spip != NULL, "spiReleaseBus");
#if CH_USE_MUTEXES #if CH_CFG_USE_MUTEXES
(void)spip; (void)spip;
chMtxUnlock(); chMtxUnlock();
#elif CH_USE_SEMAPHORES #elif CH_CFG_USE_SEMAPHORES
chSemSignal(&spip->semaphore); chSemSignal(&spip->semaphore);
#endif #endif
} }

View File

@ -43,7 +43,7 @@
* mutexes can only be taken and released by the same thread. Another * mutexes can only be taken and released by the same thread. Another
* difference is that binary semaphores, unlike mutexes, do not * difference is that binary semaphores, unlike mutexes, do not
* implement the priority inheritance protocol.<br> * implement the priority inheritance protocol.<br>
* In order to use the binary semaphores APIs the @p CH_USE_SEMAPHORES * In order to use the binary semaphores APIs the @p CH_CFG_USE_SEMAPHORES
* option must be enabled in @p chconf.h. * option must be enabled in @p chconf.h.
* @{ * @{
*/ */
@ -51,7 +51,7 @@
#ifndef _CHBSEM_H_ #ifndef _CHBSEM_H_
#define _CHBSEM_H_ #define _CHBSEM_H_
#if CH_USE_SEMAPHORES || defined(__DOXYGEN__) #if CH_CFG_USE_SEMAPHORES || defined(__DOXYGEN__)
/*===========================================================================*/ /*===========================================================================*/
/* Module constants. */ /* Module constants. */
@ -305,7 +305,7 @@ static inline bool chBSemGetStateI(binary_semaphore_t *bsp) {
return bsp->bs_sem.s_cnt > 0 ? false : true; return bsp->bs_sem.s_cnt > 0 ? false : true;
} }
#endif /* CH_USE_SEMAPHORES */ #endif /* CH_CFG_USE_SEMAPHORES */
#endif /* _CHBSEM_H_ */ #endif /* _CHBSEM_H_ */

View File

@ -32,7 +32,7 @@
#ifndef _CHCOND_H_ #ifndef _CHCOND_H_
#define _CHCOND_H_ #define _CHCOND_H_
#if CH_USE_CONDVARS || defined(__DOXYGEN__) #if CH_CFG_USE_CONDVARS || defined(__DOXYGEN__)
/*===========================================================================*/ /*===========================================================================*/
/* Module constants. */ /* Module constants. */
@ -46,8 +46,8 @@
/* Derived constants and error checks. */ /* Derived constants and error checks. */
/*===========================================================================*/ /*===========================================================================*/
#if !CH_USE_MUTEXES #if !CH_CFG_USE_MUTEXES
#error "CH_USE_CONDVARS requires CH_USE_MUTEXES" #error "CH_CFG_USE_CONDVARS requires CH_CFG_USE_MUTEXES"
#endif #endif
/*===========================================================================*/ /*===========================================================================*/
@ -98,7 +98,7 @@ extern "C" {
void chCondBroadcastI(condition_variable_t *cp); void chCondBroadcastI(condition_variable_t *cp);
msg_t chCondWait(condition_variable_t *cp); msg_t chCondWait(condition_variable_t *cp);
msg_t chCondWaitS(condition_variable_t *cp); msg_t chCondWaitS(condition_variable_t *cp);
#if CH_USE_CONDVARS_TIMEOUT #if CH_CFG_USE_CONDVARS_TIMEOUT
msg_t chCondWaitTimeout(condition_variable_t *cp, systime_t time); msg_t chCondWaitTimeout(condition_variable_t *cp, systime_t time);
msg_t chCondWaitTimeoutS(condition_variable_t *cp, systime_t time); msg_t chCondWaitTimeoutS(condition_variable_t *cp, systime_t time);
#endif #endif
@ -110,7 +110,7 @@ extern "C" {
/* Module inline functions. */ /* Module inline functions. */
/*===========================================================================*/ /*===========================================================================*/
#endif /* CH_USE_CONDVARS */ #endif /* CH_CFG_USE_CONDVARS */
#endif /* _CHCOND_H_ */ #endif /* _CHCOND_H_ */

View File

@ -29,7 +29,7 @@
#ifndef _CHDYNAMIC_H_ #ifndef _CHDYNAMIC_H_
#define _CHDYNAMIC_H_ #define _CHDYNAMIC_H_
#if CH_USE_DYNAMIC || defined(__DOXYGEN__) #if CH_CFG_USE_DYNAMIC || defined(__DOXYGEN__)
/*===========================================================================*/ /*===========================================================================*/
/* Module constants. */ /* Module constants. */
@ -46,11 +46,11 @@
/* /*
* Module dependencies check. * Module dependencies check.
*/ */
#if CH_USE_DYNAMIC && !CH_USE_WAITEXIT #if CH_CFG_USE_DYNAMIC && !CH_CFG_USE_WAITEXIT
#error "CH_USE_DYNAMIC requires CH_USE_WAITEXIT" #error "CH_CFG_USE_DYNAMIC requires CH_CFG_USE_WAITEXIT"
#endif #endif
#if CH_USE_DYNAMIC && !CH_USE_HEAP && !CH_USE_MEMPOOLS #if CH_CFG_USE_DYNAMIC && !CH_CFG_USE_HEAP && !CH_CFG_USE_MEMPOOLS
#error "CH_USE_DYNAMIC requires CH_USE_HEAP and/or CH_USE_MEMPOOLS" #error "CH_CFG_USE_DYNAMIC requires CH_CFG_USE_HEAP and/or CH_CFG_USE_MEMPOOLS"
#endif #endif
/*===========================================================================*/ /*===========================================================================*/
@ -73,11 +73,11 @@ extern "C" {
#endif #endif
thread_t *chThdAddRef(thread_t *tp); thread_t *chThdAddRef(thread_t *tp);
void chThdRelease(thread_t *tp); void chThdRelease(thread_t *tp);
#if CH_USE_HEAP #if CH_CFG_USE_HEAP
thread_t *chThdCreateFromHeap(memory_heap_t *heapp, size_t size, thread_t *chThdCreateFromHeap(memory_heap_t *heapp, size_t size,
tprio_t prio, tfunc_t pf, void *arg); tprio_t prio, tfunc_t pf, void *arg);
#endif #endif
#if CH_USE_MEMPOOLS #if CH_CFG_USE_MEMPOOLS
thread_t *chThdCreateFromMemoryPool(memory_pool_t *mp, tprio_t prio, thread_t *chThdCreateFromMemoryPool(memory_pool_t *mp, tprio_t prio,
tfunc_t pf, void *arg); tfunc_t pf, void *arg);
#endif #endif
@ -89,7 +89,7 @@ extern "C" {
/* Module inline functions. */ /* Module inline functions. */
/*===========================================================================*/ /*===========================================================================*/
#endif /* CH_USE_DYNAMIC */ #endif /* CH_CFG_USE_DYNAMIC */
#endif /* _CHDYNAMIC_H_ */ #endif /* _CHDYNAMIC_H_ */

View File

@ -32,7 +32,7 @@
#ifndef _CHEVENTS_H_ #ifndef _CHEVENTS_H_
#define _CHEVENTS_H_ #define _CHEVENTS_H_
#if CH_USE_EVENTS || defined(__DOXYGEN__) #if CH_CFG_USE_EVENTS || defined(__DOXYGEN__)
/*===========================================================================*/ /*===========================================================================*/
/* Module constants. */ /* Module constants. */
@ -131,12 +131,12 @@ extern "C" {
void chEvtBroadcastFlags(event_source_t *esp, eventflags_t flags); void chEvtBroadcastFlags(event_source_t *esp, eventflags_t flags);
void chEvtBroadcastFlagsI(event_source_t *esp, eventflags_t flags); void chEvtBroadcastFlagsI(event_source_t *esp, eventflags_t flags);
void chEvtDispatch(const evhandler_t *handlers, eventmask_t mask); void chEvtDispatch(const evhandler_t *handlers, eventmask_t mask);
#if CH_OPTIMIZE_SPEED || !CH_USE_EVENTS_TIMEOUT #if CH_CFG_OPTIMIZE_SPEED || !CH_CFG_USE_EVENTS_TIMEOUT
eventmask_t chEvtWaitOne(eventmask_t mask); eventmask_t chEvtWaitOne(eventmask_t mask);
eventmask_t chEvtWaitAny(eventmask_t mask); eventmask_t chEvtWaitAny(eventmask_t mask);
eventmask_t chEvtWaitAll(eventmask_t mask); eventmask_t chEvtWaitAll(eventmask_t mask);
#endif #endif
#if CH_USE_EVENTS_TIMEOUT #if CH_CFG_USE_EVENTS_TIMEOUT
eventmask_t chEvtWaitOneTimeout(eventmask_t mask, systime_t time); eventmask_t chEvtWaitOneTimeout(eventmask_t mask, systime_t time);
eventmask_t chEvtWaitAnyTimeout(eventmask_t mask, systime_t time); eventmask_t chEvtWaitAnyTimeout(eventmask_t mask, systime_t time);
eventmask_t chEvtWaitAllTimeout(eventmask_t mask, systime_t time); eventmask_t chEvtWaitAllTimeout(eventmask_t mask, systime_t time);
@ -145,7 +145,7 @@ extern "C" {
} }
#endif #endif
#if !CH_OPTIMIZE_SPEED && CH_USE_EVENTS_TIMEOUT #if !CH_CFG_OPTIMIZE_SPEED && CH_CFG_USE_EVENTS_TIMEOUT
#define chEvtWaitOne(mask) chEvtWaitOneTimeout(mask, TIME_INFINITE) #define chEvtWaitOne(mask) chEvtWaitOneTimeout(mask, TIME_INFINITE)
#define chEvtWaitAny(mask) chEvtWaitAnyTimeout(mask, TIME_INFINITE) #define chEvtWaitAny(mask) chEvtWaitAnyTimeout(mask, TIME_INFINITE)
#define chEvtWaitAll(mask) chEvtWaitAllTimeout(mask, TIME_INFINITE) #define chEvtWaitAll(mask) chEvtWaitAllTimeout(mask, TIME_INFINITE)
@ -233,7 +233,7 @@ static inline void chEvtBroadcastI(event_source_t *esp) {
chEvtBroadcastFlagsI(esp, 0); chEvtBroadcastFlagsI(esp, 0);
} }
#endif /* CH_USE_EVENTS */ #endif /* CH_CFG_USE_EVENTS */
#endif /* _CHEVENTS_H_ */ #endif /* _CHEVENTS_H_ */

View File

@ -29,7 +29,7 @@
#ifndef _CHHEAP_H_ #ifndef _CHHEAP_H_
#define _CHHEAP_H_ #define _CHHEAP_H_
#if CH_USE_HEAP || defined(__DOXYGEN__) #if CH_CFG_USE_HEAP || defined(__DOXYGEN__)
/*===========================================================================*/ /*===========================================================================*/
/* Module constants. */ /* Module constants. */
@ -43,12 +43,12 @@
/* Derived constants and error checks. */ /* Derived constants and error checks. */
/*===========================================================================*/ /*===========================================================================*/
#if !CH_USE_MEMCORE #if !CH_CFG_USE_MEMCORE
#error "CH_USE_HEAP requires CH_USE_MEMCORE" #error "CH_CFG_USE_HEAP requires CH_CFG_USE_MEMCORE"
#endif #endif
#if !CH_USE_MUTEXES && !CH_USE_SEMAPHORES #if !CH_CFG_USE_MUTEXES && !CH_CFG_USE_SEMAPHORES
#error "CH_USE_HEAP requires CH_USE_MUTEXES and/or CH_USE_SEMAPHORES" #error "CH_CFG_USE_HEAP requires CH_CFG_USE_MUTEXES and/or CH_CFG_USE_SEMAPHORES"
#endif #endif
/*===========================================================================*/ /*===========================================================================*/
@ -81,7 +81,7 @@ struct memory_heap {
memgetfunc_t h_provider; /**< @brief Memory blocks provider for memgetfunc_t h_provider; /**< @brief Memory blocks provider for
this heap. */ this heap. */
union heap_header h_free; /**< @brief Free blocks list header. */ union heap_header h_free; /**< @brief Free blocks list header. */
#if CH_USE_MUTEXES #if CH_CFG_USE_MUTEXES
mutex_t h_mtx; /**< @brief Heap access mutex. */ mutex_t h_mtx; /**< @brief Heap access mutex. */
#else #else
semaphore_t h_sem; /**< @brief Heap access semaphore. */ semaphore_t h_sem; /**< @brief Heap access semaphore. */
@ -112,7 +112,7 @@ extern "C" {
/* Module inline functions. */ /* Module inline functions. */
/*===========================================================================*/ /*===========================================================================*/
#endif /* CH_USE_HEAP */ #endif /* CH_CFG_USE_HEAP */
#endif /* _CHHEAP_H_ */ #endif /* _CHHEAP_H_ */

View File

@ -138,7 +138,7 @@ static inline bool queue_notempty(threads_queue_t *tqp) {
/* If the performance code path has been chosen then all the following /* If the performance code path has been chosen then all the following
functions are inlined into the various kernel modules.*/ functions are inlined into the various kernel modules.*/
#if CH_OPTIMIZE_SPEED #if CH_CFG_OPTIMIZE_SPEED
static inline void list_insert(thread_t *tp, threads_list_t *tlp) { static inline void list_insert(thread_t *tp, threads_list_t *tlp) {
tp->p_next = tlp->p_next; tp->p_next = tlp->p_next;
@ -190,6 +190,6 @@ static inline thread_t *queue_dequeue(thread_t *tp) {
tp->p_next->p_prev = tp->p_prev; tp->p_next->p_prev = tp->p_prev;
return tp; return tp;
} }
#endif /* CH_OPTIMIZE_SPEED */ #endif /* CH_CFG_OPTIMIZE_SPEED */
#endif /* _CHLISTS_H_ */ #endif /* _CHLISTS_H_ */

View File

@ -29,7 +29,7 @@
#ifndef _CHMBOXES_H_ #ifndef _CHMBOXES_H_
#define _CHMBOXES_H_ #define _CHMBOXES_H_
#if CH_USE_MAILBOXES || defined(__DOXYGEN__) #if CH_CFG_USE_MAILBOXES || defined(__DOXYGEN__)
/*===========================================================================*/ /*===========================================================================*/
/* Module constants. */ /* Module constants. */
@ -43,8 +43,8 @@
/* Derived constants and error checks. */ /* Derived constants and error checks. */
/*===========================================================================*/ /*===========================================================================*/
#if !CH_USE_SEMAPHORES #if !CH_CFG_USE_SEMAPHORES
#error "CH_USE_MAILBOXES requires CH_USE_SEMAPHORES" #error "CH_CFG_USE_MAILBOXES requires CH_CFG_USE_SEMAPHORES"
#endif #endif
/*===========================================================================*/ /*===========================================================================*/
@ -193,7 +193,7 @@ static inline cnt_t chMBPeekI(mailbox_t *mbp) {
return *mbp->mb_rdptr; return *mbp->mb_rdptr;
} }
#endif /* CH_USE_MAILBOXES */ #endif /* CH_CFG_USE_MAILBOXES */
#endif /* _CHMBOXES_H_ */ #endif /* _CHMBOXES_H_ */

View File

@ -29,7 +29,7 @@
#ifndef _CHMEMCORE_H_ #ifndef _CHMEMCORE_H_
#define _CHMEMCORE_H_ #define _CHMEMCORE_H_
#if CH_USE_MEMCORE || defined(__DOXYGEN__) #if CH_CFG_USE_MEMCORE || defined(__DOXYGEN__)
/*===========================================================================*/ /*===========================================================================*/
/* Module constants. */ /* Module constants. */
@ -107,7 +107,7 @@ extern "C" {
/* Module inline functions. */ /* Module inline functions. */
/*===========================================================================*/ /*===========================================================================*/
#endif /* CH_USE_MEMCORE */ #endif /* CH_CFG_USE_MEMCORE */
#endif /* _CHMEMCORE_H_ */ #endif /* _CHMEMCORE_H_ */

View File

@ -29,7 +29,7 @@
#ifndef _CHMEMPOOLS_H_ #ifndef _CHMEMPOOLS_H_
#define _CHMEMPOOLS_H_ #define _CHMEMPOOLS_H_
#if CH_USE_MEMPOOLS || defined(__DOXYGEN__) #if CH_CFG_USE_MEMPOOLS || defined(__DOXYGEN__)
/*===========================================================================*/ /*===========================================================================*/
/* Module constants. */ /* Module constants. */
@ -39,8 +39,8 @@
/* Module pre-compile time settings. */ /* Module pre-compile time settings. */
/*===========================================================================*/ /*===========================================================================*/
#if !CH_USE_MEMCORE #if !CH_CFG_USE_MEMCORE
#error "CH_USE_MEMPOOLS requires CH_USE_MEMCORE" #error "CH_CFG_USE_MEMPOOLS requires CH_CFG_USE_MEMCORE"
#endif #endif
/*===========================================================================*/ /*===========================================================================*/
@ -162,7 +162,7 @@ static inline void chPoolAddI(memory_pool_t *mp, void *objp) {
chPoolFreeI(mp, objp); chPoolFreeI(mp, objp);
} }
#endif /* CH_USE_MEMPOOLS */ #endif /* CH_CFG_USE_MEMPOOLS */
#endif /* _CHMEMPOOLS_H_ */ #endif /* _CHMEMPOOLS_H_ */

View File

@ -29,7 +29,7 @@
#ifndef _CHMSG_H_ #ifndef _CHMSG_H_
#define _CHMSG_H_ #define _CHMSG_H_
#if CH_USE_MESSAGES || defined(__DOXYGEN__) #if CH_CFG_USE_MESSAGES || defined(__DOXYGEN__)
/*===========================================================================*/ /*===========================================================================*/
/* Module constants. */ /* Module constants. */
@ -113,7 +113,7 @@ static inline void chMsgReleaseS(thread_t *tp, msg_t msg) {
chSchWakeupS(tp, msg); chSchWakeupS(tp, msg);
} }
#endif /* CH_USE_MESSAGES */ #endif /* CH_CFG_USE_MESSAGES */
#endif /* _CHMSG_H_ */ #endif /* _CHMSG_H_ */

View File

@ -29,7 +29,7 @@
#ifndef _CHMTX_H_ #ifndef _CHMTX_H_
#define _CHMTX_H_ #define _CHMTX_H_
#if CH_USE_MUTEXES || defined(__DOXYGEN__) #if CH_CFG_USE_MUTEXES || defined(__DOXYGEN__)
/*===========================================================================*/ /*===========================================================================*/
/* Module constants. */ /* Module constants. */
@ -119,7 +119,7 @@ static inline bool chMtxQueueNotEmptyS(mutex_t *mp) {
return queue_notempty(&mp->m_queue); return queue_notempty(&mp->m_queue);
} }
#endif /* CH_USE_MUTEXES */ #endif /* CH_CFG_USE_MUTEXES */
#endif /* _CHMTX_H_ */ #endif /* _CHMTX_H_ */

View File

@ -29,7 +29,7 @@
#ifndef _CHQUEUES_H_ #ifndef _CHQUEUES_H_
#define _CHQUEUES_H_ #define _CHQUEUES_H_
#if CH_USE_QUEUES || defined(__DOXYGEN__) #if CH_CFG_USE_QUEUES || defined(__DOXYGEN__)
/** /**
* @name Queue functions returned status value * @name Queue functions returned status value
@ -362,7 +362,8 @@ extern "C" {
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif /* CH_USE_QUEUES */
#endif /* CH_CFG_USE_QUEUES */
#endif /* _CHQUEUES_H_ */ #endif /* _CHQUEUES_H_ */

View File

@ -29,7 +29,7 @@
#ifndef _CHREGISTRY_H_ #ifndef _CHREGISTRY_H_
#define _CHREGISTRY_H_ #define _CHREGISTRY_H_
#if CH_USE_REGISTRY || defined(__DOXYGEN__) #if CH_CFG_USE_REGISTRY || defined(__DOXYGEN__)
/*===========================================================================*/ /*===========================================================================*/
/* Module constants. */ /* Module constants. */
@ -121,7 +121,7 @@ extern "C" {
/** /**
* @brief Sets the current thread name. * @brief Sets the current thread name.
* @pre This function only stores the pointer to the name if the option * @pre This function only stores the pointer to the name if the option
* @p CH_USE_REGISTRY is enabled else no action is performed. * @p CH_CFG_USE_REGISTRY is enabled else no action is performed.
* *
* @param[in] p thread name as a zero terminated string * @param[in] p thread name as a zero terminated string
* *
@ -129,7 +129,7 @@ extern "C" {
*/ */
static inline void chRegSetThreadName(const char *name) { static inline void chRegSetThreadName(const char *name) {
#if CH_USE_REGISTRY #if CH_CFG_USE_REGISTRY
currp->p_name = name; currp->p_name = name;
#else #else
(void)name; (void)name;
@ -139,7 +139,7 @@ static inline void chRegSetThreadName(const char *name) {
/** /**
* @brief Returns the name of the specified thread. * @brief Returns the name of the specified thread.
* @pre This function only returns the pointer to the name if the option * @pre This function only returns the pointer to the name if the option
* @p CH_USE_REGISTRY is enabled else @p NULL is returned. * @p CH_CFG_USE_REGISTRY is enabled else @p NULL is returned.
* *
* @param[in] tp pointer to the thread * @param[in] tp pointer to the thread
* *
@ -152,7 +152,7 @@ static inline const char *chRegGetThreadNameI(thread_t *tp) {
chDbgCheckClassI(); chDbgCheckClassI();
#if CH_USE_REGISTRY #if CH_CFG_USE_REGISTRY
return tp->p_name; return tp->p_name;
#else #else
(void)tp; (void)tp;
@ -160,7 +160,7 @@ static inline const char *chRegGetThreadNameI(thread_t *tp) {
#endif #endif
} }
#endif /* CH_USE_REGISTRY */ #endif /* CH_CFG_USE_REGISTRY */
#endif /* _CHREGISTRY_H_ */ #endif /* _CHREGISTRY_H_ */

View File

@ -98,7 +98,7 @@ typedef struct {
initialized to zero. */ initialized to zero. */
struct context r_ctx; /**< @brief Not used, present because struct context r_ctx; /**< @brief Not used, present because
offsets. */ offsets. */
#if CH_USE_REGISTRY || defined(__DOXYGEN__) #if CH_CFG_USE_REGISTRY || defined(__DOXYGEN__)
thread_t *r_newer; /**< @brief Newer registry element. */ thread_t *r_newer; /**< @brief Newer registry element. */
thread_t *r_older; /**< @brief Older registry element. */ thread_t *r_older; /**< @brief Older registry element. */
#endif #endif
@ -222,7 +222,7 @@ static inline void chSchPreemption(void) {
tprio_t p1 = firstprio(&rlist.r_queue); tprio_t p1 = firstprio(&rlist.r_queue);
tprio_t p2 = currp->p_prio; tprio_t p2 = currp->p_prio;
#if CH_TIME_QUANTUM > 0 #if CH_CFG_TIME_QUANTUM > 0
if (currp->p_preempt) { if (currp->p_preempt) {
if (p1 > p2) if (p1 > p2)
chSchDoRescheduleAhead(); chSchDoRescheduleAhead();
@ -231,10 +231,10 @@ static inline void chSchPreemption(void) {
if (p1 >= p2) if (p1 >= p2)
chSchDoRescheduleBehind(); chSchDoRescheduleBehind();
} }
#else /* CH_TIME_QUANTUM == 0 */ #else /* CH_CFG_TIME_QUANTUM == 0 */
if (p1 >= p2) if (p1 >= p2)
chSchDoRescheduleAhead(); chSchDoRescheduleAhead();
#endif /* CH_TIME_QUANTUM == 0 */ #endif /* CH_CFG_TIME_QUANTUM == 0 */
} }
#endif /* _CHSCHD_H_ */ #endif /* _CHSCHD_H_ */

View File

@ -29,7 +29,7 @@
#ifndef _CHSEM_H_ #ifndef _CHSEM_H_
#define _CHSEM_H_ #define _CHSEM_H_
#if CH_USE_SEMAPHORES || defined(__DOXYGEN__) #if CH_CFG_USE_SEMAPHORES || defined(__DOXYGEN__)
/*===========================================================================*/ /*===========================================================================*/
/* Module constants. */ /* Module constants. */
@ -99,9 +99,7 @@ extern "C" {
void chSemSignal(semaphore_t *sp); void chSemSignal(semaphore_t *sp);
void chSemSignalI(semaphore_t *sp); void chSemSignalI(semaphore_t *sp);
void chSemAddCounterI(semaphore_t *sp, cnt_t n); void chSemAddCounterI(semaphore_t *sp, cnt_t n);
#if CH_USE_SEMSW
msg_t chSemSignalWait(semaphore_t *sps, semaphore_t *spw); msg_t chSemSignalWait(semaphore_t *sps, semaphore_t *spw);
#endif
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
@ -149,7 +147,7 @@ static inline cnt_t chSemGetCounterI(semaphore_t *sp) {
return sp->s_cnt; return sp->s_cnt;
} }
#endif /* CH_USE_SEMAPHORES */ #endif /* CH_CFG_USE_SEMAPHORES */
#endif /* _CHSEM_H_ */ #endif /* _CHSEM_H_ */

View File

@ -130,7 +130,7 @@ extern "C" {
static inline void chSysSwitch(thread_t *ntp, thread_t *otp) { static inline void chSysSwitch(thread_t *ntp, thread_t *otp) {
dbg_trace(otp); dbg_trace(otp);
THREAD_CONTEXT_SWITCH_HOOK(ntp, otp); CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp);
port_switch(ntp, otp); port_switch(ntp, otp);
} }

View File

@ -94,7 +94,7 @@
/* Forward declaration required by the mutexes stack structure present /* Forward declaration required by the mutexes stack structure present
in every thread.*/ in every thread.*/
#if CH_USE_MUTEXES #if CH_CFG_USE_MUTEXES
typedef struct mutex mutex_t; typedef struct mutex mutex_t;
#endif #endif
@ -131,12 +131,12 @@ typedef struct thread {
/* End of the fields shared with the threads_queue_t structure.*/ /* End of the fields shared with the threads_queue_t structure.*/
tprio_t p_prio; /**< @brief Thread priority. */ tprio_t p_prio; /**< @brief Thread priority. */
struct context p_ctx; /**< @brief Processor context. */ struct context p_ctx; /**< @brief Processor context. */
#if CH_USE_REGISTRY || defined(__DOXYGEN__) #if CH_CFG_USE_REGISTRY || defined(__DOXYGEN__)
thread_t *p_newer; /**< @brief Newer registry element. */ thread_t *p_newer; /**< @brief Newer registry element. */
thread_t *p_older; /**< @brief Older registry element. */ thread_t *p_older; /**< @brief Older registry element. */
#endif #endif
/* End of the fields shared with the ReadyList structure. */ /* End of the fields shared with the ReadyList structure. */
#if CH_USE_REGISTRY || defined(__DOXYGEN__) #if CH_CFG_USE_REGISTRY || defined(__DOXYGEN__)
/** /**
* @brief Thread name or @p NULL. * @brief Thread name or @p NULL.
*/ */
@ -156,7 +156,7 @@ typedef struct thread {
* @brief Various thread flags. * @brief Various thread flags.
*/ */
tmode_t p_flags; tmode_t p_flags;
#if CH_USE_DYNAMIC || defined(__DOXYGEN__) #if CH_CFG_USE_DYNAMIC || defined(__DOXYGEN__)
/** /**
* @brief References to this thread. * @brief References to this thread.
*/ */
@ -165,7 +165,7 @@ typedef struct thread {
/** /**
* @brief Number of ticks remaining to this thread. * @brief Number of ticks remaining to this thread.
*/ */
#if (CH_TIME_QUANTUM > 0) || defined(__DOXYGEN__) #if (CH_CFG_TIME_QUANTUM > 0) || defined(__DOXYGEN__)
tslices_t p_preempt; tslices_t p_preempt;
#endif #endif
#if CH_DBG_THREADS_PROFILING || defined(__DOXYGEN__) #if CH_DBG_THREADS_PROFILING || defined(__DOXYGEN__)
@ -202,7 +202,7 @@ typedef struct thread {
* states. * states.
*/ */
void *wtobjp; void *wtobjp;
#if CH_USE_EVENTS || defined(__DOXYGEN__) #if CH_CFG_USE_EVENTS || defined(__DOXYGEN__)
/** /**
* @brief Enabled events mask. * @brief Enabled events mask.
* @note This field is only valid while the thread is in the * @note This field is only valid while the thread is in the
@ -211,13 +211,13 @@ typedef struct thread {
eventmask_t ewmask; eventmask_t ewmask;
#endif #endif
} p_u; } p_u;
#if CH_USE_WAITEXIT || defined(__DOXYGEN__) #if CH_CFG_USE_WAITEXIT || defined(__DOXYGEN__)
/** /**
* @brief Termination waiting list. * @brief Termination waiting list.
*/ */
threads_list_t p_waiting; threads_list_t p_waiting;
#endif #endif
#if CH_USE_MESSAGES || defined(__DOXYGEN__) #if CH_CFG_USE_MESSAGES || defined(__DOXYGEN__)
/** /**
* @brief Messages queue. * @brief Messages queue.
*/ */
@ -227,13 +227,13 @@ typedef struct thread {
*/ */
msg_t p_msg; msg_t p_msg;
#endif #endif
#if CH_USE_EVENTS || defined(__DOXYGEN__) #if CH_CFG_USE_EVENTS || defined(__DOXYGEN__)
/** /**
* @brief Pending events mask. * @brief Pending events mask.
*/ */
eventmask_t p_epending; eventmask_t p_epending;
#endif #endif
#if CH_USE_MUTEXES || defined(__DOXYGEN__) #if CH_CFG_USE_MUTEXES || defined(__DOXYGEN__)
/** /**
* @brief List of the mutexes owned by this thread. * @brief List of the mutexes owned by this thread.
* @note The list is terminated by a @p NULL in this field. * @note The list is terminated by a @p NULL in this field.
@ -244,15 +244,15 @@ typedef struct thread {
*/ */
tprio_t p_realprio; tprio_t p_realprio;
#endif #endif
#if (CH_USE_DYNAMIC && CH_USE_MEMPOOLS) || defined(__DOXYGEN__) #if (CH_CFG_USE_DYNAMIC && CH_CFG_USE_MEMPOOLS) || defined(__DOXYGEN__)
/** /**
* @brief Memory Pool where the thread workspace is returned. * @brief Memory Pool where the thread workspace is returned.
*/ */
void *p_mpool; void *p_mpool;
#endif #endif
#if defined(THREAD_EXT_FIELDS) #if defined(CH_CFG_THREAD_EXTRA_FIELDS)
/* Extra fields defined in chconf.h.*/ /* Extra fields defined in chconf.h.*/
THREAD_EXT_FIELDS CH_CFG_THREAD_EXTRA_FIELDS
#endif #endif
} thread_t; } thread_t;
@ -405,7 +405,7 @@ extern "C" {
void chThdYield(void); void chThdYield(void);
void chThdExit(msg_t msg); void chThdExit(msg_t msg);
void chThdExitS(msg_t msg); void chThdExitS(msg_t msg);
#if CH_USE_WAITEXIT #if CH_CFG_USE_WAITEXIT
msg_t chThdWait(thread_t *tp); msg_t chThdWait(thread_t *tp);
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -104,7 +104,7 @@ struct virtual_timer {
* @api * @api
*/ */
#define S2ST(sec) \ #define S2ST(sec) \
((systime_t)((uint32_t)(sec) * (uint32_t)CH_FREQUENCY)) ((systime_t)((uint32_t)(sec) * (uint32_t)CH_CFG_FREQUENCY))
/** /**
* @brief Milliseconds to system ticks. * @brief Milliseconds to system ticks.
@ -117,7 +117,7 @@ struct virtual_timer {
* @api * @api
*/ */
#define MS2ST(msec) \ #define MS2ST(msec) \
((systime_t)(((((uint32_t)(msec)) * ((uint32_t)CH_FREQUENCY) - 1UL) / \ ((systime_t)(((((uint32_t)(msec)) * ((uint32_t)CH_CFG_FREQUENCY) - 1UL) / \
1000UL) + 1UL)) 1000UL) + 1UL))
/** /**
@ -131,7 +131,7 @@ struct virtual_timer {
* @api * @api
*/ */
#define US2ST(usec) \ #define US2ST(usec) \
((systime_t)(((((uint32_t)(usec)) * ((uint32_t)CH_FREQUENCY) - 1UL) / \ ((systime_t)(((((uint32_t)(usec)) * ((uint32_t)CH_CFG_FREQUENCY) - 1UL) / \
1000000UL) + 1UL)) 1000000UL) + 1UL))
/** @} */ /** @} */

View File

@ -33,14 +33,14 @@
* The condition variable is a synchronization object meant to be * The condition variable is a synchronization object meant to be
* used inside a zone protected by a mutex. Mutexes and condition * used inside a zone protected by a mutex. Mutexes and condition
* variables together can implement a Monitor construct. * variables together can implement a Monitor construct.
* @pre In order to use the condition variable APIs the @p CH_USE_CONDVARS * @pre In order to use the condition variable APIs the @p CH_CFG_USE_CONDVARS
* option must be enabled in @p chconf.h. * option must be enabled in @p chconf.h.
* @{ * @{
*/ */
#include "ch.h" #include "ch.h"
#if CH_USE_CONDVARS || defined(__DOXYGEN__) #if CH_CFG_USE_CONDVARS || defined(__DOXYGEN__)
/*===========================================================================*/ /*===========================================================================*/
/* Module local definitions. */ /* Module local definitions. */
@ -218,14 +218,14 @@ msg_t chCondWaitS(condition_variable_t *cp) {
return msg; return msg;
} }
#if CH_USE_CONDVARS_TIMEOUT || defined(__DOXYGEN__) #if CH_CFG_USE_CONDVARS_TIMEOUT || defined(__DOXYGEN__)
/** /**
* @brief Waits on the condition variable releasing the mutex lock. * @brief Waits on the condition variable releasing the mutex lock.
* @details Releases the currently owned mutex, waits on the condition * @details Releases the currently owned mutex, waits on the condition
* variable, and finally acquires the mutex again. All the sequence * variable, and finally acquires the mutex again. All the sequence
* is performed atomically. * is performed atomically.
* @pre The invoking thread <b>must</b> have at least one owned mutex. * @pre The invoking thread <b>must</b> have at least one owned mutex.
* @pre The configuration option @p CH_USE_CONDVARS_TIMEOUT must be enabled * @pre The configuration option @p CH_CFG_USE_CONDVARS_TIMEOUT must be enabled
* in order to use this function. * in order to use this function.
* @post Exiting the function because a timeout does not re-acquire the * @post Exiting the function because a timeout does not re-acquire the
* mutex, the mutex ownership is lost. * mutex, the mutex ownership is lost.
@ -262,7 +262,7 @@ msg_t chCondWaitTimeout(condition_variable_t *cp, systime_t time) {
* variable, and finally acquires the mutex again. All the sequence * variable, and finally acquires the mutex again. All the sequence
* is performed atomically. * is performed atomically.
* @pre The invoking thread <b>must</b> have at least one owned mutex. * @pre The invoking thread <b>must</b> have at least one owned mutex.
* @pre The configuration option @p CH_USE_CONDVARS_TIMEOUT must be enabled * @pre The configuration option @p CH_CFG_USE_CONDVARS_TIMEOUT must be enabled
* in order to use this function. * in order to use this function.
* @post Exiting the function because a timeout does not re-acquire the * @post Exiting the function because a timeout does not re-acquire the
* mutex, the mutex ownership is lost. * mutex, the mutex ownership is lost.
@ -302,8 +302,8 @@ msg_t chCondWaitTimeoutS(condition_variable_t *cp, systime_t time) {
chMtxLockS(mp); chMtxLockS(mp);
return msg; return msg;
} }
#endif /* CH_USE_CONDVARS_TIMEOUT */ #endif /* CH_CFG_USE_CONDVARS_TIMEOUT */
#endif /* CH_USE_CONDVARS */ #endif /* CH_CFG_USE_CONDVARS */
/** @} */ /** @} */

View File

@ -29,7 +29,7 @@
#include "ch.h" #include "ch.h"
#if CH_USE_DYNAMIC || defined(__DOXYGEN__) #if CH_CFG_USE_DYNAMIC || defined(__DOXYGEN__)
/*===========================================================================*/ /*===========================================================================*/
/* Module local definitions. */ /* Module local definitions. */
@ -57,7 +57,7 @@
/** /**
* @brief Adds a reference to a thread object. * @brief Adds a reference to a thread object.
* @pre The configuration option @p CH_USE_DYNAMIC must be enabled in order * @pre The configuration option @p CH_CFG_USE_DYNAMIC must be enabled in order
* to use this function. * to use this function.
* *
* @param[in] tp pointer to the thread * @param[in] tp pointer to the thread
@ -80,7 +80,7 @@ thread_t *chThdAddRef(thread_t *tp) {
* @details If the references counter reaches zero <b>and</b> the thread * @details If the references counter reaches zero <b>and</b> the thread
* is in the @p THD_STATE_FINAL state then the thread's memory is * is in the @p THD_STATE_FINAL state then the thread's memory is
* returned to the proper allocator. * returned to the proper allocator.
* @pre The configuration option @p CH_USE_DYNAMIC must be enabled in order * @pre The configuration option @p CH_CFG_USE_DYNAMIC must be enabled in order
* to use this function. * to use this function.
* @note Static threads are not affected. * @note Static threads are not affected.
* *
@ -101,17 +101,17 @@ void chThdRelease(thread_t *tp) {
allocator. Of course static threads are not affected.*/ allocator. Of course static threads are not affected.*/
if ((refs == 0) && (tp->p_state == THD_STATE_FINAL)) { if ((refs == 0) && (tp->p_state == THD_STATE_FINAL)) {
switch (tp->p_flags & THD_MEM_MODE_MASK) { switch (tp->p_flags & THD_MEM_MODE_MASK) {
#if CH_USE_HEAP #if CH_CFG_USE_HEAP
case THD_MEM_MODE_HEAP: case THD_MEM_MODE_HEAP:
#if CH_USE_REGISTRY #if CH_CFG_USE_REGISTRY
REG_REMOVE(tp); REG_REMOVE(tp);
#endif #endif
chHeapFree(tp); chHeapFree(tp);
break; break;
#endif #endif
#if CH_USE_MEMPOOLS #if CH_CFG_USE_MEMPOOLS
case THD_MEM_MODE_MEMPOOL: case THD_MEM_MODE_MEMPOOL:
#if CH_USE_REGISTRY #if CH_CFG_USE_REGISTRY
REG_REMOVE(tp); REG_REMOVE(tp);
#endif #endif
chPoolFree(tp->p_mpool, tp); chPoolFree(tp->p_mpool, tp);
@ -121,10 +121,10 @@ void chThdRelease(thread_t *tp) {
} }
} }
#if CH_USE_HEAP || defined(__DOXYGEN__) #if CH_CFG_USE_HEAP || defined(__DOXYGEN__)
/** /**
* @brief Creates a new thread allocating the memory from the heap. * @brief Creates a new thread allocating the memory from the heap.
* @pre The configuration options @p CH_USE_DYNAMIC and @p CH_USE_HEAP * @pre The configuration options @p CH_CFG_USE_DYNAMIC and @p CH_CFG_USE_HEAP
* must be enabled in order to use this function. * must be enabled in order to use this function.
* @note A thread can terminate by calling @p chThdExit() or by simply * @note A thread can terminate by calling @p chThdExit() or by simply
* returning from its main function. * returning from its main function.
@ -169,13 +169,13 @@ thread_t *chThdCreateFromHeap(memory_heap_t *heapp, size_t size,
chSysUnlock(); chSysUnlock();
return tp; return tp;
} }
#endif /* CH_USE_HEAP */ #endif /* CH_CFG_USE_HEAP */
#if CH_USE_MEMPOOLS || defined(__DOXYGEN__) #if CH_CFG_USE_MEMPOOLS || defined(__DOXYGEN__)
/** /**
* @brief Creates a new thread allocating the memory from the specified * @brief Creates a new thread allocating the memory from the specified
* memory pool. * memory pool.
* @pre The configuration options @p CH_USE_DYNAMIC and @p CH_USE_MEMPOOLS * @pre The configuration options @p CH_CFG_USE_DYNAMIC and @p CH_CFG_USE_MEMPOOLS
* must be enabled in order to use this function. * must be enabled in order to use this function.
* @note A thread can terminate by calling @p chThdExit() or by simply * @note A thread can terminate by calling @p chThdExit() or by simply
* returning from its main function. * returning from its main function.
@ -221,8 +221,8 @@ thread_t *chThdCreateFromMemoryPool(memory_pool_t *mp, tprio_t prio,
chSysUnlock(); chSysUnlock();
return tp; return tp;
} }
#endif /* CH_USE_MEMPOOLS */ #endif /* CH_CFG_USE_MEMPOOLS */
#endif /* CH_USE_DYNAMIC */ #endif /* CH_CFG_USE_DYNAMIC */
/** @} */ /** @} */

View File

@ -51,7 +51,7 @@
* An unlimited number of Event Sources can exists in a system and * An unlimited number of Event Sources can exists in a system and
* each thread can be listening on an unlimited number of * each thread can be listening on an unlimited number of
* them. * them.
* @pre In order to use the Events APIs the @p CH_USE_EVENTS option must be * @pre In order to use the Events APIs the @p CH_CFG_USE_EVENTS option must be
* enabled in @p chconf.h. * enabled in @p chconf.h.
* @post Enabling events requires 1-4 (depending on the architecture) * @post Enabling events requires 1-4 (depending on the architecture)
* extra bytes in the @p thread_t structure. * extra bytes in the @p thread_t structure.
@ -60,7 +60,7 @@
#include "ch.h" #include "ch.h"
#if CH_USE_EVENTS || defined(__DOXYGEN__) #if CH_CFG_USE_EVENTS || defined(__DOXYGEN__)
/*===========================================================================*/ /*===========================================================================*/
/* Module local definitions. */ /* Module local definitions. */
@ -350,7 +350,7 @@ void chEvtDispatch(const evhandler_t *handlers, eventmask_t mask) {
} }
} }
#if CH_OPTIMIZE_SPEED || !CH_USE_EVENTS_TIMEOUT || defined(__DOXYGEN__) #if CH_CFG_OPTIMIZE_SPEED || !CH_CFG_USE_EVENTS_TIMEOUT || defined(__DOXYGEN__)
/** /**
* @brief Waits for exactly one of the specified events. * @brief Waits for exactly one of the specified events.
* @details The function waits for one event among those specified in * @details The function waits for one event among those specified in
@ -438,9 +438,9 @@ eventmask_t chEvtWaitAll(eventmask_t mask) {
chSysUnlock(); chSysUnlock();
return mask; return mask;
} }
#endif /* CH_OPTIMIZE_SPEED || !CH_USE_EVENTS_TIMEOUT */ #endif /* CH_CFG_OPTIMIZE_SPEED || !CH_CFG_USE_EVENTS_TIMEOUT */
#if CH_USE_EVENTS_TIMEOUT || defined(__DOXYGEN__) #if CH_CFG_USE_EVENTS_TIMEOUT || defined(__DOXYGEN__)
/** /**
* @brief Waits for exactly one of the specified events. * @brief Waits for exactly one of the specified events.
* @details The function waits for one event among those specified in * @details The function waits for one event among those specified in
@ -568,8 +568,8 @@ eventmask_t chEvtWaitAllTimeout(eventmask_t mask, systime_t time) {
chSysUnlock(); chSysUnlock();
return mask; return mask;
} }
#endif /* CH_USE_EVENTS_TIMEOUT */ #endif /* CH_CFG_USE_EVENTS_TIMEOUT */
#endif /* CH_USE_EVENTS */ #endif /* CH_CFG_USE_EVENTS */
/** @} */ /** @} */

View File

@ -29,14 +29,14 @@
* are functionally equivalent to the usual @p malloc() and @p free() * are functionally equivalent to the usual @p malloc() and @p free()
* library functions. The main difference is that the OS heap APIs * library functions. The main difference is that the OS heap APIs
* are guaranteed to be thread safe.<br> * are guaranteed to be thread safe.<br>
* @pre In order to use the heap APIs the @p CH_USE_HEAP option must * @pre In order to use the heap APIs the @p CH_CFG_USE_HEAP option must
* be enabled in @p chconf.h. * be enabled in @p chconf.h.
* @{ * @{
*/ */
#include "ch.h" #include "ch.h"
#if CH_USE_HEAP || defined(__DOXYGEN__) #if CH_CFG_USE_HEAP || defined(__DOXYGEN__)
/*===========================================================================*/ /*===========================================================================*/
/* Module local definitions. */ /* Module local definitions. */
@ -45,7 +45,7 @@
/* /*
* Defaults on the best synchronization mechanism available. * Defaults on the best synchronization mechanism available.
*/ */
#if CH_USE_MUTEXES || defined(__DOXYGEN__) #if CH_CFG_USE_MUTEXES || defined(__DOXYGEN__)
#define H_LOCK(h) chMtxLock(&(h)->h_mtx) #define H_LOCK(h) chMtxLock(&(h)->h_mtx)
#define H_UNLOCK(h) chMtxUnlock() #define H_UNLOCK(h) chMtxUnlock()
#else #else
@ -87,7 +87,7 @@ void _heap_init(void) {
default_heap.h_provider = chCoreAlloc; default_heap.h_provider = chCoreAlloc;
default_heap.h_free.h.u.next = (union heap_header *)NULL; default_heap.h_free.h.u.next = (union heap_header *)NULL;
default_heap.h_free.h.size = 0; default_heap.h_free.h.size = 0;
#if CH_USE_MUTEXES || defined(__DOXYGEN__) #if CH_CFG_USE_MUTEXES || defined(__DOXYGEN__)
chMtxObjectInit(&default_heap.h_mtx); chMtxObjectInit(&default_heap.h_mtx);
#else #else
chSemObjectInit(&default_heap.h_sem, 1); chSemObjectInit(&default_heap.h_sem, 1);
@ -115,7 +115,7 @@ void chHeapObjectInit(memory_heap_t *heapp, void *buf, size_t size) {
heapp->h_free.h.size = 0; heapp->h_free.h.size = 0;
hp->h.u.next = NULL; hp->h.u.next = NULL;
hp->h.size = size - sizeof(union heap_header); hp->h.size = size - sizeof(union heap_header);
#if CH_USE_MUTEXES || defined(__DOXYGEN__) #if CH_CFG_USE_MUTEXES || defined(__DOXYGEN__)
chMtxObjectInit(&heapp->h_mtx); chMtxObjectInit(&heapp->h_mtx);
#else #else
chSemObjectInit(&heapp->h_sem, 1); chSemObjectInit(&heapp->h_sem, 1);
@ -273,6 +273,6 @@ size_t chHeapStatus(memory_heap_t *heapp, size_t *sizep) {
return n; return n;
} }
#endif /* CH_USE_HEAP */ #endif /* CH_CFG_USE_HEAP */
/** @} */ /** @} */

View File

@ -54,7 +54,7 @@
/* Module exported functions. */ /* Module exported functions. */
/*===========================================================================*/ /*===========================================================================*/
#if !CH_OPTIMIZE_SPEED || defined(__DOXYGEN__) #if !CH_CFG_OPTIMIZE_SPEED || defined(__DOXYGEN__)
/** /**
* @brief Inserts a thread into a priority ordered queue. * @brief Inserts a thread into a priority ordered queue.
* @note The insertion is done by scanning the list from the highest * @note The insertion is done by scanning the list from the highest
@ -175,6 +175,6 @@ thread_t *list_remove(threads_list_t *tlp) {
tlp->p_next = tp->p_next; tlp->p_next = tp->p_next;
return tp; return tp;
} }
#endif /* CH_OPTIMIZE_SPEED */ #endif /* CH_CFG_OPTIMIZE_SPEED */
/** @} */ /** @} */

View File

@ -45,14 +45,14 @@
* example) from the posting side and free it on the fetching side. * example) from the posting side and free it on the fetching side.
* Another approach is to set a "done" flag into the structure pointed * Another approach is to set a "done" flag into the structure pointed
* by the message. * by the message.
* @pre In order to use the mailboxes APIs the @p CH_USE_MAILBOXES option * @pre In order to use the mailboxes APIs the @p CH_CFG_USE_MAILBOXES option
* must be enabled in @p chconf.h. * must be enabled in @p chconf.h.
* @{ * @{
*/ */
#include "ch.h" #include "ch.h"
#if CH_USE_MAILBOXES || defined(__DOXYGEN__) #if CH_CFG_USE_MAILBOXES || defined(__DOXYGEN__)
/*===========================================================================*/ /*===========================================================================*/
/* Module exported variables. */ /* Module exported variables. */
@ -393,6 +393,6 @@ msg_t chMBFetchI(mailbox_t *mbp, msg_t *msgp) {
chSemSignalI(&mbp->mb_emptysem); chSemSignalI(&mbp->mb_emptysem);
return RDY_OK; return RDY_OK;
} }
#endif /* CH_USE_MAILBOXES */ #endif /* CH_CFG_USE_MAILBOXES */
/** @} */ /** @} */

View File

@ -39,14 +39,14 @@
* This allocator, alone, is also useful for very simple * This allocator, alone, is also useful for very simple
* applications that just require a simple way to get memory * applications that just require a simple way to get memory
* blocks. * blocks.
* @pre In order to use the core memory manager APIs the @p CH_USE_MEMCORE * @pre In order to use the core memory manager APIs the @p CH_CFG_USE_MEMCORE
* option must be enabled in @p chconf.h. * option must be enabled in @p chconf.h.
* @{ * @{
*/ */
#include "ch.h" #include "ch.h"
#if CH_USE_MEMCORE || defined(__DOXYGEN__) #if CH_CFG_USE_MEMCORE || defined(__DOXYGEN__)
/*===========================================================================*/ /*===========================================================================*/
/* Module exported variables. */ /* Module exported variables. */
@ -77,17 +77,17 @@ static uint8_t *endmem;
* @notapi * @notapi
*/ */
void _core_init(void) { void _core_init(void) {
#if CH_MEMCORE_SIZE == 0 #if CH_CFG_MEMCORE_SIZE == 0
extern uint8_t __heap_base__[]; extern uint8_t __heap_base__[];
extern uint8_t __heap_end__[]; extern uint8_t __heap_end__[];
nextmem = (uint8_t *)MEM_ALIGN_NEXT(__heap_base__); nextmem = (uint8_t *)MEM_ALIGN_NEXT(__heap_base__);
endmem = (uint8_t *)MEM_ALIGN_PREV(__heap_end__); endmem = (uint8_t *)MEM_ALIGN_PREV(__heap_end__);
#else #else
static stkalign_t buffer[MEM_ALIGN_NEXT(CH_MEMCORE_SIZE)/MEM_ALIGN_SIZE]; static stkalign_t buffer[MEM_ALIGN_NEXT(CH_CFG_MEMCORE_SIZE)/MEM_ALIGN_SIZE];
nextmem = (uint8_t *)&buffer[0]; nextmem = (uint8_t *)&buffer[0];
endmem = (uint8_t *)&buffer[MEM_ALIGN_NEXT(CH_MEMCORE_SIZE)/MEM_ALIGN_SIZE]; endmem = (uint8_t *)&buffer[MEM_ALIGN_NEXT(CH_CFG_MEMCORE_SIZE)/MEM_ALIGN_SIZE];
#endif #endif
} }
@ -148,6 +148,6 @@ size_t chCoreStatus(void) {
return (size_t)(endmem - nextmem); return (size_t)(endmem - nextmem);
} }
#endif /* CH_USE_MEMCORE */ #endif /* CH_CFG_USE_MEMCORE */
/** @} */ /** @} */

View File

@ -31,14 +31,14 @@
* Memory Pools do not enforce any alignment constraint on the * Memory Pools do not enforce any alignment constraint on the
* contained object however the objects must be properly aligned * contained object however the objects must be properly aligned
* to contain a pointer to void. * to contain a pointer to void.
* @pre In order to use the memory pools APIs the @p CH_USE_MEMPOOLS option * @pre In order to use the memory pools APIs the @p CH_CFG_USE_MEMPOOLS option
* must be enabled in @p chconf.h. * must be enabled in @p chconf.h.
* @{ * @{
*/ */
#include "ch.h" #include "ch.h"
#if CH_USE_MEMPOOLS || defined(__DOXYGEN__) #if CH_CFG_USE_MEMPOOLS || defined(__DOXYGEN__)
/*===========================================================================*/ /*===========================================================================*/
/* Module exported variables. */ /* Module exported variables. */
@ -189,6 +189,6 @@ void chPoolFree(memory_pool_t *mp, void *objp) {
chSysUnlock(); chSysUnlock();
} }
#endif /* CH_USE_MEMPOOLS */ #endif /* CH_CFG_USE_MEMPOOLS */
/** @} */ /** @} */

View File

@ -36,8 +36,8 @@
* architectures function pointers can be larger that @p msg_t.<br> * architectures function pointers can be larger that @p msg_t.<br>
* Messages are usually processed in FIFO order but it is possible to * Messages are usually processed in FIFO order but it is possible to
* process them in priority order by enabling the * process them in priority order by enabling the
* @p CH_USE_MESSAGES_PRIORITY option in @p chconf.h.<br> * @p CH_CFG_USE_MESSAGES_PRIORITY option in @p chconf.h.<br>
* @pre In order to use the message APIs the @p CH_USE_MESSAGES option * @pre In order to use the message APIs the @p CH_CFG_USE_MESSAGES option
* must be enabled in @p chconf.h. * must be enabled in @p chconf.h.
* @post Enabling messages requires 6-12 (depending on the architecture) * @post Enabling messages requires 6-12 (depending on the architecture)
* extra bytes in the @p thread_t structure. * extra bytes in the @p thread_t structure.
@ -46,7 +46,7 @@
#include "ch.h" #include "ch.h"
#if CH_USE_MESSAGES || defined(__DOXYGEN__) #if CH_CFG_USE_MESSAGES || defined(__DOXYGEN__)
/*===========================================================================*/ /*===========================================================================*/
/* Module exported variables. */ /* Module exported variables. */
@ -64,7 +64,7 @@
/* Module local functions. */ /* Module local functions. */
/*===========================================================================*/ /*===========================================================================*/
#if CH_USE_MESSAGES_PRIORITY #if CH_CFG_USE_MESSAGES_PRIORITY
#define msg_insert(tp, qp) prio_insert(tp, qp) #define msg_insert(tp, qp) prio_insert(tp, qp)
#else #else
#define msg_insert(tp, qp) queue_insert(tp, qp) #define msg_insert(tp, qp) queue_insert(tp, qp)
@ -147,6 +147,6 @@ void chMsgRelease(thread_t *tp, msg_t msg) {
chSysUnlock(); chSysUnlock();
} }
#endif /* CH_USE_MESSAGES */ #endif /* CH_CFG_USE_MESSAGES */
/** @} */ /** @} */

View File

@ -58,7 +58,7 @@
* The mechanism works with any number of nested mutexes and any * The mechanism works with any number of nested mutexes and any
* number of involved threads. The algorithm complexity (worst case) * number of involved threads. The algorithm complexity (worst case)
* is N with N equal to the number of nested mutexes. * is N with N equal to the number of nested mutexes.
* @pre In order to use the mutex APIs the @p CH_USE_MUTEXES option * @pre In order to use the mutex APIs the @p CH_CFG_USE_MUTEXES option
* must be enabled in @p chconf.h. * must be enabled in @p chconf.h.
* @post Enabling mutexes requires 5-12 (depending on the architecture) * @post Enabling mutexes requires 5-12 (depending on the architecture)
* extra bytes in the @p thread_t structure. * extra bytes in the @p thread_t structure.
@ -67,7 +67,7 @@
#include "ch.h" #include "ch.h"
#if CH_USE_MUTEXES || defined(__DOXYGEN__) #if CH_CFG_USE_MUTEXES || defined(__DOXYGEN__)
/*===========================================================================*/ /*===========================================================================*/
/* Module exported variables. */ /* Module exported variables. */
@ -158,16 +158,16 @@ void chMtxLockS(mutex_t *mp) {
(threads_queue_t *)tp->p_u.wtobjp); (threads_queue_t *)tp->p_u.wtobjp);
tp = ((mutex_t *)tp->p_u.wtobjp)->m_owner; tp = ((mutex_t *)tp->p_u.wtobjp)->m_owner;
continue; continue;
#if CH_USE_CONDVARS | \ #if CH_CFG_USE_CONDVARS | \
(CH_USE_SEMAPHORES && CH_USE_SEMAPHORES_PRIORITY) | \ (CH_CFG_USE_SEMAPHORES && CH_CFG_USE_SEMAPHORES_PRIORITY) | \
(CH_USE_MESSAGES && CH_USE_MESSAGES_PRIORITY) (CH_CFG_USE_MESSAGES && CH_CFG_USE_MESSAGES_PRIORITY)
#if CH_USE_CONDVARS #if CH_CFG_USE_CONDVARS
case THD_STATE_WTCOND: case THD_STATE_WTCOND:
#endif #endif
#if CH_USE_SEMAPHORES && CH_USE_SEMAPHORES_PRIORITY #if CH_CFG_USE_SEMAPHORES && CH_CFG_USE_SEMAPHORES_PRIORITY
case THD_STATE_WTSEM: case THD_STATE_WTSEM:
#endif #endif
#if CH_USE_MESSAGES && CH_USE_MESSAGES_PRIORITY #if CH_CFG_USE_MESSAGES && CH_CFG_USE_MESSAGES_PRIORITY
case THD_STATE_SNDMSGQ: case THD_STATE_SNDMSGQ:
#endif #endif
/* Re-enqueues tp with its new priority on the queue.*/ /* Re-enqueues tp with its new priority on the queue.*/
@ -423,6 +423,6 @@ void chMtxUnlockAll(void) {
chSysUnlock(); chSysUnlock();
} }
#endif /* CH_USE_MUTEXES */ #endif /* CH_CFG_USE_MUTEXES */
/** @} */ /** @} */

View File

@ -36,14 +36,14 @@
* are implemented by pairing an input queue and an output queue * are implemented by pairing an input queue and an output queue
* together. * together.
* . * .
* @pre In order to use the I/O queues the @p CH_USE_QUEUES option must * @pre In order to use the I/O queues the @p CH_CFG_USE_QUEUES option must
* be enabled in @p chconf.h. * be enabled in @p chconf.h.
* @{ * @{
*/ */
#include "ch.h" #include "ch.h"
#if CH_USE_QUEUES || defined(__DOXYGEN__) #if CH_CFG_USE_QUEUES || defined(__DOXYGEN__)
/** /**
* @brief Puts the invoking thread into the queue's threads queue. * @brief Puts the invoking thread into the queue's threads queue.
@ -426,6 +426,6 @@ size_t chOQWriteTimeout(OutputQueue *oqp, const uint8_t *bp,
chSysLock(); chSysLock();
} }
} }
#endif /* CH_USE_QUEUES */ #endif /* CH_CFG_USE_QUEUES */
/** @} */ /** @} */

View File

@ -42,13 +42,13 @@
* terminating threads can pulse an event source and an event handler * terminating threads can pulse an event source and an event handler
* can perform a scansion of the registry in order to recover the * can perform a scansion of the registry in order to recover the
* memory. * memory.
* @pre In order to use the threads registry the @p CH_USE_REGISTRY option * @pre In order to use the threads registry the @p CH_CFG_USE_REGISTRY option
* must be enabled in @p chconf.h. * must be enabled in @p chconf.h.
* @{ * @{
*/ */
#include "ch.h" #include "ch.h"
#if CH_USE_REGISTRY || defined(__DOXYGEN__) #if CH_CFG_USE_REGISTRY || defined(__DOXYGEN__)
/*===========================================================================*/ /*===========================================================================*/
/* Module exported variables. */ /* Module exported variables. */
@ -98,12 +98,12 @@ ROMCONST chdebug_t ch_debug = {
#endif #endif
(uint8_t)_offsetof(thread_t, p_state), (uint8_t)_offsetof(thread_t, p_state),
(uint8_t)_offsetof(thread_t, p_flags), (uint8_t)_offsetof(thread_t, p_flags),
#if CH_USE_DYNAMIC #if CH_CFG_USE_DYNAMIC
(uint8_t)_offsetof(thread_t, p_refs), (uint8_t)_offsetof(thread_t, p_refs),
#else #else
(uint8_t)0, (uint8_t)0,
#endif #endif
#if CH_TIME_QUANTUM > 0 #if CH_CFG_TIME_QUANTUM > 0
(uint8_t)_offsetof(thread_t, p_preempt), (uint8_t)_offsetof(thread_t, p_preempt),
#else #else
(uint8_t)0, (uint8_t)0,
@ -132,7 +132,7 @@ thread_t *chRegFirstThread(void) {
chSysLock(); chSysLock();
tp = rlist.r_newer; tp = rlist.r_newer;
#if CH_USE_DYNAMIC #if CH_CFG_USE_DYNAMIC
tp->p_refs++; tp->p_refs++;
#endif #endif
chSysUnlock(); chSysUnlock();
@ -157,7 +157,7 @@ thread_t *chRegNextThread(thread_t *tp) {
ntp = tp->p_newer; ntp = tp->p_newer;
if (ntp == (thread_t *)&rlist) if (ntp == (thread_t *)&rlist)
ntp = NULL; ntp = NULL;
#if CH_USE_DYNAMIC #if CH_CFG_USE_DYNAMIC
else { else {
chDbgAssert(ntp->p_refs < 255, "chRegNextThread(), #1", chDbgAssert(ntp->p_refs < 255, "chRegNextThread(), #1",
"too many references"); "too many references");
@ -165,12 +165,12 @@ thread_t *chRegNextThread(thread_t *tp) {
} }
#endif #endif
chSysUnlock(); chSysUnlock();
#if CH_USE_DYNAMIC #if CH_CFG_USE_DYNAMIC
chThdRelease(tp); chThdRelease(tp);
#endif #endif
return ntp; return ntp;
} }
#endif /* CH_USE_REGISTRY */ #endif /* CH_CFG_USE_REGISTRY */
/** @} */ /** @} */

View File

@ -67,7 +67,7 @@ void _scheduler_init(void) {
queue_init(&rlist.r_queue); queue_init(&rlist.r_queue);
rlist.r_prio = NOPRIO; rlist.r_prio = NOPRIO;
#if CH_USE_REGISTRY #if CH_CFG_USE_REGISTRY
rlist.r_newer = rlist.r_older = (thread_t *)&rlist; rlist.r_newer = rlist.r_older = (thread_t *)&rlist;
#endif #endif
} }
@ -126,10 +126,10 @@ void chSchGoSleepS(tstate_t newstate) {
chDbgCheckClassS(); chDbgCheckClassS();
(otp = currp)->p_state = newstate; (otp = currp)->p_state = newstate;
#if CH_TIME_QUANTUM > 0 #if CH_CFG_TIME_QUANTUM > 0
/* The thread is renouncing its remaining time slices so it will have a new /* The thread is renouncing its remaining time slices so it will have a new
time quantum when it will wakeup.*/ time quantum when it will wakeup.*/
otp->p_preempt = CH_TIME_QUANTUM; otp->p_preempt = CH_CFG_TIME_QUANTUM;
#endif #endif
setcurrp(queue_fifo_remove(&rlist.r_queue)); setcurrp(queue_fifo_remove(&rlist.r_queue));
currp->p_state = THD_STATE_CURRENT; currp->p_state = THD_STATE_CURRENT;
@ -149,17 +149,17 @@ static void wakeup(void *p) {
another thread with higher priority.*/ another thread with higher priority.*/
chSysUnlockFromIsr(); chSysUnlockFromIsr();
return; return;
#if CH_USE_SEMAPHORES || CH_USE_QUEUES || \ #if CH_CFG_USE_SEMAPHORES || CH_CFG_USE_QUEUES || \
(CH_USE_CONDVARS && CH_USE_CONDVARS_TIMEOUT) (CH_CFG_USE_CONDVARS && CH_CFG_USE_CONDVARS_TIMEOUT)
#if CH_USE_SEMAPHORES #if CH_CFG_USE_SEMAPHORES
case THD_STATE_WTSEM: case THD_STATE_WTSEM:
chSemFastSignalI((semaphore_t *)tp->p_u.wtobjp); chSemFastSignalI((semaphore_t *)tp->p_u.wtobjp);
/* Falls into, intentional. */ /* Falls into, intentional. */
#endif #endif
#if CH_USE_QUEUES #if CH_CFG_USE_QUEUES
case THD_STATE_WTQUEUE: case THD_STATE_WTQUEUE:
#endif #endif
#if CH_USE_CONDVARS && CH_USE_CONDVARS_TIMEOUT #if CH_CFG_USE_CONDVARS && CH_CFG_USE_CONDVARS_TIMEOUT
case THD_STATE_WTCOND: case THD_STATE_WTCOND:
#endif #endif
/* States requiring dequeuing.*/ /* States requiring dequeuing.*/
@ -276,7 +276,7 @@ void chSchRescheduleS(void) {
bool chSchIsPreemptionRequired(void) { bool chSchIsPreemptionRequired(void) {
tprio_t p1 = firstprio(&rlist.r_queue); tprio_t p1 = firstprio(&rlist.r_queue);
tprio_t p2 = currp->p_prio; tprio_t p2 = currp->p_prio;
#if CH_TIME_QUANTUM > 0 #if CH_CFG_TIME_QUANTUM > 0
/* If the running thread has not reached its time quantum, reschedule only /* If the running thread has not reached its time quantum, reschedule only
if the first thread on the ready queue has a higher priority. if the first thread on the ready queue has a higher priority.
Otherwise, if the running thread has used up its time quantum, reschedule Otherwise, if the running thread has used up its time quantum, reschedule
@ -306,8 +306,8 @@ void chSchDoRescheduleBehind(void) {
/* Picks the first thread from the ready queue and makes it current.*/ /* Picks the first thread from the ready queue and makes it current.*/
setcurrp(queue_fifo_remove(&rlist.r_queue)); setcurrp(queue_fifo_remove(&rlist.r_queue));
currp->p_state = THD_STATE_CURRENT; currp->p_state = THD_STATE_CURRENT;
#if CH_TIME_QUANTUM > 0 #if CH_CFG_TIME_QUANTUM > 0
otp->p_preempt = CH_TIME_QUANTUM; otp->p_preempt = CH_CFG_TIME_QUANTUM;
#endif #endif
chSchReadyI(otp); chSchReadyI(otp);
chSysSwitch(currp, otp); chSysSwitch(currp, otp);
@ -355,8 +355,8 @@ void chSchDoRescheduleAhead(void) {
*/ */
void chSchDoReschedule(void) { void chSchDoReschedule(void) {
#if CH_TIME_QUANTUM > 0 #if CH_CFG_TIME_QUANTUM > 0
/* If CH_TIME_QUANTUM is enabled then there are two different scenarios to /* If CH_CFG_TIME_QUANTUM is enabled then there are two different scenarios to
handle on preemption: time quantum elapsed or not.*/ handle on preemption: time quantum elapsed or not.*/
if (currp->p_preempt == 0) { if (currp->p_preempt == 0) {
/* The thread consumed its time quantum so it is enqueued behind threads /* The thread consumed its time quantum so it is enqueued behind threads
@ -368,11 +368,11 @@ void chSchDoReschedule(void) {
threads with equal priority and does not acquire a new time quantum.*/ threads with equal priority and does not acquire a new time quantum.*/
chSchDoRescheduleAhead(); chSchDoRescheduleAhead();
} }
#else /* !(CH_TIME_QUANTUM > 0) */ #else /* !(CH_CFG_TIME_QUANTUM > 0) */
/* If the round-robin mechanism is disabled then the thread goes always /* If the round-robin mechanism is disabled then the thread goes always
ahead of its peers.*/ ahead of its peers.*/
chSchDoRescheduleAhead(); chSchDoRescheduleAhead();
#endif /* !(CH_TIME_QUANTUM > 0) */ #endif /* !(CH_CFG_TIME_QUANTUM > 0) */
} }
/** @} */ /** @} */

View File

@ -51,15 +51,15 @@
* also have other uses, queues guards and counters for example.<br> * also have other uses, queues guards and counters for example.<br>
* Semaphores usually use a FIFO queuing strategy but it is possible * Semaphores usually use a FIFO queuing strategy but it is possible
* to make them order threads by priority by enabling * to make them order threads by priority by enabling
* @p CH_USE_SEMAPHORES_PRIORITY in @p chconf.h. * @p CH_CFG_USE_SEMAPHORES_PRIORITY in @p chconf.h.
* @pre In order to use the semaphore APIs the @p CH_USE_SEMAPHORES * @pre In order to use the semaphore APIs the @p CH_CFG_USE_SEMAPHORES
* option must be enabled in @p chconf.h. * option must be enabled in @p chconf.h.
* @{ * @{
*/ */
#include "ch.h" #include "ch.h"
#if CH_USE_SEMAPHORES || defined(__DOXYGEN__) #if CH_CFG_USE_SEMAPHORES || defined(__DOXYGEN__)
/*===========================================================================*/ /*===========================================================================*/
/* Module exported variables. */ /* Module exported variables. */
@ -77,7 +77,7 @@
/* Module local functions. */ /* Module local functions. */
/*===========================================================================*/ /*===========================================================================*/
#if CH_USE_SEMAPHORES_PRIORITY #if CH_CFG_USE_SEMAPHORES_PRIORITY
#define sem_insert(tp, qp) prio_insert(tp, qp) #define sem_insert(tp, qp) prio_insert(tp, qp)
#else #else
#define sem_insert(tp, qp) queue_insert(tp, qp) #define sem_insert(tp, qp) queue_insert(tp, qp)
@ -360,11 +360,8 @@ void chSemAddCounterI(semaphore_t *sp, cnt_t n) {
} }
} }
#if CH_USE_SEMSW
/** /**
* @brief Performs atomic signal and wait operations on two semaphores. * @brief Performs atomic signal and wait operations on two semaphores.
* @pre The configuration option @p CH_USE_SEMSW must be enabled in order
* to use this function.
* *
* @param[in] sps pointer to a @p semaphore_t structure to be signaled * @param[in] sps pointer to a @p semaphore_t structure to be signaled
* @param[in] spw pointer to a @p semaphore_t structure to wait on * @param[in] spw pointer to a @p semaphore_t structure to wait on
@ -406,8 +403,7 @@ msg_t chSemSignalWait(semaphore_t *sps, semaphore_t *spw) {
chSysUnlock(); chSysUnlock();
return msg; return msg;
} }
#endif /* CH_USE_SEMSW */
#endif /* CH_USE_SEMAPHORES */ #endif /* CH_CFG_USE_SEMAPHORES */
/** @} */ /** @} */

View File

@ -47,18 +47,18 @@
/* Module local variables. */ /* Module local variables. */
/*===========================================================================*/ /*===========================================================================*/
#if !CH_NO_IDLE_THREAD || defined(__DOXYGEN__) #if !CH_CFG_NO_IDLE_THREAD || defined(__DOXYGEN__)
/** /**
* @brief Idle thread working area. * @brief Idle thread working area.
*/ */
static WORKING_AREA(_idle_thread_wa, PORT_IDLE_THREAD_STACK_SIZE); static WORKING_AREA(_idle_thread_wa, PORT_IDLE_THREAD_STACK_SIZE);
#endif /* CH_NO_IDLE_THREAD */ #endif /* CH_CFG_NO_IDLE_THREAD */
/*===========================================================================*/ /*===========================================================================*/
/* Module local functions. */ /* Module local functions. */
/*===========================================================================*/ /*===========================================================================*/
#if !CH_NO_IDLE_THREAD || defined(__DOXYGEN__) #if !CH_CFG_NO_IDLE_THREAD || defined(__DOXYGEN__)
/** /**
* @brief This function implements the idle thread infinite loop. * @brief This function implements the idle thread infinite loop.
* @details The function puts the processor in the lowest power mode capable * @details The function puts the processor in the lowest power mode capable
@ -75,10 +75,10 @@ static void _idle_thread(void *p) {
chRegSetThreadName("idle"); chRegSetThreadName("idle");
while (true) { while (true) {
port_wait_for_interrupt(); port_wait_for_interrupt();
IDLE_LOOP_HOOK(); CH_CFG_IDLE_LOOP_HOOK();
} }
} }
#endif /* CH_NO_IDLE_THREAD */ #endif /* CH_CFG_NO_IDLE_THREAD */
/*===========================================================================*/ /*===========================================================================*/
/* Module exported functions. */ /* Module exported functions. */
@ -105,10 +105,10 @@ void chSysInit(void) {
port_init(); port_init();
_scheduler_init(); _scheduler_init();
_vt_init(); _vt_init();
#if CH_USE_MEMCORE #if CH_CFG_USE_MEMCORE
_core_init(); _core_init();
#endif #endif
#if CH_USE_HEAP #if CH_CFG_USE_HEAP
_heap_init(); _heap_init();
#endif #endif
#if CH_DBG_ENABLE_TRACE #if CH_DBG_ENABLE_TRACE
@ -129,7 +129,7 @@ void chSysInit(void) {
active, else the parameter is ignored.*/ active, else the parameter is ignored.*/
chRegSetThreadName((const char *)&ch_debug); chRegSetThreadName((const char *)&ch_debug);
#if !CH_NO_IDLE_THREAD #if !CH_CFG_NO_IDLE_THREAD
/* This thread has the lowest priority in the system, its role is just to /* This thread has the lowest priority in the system, its role is just to
serve interrupts in its context while keeping the lowest energy saving serve interrupts in its context while keeping the lowest energy saving
mode compatible with the system status.*/ mode compatible with the system status.*/
@ -152,8 +152,8 @@ void chSysHalt(void) {
chSysDisable(); chSysDisable();
#if defined(SYSTEM_HALT_HOOK) || defined(__DOXYGEN__) #if defined(CH_CFG_SYSTEM_HALT_HOOK) || defined(__DOXYGEN__)
SYSTEM_HALT_HOOK(); CH_CFG_SYSTEM_HALT_HOOK();
#endif #endif
/* Harmless infinite loop.*/ /* Harmless infinite loop.*/
@ -167,7 +167,7 @@ void chSysHalt(void) {
* and preempts it when the quantum is used up. Increments system * and preempts it when the quantum is used up. Increments system
* time and manages the timers. * time and manages the timers.
* @note The frequency of the timer determines the system tick granularity * @note The frequency of the timer determines the system tick granularity
* and, together with the @p CH_TIME_QUANTUM macro, the round robin * and, together with the @p CH_CFG_TIME_QUANTUM macro, the round robin
* interval. * interval.
* *
* @iclass * @iclass
@ -176,7 +176,7 @@ void chSysTimerHandlerI(void) {
chDbgCheckClassI(); chDbgCheckClassI();
#if CH_TIME_QUANTUM > 0 #if CH_CFG_TIME_QUANTUM > 0
/* Running thread has not used up quantum yet? */ /* Running thread has not used up quantum yet? */
if (currp->p_preempt > 0) if (currp->p_preempt > 0)
/* Decrement remaining quantum.*/ /* Decrement remaining quantum.*/
@ -186,8 +186,8 @@ void chSysTimerHandlerI(void) {
currp->p_time++; currp->p_time++;
#endif #endif
chVTDoTickI(); chVTDoTickI();
#if defined(SYSTEM_TICK_EVENT_HOOK) #if defined(CH_CFG_SYSTEM_TICK_HOOK)
SYSTEM_TICK_EVENT_HOOK(); CH_CFG_SYSTEM_TICK_HOOK();
#endif #endif
} }

View File

@ -49,7 +49,7 @@
* . * .
* The threads subsystem is implicitly included in kernel however * The threads subsystem is implicitly included in kernel however
* some of its part may be excluded by disabling them in @p chconf.h, * some of its part may be excluded by disabling them in @p chconf.h,
* see the @p CH_USE_WAITEXIT and @p CH_USE_DYNAMIC configuration * see the @p CH_CFG_USE_WAITEXIT and @p CH_CFG_USE_DYNAMIC configuration
* options. * options.
* @{ * @{
*/ */
@ -95,37 +95,37 @@ thread_t *_thread_init(thread_t *tp, tprio_t prio) {
tp->p_prio = prio; tp->p_prio = prio;
tp->p_state = THD_STATE_SUSPENDED; tp->p_state = THD_STATE_SUSPENDED;
tp->p_flags = THD_MEM_MODE_STATIC; tp->p_flags = THD_MEM_MODE_STATIC;
#if CH_TIME_QUANTUM > 0 #if CH_CFG_TIME_QUANTUM > 0
tp->p_preempt = CH_TIME_QUANTUM; tp->p_preempt = CH_CFG_TIME_QUANTUM;
#endif #endif
#if CH_USE_MUTEXES #if CH_CFG_USE_MUTEXES
tp->p_realprio = prio; tp->p_realprio = prio;
tp->p_mtxlist = NULL; tp->p_mtxlist = NULL;
#endif #endif
#if CH_USE_EVENTS #if CH_CFG_USE_EVENTS
tp->p_epending = 0; tp->p_epending = 0;
#endif #endif
#if CH_DBG_THREADS_PROFILING #if CH_DBG_THREADS_PROFILING
tp->p_time = 0; tp->p_time = 0;
#endif #endif
#if CH_USE_DYNAMIC #if CH_CFG_USE_DYNAMIC
tp->p_refs = 1; tp->p_refs = 1;
#endif #endif
#if CH_USE_REGISTRY #if CH_CFG_USE_REGISTRY
tp->p_name = NULL; tp->p_name = NULL;
REG_INSERT(tp); REG_INSERT(tp);
#endif #endif
#if CH_USE_WAITEXIT #if CH_CFG_USE_WAITEXIT
list_init(&tp->p_waiting); list_init(&tp->p_waiting);
#endif #endif
#if CH_USE_MESSAGES #if CH_CFG_USE_MESSAGES
queue_init(&tp->p_msgqueue); queue_init(&tp->p_msgqueue);
#endif #endif
#if CH_DBG_ENABLE_STACK_CHECK #if CH_DBG_ENABLE_STACK_CHECK
tp->p_stklimit = (stkalign_t *)(tp + 1); tp->p_stklimit = (stkalign_t *)(tp + 1);
#endif #endif
#if defined(THREAD_EXT_INIT_HOOK) #if defined(CH_CFG_THREAD_INIT_HOOK)
THREAD_EXT_INIT_HOOK(tp); CH_CFG_THREAD_INIT_HOOK(tp);
#endif #endif
return tp; return tp;
} }
@ -238,7 +238,7 @@ tprio_t chThdSetPriority(tprio_t newprio) {
chDbgCheck(newprio <= HIGHPRIO, "chThdSetPriority"); chDbgCheck(newprio <= HIGHPRIO, "chThdSetPriority");
chSysLock(); chSysLock();
#if CH_USE_MUTEXES #if CH_CFG_USE_MUTEXES
oldprio = currp->p_realprio; oldprio = currp->p_realprio;
if ((currp->p_prio == currp->p_realprio) || (newprio > currp->p_prio)) if ((currp->p_prio == currp->p_realprio) || (newprio > currp->p_prio))
currp->p_prio = newprio; currp->p_prio = newprio;
@ -385,14 +385,14 @@ void chThdExitS(msg_t msg) {
thread_t *tp = currp; thread_t *tp = currp;
tp->p_u.exitcode = msg; tp->p_u.exitcode = msg;
#if defined(THREAD_EXT_EXIT_HOOK) #if defined(CH_CFG_THREAD_EXIT_HOOK)
THREAD_EXT_EXIT_HOOK(tp); CH_CFG_THREAD_EXIT_HOOK(tp);
#endif #endif
#if CH_USE_WAITEXIT #if CH_CFG_USE_WAITEXIT
while (list_notempty(&tp->p_waiting)) while (list_notempty(&tp->p_waiting))
chSchReadyI(list_remove(&tp->p_waiting)); chSchReadyI(list_remove(&tp->p_waiting));
#endif #endif
#if CH_USE_REGISTRY #if CH_CFG_USE_REGISTRY
/* Static threads are immediately removed from the registry because /* Static threads are immediately removed from the registry because
there is no memory to recover.*/ there is no memory to recover.*/
if ((tp->p_flags & THD_MEM_MODE_MASK) == THD_MEM_MODE_STATIC) if ((tp->p_flags & THD_MEM_MODE_MASK) == THD_MEM_MODE_STATIC)
@ -403,7 +403,7 @@ void chThdExitS(msg_t msg) {
chDbgAssert(false, "chThdExitS(), #1", "zombies apocalypse"); chDbgAssert(false, "chThdExitS(), #1", "zombies apocalypse");
} }
#if CH_USE_WAITEXIT || defined(__DOXYGEN__) #if CH_CFG_USE_WAITEXIT || defined(__DOXYGEN__)
/** /**
* @brief Blocks the execution of the invoking thread until the specified * @brief Blocks the execution of the invoking thread until the specified
* thread terminates then the exit code is returned. * thread terminates then the exit code is returned.
@ -421,13 +421,13 @@ void chThdExitS(msg_t msg) {
* - If the thread was spawned by @p chThdCreateFromMemoryPool() * - If the thread was spawned by @p chThdCreateFromMemoryPool()
* then the working area is returned to the owning memory pool. * then the working area is returned to the owning memory pool.
* . * .
* @pre The configuration option @p CH_USE_WAITEXIT must be enabled in * @pre The configuration option @p CH_CFG_USE_WAITEXIT must be enabled in
* order to use this function. * order to use this function.
* @post Enabling @p chThdWait() requires 2-4 (depending on the * @post Enabling @p chThdWait() requires 2-4 (depending on the
* architecture) extra bytes in the @p thread_t structure. * architecture) extra bytes in the @p thread_t structure.
* @post After invoking @p chThdWait() the thread pointer becomes invalid * @post After invoking @p chThdWait() the thread pointer becomes invalid
* and must not be used as parameter for further system calls. * and must not be used as parameter for further system calls.
* @note If @p CH_USE_DYNAMIC is not specified this function just waits for * @note If @p CH_CFG_USE_DYNAMIC is not specified this function just waits for
* the thread termination, no memory allocators are involved. * the thread termination, no memory allocators are involved.
* *
* @param[in] tp pointer to the thread * @param[in] tp pointer to the thread
@ -442,7 +442,7 @@ msg_t chThdWait(thread_t *tp) {
chSysLock(); chSysLock();
chDbgAssert(tp != currp, "chThdWait(), #1", "waiting self"); chDbgAssert(tp != currp, "chThdWait(), #1", "waiting self");
#if CH_USE_DYNAMIC #if CH_CFG_USE_DYNAMIC
chDbgAssert(tp->p_refs > 0, "chThdWait(), #2", "not referenced"); chDbgAssert(tp->p_refs > 0, "chThdWait(), #2", "not referenced");
#endif #endif
if (tp->p_state != THD_STATE_FINAL) { if (tp->p_state != THD_STATE_FINAL) {
@ -451,11 +451,11 @@ msg_t chThdWait(thread_t *tp) {
} }
msg = tp->p_u.exitcode; msg = tp->p_u.exitcode;
chSysUnlock(); chSysUnlock();
#if CH_USE_DYNAMIC #if CH_CFG_USE_DYNAMIC
chThdRelease(tp); chThdRelease(tp);
#endif #endif
return msg; return msg;
} }
#endif /* CH_USE_WAITEXIT */ #endif /* CH_CFG_USE_WAITEXIT */
/** @} */ /** @} */

View File

@ -44,8 +44,8 @@
* @details Frequency of the system timer that drives the system ticks. This * @details Frequency of the system timer that drives the system ticks. This
* setting also defines the system tick time unit. * setting also defines the system tick time unit.
*/ */
#if !defined(CH_FREQUENCY) || defined(__DOXYGEN__) #if !defined(CH_CFG_FREQUENCY) || defined(__DOXYGEN__)
#define CH_FREQUENCY 1000 #define CH_CFG_FREQUENCY 1000
#endif #endif
/** /**
@ -55,12 +55,25 @@
* disables the preemption for threads with equal priority and the * disables the preemption for threads with equal priority and the
* round robin becomes cooperative. Note that higher priority * round robin becomes cooperative. Note that higher priority
* threads can still preempt, the kernel is always preemptive. * threads can still preempt, the kernel is always preemptive.
*
* @note Disabling the round robin preemption makes the kernel more compact * @note Disabling the round robin preemption makes the kernel more compact
* and generally faster. * and generally faster.
* @note The round robin preemption is not supported in tickless mode and
* must be set to zero in that case.
*/ */
#if !defined(CH_TIME_QUANTUM) || defined(__DOXYGEN__) #if !defined(CH_CFG_TIME_QUANTUM) || defined(__DOXYGEN__)
#define CH_TIME_QUANTUM 20 #define CH_CFG_TIME_QUANTUM 20
#endif
/**
* @brief Time delta constant for the tick-less mode.
* @note If this value is zero then the system uses the classic
* periodic tick. This value represents the minimum number
* of ticks that is safe to specify in a timeout directive.
* The value one is not valid, timeouts are rounded up to
* this value.
*/
#if !defined(CH_CFG_TIMEDELTA) || defined(__DOXYGEN__)
#define CH_CFG_TIMEDELTA 0
#endif #endif
/** /**
@ -72,10 +85,10 @@
* *
* @note In order to let the OS manage the whole RAM the linker script must * @note In order to let the OS manage the whole RAM the linker script must
* provide the @p __heap_base__ and @p __heap_end__ symbols. * provide the @p __heap_base__ and @p __heap_end__ symbols.
* @note Requires @p CH_USE_MEMCORE. * @note Requires @p CH_CFG_USE_MEMCORE.
*/ */
#if !defined(CH_MEMCORE_SIZE) || defined(__DOXYGEN__) #if !defined(CH_CFG_MEMCORE_SIZE) || defined(__DOXYGEN__)
#define CH_MEMCORE_SIZE 0 #define CH_CFG_MEMCORE_SIZE 0
#endif #endif
/** /**
@ -91,8 +104,8 @@
* @note Unless an idle thread is spawned the @p main() thread must not * @note Unless an idle thread is spawned the @p main() thread must not
* enter a sleep state. * enter a sleep state.
*/ */
#if !defined(CH_NO_IDLE_THREAD) || defined(__DOXYGEN__) #if !defined(CH_CFG_NO_IDLE_THREAD) || defined(__DOXYGEN__)
#define CH_NO_IDLE_THREAD FALSE #define CH_CFG_NO_IDLE_THREAD FALSE
#endif #endif
/** @} */ /** @} */
@ -112,8 +125,8 @@
* @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_OPTIMIZE_SPEED) || defined(__DOXYGEN__) #if !defined(CH_CFG_OPTIMIZE_SPEED) || defined(__DOXYGEN__)
#define CH_OPTIMIZE_SPEED TRUE #define CH_CFG_OPTIMIZE_SPEED TRUE
#endif #endif
/** @} */ /** @} */
@ -131,8 +144,8 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_USE_REGISTRY) || defined(__DOXYGEN__) #if !defined(CH_CFG_USE_REGISTRY) || defined(__DOXYGEN__)
#define CH_USE_REGISTRY TRUE #define CH_CFG_USE_REGISTRY TRUE
#endif #endif
/** /**
@ -142,8 +155,8 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_USE_WAITEXIT) || defined(__DOXYGEN__) #if !defined(CH_CFG_USE_WAITEXIT) || defined(__DOXYGEN__)
#define CH_USE_WAITEXIT TRUE #define CH_CFG_USE_WAITEXIT TRUE
#endif #endif
/** /**
@ -152,8 +165,8 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_USE_SEMAPHORES) || defined(__DOXYGEN__) #if !defined(CH_CFG_USE_SEMAPHORES) || defined(__DOXYGEN__)
#define CH_USE_SEMAPHORES TRUE #define CH_CFG_USE_SEMAPHORES TRUE
#endif #endif
/** /**
@ -161,23 +174,12 @@
* @details If enabled then the threads are enqueued on semaphores by * @details If enabled then the threads are enqueued on semaphores by
* priority rather than in FIFO order. * priority rather than in FIFO order.
* *
* @note The default is @p FALSE. Enable this if you have special requirements. * @note The default is @p FALSE. Enable this if you have special
* @note Requires @p CH_USE_SEMAPHORES. * requirements.
* @note Requires @p CH_CFG_USE_SEMAPHORES.
*/ */
#if !defined(CH_USE_SEMAPHORES_PRIORITY) || defined(__DOXYGEN__) #if !defined(CH_CFG_USE_SEMAPHORES_PRIORITY) || defined(__DOXYGEN__)
#define CH_USE_SEMAPHORES_PRIORITY FALSE #define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE
#endif
/**
* @brief Atomic semaphore API.
* @details If enabled then the semaphores the @p chSemSignalWait() API
* is included in the kernel.
*
* @note The default is @p TRUE.
* @note Requires @p CH_USE_SEMAPHORES.
*/
#if !defined(CH_USE_SEMSW) || defined(__DOXYGEN__)
#define CH_USE_SEMSW TRUE
#endif #endif
/** /**
@ -186,8 +188,8 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_USE_MUTEXES) || defined(__DOXYGEN__) #if !defined(CH_CFG_USE_MUTEXES) || defined(__DOXYGEN__)
#define CH_USE_MUTEXES TRUE #define CH_CFG_USE_MUTEXES TRUE
#endif #endif
/** /**
@ -196,10 +198,10 @@
* in the kernel. * in the kernel.
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_USE_MUTEXES. * @note Requires @p CH_CFG_USE_MUTEXES.
*/ */
#if !defined(CH_USE_CONDVARS) || defined(__DOXYGEN__) #if !defined(CH_CFG_USE_CONDVARS) || defined(__DOXYGEN__)
#define CH_USE_CONDVARS TRUE #define CH_CFG_USE_CONDVARS TRUE
#endif #endif
/** /**
@ -208,10 +210,10 @@
* specification are included in the kernel. * specification are included in the kernel.
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_USE_CONDVARS. * @note Requires @p CH_CFG_USE_CONDVARS.
*/ */
#if !defined(CH_USE_CONDVARS_TIMEOUT) || defined(__DOXYGEN__) #if !defined(CH_CFG_USE_CONDVARS_TIMEOUT) || defined(__DOXYGEN__)
#define CH_USE_CONDVARS_TIMEOUT TRUE #define CH_CFG_USE_CONDVARS_TIMEOUT TRUE
#endif #endif
/** /**
@ -220,8 +222,8 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_USE_EVENTS) || defined(__DOXYGEN__) #if !defined(CH_CFG_USE_EVENTS) || defined(__DOXYGEN__)
#define CH_USE_EVENTS TRUE #define CH_CFG_USE_EVENTS TRUE
#endif #endif
/** /**
@ -230,10 +232,10 @@
* are included in the kernel. * are included in the kernel.
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_USE_EVENTS. * @note Requires @p CH_CFG_USE_EVENTS.
*/ */
#if !defined(CH_USE_EVENTS_TIMEOUT) || defined(__DOXYGEN__) #if !defined(CH_CFG_USE_EVENTS_TIMEOUT) || defined(__DOXYGEN__)
#define CH_USE_EVENTS_TIMEOUT TRUE #define CH_CFG_USE_EVENTS_TIMEOUT TRUE
#endif #endif
/** /**
@ -243,8 +245,8 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_USE_MESSAGES) || defined(__DOXYGEN__) #if !defined(CH_CFG_USE_MESSAGES) || defined(__DOXYGEN__)
#define CH_USE_MESSAGES TRUE #define CH_CFG_USE_MESSAGES TRUE
#endif #endif
/** /**
@ -252,11 +254,12 @@
* @details If enabled then messages are served by priority rather than in * @details If enabled then messages are served by priority rather than in
* FIFO order. * FIFO order.
* *
* @note The default is @p FALSE. Enable this if you have special requirements. * @note The default is @p FALSE. Enable this if you have special
* @note Requires @p CH_USE_MESSAGES. * requirements.
* @note Requires @p CH_CFG_USE_MESSAGES.
*/ */
#if !defined(CH_USE_MESSAGES_PRIORITY) || defined(__DOXYGEN__) #if !defined(CH_CFG_USE_MESSAGES_PRIORITY) || defined(__DOXYGEN__)
#define CH_USE_MESSAGES_PRIORITY FALSE #define CH_CFG_USE_MESSAGES_PRIORITY FALSE
#endif #endif
/** /**
@ -265,10 +268,10 @@
* included in the kernel. * included in the kernel.
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_USE_SEMAPHORES. * @note Requires @p CH_CFG_USE_SEMAPHORES.
*/ */
#if !defined(CH_USE_MAILBOXES) || defined(__DOXYGEN__) #if !defined(CH_CFG_USE_MAILBOXES) || defined(__DOXYGEN__)
#define CH_USE_MAILBOXES TRUE #define CH_CFG_USE_MAILBOXES TRUE
#endif #endif
/** /**
@ -277,8 +280,8 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_USE_QUEUES) || defined(__DOXYGEN__) #if !defined(CH_CFG_USE_QUEUES) || defined(__DOXYGEN__)
#define CH_USE_QUEUES TRUE #define CH_CFG_USE_QUEUES TRUE
#endif #endif
/** /**
@ -288,8 +291,8 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_USE_MEMCORE) || defined(__DOXYGEN__) #if !defined(CH_CFG_USE_MEMCORE) || defined(__DOXYGEN__)
#define CH_USE_MEMCORE TRUE #define CH_CFG_USE_MEMCORE TRUE
#endif #endif
/** /**
@ -298,12 +301,12 @@
* in the kernel. * in the kernel.
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_USE_MEMCORE and either @p CH_USE_MUTEXES or * @note Requires @p CH_CFG_USE_MEMCORE and either @p CH_CFG_USE_MUTEXES or
* @p CH_USE_SEMAPHORES. * @p CH_CFG_USE_SEMAPHORES.
* @note Mutexes are recommended. * @note Mutexes are recommended.
*/ */
#if !defined(CH_USE_HEAP) || defined(__DOXYGEN__) #if !defined(CH_CFG_USE_HEAP) || defined(__DOXYGEN__)
#define CH_USE_HEAP TRUE #define CH_CFG_USE_HEAP TRUE
#endif #endif
/** /**
@ -313,8 +316,8 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_USE_MEMPOOLS) || defined(__DOXYGEN__) #if !defined(CH_CFG_USE_MEMPOOLS) || defined(__DOXYGEN__)
#define CH_USE_MEMPOOLS TRUE #define CH_CFG_USE_MEMPOOLS TRUE
#endif #endif
/** /**
@ -323,11 +326,11 @@
* in the kernel. * in the kernel.
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_USE_WAITEXIT. * @note Requires @p CH_CFG_USE_WAITEXIT.
* @note Requires @p CH_USE_HEAP and/or @p CH_USE_MEMPOOLS. * @note Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS.
*/ */
#if !defined(CH_USE_DYNAMIC) || defined(__DOXYGEN__) #if !defined(CH_CFG_USE_DYNAMIC) || defined(__DOXYGEN__)
#define CH_USE_DYNAMIC TRUE #define CH_CFG_USE_DYNAMIC TRUE
#endif #endif
/** @} */ /** @} */
@ -347,7 +350,7 @@
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_SYSTEM_STATE_CHECK) || defined(__DOXYGEN__) #if !defined(CH_DBG_SYSTEM_STATE_CHECK) || defined(__DOXYGEN__)
#define CH_DBG_SYSTEM_STATE_CHECK FALSE #define CH_DBG_SYSTEM_STATE_CHECK FALSE
#endif #endif
/** /**
@ -358,7 +361,7 @@
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_ENABLE_CHECKS) || defined(__DOXYGEN__) #if !defined(CH_DBG_ENABLE_CHECKS) || defined(__DOXYGEN__)
#define CH_DBG_ENABLE_CHECKS FALSE #define CH_DBG_ENABLE_CHECKS FALSE
#endif #endif
/** /**
@ -370,7 +373,7 @@
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_ENABLE_ASSERTS) || defined(__DOXYGEN__) #if !defined(CH_DBG_ENABLE_ASSERTS) || defined(__DOXYGEN__)
#define CH_DBG_ENABLE_ASSERTS FALSE #define CH_DBG_ENABLE_ASSERTS FALSE
#endif #endif
/** /**
@ -381,7 +384,7 @@
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_ENABLE_TRACE) || defined(__DOXYGEN__) #if !defined(CH_DBG_ENABLE_TRACE) || defined(__DOXYGEN__)
#define CH_DBG_ENABLE_TRACE FALSE #define CH_DBG_ENABLE_TRACE FALSE
#endif #endif
/** /**
@ -395,7 +398,7 @@
* @p panic_msg variable set to @p NULL. * @p panic_msg variable set to @p NULL.
*/ */
#if !defined(CH_DBG_ENABLE_STACK_CHECK) || defined(__DOXYGEN__) #if !defined(CH_DBG_ENABLE_STACK_CHECK) || defined(__DOXYGEN__)
#define CH_DBG_ENABLE_STACK_CHECK FALSE #define CH_DBG_ENABLE_STACK_CHECK FALSE
#endif #endif
/** /**
@ -407,7 +410,7 @@
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_FILL_THREADS) || defined(__DOXYGEN__) #if !defined(CH_DBG_FILL_THREADS) || defined(__DOXYGEN__)
#define CH_DBG_FILL_THREADS FALSE #define CH_DBG_FILL_THREADS FALSE
#endif #endif
/** /**
@ -420,7 +423,7 @@
* some test cases into the test suite. * some test cases into the test suite.
*/ */
#if !defined(CH_DBG_THREADS_PROFILING) || defined(__DOXYGEN__) #if !defined(CH_DBG_THREADS_PROFILING) || defined(__DOXYGEN__)
#define CH_DBG_THREADS_PROFILING TRUE #define CH_DBG_THREADS_PROFILING TRUE
#endif #endif
/** @} */ /** @} */
@ -436,8 +439,8 @@
* @brief Threads descriptor structure extension. * @brief Threads descriptor structure extension.
* @details User fields added to the end of the @p thread_t structure. * @details User fields added to the end of the @p thread_t structure.
*/ */
#if !defined(THREAD_EXT_FIELDS) || defined(__DOXYGEN__) #if !defined(CH_CFG_THREAD_EXTRA_FIELDS) || defined(__DOXYGEN__)
#define THREAD_EXT_FIELDS \ #define CH_CFG_THREAD_EXTRA_FIELDS \
/* Add threads custom fields here.*/ /* Add threads custom fields here.*/
#endif #endif
@ -448,8 +451,8 @@
* @note It is invoked from within @p chThdInit() and implicitly from all * @note It is invoked from within @p chThdInit() and implicitly from all
* the threads creation APIs. * the threads creation APIs.
*/ */
#if !defined(THREAD_EXT_INIT_HOOK) || defined(__DOXYGEN__) #if !defined(CH_CFG_THREAD_INIT_HOOK) || defined(__DOXYGEN__)
#define THREAD_EXT_INIT_HOOK(tp) { \ #define CH_CFG_THREAD_INIT_HOOK(tp) { \
/* Add threads initialization code here.*/ \ /* Add threads initialization code here.*/ \
} }
#endif #endif
@ -462,8 +465,8 @@
* @note It is also invoked when the threads simply return in order to * @note It is also invoked when the threads simply return in order to
* terminate. * terminate.
*/ */
#if !defined(THREAD_EXT_EXIT_HOOK) || defined(__DOXYGEN__) #if !defined(CH_CFG_THREAD_EXIT_HOOK) || defined(__DOXYGEN__)
#define THREAD_EXT_EXIT_HOOK(tp) { \ #define CH_CFG_THREAD_EXIT_HOOK(tp) { \
/* Add threads finalization code here.*/ \ /* Add threads finalization code here.*/ \
} }
#endif #endif
@ -472,8 +475,8 @@
* @brief Context switch hook. * @brief Context switch hook.
* @details This hook is invoked just before switching between threads. * @details This hook is invoked just before switching between threads.
*/ */
#if !defined(THREAD_CONTEXT_SWITCH_HOOK) || defined(__DOXYGEN__) #if !defined(CH_CFG_CONTEXT_SWITCH_HOOK) || defined(__DOXYGEN__)
#define THREAD_CONTEXT_SWITCH_HOOK(ntp, otp) { \ #define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) { \
/* System halt code here.*/ \ /* System halt code here.*/ \
} }
#endif #endif
@ -482,8 +485,8 @@
* @brief Idle Loop hook. * @brief Idle Loop hook.
* @details This hook is continuously invoked by the idle thread loop. * @details This hook is continuously invoked by the idle thread loop.
*/ */
#if !defined(IDLE_LOOP_HOOK) || defined(__DOXYGEN__) #if !defined(CH_CFG_IDLE_LOOP_HOOK) || defined(__DOXYGEN__)
#define IDLE_LOOP_HOOK() { \ #define CH_CFG_IDLE_LOOP_HOOK() { \
/* Idle loop code here.*/ \ /* Idle loop code here.*/ \
} }
#endif #endif
@ -493,8 +496,8 @@
* @details This hook is invoked in the system tick handler immediately * @details This hook is invoked in the system tick handler immediately
* after processing the virtual timers queue. * after processing the virtual timers queue.
*/ */
#if !defined(SYSTEM_TICK_EVENT_HOOK) || defined(__DOXYGEN__) #if !defined(CH_CFG_SYSTEM_TICK_HOOK) || defined(__DOXYGEN__)
#define SYSTEM_TICK_EVENT_HOOK() { \ #define CH_CFG_SYSTEM_TICK_HOOK() { \
/* System tick event code here.*/ \ /* System tick event code here.*/ \
} }
#endif #endif
@ -504,8 +507,8 @@
* @details This hook is invoked in case to a system halting error before * @details This hook is invoked in case to a system halting error before
* the system is halted. * the system is halted.
*/ */
#if !defined(SYSTEM_HALT_HOOK) || defined(__DOXYGEN__) #if !defined(CH_CFG_SYSTEM_HALT_HOOK) || defined(__DOXYGEN__)
#define SYSTEM_HALT_HOOK() { \ #define CH_CFG_SYSTEM_HALT_HOOK() { \
/* System halt code here.*/ \ /* System halt code here.*/ \
} }
#endif #endif

View File

@ -42,11 +42,6 @@
#include <stdint.h> #include <stdint.h>
#endif #endif
/**
* @brief Boolean, recommended the fastest signed.
*/
typedef int32_t bool_t;
/** /**
* @brief Thread mode flags, uint8_t is ok. * @brief Thread mode flags, uint8_t is ok.
*/ */
@ -97,39 +92,6 @@ typedef uint32_t systime_t;
*/ */
typedef int32_t cnt_t; typedef int32_t cnt_t;
/**
* @brief Inline function modifier.
*/
#define INLINE inline
/**
* @brief ROM constant modifier.
* @note This is required because some compilers require a custom keyword,
* usually this macro is just set to "const" for the GCC compiler.
* @note This macro is not used to place constants in different address
* spaces (like AVR requires for example) because it is assumed that
* a pointer to a ROMCONST constant is compatible with a pointer
* to a normal variable. It is just like the "const" keyword but
* requires that the constant is placed in ROM if the architecture
* supports it.
*/
#define ROMCONST const
/**
* @brief Packed structure modifier (within).
*/
#define PACK_STRUCT_STRUCT __attribute__((packed))
/**
* @brief Packed structure modifier (before).
*/
#define PACK_STRUCT_BEGIN
/**
* @brief Packed structure modifier (after).
*/
#define PACK_STRUCT_END
#endif /* _CHTYPES_H_ */ #endif /* _CHTYPES_H_ */
/** @} */ /** @} */

View File

@ -28,7 +28,7 @@
#include "ch.h" #include "ch.h"
#if CH_USE_XXX || defined(__DOXYGEN__) #if CH_CFG_USE_XXX || defined(__DOXYGEN__)
/*===========================================================================*/ /*===========================================================================*/
/* Module local definitions. */ /* Module local definitions. */
@ -76,6 +76,6 @@ void chXxxObjectInit(xxx_t *xxxp) {
} }
#endif /* CH_USE_XXX */ #endif /* CH_CFG_USE_XXX */
/** @} */ /** @} */

View File

@ -31,7 +31,7 @@
#include "ch.h" #include "ch.h"
#if CH_USE_XXX || defined(__DOXYGEN__) #if CH_CFG_USE_XXX || defined(__DOXYGEN__)
/*===========================================================================*/ /*===========================================================================*/
/* Module constants. */ /* Module constants. */
@ -70,7 +70,7 @@ extern "C" {
/* Module inline functions. */ /* Module inline functions. */
/*===========================================================================*/ /*===========================================================================*/
#endif /* CH_USE_XXX */ #endif /* CH_CFG_USE_XXX */
#endif /* _CHXXX_H_ */ #endif /* _CHXXX_H_ */

View File

@ -57,7 +57,7 @@
*/ */
static semaphore_t sem1; static semaphore_t sem1;
#if CH_USE_MUTEXES || defined(__DOXYGEN__) #if CH_CFG_USE_MUTEXES || defined(__DOXYGEN__)
static mutex_t mtx1; static mutex_t mtx1;
#endif #endif
@ -575,7 +575,7 @@ ROMCONST struct testcase testbmk11 = {
bmk11_execute bmk11_execute
}; };
#if CH_USE_MUTEXES || defined(__DOXYGEN__) #if CH_CFG_USE_MUTEXES || defined(__DOXYGEN__)
/** /**
* @page test_benchmarks_012 Mutexes lock/unlock performance * @page test_benchmarks_012 Mutexes lock/unlock performance
* *
@ -648,7 +648,7 @@ static void bmk13_execute(void) {
test_print("--- Semaph: "); test_print("--- Semaph: ");
test_printn(sizeof(semaphore_t)); test_printn(sizeof(semaphore_t));
test_println(" bytes"); test_println(" bytes");
#if CH_USE_EVENTS || defined(__DOXYGEN__) #if CH_CFG_USE_EVENTS || defined(__DOXYGEN__)
test_print("--- EventS: "); test_print("--- EventS: ");
test_printn(sizeof(event_source_t)); test_printn(sizeof(event_source_t));
test_println(" bytes"); test_println(" bytes");
@ -656,22 +656,22 @@ static void bmk13_execute(void) {
test_printn(sizeof(event_listener_t)); test_printn(sizeof(event_listener_t));
test_println(" bytes"); test_println(" bytes");
#endif #endif
#if CH_USE_MUTEXES || defined(__DOXYGEN__) #if CH_CFG_USE_MUTEXES || defined(__DOXYGEN__)
test_print("--- Mutex : "); test_print("--- Mutex : ");
test_printn(sizeof(mutex_t)); test_printn(sizeof(mutex_t));
test_println(" bytes"); test_println(" bytes");
#endif #endif
#if CH_USE_CONDVARS || defined(__DOXYGEN__) #if CH_CFG_USE_CONDVARS || defined(__DOXYGEN__)
test_print("--- CondV.: "); test_print("--- CondV.: ");
test_printn(sizeof(condition_variable_t)); test_printn(sizeof(condition_variable_t));
test_println(" bytes"); test_println(" bytes");
#endif #endif
#if CH_USE_QUEUES || defined(__DOXYGEN__) #if CH_CFG_USE_QUEUES || defined(__DOXYGEN__)
test_print("--- Queue : "); test_print("--- Queue : ");
test_printn(sizeof(GenericQueue)); test_printn(sizeof(GenericQueue));
test_println(" bytes"); test_println(" bytes");
#endif #endif
#if CH_USE_MAILBOXES || defined(__DOXYGEN__) #if CH_CFG_USE_MAILBOXES || defined(__DOXYGEN__)
test_print("--- MailB.: "); test_print("--- MailB.: ");
test_printn(sizeof(mailbox_t)); test_printn(sizeof(mailbox_t));
test_println(" bytes"); test_println(" bytes");
@ -701,7 +701,7 @@ ROMCONST struct testcase * ROMCONST patternbmk[] = {
&testbmk9, &testbmk9,
&testbmk10, &testbmk10,
&testbmk11, &testbmk11,
#if CH_USE_MUTEXES || defined(__DOXYGEN__) #if CH_CFG_USE_MUTEXES || defined(__DOXYGEN__)
&testbmk12, &testbmk12,
#endif #endif
&testbmk13, &testbmk13,

View File

@ -31,9 +31,9 @@
* *
* <h2>Preconditions</h2> * <h2>Preconditions</h2>
* The module requires the following kernel options: * The module requires the following kernel options:
* - @p CH_USE_DYNAMIC * - @p CH_CFG_USE_DYNAMIC
* - @p CH_USE_HEAP * - @p CH_CFG_USE_HEAP
* - @p CH_USE_MEMPOOLS * - @p CH_CFG_USE_MEMPOOLS
* . * .
* In case some of the required options are not enabled then some or all tests * In case some of the required options are not enabled then some or all tests
* may be skipped. * may be skipped.
@ -49,11 +49,11 @@
* @brief Dynamic thread APIs test header file * @brief Dynamic thread APIs test header file
*/ */
#if CH_USE_DYNAMIC || defined(__DOXYGEN__) #if CH_CFG_USE_DYNAMIC || defined(__DOXYGEN__)
#if (CH_USE_HEAP && !CH_USE_MALLOC_HEAP) || defined(__DOXYGEN__) #if (CH_CFG_USE_HEAP && !CH_CFG_USE_MALLOC_HEAP) || defined(__DOXYGEN__)
static memory_heap_t heap1; static memory_heap_t heap1;
#endif #endif
#if CH_USE_MEMPOOLS || defined(__DOXYGEN__) #if CH_CFG_USE_MEMPOOLS || defined(__DOXYGEN__)
static memory_pool_t mp1; static memory_pool_t mp1;
#endif #endif
@ -74,7 +74,7 @@ static msg_t thread(void *p) {
return 0; return 0;
} }
#if (CH_USE_HEAP && !CH_USE_MALLOC_HEAP) || defined(__DOXYGEN__) #if (CH_CFG_USE_HEAP && !CH_CFG_USE_MALLOC_HEAP) || defined(__DOXYGEN__)
static void dyn1_setup(void) { static void dyn1_setup(void) {
chHeapObjectInit(&heap1, test.buffer, sizeof(union test_buffers)); chHeapObjectInit(&heap1, test.buffer, sizeof(union test_buffers));
@ -120,9 +120,9 @@ ROMCONST struct testcase testdyn1 = {
NULL, NULL,
dyn1_execute dyn1_execute
}; };
#endif /* (CH_USE_HEAP && !CH_USE_MALLOC_HEAP) */ #endif /* (CH_CFG_USE_HEAP && !CH_CFG_USE_MALLOC_HEAP) */
#if CH_USE_MEMPOOLS || defined(__DOXYGEN__) #if CH_CFG_USE_MEMPOOLS || defined(__DOXYGEN__)
/** /**
* @page test_dynamic_002 Threads creation from Memory Pool * @page test_dynamic_002 Threads creation from Memory Pool
* *
@ -176,9 +176,9 @@ ROMCONST struct testcase testdyn2 = {
NULL, NULL,
dyn2_execute dyn2_execute
}; };
#endif /* CH_USE_MEMPOOLS */ #endif /* CH_CFG_USE_MEMPOOLS */
#if (CH_USE_HEAP && !CH_USE_MALLOC_HEAP && CH_USE_REGISTRY) || \ #if (CH_CFG_USE_HEAP && !CH_CFG_USE_MALLOC_HEAP && CH_CFG_USE_REGISTRY) || \
defined(__DOXYGEN__) defined(__DOXYGEN__)
/** /**
* @page test_dynamic_003 Registry and References test * @page test_dynamic_003 Registry and References test
@ -241,21 +241,21 @@ ROMCONST struct testcase testdyn3 = {
NULL, NULL,
dyn3_execute dyn3_execute
}; };
#endif /* CH_USE_HEAP && CH_USE_REGISTRY */ #endif /* CH_CFG_USE_HEAP && CH_CFG_USE_REGISTRY */
#endif /* CH_USE_DYNAMIC */ #endif /* CH_CFG_USE_DYNAMIC */
/** /**
* @brief Test sequence for dynamic APIs. * @brief Test sequence for dynamic APIs.
*/ */
ROMCONST struct testcase * ROMCONST patterndyn[] = { ROMCONST struct testcase * ROMCONST patterndyn[] = {
#if CH_USE_DYNAMIC || defined(__DOXYGEN__) #if CH_CFG_USE_DYNAMIC || defined(__DOXYGEN__)
#if (CH_USE_HEAP && !CH_USE_MALLOC_HEAP) || defined(__DOXYGEN__) #if (CH_CFG_USE_HEAP && !CH_CFG_USE_MALLOC_HEAP) || defined(__DOXYGEN__)
&testdyn1, &testdyn1,
#endif #endif
#if CH_USE_MEMPOOLS || defined(__DOXYGEN__) #if CH_CFG_USE_MEMPOOLS || defined(__DOXYGEN__)
&testdyn2, &testdyn2,
#endif #endif
#if (CH_USE_HEAP && !CH_USE_MALLOC_HEAP && CH_USE_REGISTRY) || \ #if (CH_CFG_USE_HEAP && !CH_CFG_USE_MALLOC_HEAP && CH_CFG_USE_REGISTRY) || \
defined(__DOXYGEN__) defined(__DOXYGEN__)
&testdyn3, &testdyn3,
#endif #endif

View File

@ -30,8 +30,8 @@
* *
* <h2>Preconditions</h2> * <h2>Preconditions</h2>
* The module requires the following kernel options: * The module requires the following kernel options:
* - @p CH_USE_EVENTS * - @p CH_CFG_USE_EVENTS
* - @p CH_USE_EVENTS_TIMEOUT * - @p CH_CFG_USE_EVENTS_TIMEOUT
* . * .
* In case some of the required options are not enabled then some or all tests * In case some of the required options are not enabled then some or all tests
* may be skipped. * may be skipped.
@ -47,7 +47,7 @@
* @brief Events test header file * @brief Events test header file
*/ */
#if CH_USE_EVENTS || defined(__DOXYGEN__) #if CH_CFG_USE_EVENTS || defined(__DOXYGEN__)
#define ALLOWED_DELAY MS2ST(5) #define ALLOWED_DELAY MS2ST(5)
@ -228,7 +228,7 @@ ROMCONST struct testcase testevt2 = {
evt2_execute evt2_execute
}; };
#if CH_USE_EVENTS_TIMEOUT || defined(__DOXYGEN__) #if CH_CFG_USE_EVENTS_TIMEOUT || defined(__DOXYGEN__)
/** /**
* @page test_events_003 Events timeout * @page test_events_003 Events timeout
* *
@ -275,20 +275,20 @@ ROMCONST struct testcase testevt3 = {
NULL, NULL,
evt3_execute evt3_execute
}; };
#endif /* CH_USE_EVENTS_TIMEOUT */ #endif /* CH_CFG_USE_EVENTS_TIMEOUT */
/** /**
* @brief Test sequence for events. * @brief Test sequence for events.
*/ */
ROMCONST struct testcase * ROMCONST patternevt[] = { ROMCONST struct testcase * ROMCONST patternevt[] = {
#if CH_USE_EVENTS || defined(__DOXYGEN__) #if CH_CFG_USE_EVENTS || defined(__DOXYGEN__)
&testevt1, &testevt1,
&testevt2, &testevt2,
#if CH_USE_EVENTS_TIMEOUT || defined(__DOXYGEN__) #if CH_CFG_USE_EVENTS_TIMEOUT || defined(__DOXYGEN__)
&testevt3, &testevt3,
#endif #endif
#endif #endif
NULL NULL
}; };
#endif /* CH_USE_EVENTS */ #endif /* CH_CFG_USE_EVENTS */

View File

@ -30,7 +30,7 @@
* *
* <h2>Preconditions</h2> * <h2>Preconditions</h2>
* The module requires the following kernel options: * The module requires the following kernel options:
* - @p CH_USE_HEAP * - @p CH_CFG_USE_HEAP
* . * .
* In case some of the required options are not enabled then some or all tests * In case some of the required options are not enabled then some or all tests
* may be skipped. * may be skipped.
@ -44,7 +44,7 @@
* @brief Heap header file * @brief Heap header file
*/ */
#if (CH_USE_HEAP && !CH_USE_MALLOC_HEAP) || defined(__DOXYGEN__) #if (CH_CFG_USE_HEAP && !CH_CFG_USE_MALLOC_HEAP) || defined(__DOXYGEN__)
#define SIZE 16 #define SIZE 16
@ -146,13 +146,13 @@ ROMCONST struct testcase testheap1 = {
heap1_execute heap1_execute
}; };
#endif /* CH_USE_HEAP.*/ #endif /* CH_CFG_USE_HEAP.*/
/** /**
* @brief Test sequence for heap. * @brief Test sequence for heap.
*/ */
ROMCONST struct testcase * ROMCONST patternheap[] = { ROMCONST struct testcase * ROMCONST patternheap[] = {
#if (CH_USE_HEAP && !CH_USE_MALLOC_HEAP) || defined(__DOXYGEN__) #if (CH_CFG_USE_HEAP && !CH_CFG_USE_MALLOC_HEAP) || defined(__DOXYGEN__)
&testheap1, &testheap1,
#endif #endif
NULL NULL

View File

@ -33,7 +33,7 @@
* *
* <h2>Preconditions</h2> * <h2>Preconditions</h2>
* The module requires the following kernel options: * The module requires the following kernel options:
* - @p CH_USE_MAILBOXES * - @p CH_CFG_USE_MAILBOXES
* . * .
* In case some of the required options are not enabled then some or all tests * In case some of the required options are not enabled then some or all tests
* may be skipped. * may be skipped.
@ -47,7 +47,7 @@
* @brief Mailboxes header file * @brief Mailboxes header file
*/ */
#if CH_USE_MAILBOXES || defined(__DOXYGEN__) #if CH_CFG_USE_MAILBOXES || defined(__DOXYGEN__)
#define ALLOWED_DELAY MS2ST(5) #define ALLOWED_DELAY MS2ST(5)
#define MB_SIZE 5 #define MB_SIZE 5
@ -226,13 +226,13 @@ ROMCONST struct testcase testmbox1 = {
mbox1_execute mbox1_execute
}; };
#endif /* CH_USE_MAILBOXES */ #endif /* CH_CFG_USE_MAILBOXES */
/** /**
* @brief Test sequence for mailboxes. * @brief Test sequence for mailboxes.
*/ */
ROMCONST struct testcase * ROMCONST patternmbox[] = { ROMCONST struct testcase * ROMCONST patternmbox[] = {
#if CH_USE_MAILBOXES || defined(__DOXYGEN__) #if CH_CFG_USE_MAILBOXES || defined(__DOXYGEN__)
&testmbox1, &testmbox1,
#endif #endif
NULL NULL

Some files were not shown because too many files have changed in this diff Show More