chconf.h 23 KB

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