qmk_firmware

QMK firmware for my keyboards (Corne, Sweep Ferris) and trackball (Ploopy Adept)
Log | Files | Refs | Submodules | LICENSE

chconf.h (24538B)


      1 /*
      2     ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
      3 
      4     Licensed under the Apache License, Version 2.0 (the "License");
      5     you may not use this file except in compliance with the License.
      6     You may obtain a copy of the License at
      7 
      8         http://www.apache.org/licenses/LICENSE-2.0
      9 
     10     Unless required by applicable law or agreed to in writing, software
     11     distributed under the License is distributed on an "AS IS" BASIS,
     12     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13     See the License for the specific language governing permissions and
     14     limitations under the License.
     15 */
     16 
     17 /**
     18  * @file    rt/templates/chconf.h
     19  * @brief   Configuration file template.
     20  * @details A copy of this file must be placed in each project directory, it
     21  *          contains the application specific kernel settings.
     22  *
     23  * @addtogroup config
     24  * @details Kernel related settings and hooks.
     25  * @{
     26  */
     27 
     28 #ifndef CHCONF_H
     29 #define CHCONF_H
     30 
     31 #define _CHIBIOS_RT_CONF_
     32 #define _CHIBIOS_RT_CONF_VER_7_0_
     33 
     34 /*===========================================================================*/
     35 /**
     36  * @name System settings
     37  * @{
     38  */
     39 /*===========================================================================*/
     40 
     41 /**
     42  * @brief   Handling of instances.
     43  * @note    If enabled then threads assigned to various instances can
     44  *          interact each other using the same synchronization objects.
     45  *          If disabled then each OS instance is a separate world, no
     46  *          direct interactions are handled by the OS.
     47  */
     48 #if !defined(CH_CFG_SMP_MODE)
     49 #define CH_CFG_SMP_MODE                     FALSE
     50 #endif
     51 
     52 /**
     53  * @brief   Kernel hardening level.
     54  * @details This option is the level of functional-safety checks enabled
     55  *          in the kerkel. The meaning is:
     56  *          - 0: No checks, maximum performance.
     57  *          - 1: Reasonable checks.
     58  *          - 2: All checks.
     59  *          .
     60  */
     61 #if !defined(CH_CFG_HARDENING_LEVEL)
     62 #define CH_CFG_HARDENING_LEVEL              0
     63 #endif
     64 
     65 /** @} */
     66 
     67 /*===========================================================================*/
     68 /**
     69  * @name System timers settings
     70  * @{
     71  */
     72 /*===========================================================================*/
     73 
     74 /**
     75  * @brief   System time counter resolution.
     76  * @note    Allowed values are 16, 32 or 64 bits.
     77  */
     78 #if !defined(CH_CFG_ST_RESOLUTION)
     79 #define CH_CFG_ST_RESOLUTION                32
     80 #endif
     81 
     82 /**
     83  * @brief   System tick frequency.
     84  * @details Frequency of the system timer that drives the system ticks. This
     85  *          setting also defines the system tick time unit.
     86  */
     87 #if !defined(CH_CFG_ST_FREQUENCY)
     88 #define CH_CFG_ST_FREQUENCY                 100000
     89 #endif
     90 
     91 /**
     92  * @brief   Time intervals data size.
     93  * @note    Allowed values are 16, 32 or 64 bits.
     94  */
     95 #if !defined(CH_CFG_INTERVALS_SIZE)
     96 #define CH_CFG_INTERVALS_SIZE               32
     97 #endif
     98 
     99 /**
    100  * @brief   Time types data size.
    101  * @note    Allowed values are 16 or 32 bits.
    102  */
    103 #if !defined(CH_CFG_TIME_TYPES_SIZE)
    104 #define CH_CFG_TIME_TYPES_SIZE              32
    105 #endif
    106 
    107 /**
    108  * @brief   Time delta constant for the tick-less mode.
    109  * @note    If this value is zero then the system uses the classic
    110  *          periodic tick. This value represents the minimum number
    111  *          of ticks that is safe to specify in a timeout directive.
    112  *          The value one is not valid, timeouts are rounded up to
    113  *          this value.
    114  */
    115 #if !defined(CH_CFG_ST_TIMEDELTA)
    116 #define CH_CFG_ST_TIMEDELTA                 2
    117 #endif
    118 
    119 /** @} */
    120 
    121 /*===========================================================================*/
    122 /**
    123  * @name Kernel parameters and options
    124  * @{
    125  */
    126 /*===========================================================================*/
    127 
    128 /**
    129  * @brief   Round robin interval.
    130  * @details This constant is the number of system ticks allowed for the
    131  *          threads before preemption occurs. Setting this value to zero
    132  *          disables the preemption for threads with equal priority and the
    133  *          round robin becomes cooperative. Note that higher priority
    134  *          threads can still preempt, the kernel is always preemptive.
    135  * @note    Disabling the round robin preemption makes the kernel more compact
    136  *          and generally faster.
    137  * @note    The round robin preemption is not supported in tickless mode and
    138  *          must be set to zero in that case.
    139  */
    140 #if !defined(CH_CFG_TIME_QUANTUM)
    141 #define CH_CFG_TIME_QUANTUM                 0
    142 #endif
    143 
    144 /**
    145  * @brief   Idle thread automatic spawn suppression.
    146  * @details When this option is activated the function @p chSysInit()
    147  *          does not spawn the idle thread. The application @p main()
    148  *          function becomes the idle thread and must implement an
    149  *          infinite loop.
    150  */
    151 #if !defined(CH_CFG_NO_IDLE_THREAD)
    152 #define CH_CFG_NO_IDLE_THREAD               FALSE
    153 #endif
    154 
    155 /** @} */
    156 
    157 /*===========================================================================*/
    158 /**
    159  * @name Performance options
    160  * @{
    161  */
    162 /*===========================================================================*/
    163 
    164 /**
    165  * @brief   OS optimization.
    166  * @details If enabled then time efficient rather than space efficient code
    167  *          is used when two possible implementations exist.
    168  *
    169  * @note    This is not related to the compiler optimization options.
    170  * @note    The default is @p TRUE.
    171  */
    172 #if !defined(CH_CFG_OPTIMIZE_SPEED)
    173 #define CH_CFG_OPTIMIZE_SPEED               TRUE
    174 #endif
    175 
    176 /** @} */
    177 
    178 /*===========================================================================*/
    179 /**
    180  * @name Subsystem options
    181  * @{
    182  */
    183 /*===========================================================================*/
    184 
    185 /**
    186  * @brief   Time Measurement APIs.
    187  * @details If enabled then the time measurement APIs are included in
    188  *          the kernel.
    189  *
    190  * @note    The default is @p TRUE.
    191  */
    192 #if !defined(CH_CFG_USE_TM)
    193 #define CH_CFG_USE_TM                       FALSE
    194 #endif
    195 
    196 /**
    197  * @brief   Time Stamps APIs.
    198  * @details If enabled then the time stamps APIs are included in the kernel.
    199  *
    200  * @note    The default is @p TRUE.
    201  */
    202 #if !defined(CH_CFG_USE_TIMESTAMP)
    203 #define CH_CFG_USE_TIMESTAMP                TRUE
    204 #endif
    205 
    206 /**
    207  * @brief   Threads registry APIs.
    208  * @details If enabled then the registry APIs are included in the kernel.
    209  *
    210  * @note    The default is @p TRUE.
    211  */
    212 #if !defined(CH_CFG_USE_REGISTRY)
    213 #define CH_CFG_USE_REGISTRY                 FALSE
    214 #endif
    215 
    216 /**
    217  * @brief   Threads synchronization APIs.
    218  * @details If enabled then the @p chThdWait() function is included in
    219  *          the kernel.
    220  *
    221  * @note    The default is @p TRUE.
    222  */
    223 #if !defined(CH_CFG_USE_WAITEXIT)
    224 #define CH_CFG_USE_WAITEXIT                 FALSE
    225 #endif
    226 
    227 /**
    228  * @brief   Semaphores APIs.
    229  * @details If enabled then the Semaphores APIs are included in the kernel.
    230  *
    231  * @note    The default is @p TRUE.
    232  */
    233 #if !defined(CH_CFG_USE_SEMAPHORES)
    234 #define CH_CFG_USE_SEMAPHORES               TRUE
    235 #endif
    236 
    237 /**
    238  * @brief   Semaphores queuing mode.
    239  * @details If enabled then the threads are enqueued on semaphores by
    240  *          priority rather than in FIFO order.
    241  *
    242  * @note    The default is @p FALSE. Enable this if you have special
    243  *          requirements.
    244  * @note    Requires @p CH_CFG_USE_SEMAPHORES.
    245  */
    246 #if !defined(CH_CFG_USE_SEMAPHORES_PRIORITY)
    247 #define CH_CFG_USE_SEMAPHORES_PRIORITY      FALSE
    248 #endif
    249 
    250 /**
    251  * @brief   Mutexes APIs.
    252  * @details If enabled then the mutexes APIs are included in the kernel.
    253  *
    254  * @note    The default is @p TRUE.
    255  */
    256 #if !defined(CH_CFG_USE_MUTEXES)
    257 #define CH_CFG_USE_MUTEXES                  TRUE
    258 #endif
    259 
    260 /**
    261  * @brief   Enables recursive behavior on mutexes.
    262  * @note    Recursive mutexes are heavier and have an increased
    263  *          memory footprint.
    264  *
    265  * @note    The default is @p FALSE.
    266  * @note    Requires @p CH_CFG_USE_MUTEXES.
    267  */
    268 #if !defined(CH_CFG_USE_MUTEXES_RECURSIVE)
    269 #define CH_CFG_USE_MUTEXES_RECURSIVE        FALSE
    270 #endif
    271 
    272 /**
    273  * @brief   Conditional Variables APIs.
    274  * @details If enabled then the conditional variables APIs are included
    275  *          in the kernel.
    276  *
    277  * @note    The default is @p TRUE.
    278  * @note    Requires @p CH_CFG_USE_MUTEXES.
    279  */
    280 #if !defined(CH_CFG_USE_CONDVARS)
    281 #define CH_CFG_USE_CONDVARS                 FALSE
    282 #endif
    283 
    284 /**
    285  * @brief   Conditional Variables APIs with timeout.
    286  * @details If enabled then the conditional variables APIs with timeout
    287  *          specification are included in the kernel.
    288  *
    289  * @note    The default is @p TRUE.
    290  * @note    Requires @p CH_CFG_USE_CONDVARS.
    291  */
    292 #if !defined(CH_CFG_USE_CONDVARS_TIMEOUT)
    293 #define CH_CFG_USE_CONDVARS_TIMEOUT         TRUE
    294 #endif
    295 
    296 /**
    297  * @brief   Events Flags APIs.
    298  * @details If enabled then the event flags APIs are included in the kernel.
    299  *
    300  * @note    The default is @p TRUE.
    301  */
    302 #if !defined(CH_CFG_USE_EVENTS)
    303 #define CH_CFG_USE_EVENTS                   TRUE
    304 #endif
    305 
    306 /**
    307  * @brief   Events Flags APIs with timeout.
    308  * @details If enabled then the events APIs with timeout specification
    309  *          are included in the kernel.
    310  *
    311  * @note    The default is @p TRUE.
    312  * @note    Requires @p CH_CFG_USE_EVENTS.
    313  */
    314 #if !defined(CH_CFG_USE_EVENTS_TIMEOUT)
    315 #define CH_CFG_USE_EVENTS_TIMEOUT           TRUE
    316 #endif
    317 
    318 /**
    319  * @brief   Synchronous Messages APIs.
    320  * @details If enabled then the synchronous messages APIs are included
    321  *          in the kernel.
    322  *
    323  * @note    The default is @p TRUE.
    324  */
    325 #if !defined(CH_CFG_USE_MESSAGES)
    326 #define CH_CFG_USE_MESSAGES                 FALSE
    327 #endif
    328 
    329 /**
    330  * @brief   Synchronous Messages queuing mode.
    331  * @details If enabled then messages are served by priority rather than in
    332  *          FIFO order.
    333  *
    334  * @note    The default is @p FALSE. Enable this if you have special
    335  *          requirements.
    336  * @note    Requires @p CH_CFG_USE_MESSAGES.
    337  */
    338 #if !defined(CH_CFG_USE_MESSAGES_PRIORITY)
    339 #define CH_CFG_USE_MESSAGES_PRIORITY        FALSE
    340 #endif
    341 
    342 /**
    343  * @brief   Dynamic Threads APIs.
    344  * @details If enabled then the dynamic threads creation APIs are included
    345  *          in the kernel.
    346  *
    347  * @note    The default is @p TRUE.
    348  * @note    Requires @p CH_CFG_USE_WAITEXIT.
    349  * @note    Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS.
    350  */
    351 #if !defined(CH_CFG_USE_DYNAMIC)
    352 #define CH_CFG_USE_DYNAMIC                  FALSE
    353 #endif
    354 
    355 /** @} */
    356 
    357 /*===========================================================================*/
    358 /**
    359  * @name OSLIB options
    360  * @{
    361  */
    362 /*===========================================================================*/
    363 
    364 /**
    365  * @brief   Mailboxes APIs.
    366  * @details If enabled then the asynchronous messages (mailboxes) APIs are
    367  *          included in the kernel.
    368  *
    369  * @note    The default is @p TRUE.
    370  * @note    Requires @p CH_CFG_USE_SEMAPHORES.
    371  */
    372 #if !defined(CH_CFG_USE_MAILBOXES)
    373 #define CH_CFG_USE_MAILBOXES                FALSE
    374 #endif
    375 
    376 /**
    377  * @brief   Memory checks APIs.
    378  * @details If enabled then the memory checks APIs are included in the kernel.
    379  *
    380  * @note    The default is @p TRUE.
    381  */
    382 #if !defined(CH_CFG_USE_MEMCHECKS)
    383 #define CH_CFG_USE_MEMCHECKS                TRUE
    384 #endif
    385 
    386 /**
    387  * @brief   Core Memory Manager APIs.
    388  * @details If enabled then the core memory manager APIs are included
    389  *          in the kernel.
    390  *
    391  * @note    The default is @p TRUE.
    392  */
    393 #if !defined(CH_CFG_USE_MEMCORE)
    394 #define CH_CFG_USE_MEMCORE                  TRUE
    395 #endif
    396 
    397 /**
    398  * @brief   Managed RAM size.
    399  * @details Size of the RAM area to be managed by the OS. If set to zero
    400  *          then the whole available RAM is used. The core memory is made
    401  *          available to the heap allocator and/or can be used directly through
    402  *          the simplified core memory allocator.
    403  *
    404  * @note    In order to let the OS manage the whole RAM the linker script must
    405  *          provide the @p __heap_base__ and @p __heap_end__ symbols.
    406  * @note    Requires @p CH_CFG_USE_MEMCORE.
    407  */
    408 #if !defined(CH_CFG_MEMCORE_SIZE)
    409 #define CH_CFG_MEMCORE_SIZE                 0
    410 #endif
    411 
    412 /**
    413  * @brief   Heap Allocator APIs.
    414  * @details If enabled then the memory heap allocator APIs are included
    415  *          in the kernel.
    416  *
    417  * @note    The default is @p TRUE.
    418  * @note    Requires @p CH_CFG_USE_MEMCORE and either @p CH_CFG_USE_MUTEXES or
    419  *          @p CH_CFG_USE_SEMAPHORES.
    420  * @note    Mutexes are recommended.
    421  */
    422 #if !defined(CH_CFG_USE_HEAP)
    423 #define CH_CFG_USE_HEAP                     FALSE
    424 #endif
    425 
    426 /**
    427  * @brief   Memory Pools Allocator APIs.
    428  * @details If enabled then the memory pools allocator APIs are included
    429  *          in the kernel.
    430  *
    431  * @note    The default is @p TRUE.
    432  */
    433 #if !defined(CH_CFG_USE_MEMPOOLS)
    434 #define CH_CFG_USE_MEMPOOLS                 FALSE
    435 #endif
    436 
    437 /**
    438  * @brief   Objects FIFOs APIs.
    439  * @details If enabled then the objects FIFOs APIs are included
    440  *          in the kernel.
    441  *
    442  * @note    The default is @p TRUE.
    443  */
    444 #if !defined(CH_CFG_USE_OBJ_FIFOS)
    445 #define CH_CFG_USE_OBJ_FIFOS                FALSE
    446 #endif
    447 
    448 /**
    449  * @brief   Pipes APIs.
    450  * @details If enabled then the pipes APIs are included
    451  *          in the kernel.
    452  *
    453  * @note    The default is @p TRUE.
    454  */
    455 #if !defined(CH_CFG_USE_PIPES)
    456 #define CH_CFG_USE_PIPES                    FALSE
    457 #endif
    458 
    459 /**
    460  * @brief   Objects Caches APIs.
    461  * @details If enabled then the objects caches APIs are included
    462  *          in the kernel.
    463  *
    464  * @note    The default is @p TRUE.
    465  */
    466 #if !defined(CH_CFG_USE_OBJ_CACHES)
    467 #define CH_CFG_USE_OBJ_CACHES               FALSE
    468 #endif
    469 
    470 /**
    471  * @brief   Delegate threads APIs.
    472  * @details If enabled then the delegate threads APIs are included
    473  *          in the kernel.
    474  *
    475  * @note    The default is @p TRUE.
    476  */
    477 #if !defined(CH_CFG_USE_DELEGATES)
    478 #define CH_CFG_USE_DELEGATES                FALSE
    479 #endif
    480 
    481 /**
    482  * @brief   Jobs Queues APIs.
    483  * @details If enabled then the jobs queues APIs are included
    484  *          in the kernel.
    485  *
    486  * @note    The default is @p TRUE.
    487  */
    488 #if !defined(CH_CFG_USE_JOBS)
    489 #define CH_CFG_USE_JOBS                     FALSE
    490 #endif
    491 
    492 /** @} */
    493 
    494 /*===========================================================================*/
    495 /**
    496  * @name Objects factory options
    497  * @{
    498  */
    499 /*===========================================================================*/
    500 
    501 /**
    502  * @brief   Objects Factory APIs.
    503  * @details If enabled then the objects factory APIs are included in the
    504  *          kernel.
    505  *
    506  * @note    The default is @p FALSE.
    507  */
    508 #if !defined(CH_CFG_USE_FACTORY)
    509 #define CH_CFG_USE_FACTORY                  FALSE
    510 #endif
    511 
    512 /**
    513  * @brief   Maximum length for object names.
    514  * @details If the specified length is zero then the name is stored by
    515  *          pointer but this could have unintended side effects.
    516  */
    517 #if !defined(CH_CFG_FACTORY_MAX_NAMES_LENGTH)
    518 #define CH_CFG_FACTORY_MAX_NAMES_LENGTH     8
    519 #endif
    520 
    521 /**
    522  * @brief   Enables the registry of generic objects.
    523  */
    524 #if !defined(CH_CFG_FACTORY_OBJECTS_REGISTRY)
    525 #define CH_CFG_FACTORY_OBJECTS_REGISTRY     FALSE
    526 #endif
    527 
    528 /**
    529  * @brief   Enables factory for generic buffers.
    530  */
    531 #if !defined(CH_CFG_FACTORY_GENERIC_BUFFERS)
    532 #define CH_CFG_FACTORY_GENERIC_BUFFERS      FALSE
    533 #endif
    534 
    535 /**
    536  * @brief   Enables factory for semaphores.
    537  */
    538 #if !defined(CH_CFG_FACTORY_SEMAPHORES)
    539 #define CH_CFG_FACTORY_SEMAPHORES           FALSE
    540 #endif
    541 
    542 /**
    543  * @brief   Enables factory for mailboxes.
    544  */
    545 #if !defined(CH_CFG_FACTORY_MAILBOXES)
    546 #define CH_CFG_FACTORY_MAILBOXES            FALSE
    547 #endif
    548 
    549 /**
    550  * @brief   Enables factory for objects FIFOs.
    551  */
    552 #if !defined(CH_CFG_FACTORY_OBJ_FIFOS)
    553 #define CH_CFG_FACTORY_OBJ_FIFOS            FALSE
    554 #endif
    555 
    556 /**
    557  * @brief   Enables factory for Pipes.
    558  */
    559 #if !defined(CH_CFG_FACTORY_PIPES) || defined(__DOXYGEN__)
    560 #define CH_CFG_FACTORY_PIPES                FALSE
    561 #endif
    562 
    563 /** @} */
    564 
    565 /*===========================================================================*/
    566 /**
    567  * @name Debug options
    568  * @{
    569  */
    570 /*===========================================================================*/
    571 
    572 /**
    573  * @brief   Debug option, kernel statistics.
    574  *
    575  * @note    The default is @p FALSE.
    576  */
    577 #if !defined(CH_DBG_STATISTICS)
    578 #define CH_DBG_STATISTICS                   FALSE
    579 #endif
    580 
    581 /**
    582  * @brief   Debug option, system state check.
    583  * @details If enabled the correct call protocol for system APIs is checked
    584  *          at runtime.
    585  *
    586  * @note    The default is @p FALSE.
    587  */
    588 #if !defined(CH_DBG_SYSTEM_STATE_CHECK)
    589 #define CH_DBG_SYSTEM_STATE_CHECK           FALSE
    590 #endif
    591 
    592 /**
    593  * @brief   Debug option, parameters checks.
    594  * @details If enabled then the checks on the API functions input
    595  *          parameters are activated.
    596  *
    597  * @note    The default is @p FALSE.
    598  */
    599 #if !defined(CH_DBG_ENABLE_CHECKS)
    600 #define CH_DBG_ENABLE_CHECKS                FALSE
    601 #endif
    602 
    603 /**
    604  * @brief   Debug option, consistency checks.
    605  * @details If enabled then all the assertions in the kernel code are
    606  *          activated. This includes consistency checks inside the kernel,
    607  *          runtime anomalies and port-defined checks.
    608  *
    609  * @note    The default is @p FALSE.
    610  */
    611 #if !defined(CH_DBG_ENABLE_ASSERTS)
    612 #define CH_DBG_ENABLE_ASSERTS               FALSE
    613 #endif
    614 
    615 /**
    616  * @brief   Debug option, trace buffer.
    617  * @details If enabled then the trace buffer is activated.
    618  *
    619  * @note    The default is @p CH_DBG_TRACE_MASK_DISABLED.
    620  */
    621 #if !defined(CH_DBG_TRACE_MASK)
    622 #define CH_DBG_TRACE_MASK                   CH_DBG_TRACE_MASK_DISABLED
    623 #endif
    624 
    625 /**
    626  * @brief   Trace buffer entries.
    627  * @note    The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is
    628  *          different from @p CH_DBG_TRACE_MASK_DISABLED.
    629  */
    630 #if !defined(CH_DBG_TRACE_BUFFER_SIZE)
    631 #define CH_DBG_TRACE_BUFFER_SIZE            128
    632 #endif
    633 
    634 /**
    635  * @brief   Debug option, stack checks.
    636  * @details If enabled then a runtime stack check is performed.
    637  *
    638  * @note    The default is @p FALSE.
    639  * @note    The stack check is performed in a architecture/port dependent way.
    640  *          It may not be implemented or some ports.
    641  * @note    The default failure mode is to halt the system with the global
    642  *          @p panic_msg variable set to @p NULL.
    643  */
    644 #if !defined(CH_DBG_ENABLE_STACK_CHECK)
    645 #define CH_DBG_ENABLE_STACK_CHECK           FALSE
    646 #endif
    647 
    648 /**
    649  * @brief   Debug option, stacks initialization.
    650  * @details If enabled then the threads working area is filled with a byte
    651  *          value when a thread is created. This can be useful for the
    652  *          runtime measurement of the used stack.
    653  *
    654  * @note    The default is @p FALSE.
    655  */
    656 #if !defined(CH_DBG_FILL_THREADS)
    657 #define CH_DBG_FILL_THREADS                 FALSE
    658 #endif
    659 
    660 /**
    661  * @brief   Debug option, threads profiling.
    662  * @details If enabled then a field is added to the @p thread_t structure that
    663  *          counts the system ticks occurred while executing the thread.
    664  *
    665  * @note    The default is @p FALSE.
    666  * @note    This debug option is not currently compatible with the
    667  *          tickless mode.
    668  */
    669 #if !defined(CH_DBG_THREADS_PROFILING)
    670 #define CH_DBG_THREADS_PROFILING            FALSE
    671 #endif
    672 
    673 /** @} */
    674 
    675 /*===========================================================================*/
    676 /**
    677  * @name Kernel hooks
    678  * @{
    679  */
    680 /*===========================================================================*/
    681 
    682 /**
    683  * @brief   System structure extension.
    684  * @details User fields added to the end of the @p ch_system_t structure.
    685  */
    686 #define CH_CFG_SYSTEM_EXTRA_FIELDS                                          \
    687   /* Add system custom fields here.*/
    688 
    689 /**
    690  * @brief   System initialization hook.
    691  * @details User initialization code added to the @p chSysInit() function
    692  *          just before interrupts are enabled globally.
    693  */
    694 #define CH_CFG_SYSTEM_INIT_HOOK() {                                         \
    695   /* Add system initialization code here.*/                                 \
    696 }
    697 
    698 /**
    699  * @brief   OS instance structure extension.
    700  * @details User fields added to the end of the @p os_instance_t structure.
    701  */
    702 #define CH_CFG_OS_INSTANCE_EXTRA_FIELDS                                     \
    703   /* Add OS instance custom fields here.*/
    704 
    705 /**
    706  * @brief   OS instance initialization hook.
    707  *
    708  * @param[in] oip       pointer to the @p os_instance_t structure
    709  */
    710 #define CH_CFG_OS_INSTANCE_INIT_HOOK(oip) {                                 \
    711   /* Add OS instance initialization code here.*/                            \
    712 }
    713 
    714 /**
    715  * @brief   Threads descriptor structure extension.
    716  * @details User fields added to the end of the @p thread_t structure.
    717  */
    718 #define CH_CFG_THREAD_EXTRA_FIELDS                                          \
    719   /* Add threads custom fields here.*/
    720 
    721 /**
    722  * @brief   Threads initialization hook.
    723  * @details User initialization code added to the @p _thread_init() function.
    724  *
    725  * @note    It is invoked from within @p _thread_init() and implicitly from all
    726  *          the threads creation APIs.
    727  *
    728  * @param[in] tp        pointer to the @p thread_t structure
    729  */
    730 #define CH_CFG_THREAD_INIT_HOOK(tp) {                                       \
    731   /* Add threads initialization code here.*/                                \
    732 }
    733 
    734 /**
    735  * @brief   Threads finalization hook.
    736  * @details User finalization code added to the @p chThdExit() API.
    737  *
    738  * @param[in] tp        pointer to the @p thread_t structure
    739  */
    740 #define CH_CFG_THREAD_EXIT_HOOK(tp) {                                       \
    741   /* Add threads finalization code here.*/                                  \
    742 }
    743 
    744 /**
    745  * @brief   Context switch hook.
    746  * @details This hook is invoked just before switching between threads.
    747  *
    748  * @param[in] ntp       thread being switched in
    749  * @param[in] otp       thread being switched out
    750  */
    751 #define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) {                              \
    752   /* Context switch code here.*/                                            \
    753 }
    754 
    755 /**
    756  * @brief   ISR enter hook.
    757  */
    758 #define CH_CFG_IRQ_PROLOGUE_HOOK() {                                        \
    759   /* IRQ prologue code here.*/                                              \
    760 }
    761 
    762 /**
    763  * @brief   ISR exit hook.
    764  */
    765 #define CH_CFG_IRQ_EPILOGUE_HOOK() {                                        \
    766   /* IRQ epilogue code here.*/                                              \
    767 }
    768 
    769 /**
    770  * @brief   Idle thread enter hook.
    771  * @note    This hook is invoked within a critical zone, no OS functions
    772  *          should be invoked from here.
    773  * @note    This macro can be used to activate a power saving mode.
    774  */
    775 #define CH_CFG_IDLE_ENTER_HOOK() {                                          \
    776   /* Idle-enter code here.*/                                                \
    777 }
    778 
    779 /**
    780  * @brief   Idle thread leave hook.
    781  * @note    This hook is invoked within a critical zone, no OS functions
    782  *          should be invoked from here.
    783  * @note    This macro can be used to deactivate a power saving mode.
    784  */
    785 #define CH_CFG_IDLE_LEAVE_HOOK() {                                          \
    786   /* Idle-leave code here.*/                                                \
    787 }
    788 
    789 /**
    790  * @brief   Idle Loop hook.
    791  * @details This hook is continuously invoked by the idle thread loop.
    792  */
    793 #define CH_CFG_IDLE_LOOP_HOOK() {                                           \
    794   /* Idle loop code here.*/                                                 \
    795 }
    796 
    797 /**
    798  * @brief   System tick event hook.
    799  * @details This hook is invoked in the system tick handler immediately
    800  *          after processing the virtual timers queue.
    801  */
    802 #define CH_CFG_SYSTEM_TICK_HOOK() {                                         \
    803   /* System tick event code here.*/                                         \
    804 }
    805 
    806 /**
    807  * @brief   System halt hook.
    808  * @details This hook is invoked in case to a system halting error before
    809  *          the system is halted.
    810  */
    811 #define CH_CFG_SYSTEM_HALT_HOOK(reason) {                                   \
    812   /* System halt code here.*/                                               \
    813 }
    814 
    815 /**
    816  * @brief   Trace hook.
    817  * @details This hook is invoked each time a new record is written in the
    818  *          trace buffer.
    819  */
    820 #define CH_CFG_TRACE_HOOK(tep) {                                            \
    821   /* Trace code here.*/                                                     \
    822 }
    823 
    824 /**
    825  * @brief   Runtime Faults Collection Unit hook.
    826  * @details This hook is invoked each time new faults are collected and stored.
    827  */
    828 #define CH_CFG_RUNTIME_FAULTS_HOOK(mask) {                                  \
    829   /* Faults handling code here.*/                                           \
    830 }
    831 
    832 /** @} */
    833 
    834 /*===========================================================================*/
    835 /* Port-specific settings (override port settings defaulted in chcore.h).    */
    836 /*===========================================================================*/
    837 
    838 #endif  /* CHCONF_H */
    839 
    840 /** @} */