HPM APP
HPMicro Application solution
FreeRTOSConfig.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2022 HPMicro
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  *
6  */
7 
8 #ifndef FREERTOS_CONFIG_H
9 #define FREERTOS_CONFIG_H
10 
11 /*
12  * Application specific definitions.
13  *
14  * These definitions should be adjusted for your particular hardware and
15  * application requirements.
16  *
17  * THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
18  * FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
19  *
20  * See http://www.freertos.org/a00110.html.
21  */
22 
23 #include "board.h"
24 #if (portasmHAS_MTIME == 0)
25 #define configMTIME_BASE_ADDRESS (0)
26 #define configMTIMECMP_BASE_ADDRESS (0)
27 #else
28 #define configMTIME_BASE_ADDRESS (HPM_MCHTMR_BASE)
29 #define configMTIMECMP_BASE_ADDRESS (HPM_MCHTMR_BASE + 8UL)
30 #endif
31 
32 #define configUSE_PREEMPTION 1
33 #define configCPU_CLOCK_HZ ((uint32_t) 24000000)
34 #define configTICK_RATE_HZ ((TickType_t) 1000)
35 #define configMAX_PRIORITIES (32)
36 #define configMINIMAL_STACK_SIZE (256)
37 #define configMAX_TASK_NAME_LEN 16
38 #define configUSE_16_BIT_TICKS 0
39 #define configIDLE_SHOULD_YIELD 0
40 #define configUSE_APPLICATION_TASK_TAG 0
41 #define configGENERATE_RUN_TIME_STATS 0
42 
43 #define configUSE_COUNTING_SEMAPHORES 1
44 #define configUSE_MUTEXES 1
45 
46 /* Memory allocation definitions. */
47 #define configSUPPORT_STATIC_ALLOCATION 0
48 #define configSUPPORT_DYNAMIC_ALLOCATION 1
49 #ifndef configTOTAL_HEAP_SIZE
50 #define configTOTAL_HEAP_SIZE ((size_t) (20 * 1024))
51 #endif
52 
53 /* Hook function definitions. */
54 #define configUSE_IDLE_HOOK 0
55 #define configUSE_TICK_HOOK 0
56 #define configCHECK_FOR_STACK_OVERFLOW 0
57 #define configUSE_RECURSIVE_MUTEXES 1
58 #define configUSE_MALLOC_FAILED_HOOK 0
59 #define configUSE_DAEMON_TASK_STARTUP_HOOK 0
60 
61 /* Run time and task stats gathering definitions. */
62 #define configGENERATE_RUN_TIME_STATS 0
63 #define configUSE_TRACE_FACILITY 1
64 #define configUSE_STATS_FORMATTING_FUNCTIONS 0
65 
66 /* Set the following definitions to 1 to include the API function, or zero to exclude the API function. */
67 #define INCLUDE_vTaskPrioritySet 1
68 #define INCLUDE_uxTaskPriorityGet 1
69 #define INCLUDE_vTaskDelete 1
70 #define INCLUDE_vTaskCleanUpResources 1
71 #define INCLUDE_vTaskSuspend 1
72 #define INCLUDE_vTaskDelayUntil 1
73 #define INCLUDE_vTaskDelay 1
74 #define INCLUDE_xTaskGetCurrentTaskHandle 1
75 #define INCLUDE_xTimerPendFunctionCall 1
76 #define INCLUDE_eTaskGetState 1
77 #define INCLUDE_xTaskAbortDelay 1
78 #define INCLUDE_xTaskGetHandle 1
79 #define INCLUDE_xSemaphoreGetMutexHolder 1
80 
81 /* Co-routine definitions. */
82 #define configUSE_CO_ROUTINES 0
83 #define configMAX_CO_ROUTINE_PRIORITIES 2
84 
85 /* Software timer definitions. */
86 #define configUSE_TIMERS 1
87 #define configTIMER_TASK_PRIORITY (configMAX_PRIORITIES - 1)
88 #define configTIMER_QUEUE_LENGTH 4
89 #define configTIMER_TASK_STACK_DEPTH (configMINIMAL_STACK_SIZE)
90 
91 /* Task priorities.*/
92 #ifndef uartPRIMARY_PRIORITY
93  #define uartPRIMARY_PRIORITY (configMAX_PRIORITIES - 3)
94 #endif
95 
96 /* Normal assert() semantics without relying on the provision of an assert.h header file. */
97 #define configASSERT(x) if ((x) == 0) { taskDISABLE_INTERRUPTS(); __asm volatile("ebreak"); for (;;); }
98 
99 /*
100  * The size of the global output buffer that is available for use when there
101  * are multiple command interpreters running at once (for example, one on a UART
102  * and one on TCP/IP). This is done to prevent an output buffer being defined by
103  * each implementation - which would waste RAM. In this case, there is only one
104  * command interpreter running.
105  */
106 
107 /*
108  * The buffer into which output generated by FreeRTOS+CLI is placed. This must
109  * be at least big enough to contain the output of the task-stats command, as the
110  * example implementation does not include buffer overlow checking.
111  */
112 #define configCOMMAND_INT_MAX_OUTPUT_SIZE 2096
113 #define configINCLUDE_QUERY_HEAP_COMMAND 1
114 
115 /* This file is included from assembler files - make sure C code is not included in assembler files. */
116 #ifndef __ASSEMBLER__
117  void vAssertCalled(const char *pcFile, unsigned long ulLine);
120  void vPreSleepProcessing(unsigned long uxExpectedIdleTime);
121  void vPostSleepProcessing(unsigned long uxExpectedIdleTime);
122 #endif /* __ASSEMBLER__ */
123 
124 /****** Hardware/compiler specific settings. *******/
125 /*
126  * The application must provide a function that configures a peripheral to
127  * create the FreeRTOS tick interrupt, then define configSETUP_TICK_INTERRUPT()
128  * in FreeRTOSConfig.h to call the function.
129  */
130 #define configSETUP_TICK_INTERRUPT() vConfigureTickInterrupt()
131 #define configCLEAR_TICK_INTERRUPT() vClearTickInterrupt()
132 
133 /*
134  * The configPRE_SLEEP_PROCESSING() and configPOST_SLEEP_PROCESSING() macros
135  * allow the application writer to add additional code before and after the MCU is
136  * placed into the low power state respectively. The empty implementations
137  * provided in this demo can be extended to save even more power.
138  */
139 #define configPRE_SLEEP_PROCESSING(uxExpectedIdleTime) vPreSleepProcessing(uxExpectedIdleTime);
140 #define configPOST_SLEEP_PROCESSING(uxExpectedIdleTime) vPostSleepProcessing(uxExpectedIdleTime);
141 
142 
143 /* Compiler specifics. */
144 #define fabs(x) __builtin_fabs(x)
145 
146 /* Enable Hardware Stack Protection and Recording mechanism. */
147 #define configHSP_ENABLE 0
148 
149 /* Record the highest address of stack. */
150 #if (configHSP_ENABLE == 1 && configRECORD_STACK_HIGH_ADDRESS != 1)
151 #define configRECORD_STACK_HIGH_ADDRESS 1
152 #endif
153 
154 #endif /* FREERTOS_CONFIG_H */
void vConfigureTickInterrupt(void)
void vAssertCalled(const char *pcFile, unsigned long ulLine)
void vClearTickInterrupt(void)
void vPreSleepProcessing(unsigned long uxExpectedIdleTime)
void vPostSleepProcessing(unsigned long uxExpectedIdleTime)