Fix for x86_64 build fail
[platform/upstream/connectedhomeip.git] / examples / lighting-app / 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
130 #define configCREATE_LOW_POWER_DEMO (0)
131
132 /* Some configuration is dependent on the demo being built. */
133 #if (configCREATE_LOW_POWER_DEMO == 0)
134
135 /* Tickless mode is not used. */
136
137 /* Some of the standard demo test tasks assume a tick rate of 1KHz, even
138 though that is faster than would normally be warranted by a real
139 application. */
140 #define configTICK_RATE_HZ (1000)
141
142 /* The full demo always has tasks to run so the tick will never be turned
143 off.  The blinky demo will use the default tickless idle implementation to
144 turn the tick off. */
145 #define configUSE_TICKLESS_IDLE (0)
146
147 /* Hook function related definitions. */
148 #define configUSE_TICK_HOOK (1)
149 #define configCHECK_FOR_STACK_OVERFLOW (2)
150 #define configUSE_MALLOC_FAILED_HOOK (1)
151 #define configUSE_IDLE_HOOK (1)
152
153 #define configENERGY_MODE (sleepEM1)
154
155 #else
156
157 /* Tickless idle mode, generating RTOS tick interrupts from the RTC, fed
158 by the LXFO clock. */
159
160 /* The slow clock used to generate the tick interrupt in the low power demo
161 runs at 32768/8=4096Hz.  Ensure the tick rate is a multiple of the clock. */
162 #define configTICK_RATE_HZ (128)
163
164 /* The low power demo uses the tickless idle feature. */
165 #define configUSE_TICKLESS_IDLE (1)
166 #define configOVERRIDE_DEFAULT_TICK_CONFIGURATION (1)
167
168 /* Hook function related definitions. */
169 #define configUSE_TICK_HOOK (0)
170 #define configCHECK_FOR_STACK_OVERFLOW (0)
171 #define configUSE_MALLOC_FAILED_HOOK (0)
172 #define configUSE_IDLE_HOOK (0)
173
174 #define configENERGY_MODE (sleepEM3)
175 #endif
176
177 /* Main functions*/
178 /* Run time stats gathering related definitions. */
179 #define configGENERATE_RUN_TIME_STATS (0)
180
181 /* Co-routine related definitions. */
182 #define configUSE_CO_ROUTINES (0)
183 #define configMAX_CO_ROUTINE_PRIORITIES (1)
184
185 /* Software timer related definitions. */
186 #define configUSE_TIMERS (1)
187 #define configTIMER_TASK_PRIORITY (configMAX_PRIORITIES - 1) /* Highest priority */
188 #define configTIMER_QUEUE_LENGTH (10)
189 #define configTIMER_TASK_STACK_DEPTH (1024)
190
191 /* Cortex-M specific definitions. */
192 #ifdef __NVIC_PRIO_BITS
193 /* __BVIC_PRIO_BITS will be specified when CMSIS is being used. */
194 #define configPRIO_BITS (__NVIC_PRIO_BITS)
195 #else
196 #define configPRIO_BITS 3 /* 7 priority levels */
197 #endif
198
199 /* The lowest interrupt priority that can be used in a call to a "set priority"
200 function. */
201 #define configLIBRARY_LOWEST_INTERRUPT_PRIORITY (0x07)
202
203 /* The highest interrupt priority that can be used by any interrupt service
204 routine that makes calls to interrupt safe FreeRTOS API functions.  DO NOT CALL
205 INTERRUPT SAFE FREERTOS API FUNCTIONS FROM ANY INTERRUPT THAT HAS A HIGHER
206 PRIORITY THAN THIS! (higher priorities are lower numeric values. */
207 #define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY (0x03)
208
209 /* Interrupt priorities used by the kernel port layer itself.  These are generic
210 to all Cortex-M ports, and do not rely on any particular library functions. */
211 #define configKERNEL_INTERRUPT_PRIORITY (configLIBRARY_LOWEST_INTERRUPT_PRIORITY << (8 - configPRIO_BITS))
212 /* !!!! configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to zero !!!!
213 See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */
214 #define configMAX_SYSCALL_INTERRUPT_PRIORITY (configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS))
215
216 /* FreeRTOS MPU specific definitions. */
217 #define configINCLUDE_APPLICATION_DEFINED_PRIVILEGED_FUNCTIONS (1)
218
219 #define configCPU_CLOCK_HZ (SystemCoreClock)
220 #define configUSE_PREEMPTION (1)
221 #define configUSE_TIME_SLICING (1)
222 #define configUSE_PORT_OPTIMISED_TASK_SELECTION (1)
223 #define configUSE_TICKLESS_IDLE_SIMPLE_DEBUG (1) /* See into vPortSuppressTicksAndSleep source code for explanation */
224 #define configMAX_PRIORITIES (8)
225 #define configMINIMAL_STACK_SIZE (140) /* Number of words to use for Idle and Timer stacks */
226 #define configMAX_TASK_NAME_LEN (10)
227 #define configUSE_16_BIT_TICKS (0)
228 #define configIDLE_SHOULD_YIELD (0)
229 #define configUSE_MUTEXES (1)
230 #define configUSE_RECURSIVE_MUTEXES (1)
231 #define configUSE_COUNTING_SEMAPHORES (1)
232 #define configUSE_ALTERNATIVE_API (0) /* Deprecated! */
233 #define configQUEUE_REGISTRY_SIZE (10)
234 #define configUSE_QUEUE_SETS (0)
235 #define configUSE_NEWLIB_REENTRANT (0)
236 #define configENABLE_BACKWARD_COMPATIBILITY (1)
237 #define configSUPPORT_STATIC_ALLOCATION (1)
238
239 /* Optional functions - most linkers will remove unused functions anyway. */
240 #define INCLUDE_vTaskPrioritySet (1)
241 #define INCLUDE_uxTaskPriorityGet (1)
242 #define INCLUDE_vTaskDelete (1)
243 #define INCLUDE_vTaskSuspend (1)
244 #define INCLUDE_xResumeFromISR (1)
245 #define INCLUDE_vTaskDelayUntil (1)
246 #define INCLUDE_vTaskDelay (1)
247 #define INCLUDE_xTaskGetSchedulerState (1)
248 #define INCLUDE_xTaskGetCurrentTaskHandle (1)
249 #define INCLUDE_uxTaskGetStackHighWaterMark (1)
250 #define INCLUDE_xTaskGetIdleTaskHandle (1)
251 #define INCLUDE_xTimerGetTimerDaemonTaskHandle (1)
252 #define INCLUDE_pcTaskGetTaskName (1)
253 #define INCLUDE_eTaskGetState (1)
254 #define INCLUDE_xEventGroupSetBitFromISR (1)
255 #define INCLUDE_xTimerPendFunctionCall (1)
256 #define INCLUDE_xTaskGetHandle (1)
257
258 /* Stop if an assertion fails. */
259 #define configASSERT(x)                                                                                                            \
260     if ((x) == 0)                                                                                                                  \
261     {                                                                                                                              \
262         taskDISABLE_INTERRUPTS();                                                                                                  \
263         printf("\nFREERTOS ASSERT ( %s )\n", #x);                                                                                  \
264         for (;;)                                                                                                                   \
265             ;                                                                                                                      \
266     }
267 #define configASSERTNULL(x)                                                                                                        \
268     if ((x) == NULL)                                                                                                               \
269     {                                                                                                                              \
270         taskDISABLE_INTERRUPTS();                                                                                                  \
271         for (;;)                                                                                                                   \
272             ;                                                                                                                      \
273     }
274
275 /* Definitions that map the FreeRTOS port interrupt handlers to their CMSIS
276 standard names. */
277 #define vPortSVCHandler SVC_Handler
278 #define xPortPendSVHandler PendSV_Handler
279 #define xPortSysTickHandler SysTick_Handler
280
281 #if defined(__GNUC__)
282 /* For the linker. */
283 #define fabs __builtin_fabs
284 #endif
285
286 #ifdef __cplusplus
287 }
288 #endif