|
26 | 26 | * 1 tab == 4 spaces!
|
27 | 27 | */
|
28 | 28 |
|
29 |
| - |
30 | 29 | #ifndef FREERTOS_CONFIG_H
|
31 | 30 | #define FREERTOS_CONFIG_H
|
32 | 31 |
|
33 | 32 | #ifdef SOFTDEVICE_PRESENT
|
34 |
| -#include "nrf_soc.h" |
| 33 | + #include "nrf_soc.h" |
35 | 34 | #endif
|
36 | 35 | #include "app_util_platform.h"
|
37 | 36 |
|
38 | 37 | /*-----------------------------------------------------------
|
39 | 38 | * Possible configurations for system timer
|
40 | 39 | */
|
41 |
| -#define FREERTOS_USE_RTC 0 /**< Use real time clock for the system */ |
42 |
| -#define FREERTOS_USE_SYSTICK 1 /**< Use SysTick timer for system */ |
| 40 | +#define FREERTOS_USE_RTC 0 /**< Use real time clock for the system */ |
| 41 | +#define FREERTOS_USE_SYSTICK 1 /**< Use SysTick timer for system */ |
43 | 42 |
|
44 | 43 | /*-----------------------------------------------------------
|
45 | 44 | * Application specific definitions.
|
|
55 | 54 |
|
56 | 55 | #define configTICK_SOURCE FREERTOS_USE_RTC
|
57 | 56 |
|
58 |
| -#define configUSE_PREEMPTION 1 |
| 57 | +#define configUSE_PREEMPTION 1 |
59 | 58 | #define configUSE_PORT_OPTIMISED_TASK_SELECTION 1
|
60 |
| -#define configUSE_TICKLESS_IDLE 1 |
61 |
| -#define configUSE_TICKLESS_IDLE_SIMPLE_DEBUG 0 /* See into vPortSuppressTicksAndSleep source code for explanation */ |
62 |
| -#define configCPU_CLOCK_HZ ( SystemCoreClock ) |
63 |
| -#define configTICK_RATE_HZ 1024 |
64 |
| -#define configMAX_PRIORITIES ( 3 ) |
65 |
| -#define configMINIMAL_STACK_SIZE ( 120 ) |
66 |
| -#define configTOTAL_HEAP_SIZE ( 1024*16 ) |
67 |
| -#define configMAX_TASK_NAME_LEN ( 4 ) |
68 |
| -#define configUSE_16_BIT_TICKS 0 |
69 |
| -#define configIDLE_SHOULD_YIELD 1 |
70 |
| -#define configUSE_MUTEXES 1 |
71 |
| -#define configUSE_RECURSIVE_MUTEXES 1 |
72 |
| -#define configUSE_COUNTING_SEMAPHORES 1 |
73 |
| -#define configUSE_ALTERNATIVE_API 0 /* Deprecated! */ |
74 |
| -#define configQUEUE_REGISTRY_SIZE 2 |
75 |
| -#define configUSE_QUEUE_SETS 0 |
76 |
| -#define configUSE_TIME_SLICING 0 |
77 |
| -#define configUSE_NEWLIB_REENTRANT 0 |
78 |
| -#define configENABLE_BACKWARD_COMPATIBILITY 1 |
| 59 | +#define configUSE_TICKLESS_IDLE 1 |
| 60 | +#define configUSE_TICKLESS_IDLE_SIMPLE_DEBUG 0 /* See into vPortSuppressTicksAndSleep source code for explanation */ |
| 61 | +#define configCPU_CLOCK_HZ (SystemCoreClock) |
| 62 | +#define configTICK_RATE_HZ 1024 |
| 63 | +#define configMAX_PRIORITIES (3) |
| 64 | +#define configMINIMAL_STACK_SIZE (120) |
| 65 | +#define configTOTAL_HEAP_SIZE (1024 * 16) |
| 66 | +#define configMAX_TASK_NAME_LEN (4) |
| 67 | +#define configUSE_16_BIT_TICKS 0 |
| 68 | +#define configIDLE_SHOULD_YIELD 1 |
| 69 | +#define configUSE_MUTEXES 1 |
| 70 | +#define configUSE_RECURSIVE_MUTEXES 1 |
| 71 | +#define configUSE_COUNTING_SEMAPHORES 1 |
| 72 | +#define configUSE_ALTERNATIVE_API 0 /* Deprecated! */ |
| 73 | +#define configQUEUE_REGISTRY_SIZE 2 |
| 74 | +#define configUSE_QUEUE_SETS 0 |
| 75 | +#define configUSE_TIME_SLICING 0 |
| 76 | +#define configUSE_NEWLIB_REENTRANT 0 |
| 77 | +#define configENABLE_BACKWARD_COMPATIBILITY 1 |
79 | 78 |
|
80 | 79 | /* Hook function related definitions. */
|
81 |
| -#define configUSE_IDLE_HOOK 1 |
82 |
| -#define configUSE_TICK_HOOK 0 |
83 |
| -#define configCHECK_FOR_STACK_OVERFLOW 0 |
84 |
| -#define configUSE_MALLOC_FAILED_HOOK 0 |
| 80 | +#define configUSE_IDLE_HOOK 1 |
| 81 | +#define configUSE_TICK_HOOK 0 |
| 82 | +#define configCHECK_FOR_STACK_OVERFLOW 0 |
| 83 | +#define configUSE_MALLOC_FAILED_HOOK 0 |
85 | 84 |
|
86 | 85 | /* Run time and task stats gathering related definitions. */
|
87 |
| -#define configGENERATE_RUN_TIME_STATS 0 |
88 |
| -#define configUSE_TRACE_FACILITY 1 |
89 |
| -#define configUSE_STATS_FORMATTING_FUNCTIONS 0 |
| 86 | +#define configGENERATE_RUN_TIME_STATS 0 |
| 87 | +#define configUSE_TRACE_FACILITY 1 |
| 88 | +#define configUSE_STATS_FORMATTING_FUNCTIONS 0 |
90 | 89 |
|
91 | 90 | /* Co-routine definitions. */
|
92 |
| -#define configUSE_CO_ROUTINES 0 |
93 |
| -#define configMAX_CO_ROUTINE_PRIORITIES ( 2 ) |
| 91 | +#define configUSE_CO_ROUTINES 0 |
| 92 | +#define configMAX_CO_ROUTINE_PRIORITIES (2) |
94 | 93 |
|
95 | 94 | /* Software timer definitions. */
|
96 |
| -#define configUSE_TIMERS 1 |
97 |
| -#define configTIMER_TASK_PRIORITY ( 0 ) |
98 |
| -#define configTIMER_QUEUE_LENGTH 32 |
99 |
| -#define configTIMER_TASK_STACK_DEPTH ( 300 ) |
| 95 | +#define configUSE_TIMERS 1 |
| 96 | +#define configTIMER_TASK_PRIORITY (0) |
| 97 | +#define configTIMER_QUEUE_LENGTH 32 |
| 98 | +#define configTIMER_TASK_STACK_DEPTH (300) |
100 | 99 |
|
101 | 100 | /* Tickless Idle configuration. */
|
102 |
| -#define configEXPECTED_IDLE_TIME_BEFORE_SLEEP 2 |
| 101 | +#define configEXPECTED_IDLE_TIME_BEFORE_SLEEP 2 |
103 | 102 |
|
104 | 103 | /* Tickless idle/low power functionality. */
|
105 | 104 |
|
106 |
| - |
107 | 105 | /* Define to trap errors during development. */
|
108 | 106 | #if defined(DEBUG_NRF) || defined(DEBUG_NRF_USER)
|
109 |
| -#define configASSERT( x ) ASSERT(x) |
| 107 | + #define configASSERT(x) ASSERT(x) |
110 | 108 | #endif
|
111 | 109 |
|
112 | 110 | /* FreeRTOS MPU specific definitions. */
|
113 |
| -#define configINCLUDE_APPLICATION_DEFINED_PRIVILEGED_FUNCTIONS 1 |
| 111 | +#define configINCLUDE_APPLICATION_DEFINED_PRIVILEGED_FUNCTIONS 1 |
114 | 112 |
|
115 | 113 | /* 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_vTaskSuspend 1 |
120 |
| -#define INCLUDE_xResumeFromISR 1 |
121 |
| -#define INCLUDE_vTaskDelayUntil 1 |
122 |
| -#define INCLUDE_vTaskDelay 1 |
123 |
| -#define INCLUDE_xTaskGetSchedulerState 1 |
124 |
| -#define INCLUDE_xTaskGetCurrentTaskHandle 1 |
125 |
| -#define INCLUDE_uxTaskGetStackHighWaterMark 1 |
126 |
| -#define INCLUDE_xTaskGetIdleTaskHandle 1 |
127 |
| -#define INCLUDE_xTimerGetTimerDaemonTaskHandle 1 |
128 |
| -#define INCLUDE_pcTaskGetTaskName 1 |
129 |
| -#define INCLUDE_eTaskGetState 1 |
130 |
| -#define INCLUDE_xEventGroupSetBitFromISR 1 |
131 |
| -#define INCLUDE_xTimerPendFunctionCall 1 |
| 114 | +#define INCLUDE_vTaskPrioritySet 1 |
| 115 | +#define INCLUDE_uxTaskPriorityGet 1 |
| 116 | +#define INCLUDE_vTaskDelete 1 |
| 117 | +#define INCLUDE_vTaskSuspend 1 |
| 118 | +#define INCLUDE_xResumeFromISR 1 |
| 119 | +#define INCLUDE_vTaskDelayUntil 1 |
| 120 | +#define INCLUDE_vTaskDelay 1 |
| 121 | +#define INCLUDE_xTaskGetSchedulerState 1 |
| 122 | +#define INCLUDE_xTaskGetCurrentTaskHandle 1 |
| 123 | +#define INCLUDE_uxTaskGetStackHighWaterMark 1 |
| 124 | +#define INCLUDE_xTaskGetIdleTaskHandle 1 |
| 125 | +#define INCLUDE_xTimerGetTimerDaemonTaskHandle 1 |
| 126 | +#define INCLUDE_pcTaskGetTaskName 1 |
| 127 | +#define INCLUDE_eTaskGetState 1 |
| 128 | +#define INCLUDE_xEventGroupSetBitFromISR 1 |
| 129 | +#define INCLUDE_xTimerPendFunctionCall 1 |
132 | 130 |
|
133 | 131 | /* The lowest interrupt priority that can be used in a call to a "set priority"
|
134 | 132 | function. */
|
135 |
| -#define configLIBRARY_LOWEST_INTERRUPT_PRIORITY 0xf |
| 133 | +#define configLIBRARY_LOWEST_INTERRUPT_PRIORITY 0xf |
136 | 134 |
|
137 | 135 | /* The highest interrupt priority that can be used by any interrupt service
|
138 | 136 | routine that makes calls to interrupt safe FreeRTOS API functions. DO NOT CALL
|
139 | 137 | INTERRUPT SAFE FREERTOS API FUNCTIONS FROM ANY INTERRUPT THAT HAS A HIGHER
|
140 | 138 | PRIORITY THAN THIS! (higher priorities are lower numeric values. */
|
141 |
| -#define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY _PRIO_APP_HIGH |
142 |
| - |
| 139 | +#define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY _PRIO_APP_HIGH |
143 | 140 |
|
144 | 141 | /* Interrupt priorities used by the kernel port layer itself. These are generic
|
145 | 142 | to all Cortex-M ports, and do not rely on any particular library functions. */
|
146 |
| -#define configKERNEL_INTERRUPT_PRIORITY configLIBRARY_LOWEST_INTERRUPT_PRIORITY |
| 143 | +#define configKERNEL_INTERRUPT_PRIORITY configLIBRARY_LOWEST_INTERRUPT_PRIORITY |
147 | 144 | /* !!!! configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to zero !!!!
|
148 | 145 | See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */
|
149 |
| -#define configMAX_SYSCALL_INTERRUPT_PRIORITY configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY |
| 146 | +#define configMAX_SYSCALL_INTERRUPT_PRIORITY configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY |
150 | 147 |
|
151 | 148 | /* Definitions that map the FreeRTOS port interrupt handlers to their CMSIS
|
152 | 149 | standard names - or at least those used in the unmodified vector table. */
|
153 | 150 |
|
154 |
| -#define vPortSVCHandler SVC_Handler |
155 |
| -#define xPortPendSVHandler PendSV_Handler |
156 |
| - |
| 151 | +#define vPortSVCHandler SVC_Handler |
| 152 | +#define xPortPendSVHandler PendSV_Handler |
157 | 153 |
|
158 | 154 | /*-----------------------------------------------------------
|
159 | 155 | * Settings that are generated automatically
|
160 | 156 | * basing on the settings above
|
161 | 157 | */
|
162 | 158 | #if (configTICK_SOURCE == FREERTOS_USE_SYSTICK)
|
163 |
| - // do not define configSYSTICK_CLOCK_HZ for SysTick to be configured automatically |
164 |
| - // to CPU clock source |
165 |
| - #define xPortSysTickHandler SysTick_Handler |
| 159 | + // do not define configSYSTICK_CLOCK_HZ for SysTick to be configured automatically |
| 160 | + // to CPU clock source |
| 161 | + #define xPortSysTickHandler SysTick_Handler |
166 | 162 | #elif (configTICK_SOURCE == FREERTOS_USE_RTC)
|
167 |
| - #define configSYSTICK_CLOCK_HZ ( 32768UL ) |
168 |
| - #define xPortSysTickHandler RTC1_IRQHandler |
| 163 | + #define configSYSTICK_CLOCK_HZ (32768UL) |
| 164 | + #define xPortSysTickHandler RTC1_IRQHandler |
169 | 165 | #else
|
170 |
| - #error Unsupported configTICK_SOURCE value |
| 166 | + #error Unsupported configTICK_SOURCE value |
171 | 167 | #endif
|
172 | 168 |
|
173 | 169 | /* Code below should be only used by the compiler, and not the assembler. */
|
174 | 170 | #if !(defined(__ASSEMBLY__) || defined(__ASSEMBLER__))
|
175 |
| - #include "nrf.h" |
176 |
| - #include "nrf_assert.h" |
177 |
| - |
178 |
| - /* This part of definitions may be problematic in assembly - it uses definitions from files that are not assembly compatible. */ |
179 |
| - /* Cortex-M specific definitions. */ |
180 |
| - #ifdef __NVIC_PRIO_BITS |
181 |
| - /* __BVIC_PRIO_BITS will be specified when CMSIS is being used. */ |
182 |
| - #define configPRIO_BITS __NVIC_PRIO_BITS |
183 |
| - #else |
184 |
| - #error "This port requires __NVIC_PRIO_BITS to be defined" |
185 |
| - #endif |
186 |
| - |
187 |
| - /* Access to current system core clock is required only if we are ticking the system by systimer */ |
188 |
| - #if (configTICK_SOURCE == FREERTOS_USE_SYSTICK) |
189 |
| - #include <stdint.h> |
190 |
| - extern uint32_t SystemCoreClock; |
191 |
| - #endif |
| 171 | + #include "nrf.h" |
| 172 | + #include "nrf_assert.h" |
| 173 | + |
| 174 | + /* This part of definitions may be problematic in assembly - it uses definitions from files that are not assembly compatible. */ |
| 175 | + /* Cortex-M specific definitions. */ |
| 176 | + #ifdef __NVIC_PRIO_BITS |
| 177 | + /* __BVIC_PRIO_BITS will be specified when CMSIS is being used. */ |
| 178 | + #define configPRIO_BITS __NVIC_PRIO_BITS |
| 179 | + #else |
| 180 | + #error "This port requires __NVIC_PRIO_BITS to be defined" |
| 181 | + #endif |
| 182 | + |
| 183 | + /* Access to current system core clock is required only if we are ticking the system by systimer */ |
| 184 | + #if (configTICK_SOURCE == FREERTOS_USE_SYSTICK) |
| 185 | + #include <stdint.h> |
| 186 | +extern uint32_t SystemCoreClock; |
| 187 | + #endif |
192 | 188 | #endif /* !assembler */
|
193 | 189 |
|
194 | 190 | /** Implementation note: Use this with caution and set this to 1 ONLY for debugging
|
195 | 191 | * ----------------------------------------------------------
|
196 |
| - * Set the value of configUSE_DISABLE_TICK_AUTO_CORRECTION_DEBUG to below for enabling or disabling RTOS tick auto correction: |
197 |
| - * 0. This is default. If the RTC tick interrupt is masked for more than 1 tick by higher priority interrupts, then most likely |
198 |
| - * one or more RTC ticks are lost. The tick interrupt inside RTOS will detect this and make a correction needed. This is needed |
199 |
| - * for the RTOS internal timers to be more accurate. |
200 |
| - * 1. The auto correction for RTOS tick is disabled even though few RTC tick interrupts were lost. This feature is desirable when debugging |
201 |
| - * the RTOS application and stepping though the code. After stepping when the application is continued in debug mode, the auto-corrections of |
202 |
| - * RTOS tick might cause asserts. Setting configUSE_DISABLE_TICK_AUTO_CORRECTION_DEBUG to 1 will make RTC and RTOS go out of sync but could be |
203 |
| - * convenient for debugging. |
204 |
| - */ |
205 |
| -#define configUSE_DISABLE_TICK_AUTO_CORRECTION_DEBUG 0 |
| 192 | + * Set the value of configUSE_DISABLE_TICK_AUTO_CORRECTION_DEBUG to below for enabling or disabling RTOS tick auto correction: |
| 193 | + * 0. This is default. If the RTC tick interrupt is masked for more than 1 tick by higher priority interrupts, then most likely |
| 194 | + * one or more RTC ticks are lost. The tick interrupt inside RTOS will detect this and make a correction needed. This is needed |
| 195 | + * for the RTOS internal timers to be more accurate. |
| 196 | + * 1. The auto correction for RTOS tick is disabled even though few RTC tick interrupts were lost. This feature is desirable when debugging |
| 197 | + * the RTOS application and stepping though the code. After stepping when the application is continued in debug mode, the |
| 198 | + * auto-corrections of RTOS tick might cause asserts. Setting configUSE_DISABLE_TICK_AUTO_CORRECTION_DEBUG to 1 will make RTC and RTOS go |
| 199 | + * out of sync but could be convenient for debugging. |
| 200 | + */ |
| 201 | +#define configUSE_DISABLE_TICK_AUTO_CORRECTION_DEBUG 0 |
206 | 202 |
|
207 | 203 | #endif /* FREERTOS_CONFIG_H */
|
0 commit comments