chconf.h.ftl 22 KB

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