xref: /btstack/port/stm32-wb55xx-nucleo-freertos/Inc/FreeRTOSConfig.h (revision 0561b2d8d5dba972c7daa57d5e677f7a1327edfd)
1 /*
2  * FreeRTOS Kernel V10.2.0
3  * Copyright (C) 2017 Amazon.com, Inc. or its affiliates.  All Rights Reserved.
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a copy of
6  * this software and associated documentation files (the "Software"), to deal in
7  * the Software without restriction, including without limitation the rights to
8  * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9  * the Software, and to permit persons to whom the Software is furnished to do so,
10  * subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice shall be included in all
13  * copies or substantial portions of the Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17  * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18  * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19  * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21  *
22  * http://aws.amazon.com/freertos
23  * http://www.FreeRTOS.org
24  */
25 
26 
27 #ifndef FREERTOS_CONFIG_H
28 #define FREERTOS_CONFIG_H
29 
30 /*-----------------------------------------------------------
31  * Application specific definitions.
32  *
33  * These definitions should be adjusted for your particular hardware and
34  * application requirements.
35  *
36  * THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
37  * FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
38  *
39  * See http://www.freertos.org/a00110.html.
40  *----------------------------------------------------------*/
41 
42 /* Section where include file can be added */
43 #include "stm32wbxx_hal.h"
44 
45 /* Ensure stdint is only used by the compiler, and not the assembler. */
46 #if defined(__ICCARM__) || defined(__CC_ARM) || defined(__GNUC__)
47 #include <stdint.h>
48 #endif
49 
50 #define configUSE_PREEMPTION                    1
51 #define configUSE_PORT_OPTIMISED_TASK_SELECTION 1
52 #define configUSE_TICKLESS_IDLE                 1
53 #define configCPU_CLOCK_HZ                      ( SystemCoreClock )
54 #define configTICK_RATE_HZ                      ((TickType_t)1000)
55 #define configMAX_PRIORITIES                    ( 8 )
56 #define configMINIMAL_STACK_SIZE                ((uint16_t)128)
57 #define configUSE_16_BIT_TICKS                  0
58 
59 #define configIDLE_SHOULD_YIELD                 1
60 #define configUSE_TASK_NOTIFICATIONS            1
61 #define configUSE_MUTEXES                       1
62 #define configUSE_RECURSIVE_MUTEXES             1
63 #define configUSE_COUNTING_SEMAPHORES           1
64 #define configUSE_ALTERNATIVE_API               0 /* Deprecated! */
65 #define configUSE_QUEUE_SETS                    0
66 #define configUSE_TIME_SLICING                  0
67 #define configUSE_NEWLIB_REENTRANT              0
68 #define configENABLE_BACKWARD_COMPATIBILITY     0
69 #define configNUM_THREAD_LOCAL_STORAGE_POINTERS 0
70 
71 /* Memory allocation related definitions. */
72 #define configSUPPORT_STATIC_ALLOCATION         0
73 #define configSUPPORT_DYNAMIC_ALLOCATION        1
74 #define configTOTAL_HEAP_SIZE                   ((size_t)12*1024)
75 #define configUSE_HEAP_SCHEME                   4
76 #define configAPPLICATION_ALLOCATED_HEAP        0
77 
78 /* Hook function related definitions. */
79 #define configUSE_IDLE_HOOK                     0
80 #define configUSE_TICK_HOOK                     0
81 #define configCHECK_FOR_STACK_OVERFLOW          2
82 #define configUSE_MALLOC_FAILED_HOOK            0
83 #define configUSE_DAEMON_TASK_STARTUP_HOOK      0
84 
85 /* Debug enablement */
86 #define configUSE_TRACE_FACILITY                1
87 #define configMAX_TASK_NAME_LEN                 20
88 #define configQUEUE_REGISTRY_SIZE               10
89 #define configRECORD_STACK_HIGH_ADDRESS			1
90 #define configGENERATE_RUN_TIME_STATS           0
91 #define configGENERATE_RUN_TIME_STATS_USE_TICKS 0
92 
93 /* Co-routine definitions. */
94 #define configUSE_CO_ROUTINES                   0
95 #define configMAX_CO_ROUTINE_PRIORITIES         2
96 
97 /* Software timer related definitions. */
98 #define configUSE_TIMERS                        1
99 #define configTIMER_TASK_PRIORITY               3
100 #define configTIMER_QUEUE_LENGTH                10
101 #define configTIMER_TASK_STACK_DEPTH            configMINIMAL_STACK_SIZE
102 
103 /* Interrupt nesting behaviour configuration. */
104 #define configLIBRARY_LOWEST_INTERRUPT_PRIORITY 15
105 #define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 5
106 #define configKERNEL_INTERRUPT_PRIORITY         ( configLIBRARY_LOWEST_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
107 #define configMAX_SYSCALL_INTERRUPT_PRIORITY    ( configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
108 
109 /* Define to trap errors during development. */
110 #define configASSERT( x ) if ((x) == 0) {taskDISABLE_INTERRUPTS(); for( ;; );}
111 
112 /* FreeRTOS MPU specific definitions. */
113 #define configINCLUDE_APPLICATION_DEFINED_PRIVILEGED_FUNCTIONS 0
114 
115 /* Optional functions - most linkers will remove unused functions anyway. */
116 #define INCLUDE_vTaskPrioritySet            1
117 #define INCLUDE_uxTaskPriorityGet           1
118 #define INCLUDE_vTaskDelete                 1
119 #define INCLUDE_vTaskCleanUpResources       0
120 #define INCLUDE_vTaskSuspend                1
121 #define INCLUDE_vTaskDelayUntil             0
122 #define INCLUDE_vTaskDelay                  1
123 #define INCLUDE_xTaskGetSchedulerState      1
124 #define INCLUDE_xTaskGetCurrentTaskHandle   1
125 #define INCLUDE_xQueueGetMutexHolder        1
126 #define INCLUDE_uxTaskGetStackHighWaterMark 1
127 
128 /* Cortex-M specific definitions. */
129 #ifdef __NVIC_PRIO_BITS
130  /* __BVIC_PRIO_BITS will be specified when CMSIS is being used. */
131  #define configPRIO_BITS         __NVIC_PRIO_BITS
132 #else
133  #define configPRIO_BITS         4
134 #endif
135 
136 /* Definitions that map the FreeRTOS port interrupt handlers to their CMSIS
137 standard names. */
138 #define vPortSVCHandler    SVC_Handler
139 #define xPortPendSVHandler PendSV_Handler
140 
141 #define xPortSysTickHandler SysTick_Handler
142 
143 /* Section where parameter definitions can be added (for instance, to override default ones in FreeRTOS.h) */
144 
145 #if defined(__ICCARM__) || defined(__CC_ARM) || defined(__GNUC__)
146 void PreSleepProcessing(uint32_t ulExpectedIdleTime);
147 void PostSleepProcessing(uint32_t ulExpectedIdleTime);
148 #endif /* defined(__ICCARM__) || defined(__CC_ARM) || defined(__GNUC__) */
149 
150 /* The configPRE_SLEEP_PROCESSING() and configPOST_SLEEP_PROCESSING() macros
151 allow the application writer to add additional code before and after the MCU is
152 placed into the low power state respectively. */
153 #if configUSE_TICKLESS_IDLE == 1
154 #define configPRE_SLEEP_PROCESSING(idleTime)              do { \
155                                                                 idleTime = 0; \
156                                                                 HAL_PWR_EnterSLEEPMode(PWR_MAINREGULATOR_ON, PWR_SLEEPENTRY_WFI); \
157                                                             } while(0)
158 
159 #define configPOST_SLEEP_PROCESSING(unusedVar)            do {} while(0)
160 #endif /* configUSE_TICKLESS_IDLE == 1 */
161 
162 #endif /* FREERTOS_CONFIG_H */
163