Subversion Repositories chibiosIgnition

Rev

Rev 2 | Blame | Compare with Previous | Last modification | View Log | RSS feed

  1. /*
  2.     ChibiOS - Copyright (C) 2006..2017 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    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_5_0_
  33.  
  34. /*===========================================================================*/
  35. /**
  36.  * @name System timers settings
  37.  * @{
  38.  */
  39. /*===========================================================================*/
  40.  
  41. /**
  42.  * @brief   System time counter resolution.
  43.  * @note    Allowed values are 16 or 32 bits.
  44.  */
  45. #define CH_CFG_ST_RESOLUTION                16
  46.  
  47. /**
  48.  * @brief   System tick frequency.
  49.  * @details Frequency of the system timer that drives the system ticks. This
  50.  *          setting also defines the system tick time unit.
  51.  */
  52. #define CH_CFG_ST_FREQUENCY                 10000
  53.  
  54. /**
  55.  * @brief   Time intervals data size.
  56.  * @note    Allowed values are 16, 32 or 64 bits.
  57.  */
  58. #define CH_CFG_INTERVALS_SIZE               32
  59.  
  60. /**
  61.  * @brief   Time types data size.
  62.  * @note    Allowed values are 16 or 32 bits.
  63.  */
  64. #define CH_CFG_TIME_TYPES_SIZE              32
  65.  
  66. /**
  67.  * @brief   Time delta constant for the tick-less mode.
  68.  * @note    If this value is zero then the system uses the classic
  69.  *          periodic tick. This value represents the minimum number
  70.  *          of ticks that is safe to specify in a timeout directive.
  71.  *          The value one is not valid, timeouts are rounded up to
  72.  *          this value.
  73.  */
  74. #define CH_CFG_ST_TIMEDELTA                 2
  75.  
  76. /** @} */
  77.  
  78. /*===========================================================================*/
  79. /**
  80.  * @name Kernel parameters and options
  81.  * @{
  82.  */
  83. /*===========================================================================*/
  84.  
  85. /**
  86.  * @brief   Round robin interval.
  87.  * @details This constant is the number of system ticks allowed for the
  88.  *          threads before preemption occurs. Setting this value to zero
  89.  *          disables the preemption for threads with equal priority and the
  90.  *          round robin becomes cooperative. Note that higher priority
  91.  *          threads can still preempt, the kernel is always preemptive.
  92.  * @note    Disabling the round robin preemption makes the kernel more compact
  93.  *          and generally faster.
  94.  * @note    The round robin preemption is not supported in tickless mode and
  95.  *          must be set to zero in that case.
  96.  */
  97. #define CH_CFG_TIME_QUANTUM                 0
  98.  
  99. /**
  100.  * @brief   Managed RAM size.
  101.  * @details Size of the RAM area to be managed by the OS. If set to zero
  102.  *          then the whole available RAM is used. The core memory is made
  103.  *          available to the heap allocator and/or can be used directly through
  104.  *          the simplified core memory allocator.
  105.  *
  106.  * @note    In order to let the OS manage the whole RAM the linker script must
  107.  *          provide the @p __heap_base__ and @p __heap_end__ symbols.
  108.  * @note    Requires @p CH_CFG_USE_MEMCORE.
  109.  */
  110. #define CH_CFG_MEMCORE_SIZE                 0
  111.  
  112. /**
  113.  * @brief   Idle thread automatic spawn suppression.
  114.  * @details When this option is activated the function @p chSysInit()
  115.  *          does not spawn the idle thread. The application @p main()
  116.  *          function becomes the idle thread and must implement an
  117.  *          infinite loop.
  118.  */
  119. #define CH_CFG_NO_IDLE_THREAD               FALSE
  120.  
  121. /** @} */
  122.  
  123. /*===========================================================================*/
  124. /**
  125.  * @name Performance options
  126.  * @{
  127.  */
  128. /*===========================================================================*/
  129.  
  130. /**
  131.  * @brief   OS optimization.
  132.  * @details If enabled then time efficient rather than space efficient code
  133.  *          is used when two possible implementations exist.
  134.  *
  135.  * @note    This is not related to the compiler optimization options.
  136.  * @note    The default is @p TRUE.
  137.  */
  138. #define CH_CFG_OPTIMIZE_SPEED               TRUE
  139.  
  140. /** @} */
  141.  
  142. /*===========================================================================*/
  143. /**
  144.  * @name Subsystem options
  145.  * @{
  146.  */
  147. /*===========================================================================*/
  148.  
  149. /**
  150.  * @brief   Time Measurement APIs.
  151.  * @details If enabled then the time measurement APIs are included in
  152.  *          the kernel.
  153.  *
  154.  * @note    The default is @p TRUE.
  155.  */
  156. #define CH_CFG_USE_TM                       TRUE
  157.  
  158. /**
  159.  * @brief   Threads registry APIs.
  160.  * @details If enabled then the registry APIs are included in the kernel.
  161.  *
  162.  * @note    The default is @p TRUE.
  163.  */
  164. #define CH_CFG_USE_REGISTRY                 TRUE
  165.  
  166. /**
  167.  * @brief   Threads synchronization APIs.
  168.  * @details If enabled then the @p chThdWait() function is included in
  169.  *          the kernel.
  170.  *
  171.  * @note    The default is @p TRUE.
  172.  */
  173. #define CH_CFG_USE_WAITEXIT                 TRUE
  174.  
  175. /**
  176.  * @brief   Semaphores APIs.
  177.  * @details If enabled then the Semaphores APIs are included in the kernel.
  178.  *
  179.  * @note    The default is @p TRUE.
  180.  */
  181. #define CH_CFG_USE_SEMAPHORES               TRUE
  182.  
  183. /**
  184.  * @brief   Semaphores queuing mode.
  185.  * @details If enabled then the threads are enqueued on semaphores by
  186.  *          priority rather than in FIFO order.
  187.  *
  188.  * @note    The default is @p FALSE. Enable this if you have special
  189.  *          requirements.
  190.  * @note    Requires @p CH_CFG_USE_SEMAPHORES.
  191.  */
  192. #define CH_CFG_USE_SEMAPHORES_PRIORITY      FALSE
  193.  
  194. /**
  195.  * @brief   Mutexes APIs.
  196.  * @details If enabled then the mutexes APIs are included in the kernel.
  197.  *
  198.  * @note    The default is @p TRUE.
  199.  */
  200. #define CH_CFG_USE_MUTEXES                  TRUE
  201.  
  202. /**
  203.  * @brief   Enables recursive behavior on mutexes.
  204.  * @note    Recursive mutexes are heavier and have an increased
  205.  *          memory footprint.
  206.  *
  207.  * @note    The default is @p FALSE.
  208.  * @note    Requires @p CH_CFG_USE_MUTEXES.
  209.  */
  210. #define CH_CFG_USE_MUTEXES_RECURSIVE        FALSE
  211.  
  212. /**
  213.  * @brief   Conditional Variables APIs.
  214.  * @details If enabled then the conditional variables APIs are included
  215.  *          in the kernel.
  216.  *
  217.  * @note    The default is @p TRUE.
  218.  * @note    Requires @p CH_CFG_USE_MUTEXES.
  219.  */
  220. #define CH_CFG_USE_CONDVARS                 TRUE
  221.  
  222. /**
  223.  * @brief   Conditional Variables APIs with timeout.
  224.  * @details If enabled then the conditional variables APIs with timeout
  225.  *          specification are included in the kernel.
  226.  *
  227.  * @note    The default is @p TRUE.
  228.  * @note    Requires @p CH_CFG_USE_CONDVARS.
  229.  */
  230. #define CH_CFG_USE_CONDVARS_TIMEOUT         TRUE
  231.  
  232. /**
  233.  * @brief   Events Flags APIs.
  234.  * @details If enabled then the event flags APIs are included in the kernel.
  235.  *
  236.  * @note    The default is @p TRUE.
  237.  */
  238. #define CH_CFG_USE_EVENTS                   TRUE
  239.  
  240. /**
  241.  * @brief   Events Flags APIs with timeout.
  242.  * @details If enabled then the events APIs with timeout specification
  243.  *          are included in the kernel.
  244.  *
  245.  * @note    The default is @p TRUE.
  246.  * @note    Requires @p CH_CFG_USE_EVENTS.
  247.  */
  248. #define CH_CFG_USE_EVENTS_TIMEOUT           TRUE
  249.  
  250. /**
  251.  * @brief   Synchronous Messages APIs.
  252.  * @details If enabled then the synchronous messages APIs are included
  253.  *          in the kernel.
  254.  *
  255.  * @note    The default is @p TRUE.
  256.  */
  257. #define CH_CFG_USE_MESSAGES                 TRUE
  258.  
  259. /**
  260.  * @brief   Synchronous Messages queuing mode.
  261.  * @details If enabled then messages are served by priority rather than in
  262.  *          FIFO order.
  263.  *
  264.  * @note    The default is @p FALSE. Enable this if you have special
  265.  *          requirements.
  266.  * @note    Requires @p CH_CFG_USE_MESSAGES.
  267.  */
  268. #define CH_CFG_USE_MESSAGES_PRIORITY        FALSE
  269.  
  270. /**
  271.  * @brief   Mailboxes APIs.
  272.  * @details If enabled then the asynchronous messages (mailboxes) APIs are
  273.  *          included in the kernel.
  274.  *
  275.  * @note    The default is @p TRUE.
  276.  * @note    Requires @p CH_CFG_USE_SEMAPHORES.
  277.  */
  278. #define CH_CFG_USE_MAILBOXES                TRUE
  279.  
  280. /**
  281.  * @brief   Core Memory Manager APIs.
  282.  * @details If enabled then the core memory manager APIs are included
  283.  *          in the kernel.
  284.  *
  285.  * @note    The default is @p TRUE.
  286.  */
  287. #define CH_CFG_USE_MEMCORE                  TRUE
  288.  
  289. /**
  290.  * @brief   Heap Allocator APIs.
  291.  * @details If enabled then the memory heap allocator APIs are included
  292.  *          in the kernel.
  293.  *
  294.  * @note    The default is @p TRUE.
  295.  * @note    Requires @p CH_CFG_USE_MEMCORE and either @p CH_CFG_USE_MUTEXES or
  296.  *          @p CH_CFG_USE_SEMAPHORES.
  297.  * @note    Mutexes are recommended.
  298.  */
  299. #define CH_CFG_USE_HEAP                     TRUE
  300.  
  301. /**
  302.  * @brief   Memory Pools Allocator APIs.
  303.  * @details If enabled then the memory pools allocator APIs are included
  304.  *          in the kernel.
  305.  *
  306.  * @note    The default is @p TRUE.
  307.  */
  308. #define CH_CFG_USE_MEMPOOLS                 TRUE
  309.  
  310. /**
  311.  * @brief  Objects FIFOs APIs.
  312.  * @details If enabled then the objects FIFOs APIs are included
  313.  *          in the kernel.
  314.  *
  315.  * @note    The default is @p TRUE.
  316.  */
  317. #define CH_CFG_USE_OBJ_FIFOS                TRUE
  318.  
  319. /**
  320.  * @brief   Dynamic Threads APIs.
  321.  * @details If enabled then the dynamic threads creation APIs are included
  322.  *          in the kernel.
  323.  *
  324.  * @note    The default is @p TRUE.
  325.  * @note    Requires @p CH_CFG_USE_WAITEXIT.
  326.  * @note    Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS.
  327.  */
  328. #define CH_CFG_USE_DYNAMIC                  TRUE
  329.  
  330. /** @} */
  331.  
  332. /*===========================================================================*/
  333. /**
  334.  * @name Objects factory options
  335.  * @{
  336.  */
  337. /*===========================================================================*/
  338.  
  339. /**
  340.  * @brief   Objects Factory APIs.
  341.  * @details If enabled then the objects factory APIs are included in the
  342.  *          kernel.
  343.  *
  344.  * @note    The default is @p FALSE.
  345.  */
  346. #define CH_CFG_USE_FACTORY                  TRUE
  347.  
  348. /**
  349.  * @brief   Maximum length for object names.
  350.  * @details If the specified length is zero then the name is stored by
  351.  *          pointer but this could have unintended side effects.
  352.  */
  353. #define CH_CFG_FACTORY_MAX_NAMES_LENGTH     8
  354.  
  355. /**
  356.  * @brief   Enables the registry of generic objects.
  357.  */
  358. #define CH_CFG_FACTORY_OBJECTS_REGISTRY     TRUE
  359.  
  360. /**
  361.  * @brief   Enables factory for generic buffers.
  362.  */
  363. #define CH_CFG_FACTORY_GENERIC_BUFFERS      TRUE
  364.  
  365. /**
  366.  * @brief   Enables factory for semaphores.
  367.  */
  368. #define CH_CFG_FACTORY_SEMAPHORES           TRUE
  369.  
  370. /**
  371.  * @brief   Enables factory for mailboxes.
  372.  */
  373. #define CH_CFG_FACTORY_MAILBOXES            TRUE
  374.  
  375. /**
  376.  * @brief   Enables factory for objects FIFOs.
  377.  */
  378. #define CH_CFG_FACTORY_OBJ_FIFOS            TRUE
  379.  
  380. /** @} */
  381.  
  382. /*===========================================================================*/
  383. /**
  384.  * @name Debug options
  385.  * @{
  386.  */
  387. /*===========================================================================*/
  388.  
  389. /**
  390.  * @brief   Debug option, kernel statistics.
  391.  *
  392.  * @note    The default is @p FALSE.
  393.  */
  394. #define CH_DBG_STATISTICS                   FALSE
  395.  
  396. /**
  397.  * @brief   Debug option, system state check.
  398.  * @details If enabled the correct call protocol for system APIs is checked
  399.  *          at runtime.
  400.  *
  401.  * @note    The default is @p FALSE.
  402.  */
  403. #define CH_DBG_SYSTEM_STATE_CHECK           FALSE
  404.  
  405. /**
  406.  * @brief   Debug option, parameters checks.
  407.  * @details If enabled then the checks on the API functions input
  408.  *          parameters are activated.
  409.  *
  410.  * @note    The default is @p FALSE.
  411.  */
  412. #define CH_DBG_ENABLE_CHECKS                FALSE
  413.  
  414. /**
  415.  * @brief   Debug option, consistency checks.
  416.  * @details If enabled then all the assertions in the kernel code are
  417.  *          activated. This includes consistency checks inside the kernel,
  418.  *          runtime anomalies and port-defined checks.
  419.  *
  420.  * @note    The default is @p FALSE.
  421.  */
  422. #define CH_DBG_ENABLE_ASSERTS               FALSE
  423.  
  424. /**
  425.  * @brief   Debug option, trace buffer.
  426.  * @details If enabled then the trace buffer is activated.
  427.  *
  428.  * @note    The default is @p CH_DBG_TRACE_MASK_DISABLED.
  429.  */
  430. #define CH_DBG_TRACE_MASK                   CH_DBG_TRACE_MASK_DISABLED
  431.  
  432. /**
  433.  * @brief   Trace buffer entries.
  434.  * @note    The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is
  435.  *          different from @p CH_DBG_TRACE_MASK_DISABLED.
  436.  */
  437. #define CH_DBG_TRACE_BUFFER_SIZE            128
  438.  
  439. /**
  440.  * @brief   Debug option, stack checks.
  441.  * @details If enabled then a runtime stack check is performed.
  442.  *
  443.  * @note    The default is @p FALSE.
  444.  * @note    The stack check is performed in a architecture/port dependent way.
  445.  *          It may not be implemented or some ports.
  446.  * @note    The default failure mode is to halt the system with the global
  447.  *          @p panic_msg variable set to @p NULL.
  448.  */
  449. #define CH_DBG_ENABLE_STACK_CHECK           FALSE
  450.  
  451. /**
  452.  * @brief   Debug option, stacks initialization.
  453.  * @details If enabled then the threads working area is filled with a byte
  454.  *          value when a thread is created. This can be useful for the
  455.  *          runtime measurement of the used stack.
  456.  *
  457.  * @note    The default is @p FALSE.
  458.  */
  459. #define CH_DBG_FILL_THREADS                 FALSE
  460.  
  461. /**
  462.  * @brief   Debug option, threads profiling.
  463.  * @details If enabled then a field is added to the @p thread_t structure that
  464.  *          counts the system ticks occurred while executing the thread.
  465.  *
  466.  * @note    The default is @p FALSE.
  467.  * @note    This debug option is not currently compatible with the
  468.  *          tickless mode.
  469.  */
  470. #define CH_DBG_THREADS_PROFILING            FALSE
  471.  
  472. /** @} */
  473.  
  474. /*===========================================================================*/
  475. /**
  476.  * @name Kernel hooks
  477.  * @{
  478.  */
  479. /*===========================================================================*/
  480.  
  481. /**
  482.  * @brief   System structure extension.
  483.  * @details User fields added to the end of the @p ch_system_t structure.
  484.  */
  485. #define CH_CFG_SYSTEM_EXTRA_FIELDS                                          \
  486.   /* Add threads custom fields here.*/
  487.  
  488. /**
  489.  * @brief   System initialization hook.
  490.  * @details User initialization code added to the @p chSysInit() function
  491.  *          just before interrupts are enabled globally.
  492.  */
  493. #define CH_CFG_SYSTEM_INIT_HOOK(tp) {                                       \
  494.   /* Add threads initialization code here.*/                                \
  495. }
  496.  
  497. /**
  498.  * @brief   Threads descriptor structure extension.
  499.  * @details User fields added to the end of the @p thread_t structure.
  500.  */
  501. #define CH_CFG_THREAD_EXTRA_FIELDS                                          \
  502.   /* Add threads custom fields here.*/
  503.  
  504. /**
  505.  * @brief   Threads initialization hook.
  506.  * @details User initialization code added to the @p _thread_init() function.
  507.  *
  508.  * @note    It is invoked from within @p _thread_init() and implicitly from all
  509.  *          the threads creation APIs.
  510.  */
  511. #define CH_CFG_THREAD_INIT_HOOK(tp) {                                       \
  512.   /* Add threads initialization code here.*/                                \
  513. }
  514.  
  515. /**
  516.  * @brief   Threads finalization hook.
  517.  * @details User finalization code added to the @p chThdExit() API.
  518.  */
  519. #define CH_CFG_THREAD_EXIT_HOOK(tp) {                                       \
  520.   /* Add threads finalization code here.*/                                  \
  521. }
  522.  
  523. /**
  524.  * @brief   Context switch hook.
  525.  * @details This hook is invoked just before switching between threads.
  526.  */
  527. #define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) {                              \
  528.   /* Context switch code here.*/                                            \
  529. }
  530.  
  531. /**
  532.  * @brief   ISR enter hook.
  533.  */
  534. #define CH_CFG_IRQ_PROLOGUE_HOOK() {                                        \
  535.   /* IRQ prologue code here.*/                                              \
  536. }
  537.  
  538. /**
  539.  * @brief   ISR exit hook.
  540.  */
  541. #define CH_CFG_IRQ_EPILOGUE_HOOK() {                                        \
  542.   /* IRQ epilogue code here.*/                                              \
  543. }
  544.  
  545. /**
  546.  * @brief   Idle thread enter hook.
  547.  * @note    This hook is invoked within a critical zone, no OS functions
  548.  *          should be invoked from here.
  549.  * @note    This macro can be used to activate a power saving mode.
  550.  */
  551. #define CH_CFG_IDLE_ENTER_HOOK() {                                          \
  552.   /* Idle-enter code here.*/                                                \
  553. }
  554.  
  555. /**
  556.  * @brief   Idle thread leave hook.
  557.  * @note    This hook is invoked within a critical zone, no OS functions
  558.  *          should be invoked from here.
  559.  * @note    This macro can be used to deactivate a power saving mode.
  560.  */
  561. #define CH_CFG_IDLE_LEAVE_HOOK() {                                          \
  562.   /* Idle-leave code here.*/                                                \
  563. }
  564.  
  565. /**
  566.  * @brief   Idle Loop hook.
  567.  * @details This hook is continuously invoked by the idle thread loop.
  568.  */
  569. #define CH_CFG_IDLE_LOOP_HOOK() {                                           \
  570.   /* Idle loop code here.*/                                                 \
  571. }
  572.  
  573. /**
  574.  * @brief   System tick event hook.
  575.  * @details This hook is invoked in the system tick handler immediately
  576.  *          after processing the virtual timers queue.
  577.  */
  578. #define CH_CFG_SYSTEM_TICK_HOOK() {                                         \
  579.   /* System tick event code here.*/                                         \
  580. }
  581.  
  582. /**
  583.  * @brief   System halt hook.
  584.  * @details This hook is invoked in case to a system halting error before
  585.  *          the system is halted.
  586.  */
  587. #define CH_CFG_SYSTEM_HALT_HOOK(reason) {                                   \
  588.   /* System halt code here.*/                                               \
  589. }
  590.  
  591. /**
  592.  * @brief   Trace hook.
  593.  * @details This hook is invoked each time a new record is written in the
  594.  *          trace buffer.
  595.  */
  596. #define CH_CFG_TRACE_HOOK(tep) {                                            \
  597.   /* Trace code here.*/                                                     \
  598. }
  599.  
  600. /** @} */
  601.  
  602. /*===========================================================================*/
  603. /* Port-specific settings (override port settings defaulted in chcore.h).    */
  604. /*===========================================================================*/
  605. #define SHELL_CMD_TEST_ENABLED FALSE
  606. #endif  /* CHCONF_H */
  607.  
  608. /** @} */
  609.