1 /*
2  * FreeRTOS Kernel V10.2.0
3  * Copyright (C) 2019 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://www.FreeRTOS.org
23  * http://aws.amazon.com/freertos
24  *
25  * 1 tab == 4 spaces!
26  */
27 
28 /******************************************************************************
29 	See http://www.freertos.org/a00110.html for an explanation of the
30 	definitions contained in this file.
31 ******************************************************************************/
32 
33 #ifndef FREERTOS_CONFIG_H
34 #define FREERTOS_CONFIG_H
35 #if defined(__ICCARM__) || defined(__CC_ARM) || defined(__GNUC__)
36 #include <stdint.h>
37 extern uint32_t SystemCoreClock;
38 #endif
39 #ifndef __IASMARM__
40 #define __IASMARM__ 0 /* IAR */
41 #endif
42 #include "platform_autoconf.h"
43 
44 /*-----------------------------------------------------------
45  * Application specific definitions.
46  *
47  * These definitions should be adjusted for your particular hardware and
48  * application requirements.
49  *
50  * THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
51  * FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
52  *
53  * See http://www.freertos.org/a00110.html.
54  *----------------------------------------------------------*/
55 
56 #define configUSE_SAU					1
57 #define configUSE_PREEMPTION			1
58 #define configUSE_IDLE_HOOK				0
59 #define configUSE_TICK_HOOK				0
60 #define configCPU_CLOCK_HZ				( SystemCoreClock )
61 #define configTICK_RATE_HZ				( ( uint32_t ) 1000)
62 #define configMINIMAL_STACK_SIZE		( ( unsigned short ) 512 )
63 #ifdef CONFIG_WIFI_EN
64 #define configTOTAL_HEAP_SIZE			( ( size_t ) ( 150 * 1024 ) ) //default
65 #if (defined CONFIG_HIGH_TP_TEST)
66 	#define configTOTAL_HEAP_SIZE		( ( size_t ) ( 100 * 1024 ) )
67 #endif
68 #else
69 #define configTOTAL_HEAP_SIZE			( ( size_t ) ( 40 * 1024 ) )
70 #endif
71 #define configMAX_TASK_NAME_LEN			( 10 )
72 #define configUSE_TRACE_FACILITY		0
73 #define configUSE_16_BIT_TICKS			0
74 #define configIDLE_SHOULD_YIELD			0
75 #define configUSE_CO_ROUTINES 			1
76 #define configUSE_MUTEXES				1
77 #define configUSE_TIMERS                1
78 
79 #define configMAX_PRIORITIES			( 11 )
80 #define PRIORITIE_OFFSET				( 4 )
81 
82 #define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
83 
84 #define configUSE_COUNTING_SEMAPHORES 	1
85 #define configUSE_ALTERNATIVE_API 		0
86 #define configCHECK_FOR_STACK_OVERFLOW	2
87 #define configUSE_RECURSIVE_MUTEXES		1
88 #define configQUEUE_REGISTRY_SIZE		0
89 #define configGENERATE_RUN_TIME_STATS	0
90 #if configGENERATE_RUN_TIME_STATS
91 #define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() //( ulHighFrequencyTimerTicks = 0UL )
92 #define portGET_RUN_TIME_COUNTER_VALUE() RTIM_GetCount(0x48002000/*TIMM00*/) //ulHighFrequencyTimerTicks
93 #undef	configUSE_TRACE_FACILITY
94 #define configUSE_TRACE_FACILITY			1
95 #define portCONFIGURE_STATS_PEROID_VALUE	1000 //unit Ticks
96 #endif
97 
98 #define configTIMER_TASK_PRIORITY       ( 1 )
99 #define configTIMER_QUEUE_LENGTH        ( 10 )
100 #define configTIMER_TASK_STACK_DEPTH    ( 512 )     //USE_MIN_STACK_SIZE modify from 512 to 256
101 
102 #if (__IASMARM__ != 1)
103 
104 extern void freertos_pre_sleep_processing(unsigned int *expected_idle_time);
105 extern void freertos_post_sleep_processing(unsigned int *expected_idle_time);
106 extern int  freertos_ready_to_sleep(void);
107 
108 /* Enable tickless power saving. */
109 #define configUSE_TICKLESS_IDLE                 1
110 
111 /* In wlan usage, this value is suggested to use value less than 80 milliseconds */
112 #define configEXPECTED_IDLE_TIME_BEFORE_SLEEP   2
113 
114 /* It's magic trick that let us can use our own sleep function */
115 #define configPRE_SLEEP_PROCESSING( x )         ( freertos_pre_sleep_processing((unsigned int *)&x) )
116 
117 #define configPOST_SLEEP_PROCESSING( x )        ( freertos_post_sleep_processing((unsigned int *)&x) )
118 
119 /* It's magic trick that let us can enable/disable tickless dynamically */
120 #define traceLOW_POWER_IDLE_BEGIN();           {
121 
122                                                         // portSUPPRESS_TICKS_AND_SLEEP( xExpectedIdleTime );
123 
124 #define traceLOW_POWER_IDLE_END();              }
125 
126 /* It's FreeRTOS related feature but it's not included in FreeRTOS design. */
127 #define configUSE_WAKELOCK_PMU                  1
128 
129 #endif // #if (__IASMARM__ != 1)
130 
131 /* Set the following definitions to 1 to include the API function, or zero
132 to exclude the API function. */
133 #define INCLUDE_vTaskPrioritySet		1
134 #define INCLUDE_uxTaskPriorityGet		1
135 #define INCLUDE_vTaskDelete				1
136 #define INCLUDE_vTaskCleanUpResources	0
137 #define INCLUDE_vTaskSuspend			1
138 #define INCLUDE_vTaskDelayUntil			1
139 #define INCLUDE_vTaskDelay				1
140 #define INCLUDE_pcTaskGetTaskName       1
141 #define INCLUDE_xTimerPendFunctionCall 	1
142 
143 /* Cortex-M specific definitions. */
144 #ifdef __NVIC_PRIO_BITS
145 	/* __BVIC_PRIO_BITS will be specified when CMSIS is being used. */
146 	#define configPRIO_BITS       		__NVIC_PRIO_BITS
147 #else
148 	#define configPRIO_BITS       		4        /* 15 priority levels */
149 #endif
150 
151 
152 /* The lowest interrupt priority that can be used in a call to a "set priority"
153 function. */
154 #define configLIBRARY_LOWEST_INTERRUPT_PRIORITY			0x0f
155 
156 /* The highest interrupt priority that can be used by any interrupt service
157 routine that makes calls to interrupt safe FreeRTOS API functions.  DO NOT CALL
158 INTERRUPT SAFE FREERTOS API FUNCTIONS FROM ANY INTERRUPT THAT HAS A HIGHER
159 PRIORITY THAN THIS! (higher priorities are lower numeric values. */
160 #define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY	5
161 
162 
163 /* Interrupt priorities used by the kernel port layer itself.  These are generic
164 to all Cortex-M ports, and do not rely on any particular library functions. */
165 #define configKERNEL_INTERRUPT_PRIORITY 		( configLIBRARY_LOWEST_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
166 /* !!!! configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to zero !!!!
167 See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */
168 #define configMAX_SYSCALL_INTERRUPT_PRIORITY 	( configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
169 
170 //#define RTK_MODE_TIMER
171 
172 
173 #endif /* FREERTOS_CONFIG_H */
174