chconf.h 21 KB

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