foxBMS - Unit Tests  1.1.0
The foxBMS Unit Tests API Documentation
diag_cbs.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 diag_cbs.h
44  * @author foxBMS Team
45  * @date 2021-02-17 (date of creation)
46  * @updated 2021-06-09 (date of last update)
47  * @ingroup ENGINE
48  * @prefix DIAG
49  *
50  * @brief Diagnosis driver header
51  *
52  */
53 
54 #ifndef FOXBMS__DIAG_CBS_H_
55 #define FOXBMS__DIAG_CBS_H_
56 
57 /*========== Includes =======================================================*/
58 #include "general.h"
59 
60 #include "diag_cfg.h"
61 
62 /*========== Macros and Definitions =========================================*/
63 
64 /*========== Extern Constant and Variable Declarations ======================*/
65 
66 /*========== Extern Function Prototypes =====================================*/
67 /**
68  * @brief dummy callback function of diagnosis events
69  * @param[in] ch_id ID of entry
70  * @param[in] event OK, NOK or RESET
71  * @param[in] kpkDiagShim shim to the database entries
72  * @param[in] data data
73  */
74 extern void DIAG_DummyCallback(
75  DIAG_ID_e ch_id,
76  DIAG_EVENT_e event,
77  const DIAG_DATABASE_SHIM_s *const kpkDiagShim,
78  uint32_t data);
79 
80 /**
81  * @brief diagnosis callback function for overvoltage events
82  * @param[in] ch_id ID of diag entry
83  * @param[in] event OK, NOK or RESET
84  * @param[in] kpkDiagShim shim to the database entries
85  * @param[in] stringNumber stringNumber where overvoltage event occurred
86  */
87 extern void DIAG_ErrorOvervoltage(
88  DIAG_ID_e ch_id,
89  DIAG_EVENT_e event,
90  const DIAG_DATABASE_SHIM_s *const kpkDiagShim,
91  uint32_t stringNumber);
92 
93 /**
94  * @brief diagnosis callback function for undervoltage events
95  * @param[in] ch_id ID of diag entry
96  * @param[in] event OK, NOK or RESET
97  * @param[in] kpkDiagShim shim to the database entries
98  * @param[in] stringNumber stringNumber where undervoltage event occurred
99  */
100 extern void DIAG_ErrorUndervoltage(
101  DIAG_ID_e ch_id,
102  DIAG_EVENT_e event,
103  const DIAG_DATABASE_SHIM_s *const kpkDiagShim,
104  uint32_t stringNumber);
105 /**
106  * @brief diagnosis callback function for overtemperature charge events
107  * @param[in] ch_id ID of diag entry
108  * @param[in] event OK, NOK or RESET
109  * @param[in] kpkDiagShim shim to the database entries
110  * @param[in] stringNumber stringNumber where overtemperature event occurred
111  */
113  DIAG_ID_e ch_id,
114  DIAG_EVENT_e event,
115  const DIAG_DATABASE_SHIM_s *const kpkDiagShim,
116  uint32_t stringNumber);
117 
118 /**
119  * @brief diagnosis callback function for overtemperature discharge events
120  * @param[in] ch_id ID of diag entry
121  * @param[in] event OK, NOK or RESET
122  * @param[in] kpkDiagShim shim to the database entries
123  * @param[in] stringNumber stringNumber where overtemperature event occurred
124  */
126  DIAG_ID_e ch_id,
127  DIAG_EVENT_e event,
128  const DIAG_DATABASE_SHIM_s *const kpkDiagShim,
129  uint32_t stringNumber);
130 
131 /**
132  * @brief diagnosis callback function for undertemperature charge events
133  * @param[in] ch_id ID of diag entry
134  * @param[in] event OK, NOK or RESET
135  * @param[in] kpkDiagShim shim to the database entries
136  * @param[in] stringNumber stringNumber where undertemperature event occurred
137  */
139  DIAG_ID_e ch_id,
140  DIAG_EVENT_e event,
141  const DIAG_DATABASE_SHIM_s *const kpkDiagShim,
142  uint32_t stringNumber);
143 
144 /**
145  * @brief diagnosis callback function for undertemperature discharge events
146  * @param[in] ch_id ID of diag entry
147  * @param[in] event OK, NOK or RESET
148  * @param[in] kpkDiagShim shim to the database entries
149  * @param[in] stringNumber stringNumber where undertemperature event occurred
150  */
152  DIAG_ID_e ch_id,
153  DIAG_EVENT_e event,
154  const DIAG_DATABASE_SHIM_s *const kpkDiagShim,
155  uint32_t stringNumber);
156 
157 /**
158  * @brief diagnosis callback function for overcurrent charge events
159  * @param[in] ch_id ID of diag entry
160  * @param[in] event OK, NOK or RESET
161  * @param[in] kpkDiagShim shim to the database entries
162  * @param[in] stringNumber stringNumber where overcurrent event occurred
163  */
164 extern void DIAG_ErrorOvercurrentCharge(
165  DIAG_ID_e ch_id,
166  DIAG_EVENT_e event,
167  const DIAG_DATABASE_SHIM_s *const kpkDiagShim,
168  uint32_t stringNumber);
169 
170 /**
171  * @brief diagnosis callback function for overcurrent discharge events
172  * @param[in] ch_id ID of diag entry
173  * @param[in] event OK, NOK or RESET
174  * @param[in] kpkDiagShim shim to the database entries
175  * @param[in] stringNumber stringNumber where overcurrent event occurred
176  */
178  DIAG_ID_e ch_id,
179  DIAG_EVENT_e event,
180  const DIAG_DATABASE_SHIM_s *const kpkDiagShim,
181  uint32_t stringNumber);
182 
183 /**
184  * @brief diagnosis callback function for overcurrent charge events
185  * @param[in] ch_id ID of diag entry
186  * @param[in] event OK, NOK or RESET
187  * @param[in] kpkDiagShim shim to the database entries
188  * @param[in] stringNumber stringNumber where overcurrent event occurred
189  */
191  DIAG_ID_e ch_id,
192  DIAG_EVENT_e event,
193  const DIAG_DATABASE_SHIM_s *const kpkDiagShim,
194  uint32_t stringNumber);
195 
196 /**
197  * @brief diagnosis callback function for current measurement related events
198  * @param[in] ch_id ID of diag entry
199  * @param[in] event OK, NOK or RESET
200  * @param[in] kpkDiagShim shim to the database entries
201  * @param[in] stringNumber stringNumber where event occurred
202  */
203 extern void DIAG_ErrorCurrentMeasurement(
204  DIAG_ID_e ch_id,
205  DIAG_EVENT_e event,
206  const DIAG_DATABASE_SHIM_s *const kpkDiagShim,
207  uint32_t stringNumber);
208 
209 /**
210  * @brief diagnosis callback function for current sensor related events
211  * @param[in] ch_id ID of diag entry
212  * @param[in] event OK, NOK or RESET
213  * @param[in] kpkDiagShim shim to the database entries
214  * @param[in] stringNumber stringNumber where event occurred
215  */
217  DIAG_ID_e ch_id,
218  DIAG_EVENT_e event,
219  const DIAG_DATABASE_SHIM_s *const kpkDiagShim,
220  uint32_t stringNumber);
221 
222 /* ----------------- Functions for system related events ------------------ */
223 
224 /**
225  * @brief Callback function for system monitoring related diagnosis events
226  * @param[in] ch_id ID of diag entry
227  * @param[in] event #DIAG_EVENT_e
228  * @param[in] kpkDiagShim shim to the database entries
229  * @param[in] data data
230  */
231 extern void DIAG_ErrorSystemMonitoring(
232  DIAG_ID_e ch_id,
233  DIAG_EVENT_e event,
234  const DIAG_DATABASE_SHIM_s *const kpkDiagShim,
235  uint32_t data);
236 
237 /**
238  * @brief Callback function for interlock related diagnosis events
239  * @param[in] ch_id ID of diag entry
240  * @param[in] event #DIAG_EVENT_e
241  * @param[in] kpkDiagShim shim to the database entries
242  * @param[in] data data
243  */
244 extern void DIAG_ErrorInterlock(
245  DIAG_ID_e ch_id,
246  DIAG_EVENT_e event,
247  const DIAG_DATABASE_SHIM_s *const kpkDiagShim,
248  uint32_t data);
249 
250 /**
251  * @brief diagnosis callback function for CAN related events
252  * @param[in] ch_id ID of diag entry
253  * @param[in] event #DIAG_EVENT_e
254  * @param[in] kpkDiagShim shim to the database entries
255  * @param[in] data data
256  */
257 extern void DIAG_ErrorCanTiming(
258  DIAG_ID_e ch_id,
259  DIAG_EVENT_e event,
260  const DIAG_DATABASE_SHIM_s *const kpkDiagShim,
261  uint32_t data);
262 
263 /**
264  * @brief diagnosis callback function for CAN related events
265  * @param[in] ch_id ID of diag entry
266  * @param[in] event #DIAG_EVENT_e
267  * @param[in] kpkDiagShim shim to the database entries
268  * @param[in] data data
269  */
270 extern void DIAG_ErrorCanRxQueueFull(
271  DIAG_ID_e ch_id,
272  DIAG_EVENT_e event,
273  const DIAG_DATABASE_SHIM_s *const kpkDiagShim,
274  uint32_t data);
275 
276 /**
277  * @brief diagnosis callback function for LTC module related events
278  * @param[in] ch_id ID of diag entry
279  * @param[in] event OK, NOK or RESET
280  * @param[in] kpkDiagShim shim to the database entries
281  * @param[in] stringNumber stringNumber where LTC event occurred
282  */
283 extern void DIAG_ErrorLtc(
284  DIAG_ID_e ch_id,
285  DIAG_EVENT_e event,
286  const DIAG_DATABASE_SHIM_s *const kpkDiagShim,
287  uint32_t stringNumber);
288 
289 /**
290  * @brief diagnosis callback function for measurement IC related events
291  * @param[in] ch_id ID of diag entry
292  * @param[in] event OK, NOK or RESET
293  * @param[in] kpkDiagShim shim to the database entries
294  * @param[in] stringNumber stringNumber where event occurred
295  */
296 extern void DIAG_ErrorMeasurementIc(
297  DIAG_ID_e ch_id,
298  DIAG_EVENT_e event,
299  const DIAG_DATABASE_SHIM_s *const kpkDiagShim,
300  uint32_t stringNumber);
301 
302 /**
303  * @brief diagnosis callback function for current sensor related events
304  * @param[in] ch_id ID of diag entry
305  * @param[in] event OK, NOK or RESET
306  * @param[in] kpkDiagShim shim to the database entries
307  * @param[in] stringNumber stringNumber where current sensor event occurred
308  */
309 extern void DIAG_ErrorCurrentSensor(
310  DIAG_ID_e ch_id,
311  DIAG_EVENT_e event,
312  const DIAG_DATABASE_SHIM_s *const kpkDiagShim,
313  uint32_t stringNumber);
314 
315 /**
316  * @brief diagnosis callback function for SBC related events
317  * @param[in] ch_id ID of diag entry
318  * @param[in] event #DIAG_EVENT_e
319  * @param[in] kpkDiagShim shim to the database entries
320  * @param[in] data data
321  */
322 extern void DIAG_Sbc(DIAG_ID_e ch_id, DIAG_EVENT_e event, const DIAG_DATABASE_SHIM_s *const kpkDiagShim, uint32_t data);
323 
324 /**
325  * @brief diagnosis callback function for plausibility check related events
326  * @param[in] ch_id ID of diag entry
327  * @param[in] event #DIAG_EVENT_e
328  * @param[in] kpkDiagShim shim to the database entries
329  * @param[in] stringNumber stringNumber where current sensor event occurred
330  */
331 extern void DIAG_ErrorPlausibility(
332  DIAG_ID_e ch_id,
333  DIAG_EVENT_e event,
334  const DIAG_DATABASE_SHIM_s *const kpkDiagShim,
335  uint32_t stringNumber);
336 
337 /**
338  * @brief diagnosis callback function for string contactor feedback related events
339  * @param[in] ch_id ID of diag entry
340  * @param[in] event #DIAG_EVENT_e
341  * @param[in] kpkDiagShim shim to the database entries
342  * @param[in] stringNumber stringNumber where contactor feedback event occurred
343  */
344 extern void DIAG_StringContactorFeedback(
345  DIAG_ID_e ch_id,
346  DIAG_EVENT_e event,
347  const DIAG_DATABASE_SHIM_s *const kpkDiagShim,
348  uint32_t stringNumber);
349 
350 /**
351  * @brief diagnosis callback function for precharge contactor feedback related events
352  * @param[in] ch_id ID of diag entry
353  * @param[in] event #DIAG_EVENT_e
354  * @param[in] kpkDiagShim shim to the database entries
355  * @param[in] stringNumber stringNumber where precharge feedback event occurred
356  */
358  DIAG_ID_e ch_id,
359  DIAG_EVENT_e event,
360  const DIAG_DATABASE_SHIM_s *const kpkDiagShim,
361  uint32_t stringNumber);
362 
363 /**
364  * @brief diagnosis callback function for plausibility check related events
365  * @param[in] ch_id ID of diag entry
366  * @param[in] event #DIAG_EVENT_e
367  * @param[in] kpkDiagShim shim to the database entries
368  * @param[in] stringNumber stringNumber where precharge feedback event occurred
369  */
370 extern void DIAG_PlausibilityCheck(
371  DIAG_ID_e ch_id,
372  DIAG_EVENT_e event,
373  const DIAG_DATABASE_SHIM_s *const kpkDiagShim,
374  uint32_t stringNumber);
375 
376 /**
377  * @brief diagnosis callback function for deep discharge events
378  * @param[in] ch_id ID of diag entry
379  * @param[in] event OK, NOK or RESET
380  * @param[in] kpkDiagShim shim to the database entries
381  * @param[in] stringNumber stringNumber where deep discharge event occurred
382  */
383 extern void DIAG_ErrorDeepDischarge(
384  DIAG_ID_e ch_id,
385  DIAG_EVENT_e event,
386  const DIAG_DATABASE_SHIM_s *const kpkDiagShim,
387  uint32_t stringNumber);
388 
389 /**
390  * @brief diagnosis callback function for current sensor related events
391  * @param[in] ch_id ID of diag entry
392  * @param[in] event OK, NOK or RESET
393  * @param[in] kpkDiagShim shim to the database entries
394  * @param[in] data TODO
395  */
396 extern void DIAG_ErrorPowerMeasurement(
397  DIAG_ID_e ch_id,
398  DIAG_EVENT_e event,
399  const DIAG_DATABASE_SHIM_s *const kpkDiagShim,
400  uint32_t data);
401 
402 extern void DIAG_Insulation(
403  DIAG_ID_e ch_id,
404  DIAG_EVENT_e event,
405  const DIAG_DATABASE_SHIM_s *const kpkDiagShim,
406  uint32_t data);
407 
408 /*========== Externalized Static Functions Prototypes (Unit Test) ===========*/
409 
410 #endif /* FOXBMS__DIAG_CBS_H_ */
void DIAG_ErrorMeasurementIc(DIAG_ID_e ch_id, DIAG_EVENT_e event, const DIAG_DATABASE_SHIM_s *const kpkDiagShim, uint32_t stringNumber)
diagnosis callback function for measurement IC related events
Definition: diag_cbs_mic.c:68
void DIAG_ErrorPlausibility(DIAG_ID_e ch_id, DIAG_EVENT_e event, const DIAG_DATABASE_SHIM_s *const kpkDiagShim, uint32_t stringNumber)
diagnosis callback function for plausibility check related events
void DIAG_ErrorUndervoltage(DIAG_ID_e ch_id, DIAG_EVENT_e event, const DIAG_DATABASE_SHIM_s *const kpkDiagShim, uint32_t stringNumber)
diagnosis callback function for undervoltage events
void DIAG_ErrorCanTiming(DIAG_ID_e ch_id, DIAG_EVENT_e event, const DIAG_DATABASE_SHIM_s *const kpkDiagShim, uint32_t data)
diagnosis callback function for CAN related events
Definition: diag_cbs_can.c:68
void DIAG_ErrorCurrentSensor(DIAG_ID_e ch_id, DIAG_EVENT_e event, const DIAG_DATABASE_SHIM_s *const kpkDiagShim, uint32_t stringNumber)
diagnosis callback function for current sensor related events
void DIAG_ErrorOvervoltage(DIAG_ID_e ch_id, DIAG_EVENT_e event, const DIAG_DATABASE_SHIM_s *const kpkDiagShim, uint32_t stringNumber)
diagnosis callback function for overvoltage events
void DIAG_ErrorUndertemperatureDischarge(DIAG_ID_e ch_id, DIAG_EVENT_e event, const DIAG_DATABASE_SHIM_s *const kpkDiagShim, uint32_t stringNumber)
diagnosis callback function for undertemperature discharge events
void DIAG_ErrorCurrentOnOpenString(DIAG_ID_e ch_id, DIAG_EVENT_e event, const DIAG_DATABASE_SHIM_s *const kpkDiagShim, uint32_t stringNumber)
diagnosis callback function for overcurrent charge events
void DIAG_ErrorOvertemperatureCharge(DIAG_ID_e ch_id, DIAG_EVENT_e event, const DIAG_DATABASE_SHIM_s *const kpkDiagShim, uint32_t stringNumber)
diagnosis callback function for overtemperature charge events
void DIAG_ErrorDeepDischarge(DIAG_ID_e ch_id, DIAG_EVENT_e event, const DIAG_DATABASE_SHIM_s *const kpkDiagShim, uint32_t stringNumber)
diagnosis callback function for deep discharge events
void DIAG_Sbc(DIAG_ID_e ch_id, DIAG_EVENT_e event, const DIAG_DATABASE_SHIM_s *const kpkDiagShim, uint32_t data)
diagnosis callback function for SBC related events
Definition: diag_cbs_sbc.c:68
void DIAG_ErrorPowerMeasurement(DIAG_ID_e ch_id, DIAG_EVENT_e event, const DIAG_DATABASE_SHIM_s *const kpkDiagShim, uint32_t data)
diagnosis callback function for current sensor related events
void DIAG_ErrorHighVoltageMeasurement(DIAG_ID_e ch_id, DIAG_EVENT_e event, const DIAG_DATABASE_SHIM_s *const kpkDiagShim, uint32_t stringNumber)
diagnosis callback function for current sensor related events
void DIAG_PlausibilityCheck(DIAG_ID_e ch_id, DIAG_EVENT_e event, const DIAG_DATABASE_SHIM_s *const kpkDiagShim, uint32_t stringNumber)
diagnosis callback function for plausibility check related events
void DIAG_StringContactorFeedback(DIAG_ID_e ch_id, DIAG_EVENT_e event, const DIAG_DATABASE_SHIM_s *const kpkDiagShim, uint32_t stringNumber)
diagnosis callback function for string contactor feedback related events
void DIAG_Insulation(DIAG_ID_e ch_id, DIAG_EVENT_e event, const DIAG_DATABASE_SHIM_s *const kpkDiagShim, uint32_t data)
void DIAG_ErrorLtc(DIAG_ID_e ch_id, DIAG_EVENT_e event, const DIAG_DATABASE_SHIM_s *const kpkDiagShim, uint32_t stringNumber)
diagnosis callback function for LTC module related events
Definition: diag_cbs_ltc.c:68
void DIAG_ErrorOvertemperatureDischarge(DIAG_ID_e ch_id, DIAG_EVENT_e event, const DIAG_DATABASE_SHIM_s *const kpkDiagShim, uint32_t stringNumber)
diagnosis callback function for overtemperature discharge events
void DIAG_ErrorCurrentMeasurement(DIAG_ID_e ch_id, DIAG_EVENT_e event, const DIAG_DATABASE_SHIM_s *const kpkDiagShim, uint32_t stringNumber)
diagnosis callback function for current measurement related events
void DIAG_ErrorOvercurrentCharge(DIAG_ID_e ch_id, DIAG_EVENT_e event, const DIAG_DATABASE_SHIM_s *const kpkDiagShim, uint32_t stringNumber)
diagnosis callback function for overcurrent charge events
void DIAG_ErrorCanRxQueueFull(DIAG_ID_e ch_id, DIAG_EVENT_e event, const DIAG_DATABASE_SHIM_s *const kpkDiagShim, uint32_t data)
diagnosis callback function for CAN related events
Definition: diag_cbs_can.c:87
void DIAG_PrechargeContactorFeedback(DIAG_ID_e ch_id, DIAG_EVENT_e event, const DIAG_DATABASE_SHIM_s *const kpkDiagShim, uint32_t stringNumber)
diagnosis callback function for precharge contactor feedback related events
void DIAG_ErrorOvercurrentDischarge(DIAG_ID_e ch_id, DIAG_EVENT_e event, const DIAG_DATABASE_SHIM_s *const kpkDiagShim, uint32_t stringNumber)
diagnosis callback function for overcurrent discharge events
void DIAG_DummyCallback(DIAG_ID_e ch_id, DIAG_EVENT_e event, const DIAG_DATABASE_SHIM_s *const kpkDiagShim, uint32_t data)
dummy callback function of diagnosis events
void DIAG_ErrorInterlock(DIAG_ID_e ch_id, DIAG_EVENT_e event, const DIAG_DATABASE_SHIM_s *const kpkDiagShim, uint32_t data)
Callback function for interlock related diagnosis events.
void DIAG_ErrorUndertemperatureCharge(DIAG_ID_e ch_id, DIAG_EVENT_e event, const DIAG_DATABASE_SHIM_s *const kpkDiagShim, uint32_t stringNumber)
diagnosis callback function for undertemperature charge events
void DIAG_ErrorSystemMonitoring(DIAG_ID_e ch_id, DIAG_EVENT_e event, const DIAG_DATABASE_SHIM_s *const kpkDiagShim, uint32_t data)
Callback function for system monitoring related diagnosis events.
Diagnostic module configuration header.
enum DIAG_EVENT DIAG_EVENT_e
enum DIAG_ID DIAG_ID_e
General macros and definitions for the whole platform.