1 /* 2 FreeRTOS V10 - Copyright (C) 2021 Real Time Engineers Ltd. 3 All rights reserved 4 5 VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. 6 7 This file is part of the FreeRTOS distribution. 8 9 FreeRTOS is free software; you can redistribute it and/or modify it under 10 the terms of the GNU General Public License (version 2) as published by the 11 Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception. 12 13 *************************************************************************** 14 >>! NOTE: The modification to the GPL is included to allow you to !<< 15 >>! distribute a combined work that includes FreeRTOS without being !<< 16 >>! obliged to provide the source code for proprietary components !<< 17 >>! outside of the FreeRTOS kernel. !<< 18 *************************************************************************** 19 20 FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY 21 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 22 FOR A PARTICULAR PURPOSE. Full license text is available on the following 23 link: http://www.freertos.org/a00114.html 24 25 *************************************************************************** 26 * * 27 * FreeRTOS provides completely free yet professionally developed, * 28 * robust, strictly quality controlled, supported, and cross * 29 * platform software that is more than just the market leader, it * 30 * is the industry's de facto standard. * 31 * * 32 * Help yourself get started quickly while simultaneously helping * 33 * to support the FreeRTOS project by purchasing a FreeRTOS * 34 * tutorial book, reference manual, or both: * 35 * http://www.FreeRTOS.org/Documentation * 36 * * 37 *************************************************************************** 38 39 http://www.FreeRTOS.org/FAQHelp.html - Having a problem? Start by reading 40 the FAQ page "My application does not run, what could be wrong?". Have you 41 defined configASSERT()? 42 43 http://www.FreeRTOS.org/support - In return for receiving this top quality 44 embedded software for free we request you assist our global community by 45 participating in the support forum. 46 47 http://www.FreeRTOS.org/training - Investing in training allows your team to 48 be as productive as possible as early as possible. Now you can receive 49 FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers 50 Ltd, and the world's leading authority on the world's leading RTOS. 51 52 http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products, 53 including FreeRTOS+Trace - an indispensable productivity tool, a DOS 54 compatible FAT file system, and our tiny thread aware UDP/IP stack. 55 56 http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate. 57 Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS. 58 59 http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High 60 Integrity Systems ltd. to sell under the OpenRTOS brand. Low cost OpenRTOS 61 licenses offer ticketed support, indemnification and commercial middleware. 62 63 http://www.SafeRTOS.com - High Integrity Systems also provide a safety 64 engineered and independently SIL3 certified version for use in safety and 65 mission critical applications that require provable dependability. 66 67 1 tab == 4 spaces! 68 */ 69 70 #ifndef FREERTOS_CONFIG_XTENSA_H 71 #define FREERTOS_CONFIG_XTENSA_H 72 73 #include "sdkconfig.h" 74 75 /* enable use of optimized task selection by the scheduler */ 76 #ifdef CONFIG_FREERTOS_OPTIMIZED_SCHEDULER 77 #define configUSE_PORT_OPTIMISED_TASK_SELECTION 1 78 #endif 79 80 #define XT_USE_THREAD_SAFE_CLIB 0 81 #undef XT_USE_SWPRI 82 83 #if CONFIG_FREERTOS_CORETIMER_0 84 #define XT_TIMER_INDEX 0 85 #elif CONFIG_FREERTOS_CORETIMER_1 86 #define XT_TIMER_INDEX 1 87 #endif 88 89 #ifndef __ASSEMBLER__ 90 /** 91 * This function is defined to provide a deprecation warning whenever 92 * XT_CLOCK_FREQ macro is used. 93 * Update the code to use esp_clk_cpu_freq function instead. 94 * @return current CPU clock frequency, in Hz 95 */ 96 int xt_clock_freq(void) __attribute__((deprecated)); 97 98 #define XT_CLOCK_FREQ (xt_clock_freq()) 99 100 #endif // __ASSEMBLER__ 101 102 /* Required for configuration-dependent settings */ 103 #include <freertos/xtensa_config.h> 104 105 /* configASSERT behaviour */ 106 #ifndef __ASSEMBLER__ 107 #include <assert.h> 108 #include "esp_rom_sys.h" 109 #if CONFIG_IDF_TARGET_ESP32 110 #include "esp32/rom/ets_sys.h" // will be removed in idf v5.0 111 #elif CONFIG_IDF_TARGET_ESP32S2 112 #include "esp32s2/rom/ets_sys.h" 113 #elif CONFIG_IDF_TARGET_ESP32S3 114 #include "esp32s3/rom/ets_sys.h" 115 #endif 116 #endif // __ASSEMBLER__ 117 118 // If CONFIG_FREERTOS_ASSERT_DISABLE is set then configASSERT is defined empty later in FreeRTOS.h and the macro 119 // configASSERT_DEFINED remains unset (meaning some warnings are avoided) 120 121 #if defined(CONFIG_FREERTOS_ASSERT_FAIL_PRINT_CONTINUE) 122 #define configASSERT(a) if (unlikely(!(a))) { \ 123 esp_rom_printf("%s:%d (%s)- assert failed!\n", __FILE__, __LINE__, \ 124 __FUNCTION__); \ 125 } 126 #elif defined(CONFIG_FREERTOS_ASSERT_FAIL_ABORT) 127 #define configASSERT(a) assert(a) 128 #endif 129 130 #if CONFIG_FREERTOS_ASSERT_ON_UNTESTED_FUNCTION 131 #define UNTESTED_FUNCTION() { esp_rom_printf("Untested FreeRTOS function %s\r\n", __FUNCTION__); configASSERT(false); } while(0) 132 #else 133 #define UNTESTED_FUNCTION() 134 #endif 135 136 #define configXT_BOARD 1 /* Board mode */ 137 #define configXT_SIMULATOR 0 138 139 /* The maximum interrupt priority from which FreeRTOS.org API functions can 140 be called. Only API functions that end in ...FromISR() can be used within 141 interrupts. */ 142 #define configMAX_SYSCALL_INTERRUPT_PRIORITY XCHAL_EXCM_LEVEL 143 144 /* Stack alignment, architecture specifc. Must be a power of two. */ 145 #define configSTACK_ALIGNMENT 16 146 147 148 /* The Xtensa port uses a separate interrupt stack. Adjust the stack size 149 * to suit the needs of your specific application. 150 * Size needs to be aligned to the stack increment, since the location of 151 * the stack for the 2nd CPU will be calculated using configISR_STACK_SIZE. 152 */ 153 #ifndef configISR_STACK_SIZE 154 #define configISR_STACK_SIZE ((CONFIG_FREERTOS_ISR_STACKSIZE + configSTACK_ALIGNMENT - 1) & (~(configSTACK_ALIGNMENT - 1))) 155 #endif 156 157 #ifndef __ASSEMBLER__ 158 #if CONFIG_APPTRACE_SV_ENABLE 159 extern uint32_t port_switch_flag[]; 160 #define os_task_switch_is_pended(_cpu_) (port_switch_flag[_cpu_]) 161 #else 162 #define os_task_switch_is_pended(_cpu_) (false) 163 #endif 164 #endif 165 166 #endif // FREERTOS_CONFIG_XTENSA_H 167