foxBMS - Unit Tests  1.2.0
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-07-23 (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 Stack size of cyclic 1 ms task */
76 #define FTSK_TASK_CYCLIC_1MS_STACK_SIZE (1024u / 4u)
77 
78 /** @brief Phase of cyclic 1ms task */
79 #define FTSK_TASK_CYCLIC_1MS_PHASE (0u)
80 
81 /** @brief Cycle time of 1ms task */
82 #define FTSK_TASK_CYCLIC_1MS_CYCLE_TIME (1u)
83 
84 /** @brief Maximum allowed jitter of 1ms task */
85 #define FTSK_TASK_CYCLIC_1MS_MAXIMUM_JITTER (1u)
86 
87 /** @brief Stack size of cyclic 10 ms task */
88 #define FTSK_TASK_CYCLIC_10MS_STACK_SIZE ((4096u) / 4u)
89 
90 /** @brief Phase of cyclic 10 ms task */
91 #define FTSK_TASK_CYCLIC_10MS_PHASE (2u)
92 
93 /** @brief Cycle time of 10 ms task */
94 #define FTSK_TASK_CYCLIC_10MS_CYCLE_TIME (10u)
95 
96 /** @brief Maximum allowed jitter of 10ms task */
97 #define FTSK_TASK_CYCLIC_10MS_MAXIMUM_JITTER (2u)
98 
99 /** @brief Stack size of cyclic 100 ms task */
100 #define FTSK_TASK_CYCLIC_100MS_STACK_SIZE (1024u / 4u)
101 
102 /** @brief Phase of cyclic 100 ms task */
103 #define FTSK_TASK_CYCLIC_100MS_PHASE (56u)
104 
105 /** @brief Cycle time of 100ms task */
106 #define FTSK_TASK_CYCLIC_100MS_CYCLE_TIME (100u)
107 
108 /** @brief Maximum allowed jitter of 100ms task */
109 #define FTSK_TASK_CYCLIC_100MS_MAXIMUM_JITTER (5u)
110 
111 /** @brief Stack size of cyclic 100 ms task for algorithms */
112 #define FTSK_TASK_CYCLIC_ALGORITHM_100MS_STACKSIZE (1024u / 4u)
113 
114 /** @brief Phase of cyclic 100 ms task for algorithms */
115 #define FTSK_TASK_CYCLIC_ALGORITHM_100MS_PHASE (64u)
116 
117 /** @brief Cycle time of 100ms task for algorithms*/
118 #define FTSK_TASK_CYCLIC_ALGORITHM_100MS_CYCLE_TIME (100u)
119 
120 /** @brief Maximum allowed jitter of 100ms task for algorithms */
121 #define FTSK_TASK_CYCLIC_ALGORITHM_100MS_MAXIMUM_JITTER (5u)
122 
123 /*========== Extern Constant and Variable Declarations ======================*/
124 /**
125  * @brief Task configuration of the engine task
126  * @details Task for database and system monitoring
127  * @ingroup API_OS
128  */
130 
131 /**
132  * @brief Task configuration of the cyclic 1 ms task
133  * @details Cyclic 1 ms task
134  * @ingroup API_OS
135  */
137 
138 /**
139  * @brief Task configuration of the cyclic 10 ms task
140  * @details Cyclic 10 ms task
141  * @ingroup API_OS
142  */
144 
145 /**
146  * @brief Task configuration of the cyclic 100 ms task
147  * @details Cyclic 100 ms task
148  * @ingroup API_OS
149  */
151 
152 /**
153  * @brief Task configuration of the cyclic 100 ms task for algorithms
154  * @details Cyclic 100 ms task for algorithms
155  * @ingroup API_OS
156  */
158 
159 /*========== Extern Function Prototypes =====================================*/
160 /**
161  * @brief Initializes the database
162  * @details Start up after scheduler starts
163  * @ingroup API_OS
164  * @warning Do not change the content of this function. This will very likely
165  * break the system. This function is kept in the configuration file
166  * to have a uniform task configuration.
167  */
168 extern void FTSK_InitializeUserCodeEngine(void);
169 
170 /**
171  * @brief Engine task for the database and the system monitoring module
172  * @details Start up after scheduler start. First task to be run, all other
173  * tasks only starts when this task has started
174  * @ingroup API_OS
175  * @warning Do not change the content of this function. This will very likely
176  * break the system. This function is kept in the configuration file
177  * to have a uniform task configuration.
178  */
179 extern void FTSK_RunUserCodeEngine(void);
180 
181 /**
182  * @brief Initialization function before all tasks started
183  * @details This function is called after the scheduler started but before any
184  * cyclic task runs. Here modules get initialized that are not used
185  * during the startup process.
186  * @ingroup API_OS
187  */
188 extern void FTSK_InitializeUserCodePreCyclicTasks(void);
189 
190 /**
191  * @brief Cyclic 1 ms task
192  * @details TODO
193  * @ingroup API_OS
194  */
195 extern void FTSK_RunUserCodeCyclic1ms(void);
196 
197 /**
198  * @brief Cyclic 10 ms task
199  * @details TODO
200  * @ingroup API_OS
201  */
202 extern void FTSK_RunUserCodeCyclic10ms(void);
203 
204 /**
205  * @brief Cyclic 100 ms task
206  * @details TODO
207  * @ingroup API_OS
208  */
209 extern void FTSK_RunUserCodeCyclic100ms(void);
210 
211 /**
212  * @brief Cyclic 100 ms task for algorithms
213  * @details TODO
214  * @ingroup API_OS
215  */
216 extern void FTSK_RunUserCodeCyclicAlgorithm100ms(void);
217 
218 /**
219  * @brief Idle task
220  * @details Called by #vApplicationIdleHook() if configUSE_IDLE_HOOK in
221  * FreeRTOSConfig.h is enabled. If you do not need this hook, you can
222  * disable it in the FreeRTOS configuration.
223  * @ingroup API_OS
224  */
225 extern void FTSK_RunUserCodeIdle(void);
226 
227 /*========== Externalized Static Functions Prototypes (Unit Test) ===========*/
228 
229 #endif /* FOXBMS__FTASK_CFG_H_ */
OS_TASK_DEFINITION_s ftsk_taskDefinitionCyclic100ms
Task configuration of the cyclic 100 ms task.
Definition: ftask_cfg.c:114
void FTSK_InitializeUserCodeEngine(void)
Initializes the database.
Definition: ftask_cfg.c:130
void FTSK_RunUserCodeEngine(void)
Engine task for the database and the system monitoring module.
Definition: ftask_cfg.c:151
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:107
void FTSK_RunUserCodeIdle(void)
Idle task.
Definition: ftask_cfg.c:256
OS_TASK_DEFINITION_s ftsk_taskDefinitionCyclicAlgorithm100ms
Task configuration of the cyclic 100 ms task for algorithms.
Definition: ftask_cfg.c:119
void FTSK_RunUserCodeCyclic100ms(void)
Cyclic 100 ms task.
Definition: ftask_cfg.c:227
void FTSK_InitializeUserCodePreCyclicTasks(void)
Initialization function before all tasks started.
Definition: ftask_cfg.c:160
void FTSK_RunUserCodeCyclic10ms(void)
Cyclic 10 ms task.
Definition: ftask_cfg.c:205
void FTSK_RunUserCodeCyclic1ms(void)
Cyclic 1 ms task.
Definition: ftask_cfg.c:195
OS_TASK_DEFINITION_s ftsk_taskDefinitionCyclic10ms
Task configuration of the cyclic 10 ms task.
Definition: ftask_cfg.c:112
void FTSK_RunUserCodeCyclicAlgorithm100ms(void)
Cyclic 100 ms task for algorithms.
Definition: ftask_cfg.c:247
General macros and definitions for the whole platform.
Implementation of the tasks used by the system, headers.
struct for FreeRTOS task definition
Definition: os.h:116