dRonin  adbada4
dRonin firmware
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
chconf.h
Go to the documentation of this file.
1 /*
2  ChibiOS/RT - Copyright (C) 2006-2013 Giovanni Di Sirio
3 
4  Licensed under the Apache License, Version 2.0 (the "License");
5  you may not use this file except in compliance with the License.
6  You may obtain a copy of the License at
7 
8  http://www.apache.org/licenses/LICENSE-2.0
9 
10  Unless required by applicable law or agreed to in writing, software
11  distributed under the License is distributed on an "AS IS" BASIS,
12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  See the License for the specific language governing permissions and
14  limitations under the License.
15 */
16 
28 #ifndef _CHCONF_H_
29 #define _CHCONF_H_
30 
31 /*===========================================================================*/
36 /*===========================================================================*/
37 
43 #if !defined(CH_FREQUENCY) || defined(__DOXYGEN__)
44 #define CH_FREQUENCY 1000
45 #endif
46 
58 #if !defined(CH_TIME_QUANTUM) || defined(__DOXYGEN__)
59 #define CH_TIME_QUANTUM 1
60 #endif
61 
73 #if !defined(CH_MEMCORE_SIZE) || defined(__DOXYGEN__)
74 #define CH_MEMCORE_SIZE 0
75 #endif
76 
90 #if !defined(CH_NO_IDLE_THREAD) || defined(__DOXYGEN__)
91 #define CH_NO_IDLE_THREAD FALSE
92 #endif
93 
96 /*===========================================================================*/
101 /*===========================================================================*/
102 
111 #if !defined(CH_OPTIMIZE_SPEED) || defined(__DOXYGEN__)
112 #define CH_OPTIMIZE_SPEED FALSE
113 #endif
114 
117 /*===========================================================================*/
122 /*===========================================================================*/
123 
130 #if !defined(CH_USE_REGISTRY) || defined(__DOXYGEN__)
131 #define CH_USE_REGISTRY TRUE
132 #endif
133 
141 #if !defined(CH_USE_WAITEXIT) || defined(__DOXYGEN__)
142 #define CH_USE_WAITEXIT TRUE
143 #endif
144 
151 #if !defined(CH_USE_SEMAPHORES) || defined(__DOXYGEN__)
152 #define CH_USE_SEMAPHORES TRUE
153 #endif
154 
163 #if !defined(CH_USE_SEMAPHORES_PRIORITY) || defined(__DOXYGEN__)
164 #define CH_USE_SEMAPHORES_PRIORITY FALSE
165 #endif
166 
175 #if !defined(CH_USE_SEMSW) || defined(__DOXYGEN__)
176 #define CH_USE_SEMSW TRUE
177 #endif
178 
185 #if !defined(CH_USE_MUTEXES) || defined(__DOXYGEN__)
186 #define CH_USE_MUTEXES TRUE
187 #endif
188 
197 #if !defined(CH_USE_CONDVARS) || defined(__DOXYGEN__)
198 #define CH_USE_CONDVARS FALSE
199 #endif
200 
209 #if !defined(CH_USE_CONDVARS_TIMEOUT) || defined(__DOXYGEN__)
210 #define CH_USE_CONDVARS_TIMEOUT FALSE
211 #endif
212 
219 #if !defined(CH_USE_EVENTS) || defined(__DOXYGEN__)
220 #define CH_USE_EVENTS FALSE
221 #endif
222 
231 #if !defined(CH_USE_EVENTS_TIMEOUT) || defined(__DOXYGEN__)
232 #define CH_USE_EVENTS_TIMEOUT FALSE
233 #endif
234 
242 #if !defined(CH_USE_MESSAGES) || defined(__DOXYGEN__)
243 #define CH_USE_MESSAGES FALSE
244 #endif
245 
254 #if !defined(CH_USE_MESSAGES_PRIORITY) || defined(__DOXYGEN__)
255 #define CH_USE_MESSAGES_PRIORITY FALSE
256 #endif
257 
266 #if !defined(CH_USE_MAILBOXES) || defined(__DOXYGEN__)
267 #define CH_USE_MAILBOXES TRUE
268 #endif
269 
276 #if !defined(CH_USE_QUEUES) || defined(__DOXYGEN__)
277 #define CH_USE_QUEUES FALSE
278 #endif
279 
287 #if !defined(CH_USE_MEMCORE) || defined(__DOXYGEN__)
288 #define CH_USE_MEMCORE FALSE
289 #endif
290 
301 #if !defined(CH_USE_HEAP) || defined(__DOXYGEN__)
302 #define CH_USE_HEAP FALSE
303 #endif
304 
315 #if !defined(CH_USE_MALLOC_HEAP) || defined(__DOXYGEN__)
316 #define CH_USE_MALLOC_HEAP FALSE
317 #endif
318 
326 #if !defined(CH_USE_MEMPOOLS) || defined(__DOXYGEN__)
327 #define CH_USE_MEMPOOLS TRUE
328 #endif
329 
339 #if !defined(CH_USE_DYNAMIC) || defined(__DOXYGEN__)
340 #define CH_USE_DYNAMIC FALSE
341 #endif
342 
345 /*===========================================================================*/
350 /*===========================================================================*/
351 
359 #if !defined(CH_DBG_SYSTEM_STATE_CHECK) || defined(__DOXYGEN__)
360 #define CH_DBG_SYSTEM_STATE_CHECK FALSE
361 #endif
362 
370 #if !defined(CH_DBG_ENABLE_CHECKS) || defined(__DOXYGEN__)
371 #define CH_DBG_ENABLE_CHECKS FALSE
372 #endif
373 
382 #if !defined(CH_DBG_ENABLE_ASSERTS) || defined(__DOXYGEN__)
383 #define CH_DBG_ENABLE_ASSERTS FALSE
384 #endif
385 
393 #if !defined(CH_DBG_ENABLE_TRACE) || defined(__DOXYGEN__)
394 #define CH_DBG_ENABLE_TRACE FALSE
395 #endif
396 
407 #if !defined(CH_DBG_ENABLE_STACK_CHECK) || defined(__DOXYGEN__)
408 #define CH_DBG_ENABLE_STACK_CHECK FALSE
409 #endif
410 
419 #if !defined(CH_DBG_FILL_THREADS) || defined(__DOXYGEN__)
420 #define CH_DBG_FILL_THREADS TRUE
421 #endif
422 
432 #if !defined(CH_DBG_THREADS_PROFILING) || defined(__DOXYGEN__)
433 #define CH_DBG_THREADS_PROFILING FALSE
434 #endif
435 
438 /*===========================================================================*/
443 /*===========================================================================*/
444 
445 #include <stdint.h>
446 
450 typedef uint32_t halrtcnt_t;
451 
467 #define halGetCounterValue() hal_lld_get_counter_value()
468 
479 #define hal_lld_get_counter_value() DWT_CYCCNT
480 
485 #if !defined(THREAD_EXT_FIELDS) || defined(__DOXYGEN__)
486 #define THREAD_EXT_FIELDS \
487  halrtcnt_t ticks_switched_in; \
488  halrtcnt_t ticks_total; \
489  /* Add threads custom fields here.*/
490 #endif
491 
499 #if !defined(THREAD_EXT_INIT_HOOK) || defined(__DOXYGEN__)
500 #define THREAD_EXT_INIT_HOOK(tp) { \
501  /* Add threads initialization code here.*/ \
502 }
503 #endif
504 
513 #if !defined(THREAD_EXT_EXIT_HOOK) || defined(__DOXYGEN__)
514 #define THREAD_EXT_EXIT_HOOK(tp) { \
515  /* Add threads finalization code here.*/ \
516 }
517 #endif
518 
523 #if !defined(THREAD_CONTEXT_SWITCH_HOOK) || defined(__DOXYGEN__)
524 #define THREAD_CONTEXT_SWITCH_HOOK(ntp, otp) { \
525  ntp->ticks_switched_in = halGetCounterValue(); \
526  otp->ticks_total += ntp->ticks_switched_in - otp->ticks_switched_in; \
527  /* System halt code here.*/ \
528 }
529 #endif
530 
535 #if !defined(IDLE_LOOP_HOOK) || defined(__DOXYGEN__)
536 #define IDLE_LOOP_HOOK() { \
537  extern void vApplicationIdleHook(void); \
538  vApplicationIdleHook(); \
539 }
540 #endif
541 
547 #if !defined(SYSTEM_TICK_EVENT_HOOK) || defined(__DOXYGEN__)
548 #define SYSTEM_TICK_EVENT_HOOK() { \
549  /* System tick event code here.*/ \
550 }
551 #endif
552 
558 #if !defined(SYSTEM_HALT_HOOK) || defined(__DOXYGEN__)
559 #define SYSTEM_HALT_HOOK() { \
560  /* System halt code here.*/ \
561 }
562 #endif
563 
566 /*===========================================================================*/
567 /* Port-specific settings (override port settings defaulted in chcore.h). */
568 /*===========================================================================*/
569 
570 #endif /* _CHCONF_H_ */
571 
uint32_t halrtcnt_t
Type of the realtime free counter value.
Definition: chconf.h:454