Fix for x86_64 build fail
[platform/upstream/connectedhomeip.git] / examples / persistent-storage / efr32 / include / FreeRTOSConfig.h
1 /*
2  *
3  *    Copyright (c) 2020 Project CHIP Authors
4  *    All rights reserved.
5  *
6  *    Licensed under the Apache License, Version 2.0 (the "License");
7  *    you may not use this file except in compliance with the License.
8  *    You may obtain a copy of the License at
9  *
10  *        http://www.apache.org/licenses/LICENSE-2.0
11  *
12  *    Unless required by applicable law or agreed to in writing, software
13  *    distributed under the License is distributed on an "AS IS" BASIS,
14  *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  *    See the License for the specific language governing permissions and
16  *    limitations under the License.
17  */
18
19 /***************************************************************************
20  * # License
21  *
22  * The licensor of this software is Silicon Laboratories Inc. Your use of this
23  * software is governed by the terms of Silicon Labs Master Software License
24  * Agreement (MSLA) available at
25  * www.silabs.com/about-us/legal/master-software-license-agreement. This
26  * software is Third Party Software licensed by Silicon Labs from a third party
27  * and is governed by the sections of the MSLA applicable to Third Party
28  * Software and the additional terms set forth below.
29  *
30  ******************************************************************************/
31 /*
32     FreeRTOS V9.0.0 - Copyright (C) 2016 Real Time Engineers Ltd.
33     All rights reserved
34
35     VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
36
37     This file is part of the FreeRTOS distribution.
38
39     FreeRTOS is free software; you can redistribute it and/or modify it under
40     the terms of the GNU General Public License (version 2) as published by the
41     Free Software Foundation >>>> AND MODIFIED BY <<<< the FreeRTOS exception.
42
43     ***************************************************************************
44     >>!   NOTE: The modification to the GPL is included to allow you to     !<<
45     >>!   distribute a combined work that includes FreeRTOS without being   !<<
46     >>!   obliged to provide the source code for proprietary components     !<<
47     >>!   outside of the FreeRTOS kernel.                                   !<<
48     ***************************************************************************
49
50     FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
51     WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
52     FOR A PARTICULAR PURPOSE.  Full license text is available on the following
53     link: http://www.freertos.org/a00114.html
54
55     ***************************************************************************
56      *                                                                       *
57      *    FreeRTOS provides completely free yet professionally developed,    *
58      *    robust, strictly quality controlled, supported, and cross          *
59      *    platform software that is more than just the market leader, it     *
60      *    is the industry's de facto standard.                               *
61      *                                                                       *
62      *    Help yourself get started quickly while simultaneously helping     *
63      *    to support the FreeRTOS project by purchasing a FreeRTOS           *
64      *    tutorial book, reference manual, or both:                          *
65      *    http://www.FreeRTOS.org/Documentation                              *
66      *                                                                       *
67     ***************************************************************************
68
69     http://www.FreeRTOS.org/FAQHelp.html - Having a problem?  Start by reading
70     the FAQ page "My application does not run, what could be wrong?".  Have you
71     defined configASSERT()?
72
73     http://www.FreeRTOS.org/support - In return for receiving this top quality
74     embedded software for free we request you assist our global community by
75     participating in the support forum.
76
77     http://www.FreeRTOS.org/training - Investing in training allows your team to
78     be as productive as possible as early as possible.  Now you can receive
79     FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers
80     Ltd, and the world's leading authority on the world's leading RTOS.
81
82     http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
83     including FreeRTOS+Trace - an indispensable productivity tool, a DOS
84     compatible FAT file system, and our tiny thread aware UDP/IP stack.
85
86     http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.
87     Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.
88
89     http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High
90     Integrity Systems ltd. to sell under the OpenRTOS brand.  Low cost OpenRTOS
91     licenses offer ticketed support, indemnification and commercial middleware.
92
93     http://www.SafeRTOS.com - High Integrity Systems also provide a safety
94     engineered and independently SIL3 certified version for use in safety and
95     mission critical applications that require provable dependability.
96
97     1 tab == 4 spaces!
98 */
99
100 #pragma once
101
102 #ifdef __cplusplus
103 extern "C" {
104 #endif
105
106 #include "em_device.h"
107 #include <stdio.h>
108
109 /*-----------------------------------------------------------
110  * Application specific definitions.
111  *
112  * These definitions should be adjusted for your particular hardware and
113  * application requirements.
114  *
115  * THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
116  * FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
117  *
118  * See http://www.freertos.org/a00110.html.
119  *----------------------------------------------------------*/
120
121 /* Set configCREATE_LOW_POWER_DEMO as follows:
122  *
123  * 0: Build the full test and demo application.
124  * 1: Build the simple blinky tickless low power demo, generating the tick
125  *    interrupt from the RTCC.  EM2 will be entered.  The LXFO clock is used.
126  *  See the comments at the top of main.c, main_full.c and main_low_power.c for
127  *  more information.
128  */
129 #define configCREATE_LOW_POWER_DEMO (0)
130
131 /* Some configuration is dependent on the demo being built. */
132 #if (configCREATE_LOW_POWER_DEMO == 0)
133
134 /* Tickless mode is not used. */
135
136 /* Some of the standard demo test tasks assume a tick rate of 1KHz, even
137 though that is faster than would normally be warranted by a real
138 application. */
139 #define configTICK_RATE_HZ (1000)
140
141 /* The full demo always has tasks to run so the tick will never be turned
142 off.  The blinky demo will use the default tickless idle implementation to
143 turn the tick off. */
144 #define configUSE_TICKLESS_IDLE (0)
145
146 /* Hook function related definitions. */
147 #define configUSE_TICK_HOOK (1)
148 #define configCHECK_FOR_STACK_OVERFLOW (2)
149 #define configUSE_MALLOC_FAILED_HOOK (1)
150 #define configUSE_IDLE_HOOK (0)
151
152 #define configENERGY_MODE (sleepEM1)
153
154 #else
155
156 /* Tickless idle mode, generating RTOS tick interrupts from the RTC, fed
157 by the LXFO clock. */
158
159 /* The slow clock used to generate the tick interrupt in the low power demo
160 runs at 32768/8=4096Hz.  Ensure the tick rate is a multiple of the clock. */
161 #define configTICK_RATE_HZ (128)
162
163 /* The low power demo uses the tickless idle feature. */
164 #define configUSE_TICKLESS_IDLE (1)
165 #define configOVERRIDE_DEFAULT_TICK_CONFIGURATION (1)
166
167 /* Hook function related definitions. */
168 #define configUSE_TICK_HOOK (0)
169 #define configCHECK_FOR_STACK_OVERFLOW (0)
170 #define configUSE_MALLOC_FAILED_HOOK (0)
171 #define configUSE_IDLE_HOOK (0)
172
173 #define configENERGY_MODE (sleepEM3)
174 #endif
175
176 /* Main functions*/
177 /* Run time stats gathering related definitions. */
178 #define configGENERATE_RUN_TIME_STATS (0)
179
180 /* Co-routine related definitions. */
181 #define configUSE_CO_ROUTINES (0)
182 #define configMAX_CO_ROUTINE_PRIORITIES (1)
183
184 /* Software timer related definitions. */
185 #define configUSE_TIMERS (1)
186 #define configTIMER_TASK_PRIORITY (configMAX_PRIORITIES - 1) /* Highest priority */
187 #define configTIMER_QUEUE_LENGTH (10)
188 #define configTIMER_TASK_STACK_DEPTH (1024)
189
190 /* Cortex-M specific definitions. */
191 #ifdef __NVIC_PRIO_BITS
192 /* __BVIC_PRIO_BITS will be specified when CMSIS is being used. */
193 #define configPRIO_BITS (__NVIC_PRIO_BITS)
194 #else
195 #define configPRIO_BITS 3 /* 7 priority levels */
196 #endif
197
198 /* The lowest interrupt priority that can be used in a call to a "set priority"
199 function. */
200 #define configLIBRARY_LOWEST_INTERRUPT_PRIORITY (0x07)
201
202 /* The highest interrupt priority that can be used by any interrupt service
203 routine that makes calls to interrupt safe FreeRTOS API functions.  DO NOT CALL
204 INTERRUPT SAFE FREERTOS API FUNCTIONS FROM ANY INTERRUPT THAT HAS A HIGHER
205 PRIORITY THAN THIS! (higher priorities are lower numeric values. */
206 #define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY (0x03)
207
208 /* Interrupt priorities used by the kernel port layer itself.  These are generic
209 to all Cortex-M ports, and do not rely on any particular library functions. */
210 #define configKERNEL_INTERRUPT_PRIORITY (configLIBRARY_LOWEST_INTERRUPT_PRIORITY << (8 - configPRIO_BITS))
211 /* !!!! configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to zero !!!!
212 See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */
213 #define configMAX_SYSCALL_INTERRUPT_PRIORITY (configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS))
214
215 /* FreeRTOS MPU specific definitions. */
216 #define configINCLUDE_APPLICATION_DEFINED_PRIVILEGED_FUNCTIONS (1)
217
218 #define configCPU_CLOCK_HZ (SystemCoreClock)
219 #define configUSE_PREEMPTION (1)
220 #define configUSE_TIME_SLICING (1)
221 #define configUSE_PORT_OPTIMISED_TASK_SELECTION (1)
222 #define configUSE_TICKLESS_IDLE_SIMPLE_DEBUG (1) /* See into vPortSuppressTicksAndSleep source code for explanation */
223 #define configMAX_PRIORITIES (8)
224 #define configMINIMAL_STACK_SIZE (120) /* Number of words to use for Idle and Timer stacks */
225 #define configMAX_TASK_NAME_LEN (4)
226 #define configUSE_16_BIT_TICKS (0)
227 #define configIDLE_SHOULD_YIELD (0)
228 #define configUSE_MUTEXES (1)
229 #define configUSE_RECURSIVE_MUTEXES (1)
230 #define configUSE_COUNTING_SEMAPHORES (1)
231 #define configUSE_ALTERNATIVE_API (0) /* Deprecated! */
232 #define configQUEUE_REGISTRY_SIZE (10)
233 #define configUSE_QUEUE_SETS (0)
234 #define configUSE_NEWLIB_REENTRANT (0)
235 #define configENABLE_BACKWARD_COMPATIBILITY (1)
236 #define configSUPPORT_STATIC_ALLOCATION (1)
237
238 /* Optional functions - most linkers will remove unused functions anyway. */
239 #define INCLUDE_vTaskPrioritySet (1)
240 #define INCLUDE_uxTaskPriorityGet (1)
241 #define INCLUDE_vTaskDelete (1)
242 #define INCLUDE_vTaskSuspend (1)
243 #define INCLUDE_xResumeFromISR (1)
244 #define INCLUDE_vTaskDelayUntil (1)
245 #define INCLUDE_vTaskDelay (1)
246 #define INCLUDE_xTaskGetSchedulerState (1)
247 #define INCLUDE_xTaskGetCurrentTaskHandle (1)
248 #define INCLUDE_uxTaskGetStackHighWaterMark (1)
249 #define INCLUDE_xTaskGetIdleTaskHandle (1)
250 #define INCLUDE_xTimerGetTimerDaemonTaskHandle (1)
251 #define INCLUDE_pcTaskGetTaskName (1)
252 #define INCLUDE_eTaskGetState (1)
253 #define INCLUDE_xEventGroupSetBitFromISR (1)
254 #define INCLUDE_xTimerPendFunctionCall (1)
255
256 /* Stop if an assertion fails. */
257 #define configASSERT(x)                                                                                                            \
258     if ((x) == 0)                                                                                                                  \
259     {                                                                                                                              \
260         taskDISABLE_INTERRUPTS();                                                                                                  \
261         printf("\nFREERTOS ASSERT ( %s )\n", #x);                                                                                  \
262         for (;;)                                                                                                                   \
263             ;                                                                                                                      \
264     }
265 #define configASSERTNULL(x)                                                                                                        \
266     if ((x) == NULL)                                                                                                               \
267     {                                                                                                                              \
268         taskDISABLE_INTERRUPTS();                                                                                                  \
269         for (;;)                                                                                                                   \
270             ;                                                                                                                      \
271     }
272
273 /* Definitions that map the FreeRTOS port interrupt handlers to their CMSIS
274 standard names. */
275 #define vPortSVCHandler SVC_Handler
276 #define xPortPendSVHandler PendSV_Handler
277 #define xPortSysTickHandler SysTick_Handler
278
279 #if defined(__GNUC__)
280 /* For the linker. */
281 #define fabs __builtin_fabs
282 #endif
283
284 #ifdef __cplusplus
285 }
286 #endif