chconf.h 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348
  1. /*
  2. ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. */
  13. /**
  14. * @file nil/templates/chconf.h
  15. * @brief Configuration file template.
  16. * @details A copy of this file must be placed in each project directory, it
  17. * contains the application specific kernel settings.
  18. *
  19. * @addtogroup NIL_CONFIG
  20. * @details Kernel related settings and hooks.
  21. * @{
  22. */
  23. #ifndef CHCONF_H
  24. #define CHCONF_H
  25. #define _CHIBIOS_NIL_CONF_
  26. #define _CHIBIOS_NIL_CONF_VER_3_2_
  27. /*===========================================================================*/
  28. /**
  29. * @name Kernel parameters and options
  30. * @{
  31. */
  32. /*===========================================================================*/
  33. /**
  34. * @brief Number of user threads in the application.
  35. * @note This number is not inclusive of the idle thread which is
  36. * Implicitly handled.
  37. */
  38. #define CH_CFG_NUM_THREADS 2
  39. /** @} */
  40. /*===========================================================================*/
  41. /**
  42. * @name System timer settings
  43. * @{
  44. */
  45. /*===========================================================================*/
  46. /**
  47. * @brief System time counter resolution.
  48. * @note Allowed values are 16 or 32 bits.
  49. */
  50. #define CH_CFG_ST_RESOLUTION 16
  51. /**
  52. * @brief System tick frequency.
  53. * @note This value together with the @p CH_CFG_ST_RESOLUTION
  54. * option defines the maximum amount of time allowed for
  55. * timeouts.
  56. */
  57. #define CH_CFG_ST_FREQUENCY 1000
  58. /**
  59. * @brief Time delta constant for the tick-less mode.
  60. * @note If this value is zero then the system uses the classic
  61. * periodic tick. This value represents the minimum number
  62. * of ticks that is safe to specify in a timeout directive.
  63. * The value one is not valid, timeouts are rounded up to
  64. * this value.
  65. */
  66. #define CH_CFG_ST_TIMEDELTA 2
  67. /** @} */
  68. /*===========================================================================*/
  69. /**
  70. * @name Subsystem options
  71. * @{
  72. */
  73. /*===========================================================================*/
  74. /**
  75. * @brief Semaphores APIs.
  76. * @details If enabled then the Semaphores APIs are included in the kernel.
  77. *
  78. * @note The default is @p TRUE.
  79. */
  80. #define CH_CFG_USE_SEMAPHORES TRUE
  81. /**
  82. * @brief Mutexes APIs.
  83. * @details If enabled then the mutexes APIs are included in the kernel.
  84. *
  85. * @note Feature not currently implemented.
  86. * @note The default is @p FALSE.
  87. */
  88. #define CH_CFG_USE_MUTEXES FALSE
  89. /**
  90. * @brief Events Flags APIs.
  91. * @details If enabled then the event flags APIs are included in the kernel.
  92. *
  93. * @note The default is @p TRUE.
  94. */
  95. #define CH_CFG_USE_EVENTS TRUE
  96. /**
  97. * @brief Mailboxes APIs.
  98. * @details If enabled then the asynchronous messages (mailboxes) APIs are
  99. * included in the kernel.
  100. *
  101. * @note The default is @p TRUE.
  102. * @note Requires @p CH_CFG_USE_SEMAPHORES.
  103. */
  104. #define CH_CFG_USE_MAILBOXES TRUE
  105. /**
  106. * @brief Core Memory Manager APIs.
  107. * @details If enabled then the core memory manager APIs are included
  108. * in the kernel.
  109. *
  110. * @note The default is @p TRUE.
  111. */
  112. #define CH_CFG_USE_MEMCORE TRUE
  113. /**
  114. * @brief Heap Allocator APIs.
  115. * @details If enabled then the memory heap allocator APIs are included
  116. * in the kernel.
  117. *
  118. * @note The default is @p TRUE.
  119. */
  120. #define CH_CFG_USE_HEAP TRUE
  121. /**
  122. * @brief Memory Pools Allocator APIs.
  123. * @details If enabled then the memory pools allocator APIs are included
  124. * in the kernel.
  125. *
  126. * @note The default is @p TRUE.
  127. */
  128. #define CH_CFG_USE_MEMPOOLS TRUE
  129. /**
  130. * @brief Objects FIFOs APIs.
  131. * @details If enabled then the objects FIFOs APIs are included
  132. * in the kernel.
  133. *
  134. * @note The default is @p TRUE.
  135. */
  136. #define CH_CFG_USE_OBJ_FIFOS TRUE
  137. /**
  138. * @brief Pipes APIs.
  139. * @details If enabled then the pipes APIs are included
  140. * in the kernel.
  141. *
  142. * @note The default is @p TRUE.
  143. */
  144. #define CH_CFG_USE_PIPES TRUE
  145. /**
  146. * @brief Managed RAM size.
  147. * @details Size of the RAM area to be managed by the OS. If set to zero
  148. * then the whole available RAM is used. The core memory is made
  149. * available to the heap allocator and/or can be used directly through
  150. * the simplified core memory allocator.
  151. *
  152. * @note In order to let the OS manage the whole RAM the linker script must
  153. * provide the @p __heap_base__ and @p __heap_end__ symbols.
  154. * @note Requires @p CH_CFG_USE_MEMCORE.
  155. */
  156. #define CH_CFG_MEMCORE_SIZE 0
  157. /** @} */
  158. /*===========================================================================*/
  159. /**
  160. * @name Objects factory options
  161. * @{
  162. */
  163. /*===========================================================================*/
  164. /**
  165. * @brief Objects Factory APIs.
  166. * @details If enabled then the objects factory APIs are included in the
  167. * kernel.
  168. *
  169. * @note The default is @p FALSE.
  170. */
  171. #define CH_CFG_USE_FACTORY TRUE
  172. /**
  173. * @brief Maximum length for object names.
  174. * @details If the specified length is zero then the name is stored by
  175. * pointer but this could have unintended side effects.
  176. */
  177. #define CH_CFG_FACTORY_MAX_NAMES_LENGTH 8
  178. /**
  179. * @brief Enables the registry of generic objects.
  180. */
  181. #define CH_CFG_FACTORY_OBJECTS_REGISTRY TRUE
  182. /**
  183. * @brief Enables factory for generic buffers.
  184. */
  185. #define CH_CFG_FACTORY_GENERIC_BUFFERS TRUE
  186. /**
  187. * @brief Enables factory for semaphores.
  188. */
  189. #define CH_CFG_FACTORY_SEMAPHORES TRUE
  190. /**
  191. * @brief Enables factory for mailboxes.
  192. */
  193. #define CH_CFG_FACTORY_MAILBOXES TRUE
  194. /**
  195. * @brief Enables factory for objects FIFOs.
  196. */
  197. #define CH_CFG_FACTORY_OBJ_FIFOS TRUE
  198. /**
  199. * @brief Enables factory for Pipes.
  200. */
  201. #define CH_CFG_FACTORY_PIPES TRUE
  202. /** @} */
  203. /*===========================================================================*/
  204. /**
  205. * @name Debug options
  206. * @{
  207. */
  208. /*===========================================================================*/
  209. /**
  210. * @brief Debug option, kernel statistics.
  211. *
  212. * @note Feature not currently implemented.
  213. * @note The default is @p FALSE.
  214. */
  215. #define CH_DBG_STATISTICS FALSE
  216. /**
  217. * @brief Debug option, system state check.
  218. *
  219. * @note The default is @p FALSE.
  220. */
  221. #define CH_DBG_SYSTEM_STATE_CHECK FALSE
  222. /**
  223. * @brief Debug option, parameters checks.
  224. *
  225. * @note The default is @p FALSE.
  226. */
  227. #define CH_DBG_ENABLE_CHECKS FALSE
  228. /**
  229. * @brief System assertions.
  230. *
  231. * @note The default is @p FALSE.
  232. */
  233. #define CH_DBG_ENABLE_ASSERTS FALSE
  234. /**
  235. * @brief Stack check.
  236. *
  237. * @note The default is @p FALSE.
  238. */
  239. #define CH_DBG_ENABLE_STACK_CHECK FALSE
  240. /** @} */
  241. /*===========================================================================*/
  242. /**
  243. * @name Kernel hooks
  244. * @{
  245. */
  246. /*===========================================================================*/
  247. /**
  248. * @brief System initialization hook.
  249. */
  250. #if !defined(CH_CFG_SYSTEM_INIT_HOOK) || defined(__DOXYGEN__)
  251. #define CH_CFG_SYSTEM_INIT_HOOK() { \
  252. }
  253. #endif
  254. /**
  255. * @brief Threads descriptor structure extension.
  256. * @details User fields added to the end of the @p thread_t structure.
  257. */
  258. #define CH_CFG_THREAD_EXT_FIELDS \
  259. /* Add threads custom fields here.*/
  260. /**
  261. * @brief Threads initialization hook.
  262. */
  263. #define CH_CFG_THREAD_EXT_INIT_HOOK(tr) { \
  264. /* Add custom threads initialization code here.*/ \
  265. }
  266. /**
  267. * @brief Idle thread enter hook.
  268. * @note This hook is invoked within a critical zone, no OS functions
  269. * should be invoked from here.
  270. * @note This macro can be used to activate a power saving mode.
  271. */
  272. #define CH_CFG_IDLE_ENTER_HOOK() { \
  273. }
  274. /**
  275. * @brief Idle thread leave hook.
  276. * @note This hook is invoked within a critical zone, no OS functions
  277. * should be invoked from here.
  278. * @note This macro can be used to deactivate a power saving mode.
  279. */
  280. #define CH_CFG_IDLE_LEAVE_HOOK() { \
  281. }
  282. /**
  283. * @brief System halt hook.
  284. */
  285. #if !defined(CH_CFG_SYSTEM_HALT_HOOK) || defined(__DOXYGEN__)
  286. #define CH_CFG_SYSTEM_HALT_HOOK(reason) { \
  287. }
  288. #endif
  289. /** @} */
  290. /*===========================================================================*/
  291. /* Port-specific settings (override port settings defaulted in nilcore.h). */
  292. /*===========================================================================*/
  293. #endif /* CHCONF_H */
  294. /** @} */