Firmware for the remote control translator
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

chconf.h 16KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520
  1. /*
  2. ChibiOS - Copyright (C) 2006..2016 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 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. /*===========================================================================*/
  27. /**
  28. * @name System timers settings
  29. * @{
  30. */
  31. /*===========================================================================*/
  32. /**
  33. * @brief System time counter resolution.
  34. * @note Allowed values are 16 or 32 bits.
  35. */
  36. #define CH_CFG_ST_RESOLUTION 16
  37. /**
  38. * @brief System tick frequency.
  39. * @details Frequency of the system timer that drives the system ticks. This
  40. * setting also defines the system tick time unit.
  41. */
  42. #define CH_CFG_ST_FREQUENCY 10000
  43. /**
  44. * @brief Time delta constant for the tick-less mode.
  45. * @note If this value is zero then the system uses the classic
  46. * periodic tick. This value represents the minimum number
  47. * of ticks that is safe to specify in a timeout directive.
  48. * The value one is not valid, timeouts are rounded up to
  49. * this value.
  50. */
  51. #define CH_CFG_ST_TIMEDELTA 2
  52. /** @} */
  53. /*===========================================================================*/
  54. /**
  55. * @name Kernel parameters and options
  56. * @{
  57. */
  58. /*===========================================================================*/
  59. /**
  60. * @brief Round robin interval.
  61. * @details This constant is the number of system ticks allowed for the
  62. * threads before preemption occurs. Setting this value to zero
  63. * disables the preemption for threads with equal priority and the
  64. * round robin becomes cooperative. Note that higher priority
  65. * threads can still preempt, the kernel is always preemptive.
  66. * @note Disabling the round robin preemption makes the kernel more compact
  67. * and generally faster.
  68. * @note The round robin preemption is not supported in tickless mode and
  69. * must be set to zero in that case.
  70. */
  71. #define CH_CFG_TIME_QUANTUM 0
  72. /**
  73. * @brief Managed RAM size.
  74. * @details Size of the RAM area to be managed by the OS. If set to zero
  75. * then the whole available RAM is used. The core memory is made
  76. * available to the heap allocator and/or can be used directly through
  77. * the simplified core memory allocator.
  78. *
  79. * @note In order to let the OS manage the whole RAM the linker script must
  80. * provide the @p __heap_base__ and @p __heap_end__ symbols.
  81. * @note Requires @p CH_CFG_USE_MEMCORE.
  82. */
  83. #define CH_CFG_MEMCORE_SIZE 0
  84. /**
  85. * @brief Idle thread automatic spawn suppression.
  86. * @details When this option is activated the function @p chSysInit()
  87. * does not spawn the idle thread. The application @p main()
  88. * function becomes the idle thread and must implement an
  89. * infinite loop.
  90. */
  91. #define CH_CFG_NO_IDLE_THREAD FALSE
  92. /** @} */
  93. /*===========================================================================*/
  94. /**
  95. * @name Performance options
  96. * @{
  97. */
  98. /*===========================================================================*/
  99. /**
  100. * @brief OS optimization.
  101. * @details If enabled then time efficient rather than space efficient code
  102. * is used when two possible implementations exist.
  103. *
  104. * @note This is not related to the compiler optimization options.
  105. * @note The default is @p TRUE.
  106. */
  107. #define CH_CFG_OPTIMIZE_SPEED TRUE
  108. /** @} */
  109. /*===========================================================================*/
  110. /**
  111. * @name Subsystem options
  112. * @{
  113. */
  114. /*===========================================================================*/
  115. /**
  116. * @brief Time Measurement APIs.
  117. * @details If enabled then the time measurement APIs are included in
  118. * the kernel.
  119. *
  120. * @note The default is @p TRUE.
  121. */
  122. #define CH_CFG_USE_TM TRUE
  123. /**
  124. * @brief Threads registry APIs.
  125. * @details If enabled then the registry APIs are included in the kernel.
  126. *
  127. * @note The default is @p TRUE.
  128. */
  129. #define CH_CFG_USE_REGISTRY TRUE
  130. /**
  131. * @brief Threads synchronization APIs.
  132. * @details If enabled then the @p chThdWait() function is included in
  133. * the kernel.
  134. *
  135. * @note The default is @p TRUE.
  136. */
  137. #define CH_CFG_USE_WAITEXIT TRUE
  138. /**
  139. * @brief Semaphores APIs.
  140. * @details If enabled then the Semaphores APIs are included in the kernel.
  141. *
  142. * @note The default is @p TRUE.
  143. */
  144. #define CH_CFG_USE_SEMAPHORES TRUE
  145. /**
  146. * @brief Semaphores queuing mode.
  147. * @details If enabled then the threads are enqueued on semaphores by
  148. * priority rather than in FIFO order.
  149. *
  150. * @note The default is @p FALSE. Enable this if you have special
  151. * requirements.
  152. * @note Requires @p CH_CFG_USE_SEMAPHORES.
  153. */
  154. #define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE
  155. /**
  156. * @brief Mutexes APIs.
  157. * @details If enabled then the mutexes APIs are included in the kernel.
  158. *
  159. * @note The default is @p TRUE.
  160. */
  161. #define CH_CFG_USE_MUTEXES TRUE
  162. /**
  163. * @brief Enables recursive behavior on mutexes.
  164. * @note Recursive mutexes are heavier and have an increased
  165. * memory footprint.
  166. *
  167. * @note The default is @p FALSE.
  168. * @note Requires @p CH_CFG_USE_MUTEXES.
  169. */
  170. #define CH_CFG_USE_MUTEXES_RECURSIVE FALSE
  171. /**
  172. * @brief Conditional Variables APIs.
  173. * @details If enabled then the conditional variables APIs are included
  174. * in the kernel.
  175. *
  176. * @note The default is @p TRUE.
  177. * @note Requires @p CH_CFG_USE_MUTEXES.
  178. */
  179. #define CH_CFG_USE_CONDVARS TRUE
  180. /**
  181. * @brief Conditional Variables APIs with timeout.
  182. * @details If enabled then the conditional variables APIs with timeout
  183. * specification are included in the kernel.
  184. *
  185. * @note The default is @p TRUE.
  186. * @note Requires @p CH_CFG_USE_CONDVARS.
  187. */
  188. #define CH_CFG_USE_CONDVARS_TIMEOUT TRUE
  189. /**
  190. * @brief Events Flags APIs.
  191. * @details If enabled then the event flags APIs are included in the kernel.
  192. *
  193. * @note The default is @p TRUE.
  194. */
  195. #define CH_CFG_USE_EVENTS TRUE
  196. /**
  197. * @brief Events Flags APIs with timeout.
  198. * @details If enabled then the events APIs with timeout specification
  199. * are included in the kernel.
  200. *
  201. * @note The default is @p TRUE.
  202. * @note Requires @p CH_CFG_USE_EVENTS.
  203. */
  204. #define CH_CFG_USE_EVENTS_TIMEOUT TRUE
  205. /**
  206. * @brief Synchronous Messages APIs.
  207. * @details If enabled then the synchronous messages APIs are included
  208. * in the kernel.
  209. *
  210. * @note The default is @p TRUE.
  211. */
  212. #define CH_CFG_USE_MESSAGES TRUE
  213. /**
  214. * @brief Synchronous Messages queuing mode.
  215. * @details If enabled then messages are served by priority rather than in
  216. * FIFO order.
  217. *
  218. * @note The default is @p FALSE. Enable this if you have special
  219. * requirements.
  220. * @note Requires @p CH_CFG_USE_MESSAGES.
  221. */
  222. #define CH_CFG_USE_MESSAGES_PRIORITY FALSE
  223. /**
  224. * @brief Mailboxes APIs.
  225. * @details If enabled then the asynchronous messages (mailboxes) APIs are
  226. * included in the kernel.
  227. *
  228. * @note The default is @p TRUE.
  229. * @note Requires @p CH_CFG_USE_SEMAPHORES.
  230. */
  231. #define CH_CFG_USE_MAILBOXES TRUE
  232. /**
  233. * @brief Core Memory Manager APIs.
  234. * @details If enabled then the core memory manager APIs are included
  235. * in the kernel.
  236. *
  237. * @note The default is @p TRUE.
  238. */
  239. #define CH_CFG_USE_MEMCORE TRUE
  240. /**
  241. * @brief Heap Allocator APIs.
  242. * @details If enabled then the memory heap allocator APIs are included
  243. * in the kernel.
  244. *
  245. * @note The default is @p TRUE.
  246. * @note Requires @p CH_CFG_USE_MEMCORE and either @p CH_CFG_USE_MUTEXES or
  247. * @p CH_CFG_USE_SEMAPHORES.
  248. * @note Mutexes are recommended.
  249. */
  250. #define CH_CFG_USE_HEAP TRUE
  251. /**
  252. * @brief Memory Pools Allocator APIs.
  253. * @details If enabled then the memory pools allocator APIs are included
  254. * in the kernel.
  255. *
  256. * @note The default is @p TRUE.
  257. */
  258. #define CH_CFG_USE_MEMPOOLS TRUE
  259. /**
  260. * @brief Dynamic Threads APIs.
  261. * @details If enabled then the dynamic threads creation APIs are included
  262. * in the kernel.
  263. *
  264. * @note The default is @p TRUE.
  265. * @note Requires @p CH_CFG_USE_WAITEXIT.
  266. * @note Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS.
  267. */
  268. #define CH_CFG_USE_DYNAMIC TRUE
  269. /** @} */
  270. /*===========================================================================*/
  271. /**
  272. * @name Debug options
  273. * @{
  274. */
  275. /*===========================================================================*/
  276. /**
  277. * @brief Debug option, kernel statistics.
  278. *
  279. * @note The default is @p FALSE.
  280. */
  281. #define CH_DBG_STATISTICS FALSE
  282. /**
  283. * @brief Debug option, system state check.
  284. * @details If enabled the correct call protocol for system APIs is checked
  285. * at runtime.
  286. *
  287. * @note The default is @p FALSE.
  288. */
  289. #define CH_DBG_SYSTEM_STATE_CHECK FALSE
  290. /**
  291. * @brief Debug option, parameters checks.
  292. * @details If enabled then the checks on the API functions input
  293. * parameters are activated.
  294. *
  295. * @note The default is @p FALSE.
  296. */
  297. #define CH_DBG_ENABLE_CHECKS FALSE
  298. /**
  299. * @brief Debug option, consistency checks.
  300. * @details If enabled then all the assertions in the kernel code are
  301. * activated. This includes consistency checks inside the kernel,
  302. * runtime anomalies and port-defined checks.
  303. *
  304. * @note The default is @p FALSE.
  305. */
  306. #define CH_DBG_ENABLE_ASSERTS FALSE
  307. /**
  308. * @brief Debug option, trace buffer.
  309. * @details If enabled then the trace buffer is activated.
  310. *
  311. * @note The default is @p CH_DBG_TRACE_MASK_DISABLED.
  312. */
  313. #define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED
  314. /**
  315. * @brief Trace buffer entries.
  316. * @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is
  317. * different from @p CH_DBG_TRACE_MASK_DISABLED.
  318. */
  319. #define CH_DBG_TRACE_BUFFER_SIZE 128
  320. /**
  321. * @brief Debug option, stack checks.
  322. * @details If enabled then a runtime stack check is performed.
  323. *
  324. * @note The default is @p FALSE.
  325. * @note The stack check is performed in a architecture/port dependent way.
  326. * It may not be implemented or some ports.
  327. * @note The default failure mode is to halt the system with the global
  328. * @p panic_msg variable set to @p NULL.
  329. */
  330. #define CH_DBG_ENABLE_STACK_CHECK FALSE
  331. /**
  332. * @brief Debug option, stacks initialization.
  333. * @details If enabled then the threads working area is filled with a byte
  334. * value when a thread is created. This can be useful for the
  335. * runtime measurement of the used stack.
  336. *
  337. * @note The default is @p FALSE.
  338. */
  339. #define CH_DBG_FILL_THREADS FALSE
  340. /**
  341. * @brief Debug option, threads profiling.
  342. * @details If enabled then a field is added to the @p thread_t structure that
  343. * counts the system ticks occurred while executing the thread.
  344. *
  345. * @note The default is @p FALSE.
  346. * @note This debug option is not currently compatible with the
  347. * tickless mode.
  348. */
  349. #define CH_DBG_THREADS_PROFILING FALSE
  350. /** @} */
  351. /*===========================================================================*/
  352. /**
  353. * @name Kernel hooks
  354. * @{
  355. */
  356. /*===========================================================================*/
  357. /**
  358. * @brief Threads descriptor structure extension.
  359. * @details User fields added to the end of the @p thread_t structure.
  360. */
  361. #define CH_CFG_THREAD_EXTRA_FIELDS \
  362. /* Add threads custom fields here.*/
  363. /**
  364. * @brief Threads initialization hook.
  365. * @details User initialization code added to the @p chThdInit() API.
  366. *
  367. * @note It is invoked from within @p chThdInit() and implicitly from all
  368. * the threads creation APIs.
  369. */
  370. #define CH_CFG_THREAD_INIT_HOOK(tp) { \
  371. /* Add threads initialization code here.*/ \
  372. }
  373. /**
  374. * @brief Threads finalization hook.
  375. * @details User finalization code added to the @p chThdExit() API.
  376. */
  377. #define CH_CFG_THREAD_EXIT_HOOK(tp) { \
  378. /* Add threads finalization code here.*/ \
  379. }
  380. /**
  381. * @brief Context switch hook.
  382. * @details This hook is invoked just before switching between threads.
  383. */
  384. #define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) { \
  385. /* Context switch code here.*/ \
  386. }
  387. /**
  388. * @brief ISR enter hook.
  389. */
  390. #define CH_CFG_IRQ_PROLOGUE_HOOK() { \
  391. /* IRQ prologue code here.*/ \
  392. }
  393. /**
  394. * @brief ISR exit hook.
  395. */
  396. #define CH_CFG_IRQ_EPILOGUE_HOOK() { \
  397. /* IRQ epilogue code here.*/ \
  398. }
  399. /**
  400. * @brief Idle thread enter hook.
  401. * @note This hook is invoked within a critical zone, no OS functions
  402. * should be invoked from here.
  403. * @note This macro can be used to activate a power saving mode.
  404. */
  405. #define CH_CFG_IDLE_ENTER_HOOK() { \
  406. /* Idle-enter code here.*/ \
  407. }
  408. /**
  409. * @brief Idle thread leave hook.
  410. * @note This hook is invoked within a critical zone, no OS functions
  411. * should be invoked from here.
  412. * @note This macro can be used to deactivate a power saving mode.
  413. */
  414. #define CH_CFG_IDLE_LEAVE_HOOK() { \
  415. /* Idle-leave code here.*/ \
  416. }
  417. /**
  418. * @brief Idle Loop hook.
  419. * @details This hook is continuously invoked by the idle thread loop.
  420. */
  421. #define CH_CFG_IDLE_LOOP_HOOK() { \
  422. /* Idle loop code here.*/ \
  423. }
  424. /**
  425. * @brief System tick event hook.
  426. * @details This hook is invoked in the system tick handler immediately
  427. * after processing the virtual timers queue.
  428. */
  429. #define CH_CFG_SYSTEM_TICK_HOOK() { \
  430. /* System tick event code here.*/ \
  431. }
  432. /**
  433. * @brief System halt hook.
  434. * @details This hook is invoked in case to a system halting error before
  435. * the system is halted.
  436. */
  437. #define CH_CFG_SYSTEM_HALT_HOOK(reason) { \
  438. /* System halt code here.*/ \
  439. }
  440. /**
  441. * @brief Trace hook.
  442. * @details This hook is invoked each time a new record is written in the
  443. * trace buffer.
  444. */
  445. #define CH_CFG_TRACE_HOOK(tep) { \
  446. /* Trace code here.*/ \
  447. }
  448. /** @} */
  449. /*===========================================================================*/
  450. /* Port-specific settings (override port settings defaulted in chcore.h). */
  451. /*===========================================================================*/
  452. #endif /* CHCONF_H */
  453. /** @} */