foxBMS - Unit Tests  1.3.0
The foxBMS Unit Tests API Documentation
ftask_cfg.h
Go to the documentation of this file.
1 /**
2  *
3  * @copyright © 2010 - 2022, Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V.
4  * All rights reserved.
5  *
6  * SPDX-License-Identifier: BSD-3-Clause
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions are met:
10  *
11  * 1. Redistributions of source code must retain the above copyright notice, this
12  * list of conditions and the following disclaimer.
13  *
14  * 2. Redistributions in binary form must reproduce the above copyright notice,
15  * this list of conditions and the following disclaimer in the documentation
16  * and/or other materials provided with the distribution.
17  *
18  * 3. Neither the name of the copyright holder nor the names of its
19  * contributors may be used to endorse or promote products derived from
20  * this software without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
25  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
26  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
28  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32  *
33  * We kindly request you to use one or more of the following phrases to refer to
34  * foxBMS in your hardware, software, documentation or advertising materials:
35  *
36  * - ″This product uses parts of foxBMS®″
37  * - ″This product includes parts of foxBMS®″
38  * - ″This product is derived from foxBMS®″
39  *
40  */
41 
42 /**
43  * @file ftask_cfg.h
44  * @author foxBMS Team
45  * @date 2019-08-26 (date of creation)
46  * @updated 2022-05-30 (date of last update)
47  * @version v1.3.0
48  * @ingroup TASK_CONFIGURATION
49  * @prefix FTSK
50  *
51  * @brief Task configuration header
52  * @details TODO
53  */
54 
55 #ifndef FOXBMS__FTASK_CFG_H_
56 #define FOXBMS__FTASK_CFG_H_
57 
58 /*========== Includes =======================================================*/
59 #include "general.h"
60 
61 #include "os.h"
62 
63 /*========== Macros and Definitions =========================================*/
64 /** @brief Stack size of engine task */
65 #define FTSK_TASK_ENGINE_STACK_SIZE_IN_BYTES (1024u)
66 
67 /** @brief Phase of engine task */
68 #define FTSK_TASK_ENGINE_PRIORITY (OS_PRIORITY_REAL_TIME)
69 
70 /** @brief Phase of engine task */
71 #define FTSK_TASK_ENGINE_PHASE (0u)
72 
73 /** @brief Cycle time of engine task */
74 #define FTSK_TASK_ENGINE_CYCLE_TIME (1u)
75 
76 /** @brief Maximum allowed jitter of engine task */
77 #define FTSK_TASK_ENGINE_MAXIMUM_JITTER (1u)
78 
79 /** @brief pvParameters of the engine task */
80 #define FTSK_TASK_ENGINE_PV_PARAMETERS (NULL_PTR)
81 
82 /** @brief Stack size of cyclic 1 ms task */
83 #define FTSK_TASK_CYCLIC_1MS_STACK_SIZE_IN_BYTES (1024u)
84 
85 /** @brief Priority of cyclic 1ms task */
86 #define FTSK_TASK_CYCLIC_1MS_PRIORITY (OS_PRIORITY_ABOVE_HIGH)
87 
88 /** @brief Phase of cyclic 1ms task */
89 #define FTSK_TASK_CYCLIC_1MS_PHASE (0u)
90 
91 /** @brief Cycle time of 1ms task */
92 #define FTSK_TASK_CYCLIC_1MS_CYCLE_TIME (1u)
93 
94 /** @brief Maximum allowed jitter of 1ms task */
95 #define FTSK_TASK_CYCLIC_1MS_MAXIMUM_JITTER (1u)
96 
97 /** @brief pvParameters of the 1ms task */
98 #define FTSK_TASK_CYCLIC_1MS_PV_PARAMETERS (NULL_PTR)
99 
100 /** @brief Stack size of cyclic 10 ms task */
101 #define FTSK_TASK_CYCLIC_10MS_STACK_SIZE_IN_BYTES (5120u)
102 
103 /** @brief Priority of cyclic 10 ms task */
104 #define FTSK_TASK_CYCLIC_10MS_PRIORITY (OS_PRIORITY_HIGH)
105 
106 /** @brief Phase of cyclic 10 ms task */
107 #define FTSK_TASK_CYCLIC_10MS_PHASE (2u)
108 
109 /** @brief Cycle time of 10 ms task */
110 #define FTSK_TASK_CYCLIC_10MS_CYCLE_TIME (10u)
111 
112 /** @brief Maximum allowed jitter of 10ms task */
113 #define FTSK_TASK_CYCLIC_10MS_MAXIMUM_JITTER (2u)
114 
115 /** @brief pvParameters of the 10ms task */
116 #define FTSK_TASK_CYCLIC_10MS_PV_PARAMETERS (NULL_PTR)
117 
118 /** @brief Stack size of cyclic 100 ms task */
119 #define FTSK_TASK_CYCLIC_100MS_STACK_SIZE_IN_BYTES (1024u)
120 
121 /** @brief Priority of cyclic 100 ms task */
122 #define FTSK_TASK_CYCLIC_100MS_PRIORITY (OS_PRIORITY_ABOVE_NORMAL)
123 
124 /** @brief Phase of cyclic 100 ms task */
125 #define FTSK_TASK_CYCLIC_100MS_PHASE (56u)
126 
127 /** @brief Cycle time of 100ms task */
128 #define FTSK_TASK_CYCLIC_100MS_CYCLE_TIME (100u)
129 
130 /** @brief Maximum allowed jitter of 100ms task */
131 #define FTSK_TASK_CYCLIC_100MS_MAXIMUM_JITTER (5u)
132 
133 /** @brief pvParameters of the 100ms task */
134 #define FTSK_TASK_CYCLIC_100MS_PV_PARAMETERS (NULL_PTR)
135 
136 /** @brief Stack size of cyclic 100 ms task for algorithms */
137 #define FTSK_TASK_CYCLIC_ALGORITHM_100MS_STACK_SIZE_IN_BYTES (1024u)
138 
139 /** @brief Priority of cyclic 100 ms task for algorithms */
140 #define FTSK_TASK_CYCLIC_ALGORITHM_100MS_PRIORITY (OS_PRIORITY_NORMAL)
141 
142 /** @brief Phase of cyclic 100 ms task for algorithms */
143 #define FTSK_TASK_CYCLIC_ALGORITHM_100MS_PHASE (64u)
144 
145 /** @brief Cycle time of 100ms task for algorithms*/
146 #define FTSK_TASK_CYCLIC_ALGORITHM_100MS_CYCLE_TIME (100u)
147 
148 /** @brief Maximum allowed jitter of 100ms task for algorithms */
149 #define FTSK_TASK_CYCLIC_ALGORITHM_100MS_MAXIMUM_JITTER (5u)
150 
151 /** @brief pvParameters of the 100ms task for algorithms */
152 #define FTSK_TASK_CYCLIC_ALGORITHM_100MS_PV_PARAMETERS (NULL_PTR)
153 
154 /** @brief Stack size of continuously running task for AFEs */
155 #define FTSK_TASK_AFE_STACK_SIZE_IN_BYTES (2048u / 4u)
156 
157 /** @brief Priority of continuously running task for AFEs */
158 #define FTSK_TASK_AFE_PRIORITY (OS_PRIORITY_ABOVE_HIGH)
159 
160 /** @brief Phase of continuously running task for AFEs */
161 #define FTSK_TASK_AFE_PHASE (0u)
162 
163 /** @brief Cycle time of continuously running task for AFEs */
164 #define FTSK_TASK_AFE_CYCLE_TIME (0u)
165 
166 /** @brief Maximum allowed jitter of continuously running task for AFEs */
167 #define FTSK_TASK_AFE_MAXIMUM_JITTER (5u)
168 
169 /** @brief pvParameters of the continuously running task for AFEs */
170 #define FTSK_TASK_AFE_PV_PARAMETERS (NULL_PTR)
171 
172 /*========== Extern Constant and Variable Declarations ======================*/
173 /**
174  * @brief Task configuration of the engine task
175  * @details Task for database and system monitoring
176  * @ingroup API_OS
177  */
179 
180 /**
181  * @brief Task configuration of the cyclic 1 ms task
182  * @details Cyclic 1 ms task
183  * @ingroup API_OS
184  */
186 
187 /**
188  * @brief Task configuration of the cyclic 10 ms task
189  * @details Cyclic 10 ms task
190  * @ingroup API_OS
191  */
193 
194 /**
195  * @brief Task configuration of the cyclic 100 ms task
196  * @details Cyclic 100 ms task
197  * @ingroup API_OS
198  */
200 
201 /**
202  * @brief Task configuration of the cyclic 100 ms task for algorithms
203  * @details Cyclic 100 ms task for algorithms
204  * @ingroup API_OS
205  */
207 
208 /**
209  * @brief Task configuration of the continuously running task for AFEs
210  * @details Continuously running task for AFEs
211  * @ingroup API_OS
212  */
214 
215 /**
216  * @brief Definition of task handles
217  * @ingroup API_OS
218  */
219 extern TaskHandle_t ftsk_taskHandleAfe;
220 
221 /*========== Extern Function Prototypes =====================================*/
222 /**
223  * @brief Initializes the database
224  * @details Start up after scheduler starts
225  * @ingroup API_OS
226  * @warning Do not change the content of this function. This will very likely
227  * break the system. This function is kept in the configuration file
228  * to have a uniform task configuration.
229  */
230 extern void FTSK_InitializeUserCodeEngine(void);
231 
232 /**
233  * @brief Engine task for the database and the system monitoring module
234  * @details Start up after scheduler start. First task to be run, all other
235  * tasks only starts when this task has started
236  * @ingroup API_OS
237  * @warning Do not change the content of this function. This will very likely
238  * break the system. This function is kept in the configuration file
239  * to have a uniform task configuration.
240  */
241 extern void FTSK_RunUserCodeEngine(void);
242 
243 /**
244  * @brief Initialization function before all tasks started
245  * @details This function is called after the scheduler started but before any
246  * cyclic task runs. Here modules get initialized that are not used
247  * during the startup process.
248  * @ingroup API_OS
249  */
250 extern void FTSK_InitializeUserCodePreCyclicTasks(void);
251 
252 /**
253  * @brief Cyclic 1 ms task
254  * @details TODO
255  * @ingroup API_OS
256  */
257 extern void FTSK_RunUserCodeCyclic1ms(void);
258 
259 /**
260  * @brief Cyclic 10 ms task
261  * @details TODO
262  * @ingroup API_OS
263  */
264 extern void FTSK_RunUserCodeCyclic10ms(void);
265 
266 /**
267  * @brief Cyclic 100 ms task
268  * @details TODO
269  * @ingroup API_OS
270  */
271 extern void FTSK_RunUserCodeCyclic100ms(void);
272 
273 /**
274  * @brief Cyclic 100 ms task for algorithms
275  * @details TODO
276  * @ingroup API_OS
277  */
278 extern void FTSK_RunUserCodeCyclicAlgorithm100ms(void);
279 
280 /**
281  * @brief Continuously running task for AFEs
282  * @details Used to implement the communications with AFEs,
283  * for drivers that do not use a cyclic task.
284  * @ingroup API_OS
285  */
286 extern void FTSK_RunUserCodeAfe(void);
287 
288 /**
289  * @brief Idle task
290  * @details Called by #vApplicationIdleHook() if configUSE_IDLE_HOOK in
291  * FreeRTOSConfig.h is enabled. If you do not need this hook, you can
292  * disable it in the FreeRTOS configuration.
293  * @ingroup API_OS
294  */
295 extern void FTSK_RunUserCodeIdle(void);
296 
297 /*========== Externalized Static Functions Prototypes (Unit Test) ===========*/
298 
299 #endif /* FOXBMS__FTASK_CFG_H_ */
OS_TASK_DEFINITION_s ftsk_taskDefinitionAfe
Task configuration of the continuously running task for AFEs.
Definition: ftask_cfg.c:136
OS_TASK_DEFINITION_s ftsk_taskDefinitionCyclic100ms
Task configuration of the cyclic 100 ms task.
Definition: ftask_cfg.c:124
void FTSK_RunUserCodeAfe(void)
Continuously running task for AFEs.
Definition: ftask_cfg.c:278
void FTSK_InitializeUserCodeEngine(void)
Initializes the database.
Definition: ftask_cfg.c:148
void FTSK_RunUserCodeEngine(void)
Engine task for the database and the system monitoring module.
Definition: ftask_cfg.c:175
OS_TASK_DEFINITION_s ftsk_taskDefinitionEngine
Task configuration of the engine task.
Definition: ftask_cfg.c:106
OS_TASK_DEFINITION_s ftsk_taskDefinitionCyclic1ms
Task configuration of the cyclic 1 ms task.
Definition: ftask_cfg.c:112
void FTSK_RunUserCodeIdle(void)
Idle task.
Definition: ftask_cfg.c:282
OS_TASK_DEFINITION_s ftsk_taskDefinitionCyclicAlgorithm100ms
Task configuration of the cyclic 100 ms task for algorithms.
Definition: ftask_cfg.c:130
void FTSK_RunUserCodeCyclic100ms(void)
Cyclic 100 ms task.
Definition: ftask_cfg.c:249
void FTSK_InitializeUserCodePreCyclicTasks(void)
Initialization function before all tasks started.
Definition: ftask_cfg.c:184
void FTSK_RunUserCodeCyclic10ms(void)
Cyclic 10 ms task.
Definition: ftask_cfg.c:226
TaskHandle_t ftsk_taskHandleAfe
Definition of task handles.
void FTSK_RunUserCodeCyclic1ms(void)
Cyclic 1 ms task.
Definition: ftask_cfg.c:216
OS_TASK_DEFINITION_s ftsk_taskDefinitionCyclic10ms
Task configuration of the cyclic 10 ms task.
Definition: ftask_cfg.c:118
void FTSK_RunUserCodeCyclicAlgorithm100ms(void)
Cyclic 100 ms task for algorithms.
Definition: ftask_cfg.c:269
General macros and definitions for the whole platform.
Declaration of the OS wrapper interface.
struct for FreeRTOS task definition
Definition: os.h:127