foxBMS - Unit Tests  1.2.1
The foxBMS Unit Tests API Documentation
ftask_cfg.h
Go to the documentation of this file.
1 /**
2  *
3  * @copyright © 2010 - 2021, 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 2021-12-08 (date of last update)
47  * @ingroup TASK_CONFIGURATION
48  * @prefix FTSK
49  *
50  * @brief Task configuration header
51  * @details TODO
52  */
53 
54 #ifndef FOXBMS__FTASK_CFG_H_
55 #define FOXBMS__FTASK_CFG_H_
56 
57 /*========== Includes =======================================================*/
58 #include "general.h"
59 
60 #include "os.h"
61 
62 /*========== Macros and Definitions =========================================*/
63 /** @brief Stack size of engine task */
64 #define FTSK_TASK_ENGINE_STACK_SIZE (1024u / 4u)
65 
66 /** @brief Phase of engine task */
67 #define FTSK_TASK_ENGINE_PHASE (0u)
68 
69 /** @brief Cycle time of engine task */
70 #define FTSK_TASK_ENGINE_CYCLE_TIME (1u)
71 
72 /** @brief Maximum allowed jitter of engine task */
73 #define FTSK_TASK_ENGINE_MAXIMUM_JITTER (1u)
74 
75 /** @brief pvParameters of the engine task */
76 #define FTSK_TASK_ENGINE_PV_PARAMETERS (NULL_PTR)
77 
78 /** @brief Stack size of cyclic 1 ms task */
79 #define FTSK_TASK_CYCLIC_1MS_STACK_SIZE (1024u / 4u)
80 
81 /** @brief Phase of cyclic 1ms task */
82 #define FTSK_TASK_CYCLIC_1MS_PHASE (0u)
83 
84 /** @brief Cycle time of 1ms task */
85 #define FTSK_TASK_CYCLIC_1MS_CYCLE_TIME (1u)
86 
87 /** @brief Maximum allowed jitter of 1ms task */
88 #define FTSK_TASK_CYCLIC_1MS_MAXIMUM_JITTER (1u)
89 
90 /** @brief pvParameters of the 1ms task */
91 #define FTSK_TASK_CYCLIC_1MS_PV_PARAMETERS (NULL_PTR)
92 
93 /** @brief Stack size of cyclic 10 ms task */
94 #define FTSK_TASK_CYCLIC_10MS_STACK_SIZE ((5120u) / 4u)
95 
96 /** @brief Phase of cyclic 10 ms task */
97 #define FTSK_TASK_CYCLIC_10MS_PHASE (2u)
98 
99 /** @brief Cycle time of 10 ms task */
100 #define FTSK_TASK_CYCLIC_10MS_CYCLE_TIME (10u)
101 
102 /** @brief Maximum allowed jitter of 10ms task */
103 #define FTSK_TASK_CYCLIC_10MS_MAXIMUM_JITTER (2u)
104 
105 /** @brief pvParameters of the 10ms task */
106 #define FTSK_TASK_CYCLIC_10MS_PV_PARAMETERS (NULL_PTR)
107 
108 /** @brief Stack size of cyclic 100 ms task */
109 #define FTSK_TASK_CYCLIC_100MS_STACK_SIZE (1024u / 4u)
110 
111 /** @brief Phase of cyclic 100 ms task */
112 #define FTSK_TASK_CYCLIC_100MS_PHASE (56u)
113 
114 /** @brief Cycle time of 100ms task */
115 #define FTSK_TASK_CYCLIC_100MS_CYCLE_TIME (100u)
116 
117 /** @brief Maximum allowed jitter of 100ms task */
118 #define FTSK_TASK_CYCLIC_100MS_MAXIMUM_JITTER (5u)
119 
120 /** @brief pvParameters of the 100ms task */
121 #define FTSK_TASK_CYCLIC_100MS_PV_PARAMETERS (NULL_PTR)
122 
123 /** @brief Stack size of cyclic 100 ms task for algorithms */
124 #define FTSK_TASK_CYCLIC_ALGORITHM_100MS_STACKSIZE (1024u / 4u)
125 
126 /** @brief Phase of cyclic 100 ms task for algorithms */
127 #define FTSK_TASK_CYCLIC_ALGORITHM_100MS_PHASE (64u)
128 
129 /** @brief Cycle time of 100ms task for algorithms*/
130 #define FTSK_TASK_CYCLIC_ALGORITHM_100MS_CYCLE_TIME (100u)
131 
132 /** @brief Maximum allowed jitter of 100ms task for algorithms */
133 #define FTSK_TASK_CYCLIC_ALGORITHM_100MS_MAXIMUM_JITTER (5u)
134 
135 /** @brief pvParameters of the 100ms task for algorithms */
136 #define FTSK_TASK_CYCLIC_ALGORITHM_100MS_PV_PARAMETERS (NULL_PTR)
137 
138 /*========== Extern Constant and Variable Declarations ======================*/
139 /**
140  * @brief Task configuration of the engine task
141  * @details Task for database and system monitoring
142  * @ingroup API_OS
143  */
145 
146 /**
147  * @brief Task configuration of the cyclic 1 ms task
148  * @details Cyclic 1 ms task
149  * @ingroup API_OS
150  */
152 
153 /**
154  * @brief Task configuration of the cyclic 10 ms task
155  * @details Cyclic 10 ms task
156  * @ingroup API_OS
157  */
159 
160 /**
161  * @brief Task configuration of the cyclic 100 ms task
162  * @details Cyclic 100 ms task
163  * @ingroup API_OS
164  */
166 
167 /**
168  * @brief Task configuration of the cyclic 100 ms task for algorithms
169  * @details Cyclic 100 ms task for algorithms
170  * @ingroup API_OS
171  */
173 
174 /*========== Extern Function Prototypes =====================================*/
175 /**
176  * @brief Initializes the database
177  * @details Start up after scheduler starts
178  * @ingroup API_OS
179  * @warning Do not change the content of this function. This will very likely
180  * break the system. This function is kept in the configuration file
181  * to have a uniform task configuration.
182  */
183 extern void FTSK_InitializeUserCodeEngine(void);
184 
185 /**
186  * @brief Engine task for the database and the system monitoring module
187  * @details Start up after scheduler start. First task to be run, all other
188  * tasks only starts when this task has started
189  * @ingroup API_OS
190  * @warning Do not change the content of this function. This will very likely
191  * break the system. This function is kept in the configuration file
192  * to have a uniform task configuration.
193  */
194 extern void FTSK_RunUserCodeEngine(void);
195 
196 /**
197  * @brief Initialization function before all tasks started
198  * @details This function is called after the scheduler started but before any
199  * cyclic task runs. Here modules get initialized that are not used
200  * during the startup process.
201  * @ingroup API_OS
202  */
203 extern void FTSK_InitializeUserCodePreCyclicTasks(void);
204 
205 /**
206  * @brief Cyclic 1 ms task
207  * @details TODO
208  * @ingroup API_OS
209  */
210 extern void FTSK_RunUserCodeCyclic1ms(void);
211 
212 /**
213  * @brief Cyclic 10 ms task
214  * @details TODO
215  * @ingroup API_OS
216  */
217 extern void FTSK_RunUserCodeCyclic10ms(void);
218 
219 /**
220  * @brief Cyclic 100 ms task
221  * @details TODO
222  * @ingroup API_OS
223  */
224 extern void FTSK_RunUserCodeCyclic100ms(void);
225 
226 /**
227  * @brief Cyclic 100 ms task for algorithms
228  * @details TODO
229  * @ingroup API_OS
230  */
231 extern void FTSK_RunUserCodeCyclicAlgorithm100ms(void);
232 
233 /**
234  * @brief Idle task
235  * @details Called by #vApplicationIdleHook() if configUSE_IDLE_HOOK in
236  * FreeRTOSConfig.h is enabled. If you do not need this hook, you can
237  * disable it in the FreeRTOS configuration.
238  * @ingroup API_OS
239  */
240 extern void FTSK_RunUserCodeIdle(void);
241 
242 /*========== Externalized Static Functions Prototypes (Unit Test) ===========*/
243 
244 #endif /* FOXBMS__FTASK_CFG_H_ */
OS_TASK_DEFINITION_s ftsk_taskDefinitionCyclic100ms
Task configuration of the cyclic 100 ms task.
Definition: ftask_cfg.c:123
void FTSK_InitializeUserCodeEngine(void)
Initializes the database.
Definition: ftask_cfg.c:141
void FTSK_RunUserCodeEngine(void)
Engine task for the database and the system monitoring module.
Definition: ftask_cfg.c:162
OS_TASK_DEFINITION_s ftsk_taskDefinitionEngine
Task configuration of the engine task.
Definition: ftask_cfg.c:105
OS_TASK_DEFINITION_s ftsk_taskDefinitionCyclic1ms
Task configuration of the cyclic 1 ms task.
Definition: ftask_cfg.c:111
void FTSK_RunUserCodeIdle(void)
Idle task.
Definition: ftask_cfg.c:267
OS_TASK_DEFINITION_s ftsk_taskDefinitionCyclicAlgorithm100ms
Task configuration of the cyclic 100 ms task for algorithms.
Definition: ftask_cfg.c:129
void FTSK_RunUserCodeCyclic100ms(void)
Cyclic 100 ms task.
Definition: ftask_cfg.c:238
void FTSK_InitializeUserCodePreCyclicTasks(void)
Initialization function before all tasks started.
Definition: ftask_cfg.c:171
void FTSK_RunUserCodeCyclic10ms(void)
Cyclic 10 ms task.
Definition: ftask_cfg.c:216
void FTSK_RunUserCodeCyclic1ms(void)
Cyclic 1 ms task.
Definition: ftask_cfg.c:206
OS_TASK_DEFINITION_s ftsk_taskDefinitionCyclic10ms
Task configuration of the cyclic 10 ms task.
Definition: ftask_cfg.c:117
void FTSK_RunUserCodeCyclicAlgorithm100ms(void)
Cyclic 100 ms task for algorithms.
Definition: ftask_cfg.c:258
General macros and definitions for the whole platform.
Declaration of the OS wrapper interface.
struct for FreeRTOS task definition
Definition: os.h:125