chconf.h 24 KB

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