]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/CORTEX_A9_Cyclone_V_SoC_DK/FreeRTOSConfig.h
Update version number in readiness for V10.3.0 release. Sync SVN with reviewed releas...
[freertos] / FreeRTOS / Demo / CORTEX_A9_Cyclone_V_SoC_DK / FreeRTOSConfig.h
1 /*\r
2  * FreeRTOS Kernel V10.3.0\r
3  * Copyright (C) 2020 Amazon.com, Inc. or its affiliates.  All Rights Reserved.\r
4  *\r
5  * Permission is hereby granted, free of charge, to any person obtaining a copy of\r
6  * this software and associated documentation files (the "Software"), to deal in\r
7  * the Software without restriction, including without limitation the rights to\r
8  * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\r
9  * the Software, and to permit persons to whom the Software is furnished to do so,\r
10  * subject to the following conditions:\r
11  *\r
12  * The above copyright notice and this permission notice shall be included in all\r
13  * copies or substantial portions of the Software.\r
14  *\r
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
17  * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
18  * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
19  * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
20  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
21  *\r
22  * http://www.FreeRTOS.org\r
23  * http://aws.amazon.com/freertos\r
24  *\r
25  * 1 tab == 4 spaces!\r
26  */\r
27 \r
28 #ifndef FREERTOS_CONFIG_H\r
29 #define FREERTOS_CONFIG_H\r
30 \r
31 /* Altera library includes. */\r
32 #include "alt_timers.h"\r
33 #include "alt_interrupt.h"\r
34 #include "alt_globaltmr.h"\r
35 \r
36 /*-----------------------------------------------------------\r
37  * Application specific definitions.\r
38  *\r
39  * These definitions should be adjusted for your particular hardware and\r
40  * application requirements.\r
41  *\r
42  * THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE\r
43  * FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.\r
44  *\r
45  * See http://www.freertos.org/a00110.html for a full list of configuration\r
46  * options.\r
47  *----------------------------------------------------------*/\r
48 \r
49 /*\r
50  * The FreeRTOS Cortex-A port implements a full interrupt nesting model.\r
51  *\r
52  * Interrupts that are assigned a priority at or below\r
53  * configMAX_API_CALL_INTERRUPT_PRIORITY (which counter-intuitively in the ARM\r
54  * generic interrupt controller [GIC] means a priority that has a numerical\r
55  * value above configMAX_API_CALL_INTERRUPT_PRIORITY) can call interrupt safe\r
56  * FreeRTOS API functions and will nest.\r
57  *\r
58  * Interrupts that are assigned a priority above\r
59  * configMAX_API_CALL_INTERRUPT_PRIORITY (which in the GIC means a numerical\r
60  * value below configMAX_API_CALL_INTERRUPT_PRIORITY) cannot call any FreeRTOS\r
61  * API functions, will nest, and will not be masked by FreeRTOS critical\r
62  * sections (although it is necessary for interrupts to be globally disabled\r
63  * extremely briefly as the interrupt mask is updated in the GIC).\r
64  *\r
65  * FreeRTOS functions that can be called from an interrupt are those that end in\r
66  * "FromISR".  FreeRTOS maintains a separate interrupt safe API to enable\r
67  * interrupt entry to be shorter, faster, simpler and smaller.\r
68  *\r
69  * The Cyclone V SoC implements 32 unique interrupt priorities.  For the\r
70  * purpose of setting configMAX_API_CALL_INTERRUPT_PRIORITY 32 represents the\r
71  * lowest priority.\r
72  */\r
73 #define configMAX_API_CALL_INTERRUPT_PRIORITY   18\r
74 \r
75 /* The application will define the array used as the RTOS heap to ensure it can\r
76 be located in the (faster) on-chip RAM.  When this parameter is set to 1 the\r
77 application must define an array using the name and size as follows below, but\r
78 is free to locate the array in any suitable RAM region (the faster the better as\r
79 the stacks used by the tasks are allocated from this array):\r
80 \r
81 uint8_t ucHeap[ configTOTAL_HEAP_SIZE ];\r
82 \r
83 */\r
84 #define configAPPLICATION_ALLOCATED_HEAP                1\r
85 \r
86 #define configCPU_CLOCK_HZ                                              /* Not used in this demo. */\r
87 #define configUSE_PORT_OPTIMISED_TASK_SELECTION 1\r
88 #define configUSE_TICKLESS_IDLE                                 0\r
89 #define configTICK_RATE_HZ                                              ( ( TickType_t ) 1000 )\r
90 #define configUSE_PREEMPTION                                    1\r
91 #define configMAX_PRIORITIES                                    ( 7 )\r
92 #define configMINIMAL_STACK_SIZE                                ( ( unsigned short ) 200 )\r
93 #define configTOTAL_HEAP_SIZE                                   ( 50 * 1024 )\r
94 #define configMAX_TASK_NAME_LEN                                 ( 10 )\r
95 #define configUSE_TRACE_FACILITY                                1\r
96 #define configUSE_16_BIT_TICKS                                  0\r
97 #define configIDLE_SHOULD_YIELD                                 1\r
98 #define configUSE_MUTEXES                                               1\r
99 #define configQUEUE_REGISTRY_SIZE                               8\r
100 #define configCHECK_FOR_STACK_OVERFLOW                  2\r
101 #define configUSE_RECURSIVE_MUTEXES                             1\r
102 #define configUSE_APPLICATION_TASK_TAG                  0\r
103 #define configUSE_COUNTING_SEMAPHORES                   1\r
104 #define configUSE_QUEUE_SETS                                    1\r
105 \r
106 /* Hook/Callback related definitions. */\r
107 #define configUSE_MALLOC_FAILED_HOOK                    1\r
108 #define configUSE_IDLE_HOOK                                             1\r
109 #define configUSE_TICK_HOOK                                             1\r
110 #define configUSE_DAEMON_TASK_STARTUP_HOOK              1\r
111 \r
112 /* Co-routine definitions. */\r
113 #define configUSE_CO_ROUTINES                                   0\r
114 #define configMAX_CO_ROUTINE_PRIORITIES                 ( 2 )\r
115 \r
116 /* Software timer definitions. */\r
117 #define configUSE_TIMERS                                                1\r
118 #define configTIMER_TASK_PRIORITY                               ( configMAX_PRIORITIES - 1 )\r
119 #define configTIMER_QUEUE_LENGTH                                5\r
120 #define configTIMER_TASK_STACK_DEPTH                    ( configMINIMAL_STACK_SIZE * 2 )\r
121 \r
122 /* Set the following definitions to 1 to include the API function, or zero\r
123 to exclude the API function. */\r
124 #define INCLUDE_vTaskPrioritySet                                1\r
125 #define INCLUDE_uxTaskPriorityGet                               1\r
126 #define INCLUDE_vTaskDelete                                             1\r
127 #define INCLUDE_vTaskCleanUpResources                   1\r
128 #define INCLUDE_vTaskSuspend                                    1\r
129 #define INCLUDE_vTaskDelayUntil                                 1\r
130 #define INCLUDE_vTaskDelay                                              1\r
131 #define INCLUDE_xTimerPendFunctionCall                  1\r
132 #define INCLUDE_eTaskGetState                                   1\r
133 \r
134 /* This demo makes use of one or more example stats formatting functions.  These\r
135 format the raw data provided by the uxTaskGetSystemState() function in to human\r
136 readable ASCII form.  See the notes in the implementation of vTaskList() within\r
137 FreeRTOS/Source/tasks.c for limitations. */\r
138 #define configUSE_STATS_FORMATTING_FUNCTIONS    1\r
139 \r
140 /* Run time stats related definitions. */\r
141 #define configGENERATE_RUN_TIME_STATS 1\r
142 #define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() alt_globaltmr_start()\r
143 #define portGET_RUN_TIME_COUNTER_VALUE()  ( ( uint32_t ) ( alt_globaltmr_get64() >> ( uint64_t ) 16 ) )\r
144 \r
145 \r
146 /* The size of the global output buffer that is available for use when there\r
147 are multiple command interpreters running at once (for example, one on a UART\r
148 and one on TCP/IP).  This is done to prevent an output buffer being defined by\r
149 each implementation - which would waste RAM.  In this case, there is only one\r
150 command interpreter running. */\r
151 #define configCOMMAND_INT_MAX_OUTPUT_SIZE 2096\r
152 \r
153 /* Normal assert() semantics without relying on the provision of an assert.h\r
154 header file. */\r
155 void vAssertCalled( const char * pcFile, unsigned long ulLine );\r
156 #define configASSERT( x ) if( ( x ) == 0 ) vAssertCalled( __FILE__, __LINE__ );\r
157 \r
158 /* If configTASK_RETURN_ADDRESS is not defined then a task that attempts to\r
159 return from its implementing function will end up in a "task exit error"\r
160 function - which contains a call to configASSERT().  However this can give GCC\r
161 some problems when it tries to unwind the stack, as the exit error function has\r
162 nothing to return to.  To avoid this define configTASK_RETURN_ADDRESS to 0.  */\r
163 #define configTASK_RETURN_ADDRESS       NULL\r
164 \r
165 \r
166 /****** Hardware specific settings. *******************************************/\r
167 \r
168  typedef struct INT_DISPATCH_s\r
169  {\r
170      alt_int_callback_t pxISR;\r
171      void *             pvContext;\r
172  }\r
173  INT_DISPATCH_t;\r
174 \r
175 void vRegisterIRQHandler( uint32_t ulID, alt_int_callback_t pxHandlerFunction, void *pvContext );\r
176 void vApplicationIRQHandler( uint32_t ulICCIAR );\r
177 \r
178 /*\r
179  * The application must provide a function that configures a peripheral to\r
180  * create the FreeRTOS tick interrupt, then define configSETUP_TICK_INTERRUPT()\r
181  * in FreeRTOSConfig.h to call the function.  This file contains a function\r
182  * that is suitable for use on the Zynq MPU.  FreeRTOS_Tick_Handler() must\r
183  * be installed as the peripheral's interrupt handler.\r
184  */\r
185 void vConfigureTickInterrupt( void );\r
186 #define configSETUP_TICK_INTERRUPT() vConfigureTickInterrupt();\r
187 \r
188 void vClearTickInterrupt( void );\r
189 #define configCLEAR_TICK_INTERRUPT() alt_gpt_int_clear_pending( ALT_GPT_CPU_PRIVATE_TMR );\r
190 \r
191 /* The following constant describe the hardware, and are correct for the\r
192 Cyclone V SoC. */\r
193 #define configINTERRUPT_CONTROLLER_BASE_ADDRESS                 ( 0xFFFED000 )\r
194 #define configINTERRUPT_CONTROLLER_CPU_INTERFACE_OFFSET ( -0xf00 )\r
195 #define configUNIQUE_INTERRUPT_PRIORITIES                               32\r
196 \r
197 #endif /* FREERTOS_CONFIG_H */\r
198 \r