mn_config.hpp
Go to the documentation of this file.
1 
20 #ifndef __MINLIB_MNTHREAD_CONFIG_H__
21 #define __MINLIB_MNTHREAD_CONFIG_H__
22 
30 #ifdef ESP_BUILD_WITH_SDKCONFIG
31 #include "sdkconfig.h"
32 #endif
33 
34 
36 #define MN_THREAD_CONFIG_MUTEX 1
38 #define MN_THREAD_CONFIG_COUNTING_SEMAPHORE 2
40 #define MN_THREAD_CONFIG_BINARY_SEMAPHORE 3
41 
43 #define MN_THREAD_CONFIG_YES 1
45 #define MN_THREAD_CONFIG_NO 2
46 
48 #define MN_THREAD_CONFIG_CORE_MAX (portNUM_PROCESSORS - 1)
49 
54 #define MN_THREAD_CONFIG_CORE_IFNO tskNO_AFFINITY
59 #define MN_THREAD_CONFIG_CORE_ONE 0
64 #define MN_THREAD_CONFIG_CORE_TWO 1
65 
71 #define MN_THREAD_CONFIG_ESP32 0
72 
78 #define MN_THREAD_CONFIG_BOARD_NODEFS 99
79 
85 #define MN_THREAD_CONFIG_OTHER 1
86 
87 #if( configSUPPORT_STATIC_ALLOCATION == 1 )
88  #define MN_THREAD_CONFIG_STACK_DEPTH 8192
89 #endif
90 
91 #ifndef MN_THREAD_CONFIG_BOARD
92  #define MN_THREAD_CONFIG_BOARD MN_THREAD_CONFIG_ESP32
93 #endif
98 #define MN_THREAD_CONFIG_DEFAULT_CORE MN_THREAD_CONFIG_CORE_IFNO
103 #define MN_THREAD_CONFIG_DEFAULT_WORKQUEUE_CORE MN_THREAD_CONFIG_CORE_TWO
104 
105 
110 #define MN_THREAD_CONFIG_ALLOCATOR_SYSTEM 1
115 #define MN_THREAD_CONFIG_ALLOCATOR_SPIRAM 2
116 
117 //Start Config section
118 //==================================
119 
120 
121 // start basic config
122 //==================================
123 #ifndef MN_THREAD_CONFIG_SIZE_TYPE
127  #define MN_THREAD_CONFIG_SIZE_TYPE long unsigned int
128 #endif
129 
130 
131 #ifndef MN_THREAD_CONFIG_USE_EXCEPTIONS
136  #define MN_THREAD_CONFIG_USE_EXCEPTIONS MN_THREAD_CONFIG_NO
137 #endif
138 
139 #ifndef MN_THREAD_CONFIG_DEBUG
140  #define MN_THREAD_CONFIG_DEBUG MN_THREAD_CONFIG_YES
141 #endif
142 
143 #ifndef MN_THREAD_CONFIG_STACK_TYPE
145  #define MN_THREAD_CONFIG_STACK_TYPE unsigned long
146 #endif
147 
148 #ifndef MN_THREAD_CONFIG_BASIC_ALIGNMENT
149  #define MN_THREAD_CONFIG_BASIC_ALIGNMENT sizeof(unsigned char*)
150 #endif
151 
152 #ifndef MN_THREAD_CONFIG_BASIC_HASHMUL_VAL
154  #define MN_THREAD_CONFIG_BASIC_HASHMUL_VAL 2149645487U
155 #endif // MN_THREAD_CONFIG_BASIC_HASHMUL_VAL
156 
157 //==================================
158 // end basic config
159 
160 
161 // start task config
162 //==================================
163 #ifndef MN_THREAD_CONFIG_CORE_PRIORITY_IDLE
167  #define MN_THREAD_CONFIG_CORE_PRIORITY_IDLE tskIDLE_PRIORITY
168 #endif
169 
170 #ifndef MN_THREAD_CONFIG_CORE_PRIORITY_LOW
174  #define MN_THREAD_CONFIG_CORE_PRIORITY_LOW 1
175 #endif
176 
177 #ifndef MN_THREAD_CONFIG_CORE_PRIORITY_NORM
181  #define MN_THREAD_CONFIG_CORE_PRIORITY_NORM 2
182 #endif
183 
184 #ifndef MN_THREAD_CONFIG_CORE_PRIORITY_HALFCRT
188  #define MN_THREAD_CONFIG_CORE_PRIORITY_HALFCRT (configMAX_PRIORITIES-1)/2
189 #endif
190 
191 #ifndef MN_THREAD_CONFIG_CORE_PRIORITY_URGENT
195  #define MN_THREAD_CONFIG_CORE_PRIORITY_URGENT (configMAX_PRIORITIES-2)
196 #endif
197 
198 #ifndef MN_THREAD_CONFIG_CORE_PRIORITY_CRITICAL
202  #define MN_THREAD_CONFIG_CORE_PRIORITY_CRITICAL (configMAX_PRIORITIES-1)
203 #endif
204 
205 #ifndef MN_THREAD_CONFIG_CONDITION_VARIABLE_SUPPORT
211  #define MN_THREAD_CONFIG_CONDITION_VARIABLE_SUPPORT MN_THREAD_CONFIG_YES
212 #endif
213 
214 #ifndef MN_THREAD_CONFIG_MINIMAL_STACK_SIZE
219  #define MN_THREAD_CONFIG_MINIMAL_STACK_SIZE 2048
220 #endif
221 
222 #ifndef MN_THREAD_CONFIG_MSGTASK_MAX_MESSAGES
229  #define MN_THREAD_CONFIG_MSGTASK_MAX_MESSAGES 5
230 #endif
231 
232 
233 #ifndef MN_THREAD_CONFIG_FOREIGIN_TASK_SUPPORT
241  #define MN_THREAD_CONFIG_FOREIGIN_TASK_SUPPORT MN_THREAD_CONFIG_YES
242 #endif
243 
244 #ifndef MN_THREAD_CONFIG_LOCK_TYPE
252  #define MN_THREAD_CONFIG_LOCK_TYPE MN_THREAD_CONFIG_BINARY_SEMAPHORE
253 #endif
254 
255 #ifndef MN_THREAD_CONFIG_ADD_TASK_TO_TASK_LIST
259  #define MN_THREAD_CONFIG_ADD_TASK_TO_TASK_LIST MN_THREAD_CONFIG_NO
260 #endif
261 //==================================
262 // end task config
263 
264 
265 // start workqueue config
266 //==================================
267 #ifndef MN_THREAD_CONFIG_WORKQUEUE_GETNEXTITEM_TIMEOUT
273  #define MN_THREAD_CONFIG_WORKQUEUE_GETNEXTITEM_TIMEOUT 512
274 #endif
275 
276 #ifndef MN_THREAD_CONFIG_WORKQUEUE_SINGLE_MAXITEMS
280  #define MN_THREAD_CONFIG_WORKQUEUE_SINGLE_MAXITEMS 8
281 #endif
282 
283 #ifndef MN_THREAD_CONFIG_WORKQUEUE_SINGLE_STACKSIZE
288  #define MN_THREAD_CONFIG_WORKQUEUE_SINGLE_STACKSIZE MN_THREAD_CONFIG_MINIMAL_STACK_SIZE
289 #endif
290 
291 #ifndef MN_THREAD_CONFIG_WORKQUEUE_SINGLE_PRIORITY
296  #define MN_THREAD_CONFIG_WORKQUEUE_SINGLE_PRIORITY mn::basic_task::priority::Low
297 #endif
298 
299 #ifndef MN_THREAD_CONFIG_WORKQUEUE_MULTI_WORKER
304  #define MN_THREAD_CONFIG_WORKQUEUE_MULTI_WORKER 4
305 #endif
306 
307 #ifndef MN_THREAD_CONFIG_WORKQUEUE_MULTI_MAXITEMS
312  #define MN_THREAD_CONFIG_WORKQUEUE_MULTI_MAXITEMS 8
313 #endif
314 
315 #ifndef MN_THREAD_CONFIG_WORKQUEUE_MULTI_STACKSIZE
320  #define MN_THREAD_CONFIG_WORKQUEUE_MULTI_STACKSIZE MN_THREAD_CONFIG_MINIMAL_STACK_SIZE
321 #endif
322 
323 #ifndef MN_THREAD_CONFIG_WORKQUEUE_MULTI_PRIORITY
328  #define MN_THREAD_CONFIG_WORKQUEUE_MULTI_PRIORITY mn::basic_task::priority::Low
329 #endif
330 //==================================
331 // end workqueue config
332 
333 
334 // start SEMAPHORE config
335 //==================================
336 #ifndef MN_THREAD_CONFIG_TIMEOUT_SEMAPHORE_DEFAULT
342  #define MN_THREAD_CONFIG_TIMEOUT_SEMAPHORE_DEFAULT (unsigned int) 0xffffffffUL
343 #endif
344 
345 #ifndef MN_THREAD_CONFIG_CSEMAPHORE_MIN_COUNT
349  #define MN_THREAD_CONFIG_CSEMAPHORE_MIN_COUNT 1
350 #endif
351 
352 #ifndef MN_THREAD_CONFIG_CSEMAPHORE_MAX_COUNT
357  #define MN_THREAD_CONFIG_CSEMAPHORE_MAX_COUNT 0x7fffffff
358 #endif
359 // end SEMAPHORE config
360 
361 // start mutex config
362 #ifndef MN_THREAD_CONFIG_TIMEOUT_MUTEX_DEFAULT
368  #define MN_THREAD_CONFIG_TIMEOUT_MUTEX_DEFAULT (unsigned int) 0xffffffffUL
369 #endif
370 
371 #ifndef MN_THREAD_CONFIG_RECURSIVE_MUTEX_CHEAKING
376  #define MN_THREAD_CONFIG_RECURSIVE_MUTEX_CHEAKING MN_THREAD_CONFIG_YES
377 #endif
378 // end mutex config
379 
380 // start queue config
381 #ifndef MN_THREAD_CONFIG_TIMEOUT_QUEUE_DEFAULT
387  #define MN_THREAD_CONFIG_TIMEOUT_QUEUE_DEFAULT (unsigned int) 0xffffffffUL
388 #endif
389 //==================================
390 // end queue config
391 
392 // start tasklet config
393 //==================================
394 #ifndef MN_THREAD_CONFIG_TIMEOUT_COROUTINE_DEFAULT
400  #define MN_THREAD_CONFIG_TIMEOUT_COROUTINE_DEFAULT (unsigned int) 0xffffffffUL
401 #endif
402 //==================================
403 // end tasklet config
404 
405 // start sharedobject config
406 //==================================
407 #ifndef MN_THREAD_CONFIG_SHAREDOBJECT_PREUSING
409  #define MN_THREAD_CONFIG_SHAREDOBJECT_PREUSING MN_THREAD_CONFIG_YES
410 #endif //MN_THREAD_CONFIG_SHAREDOBJECT_PREUSING
411 //==================================
412 // end sharedobject config
413 
414 // start mempool config
415 //==================================
416 #ifndef MN_THREAD_CONFIG_MEMPOOL_USE_MAGIC
418  #define MN_THREAD_CONFIG_MEMPOOL_USE_MAGIC MN_THREAD_CONFIG_NO
419 #endif //MN_THREAD_CONFIG_SHAREDOBJECT_PREUSING
420 
421 #ifndef MN_THREAD_CONFIG_MEMPOOL_MAGIC_START
423  #define MN_THREAD_CONFIG_MEMPOOL_MAGIC_START 0x6d //109
424 #endif
425 
426 #ifndef MN_THREAD_CONFIG_MEMPOOL_MAGIC_END
428  #define MN_THREAD_CONFIG_MEMPOOL_MAGIC_END 0xa8 //168
429 #endif
430 
431 #ifndef MN_THREAD_CONFIG_MEMPOOL_USETIMED
437  #define MN_THREAD_CONFIG_MEMPOOL_USETIMED MN_THREAD_CONFIG_YES
438 #endif
439 //==================================
440 // end mempool config
441 
442 
443 // start allocator config
444 //==================================
445 #ifndef MN_THREAD_CONFIG_ALLOCATOR_DEFAULT
450  #define MN_THREAD_CONFIG_ALLOCATOR_DEFAULT MN_THREAD_CONFIG_ALLOCATOR_SYSTEM
451 #endif
452 //==================================
453 // end allocator config
454 
455 
456 // start tickhook config
457 //==================================
458 #ifndef MN_THREAD_CONFIG_TICKHOOK_MAXENTRYS
460  #define MN_THREAD_CONFIG_TICKHOOK_MAXENTRYS 10
461 #endif
462 //==================================
463 // end tickhook config
464 
465 
466 
467 // start net / socket config
468 //==================================
469 #ifndef MN_THREAD_CONFIG_NET_IPADDRESS6_ENABLE
470  #define MN_THREAD_CONFIG_NET_IPADDRESS6_ENABLE MN_THREAD_CONFIG_YES
471 #endif
472 
473 #ifndef MN_THREAD_CONFIG_NET_IPADDRESS6_USE_SCOPEID
474  #define MN_THREAD_CONFIG_NET_IPADDRESS6_USE_SCOPEID MN_THREAD_CONFIG_NO
475 #endif
476 
477 #ifndef MN_THREAD_CONFIG_NET_IPADDRESS6_SCOPEID_VAL
478  #define MN_THREAD_CONFIG_NET_IPADDRESS6_SCOPEID_VAL 0
479 #endif
480 //==================================
481 // end net / socket config
482 
483 #ifndef MN_THREAD_CONFIG_PREVIEW_FUTURE
490  #define MN_THREAD_CONFIG_PREVIEW_FUTURE MN_THREAD_CONFIG_NO
491 #endif
492 
493 // DO NOT EDIT AFTER THIS LINE!!!
494 // =================================================================
495 
496 #if MN_THREAD_CONFIG_PREVIEW_FUTURE == MN_THREAD_CONFIG_YES
498  #define MN_THREAD_BETA_MAJOR_VERSION 2
500  #define MN_THREAD_BETA_MINOR_VERSION 0
502  #define MN_THREAD_BETA_VERSION_STRING "-beta2.0"
503 #else
504  #define MN_THREAD_BETA_VERSION_STRING
505  #define MN_THREAD_BETA_MAJOR_VERSION 0
506  #define MN_THREAD_BETA_MINOR_VERSION 0
507 #endif // MN_THREAD_CONFIG_PREVIEW_FUTURE
508 
513 #if (configUSE_RECURSIVE_MUTEXES == 1)
514 
515  #if (MN_THREAD_CONFIG_RECURSIVE_MUTEX_CHEAKING == MN_THREAD_CONFIG_YES)
519  #define MN_THREAD_CONFIG_RECURSIVE_MUTEX MN_THREAD_CONFIG_YES
520  #else
524  #define MN_THREAD_CONFIG_RECURSIVE_MUTEX MN_THREAD_CONFIG_NO
525  #warning ("recursive mutex are not supported")
526  #endif // (MN_THREAD_CONFIG_RECURSIVE_MUTEX_CHEAKING == MN_THREAD_CONFIG_YES)
527 
528 #endif //configUSE_RECURSIVE_MUTEXES
529 
530 
531 #ifndef MN_THREAD_CONFIG_FREELIST_MEMPOOL_FREE
533  #define MN_THREAD_CONFIG_FREELIST_MEMPOOL_FREE 1
534 #endif
535 
536 #ifndef MN_THREAD_CONFIG_FREELIST_MEMPOOL_USED
538  #define MN_THREAD_CONFIG_FREELIST_MEMPOOL_USED 0
539 #endif
540 
541 #ifndef MN_THREAD_CONFIG_USE_TRACE
542  #define MN_THREAD_CONFIG_USE_TRACE configUSE_TRACE_FACILITY
543 #endif
544 
545 #if defined(__has_builtin)
546  #define MN_THREAD_CONFIG_HAS_BUILTIN MN_THREAD_CONFIG_YES
547 #else
548  #define MN_THREAD_CONFIG_HAS_BUILTIN MN_THREAD_CONFIG_NO
549 #endif // defined
550 
551 
552 #include "mn_defines.hpp"
553 
554 
555 #endif //__MINLIB_MNTHREAD_CONFIG_H__