foxBMS - Unit Tests  1.6.0
The foxBMS Unit Tests API Documentation
can_cbs_rx.h
Go to the documentation of this file.
1 /**
2  *
3  * @copyright © 2010 - 2023, 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 can_cbs_rx.h
44  * @author foxBMS Team
45  * @date 2021-04-20 (date of creation)
46  * @updated 2023-10-12 (date of last update)
47  * @version v1.6.0
48  * @ingroup DRIVER
49  * @prefix CANRX
50  *
51  * @brief CAN callbacks header
52  *
53  */
54 
55 #ifndef FOXBMS__CAN_CBS_RX_H_
56 #define FOXBMS__CAN_CBS_RX_H_
57 
58 /*========== Includes =======================================================*/
59 
60 #include "can_cfg.h"
61 
62 #include <stdint.h>
63 
64 /*========== Macros and Definitions =========================================*/
65 
66 /*========== Extern Constant and Variable Declarations ======================*/
67 
68 /*========== Extern Function Prototypes =====================================*/
69 
70 /** RX callback functions @{ */
71 /**
72  * @brief can rx callback function for IMD info messages
73  * @param[in] message contains the message ID, DLC and endianness
74  * @param[in] kpkCanData payload of can frame
75  * @param[in] kpkCanShim shim to the database entries
76  */
77 extern uint32_t CANRX_ImdInfo(
79  const uint8_t *const kpkCanData,
80  const CAN_SHIM_s *const kpkCanShim);
81 
82 /**
83  * @brief can rx callback function for IMD response messages
84  * @param[in] message contains the message ID, DLC and endianness
85  * @param[in] kpkCanData payload of can frame
86  * @param[in] kpkCanShim shim to the database entries
87  */
88 extern uint32_t CANRX_ImdResponse(
90  const uint8_t *const kpkCanData,
91  const CAN_SHIM_s *const kpkCanShim);
92 
93 /**
94  * @brief can rx callback function for state requests
95  * @param[in] message contains the message ID, DLC and endianness
96  * @param[in] kpkCanData payload of can frame
97  * @param[in] kpkCanShim shim to the database entries
98  */
99 extern uint32_t CANRX_BmsStateRequest(
100  CAN_MESSAGE_PROPERTIES_s message,
101  const uint8_t *const kpkCanData,
102  const CAN_SHIM_s *const kpkCanShim);
103 
104 /**
105  * @brief can rx callback function for current sensor measurements
106  * @param[in] message contains the message ID, DLC and endianness
107  * @param[in] kpkCanData payload of can frame
108  * @param[in] kpkCanShim shim to the database entries
109  */
110 extern uint32_t CANRX_CurrentSensor(
111  CAN_MESSAGE_PROPERTIES_s message,
112  const uint8_t *const kpkCanData,
113  const CAN_SHIM_s *const kpkCanShim);
114 
115 /**
116  * @brief can rx callback function for debug messages
117  * @param[in] message contains the message ID, DLC and endianness
118  * @param[in] kpkCanData payload of can frame
119  * @param[in] kpkCanShim shim to the database entries
120  */
121 extern uint32_t CANRX_Debug(
122  CAN_MESSAGE_PROPERTIES_s message,
123  const uint8_t *const kpkCanData,
124  const CAN_SHIM_s *const kpkCanShim);
125 
126 /**
127  * @brief can rx callback function for aerosol sensor messages
128  * @param[in] message contains the message ID, DLC and endianness
129  * @param[in] kpkCanData payload of can frame
130  * @param[in] kpkCanShim shim to the database entries
131  */
132 extern uint32_t CANRX_AerosolSensor(
133  CAN_MESSAGE_PROPERTIES_s message,
134  const uint8_t *const kpkCanData,
135  const CAN_SHIM_s *const kpkCanShim);
136 /**@}*/
137 
138 /*========== Externalized Static Functions Prototypes (Unit Test) ===========*/
139 #ifdef UNITY_UNIT_TEST
140 extern uint8_t TEST_CANRX_GetHundredthOfSeconds(uint64_t messageData, CAN_ENDIANNESS_e endianness);
141 extern uint8_t TEST_CANRX_GetSeconds(uint64_t messageData, CAN_ENDIANNESS_e endianness);
142 extern uint8_t TEST_CANRX_GetMinutes(uint64_t messageData, CAN_ENDIANNESS_e endianness);
143 extern uint8_t TEST_CANRX_GetHours(uint64_t messageData, CAN_ENDIANNESS_e endianness);
144 extern uint8_t TEST_CANRX_GetWeekday(uint64_t messageData, CAN_ENDIANNESS_e endianness);
145 extern uint8_t TEST_CANRX_GetDay(uint64_t messageData, CAN_ENDIANNESS_e endianness);
146 extern uint8_t TEST_CANRX_GetMonth(uint64_t messageData, CAN_ENDIANNESS_e endianness);
147 extern uint8_t TEST_CANRX_GetYear(uint64_t messageData, CAN_ENDIANNESS_e endianness);
148 
151 extern void TEST_CANRX_TriggerMcuLotNumberMessage(void);
153 extern void TEST_CANRX_TriggerTimeInfoMessage(void);
154 extern void TEST_CANRX_TriggerCommitHashMessage(void);
155 
156 extern bool TEST_CANRX_CheckIfBmsSoftwareVersionIsRequested(uint64_t messageData, CAN_ENDIANNESS_e endianness);
157 extern bool TEST_CANRX_CheckIfMcuUniqueDieIdIsRequested(uint64_t messageData, CAN_ENDIANNESS_e endianness);
158 extern bool TEST_CANRX_CheckIfMcuLotNumberIsRequested(uint64_t messageData, CAN_ENDIANNESS_e endianness);
159 extern bool TEST_CANRX_CheckIfMcuWaferInformationIsRequested(uint64_t messageData, CAN_ENDIANNESS_e endianness);
160 extern bool TEST_CANRX_CheckIfSoftwareResetIsRequested(uint64_t messageData, CAN_ENDIANNESS_e endianness);
161 extern bool TEST_CANRX_CheckIfFramInitializationIsRequested(uint64_t messageData, CAN_ENDIANNESS_e endianness);
162 extern bool TEST_CANRX_CheckIfTimeInfoIsRequested(uint64_t messageData, CAN_ENDIANNESS_e endianness);
163 extern bool TEST_CANRX_CheckIfCommitHashIsRequested(uint64_t messageData, CAN_ENDIANNESS_e endianness);
164 
165 extern void TEST_CANRX_ProcessVersionInformationMux(uint64_t messageData, CAN_ENDIANNESS_e endianness);
166 extern void TEST_CANRX_ProcessRtcMux(uint64_t messageData, CAN_ENDIANNESS_e endianness);
167 extern void TEST_CANRX_ProcessSoftwareResetMux(uint64_t messageData, CAN_ENDIANNESS_e endianness);
168 extern void TEST_CANRX_ProcessFramInitializationMux(uint64_t messageData, CAN_ENDIANNESS_e endianness);
169 extern void TEST_CANRX_ProcessTimeInfoMux(uint64_t messageData, CAN_ENDIANNESS_e endianness);
170 
171 extern void TEST_CANRX_HandleAerosolSensorErrors(const CAN_SHIM_s *const kpkCanShim, uint16_t signalData);
172 extern void TEST_CANRX_HandleAerosolSensorStatus(const CAN_SHIM_s *const kpkCanShim, uint16_t signalData);
173 extern void TEST_CANRX_SetParticulateMatterConcentration(const CAN_SHIM_s *const kpkCanShim, uint16_t signalData);
174 extern void TEST_CANRX_SetAerosolSensorCrcCheckCode(const CAN_SHIM_s *const kpkCanShim, uint16_t signalData);
175 #endif
176 
177 #endif /* FOXBMS__CAN_CBS_RX_H_ */
void TEST_CANRX_ProcessSoftwareResetMux(uint64_t messageData, CAN_ENDIANNESS_e endianness)
uint8_t TEST_CANRX_GetHours(uint64_t messageData, CAN_ENDIANNESS_e endianness)
uint8_t TEST_CANRX_GetMinutes(uint64_t messageData, CAN_ENDIANNESS_e endianness)
bool TEST_CANRX_CheckIfMcuUniqueDieIdIsRequested(uint64_t messageData, CAN_ENDIANNESS_e endianness)
void TEST_CANRX_TriggerMcuLotNumberMessage(void)
void TEST_CANRX_TriggerCommitHashMessage(void)
bool TEST_CANRX_CheckIfTimeInfoIsRequested(uint64_t messageData, CAN_ENDIANNESS_e endianness)
uint32_t CANRX_ImdResponse(CAN_MESSAGE_PROPERTIES_s message, const uint8_t *const kpkCanData, const CAN_SHIM_s *const kpkCanShim)
can rx callback function for IMD response messages
void TEST_CANRX_ProcessFramInitializationMux(uint64_t messageData, CAN_ENDIANNESS_e endianness)
void TEST_CANRX_TriggerTimeInfoMessage(void)
bool TEST_CANRX_CheckIfFramInitializationIsRequested(uint64_t messageData, CAN_ENDIANNESS_e endianness)
uint8_t TEST_CANRX_GetHundredthOfSeconds(uint64_t messageData, CAN_ENDIANNESS_e endianness)
void TEST_CANRX_TriggerMcuUniqueDieIdMessage(void)
void TEST_CANRX_TriggerMcuWaferInformationMessage(void)
bool TEST_CANRX_CheckIfMcuLotNumberIsRequested(uint64_t messageData, CAN_ENDIANNESS_e endianness)
uint8_t TEST_CANRX_GetWeekday(uint64_t messageData, CAN_ENDIANNESS_e endianness)
uint32_t CANRX_Debug(CAN_MESSAGE_PROPERTIES_s message, const uint8_t *const kpkCanData, const CAN_SHIM_s *const kpkCanShim)
can rx callback function for debug messages
void TEST_CANRX_HandleAerosolSensorErrors(const CAN_SHIM_s *const kpkCanShim, uint16_t signalData)
uint32_t CANRX_CurrentSensor(CAN_MESSAGE_PROPERTIES_s message, const uint8_t *const kpkCanData, const CAN_SHIM_s *const kpkCanShim)
can rx callback function for current sensor measurements
void TEST_CANRX_ProcessRtcMux(uint64_t messageData, CAN_ENDIANNESS_e endianness)
uint8_t TEST_CANRX_GetYear(uint64_t messageData, CAN_ENDIANNESS_e endianness)
bool TEST_CANRX_CheckIfSoftwareResetIsRequested(uint64_t messageData, CAN_ENDIANNESS_e endianness)
void TEST_CANRX_SetAerosolSensorCrcCheckCode(const CAN_SHIM_s *const kpkCanShim, uint16_t signalData)
uint32_t CANRX_BmsStateRequest(CAN_MESSAGE_PROPERTIES_s message, const uint8_t *const kpkCanData, const CAN_SHIM_s *const kpkCanShim)
can rx callback function for state requests
uint32_t CANRX_AerosolSensor(CAN_MESSAGE_PROPERTIES_s message, const uint8_t *const kpkCanData, const CAN_SHIM_s *const kpkCanShim)
can rx callback function for aerosol sensor messages
void TEST_CANRX_ProcessVersionInformationMux(uint64_t messageData, CAN_ENDIANNESS_e endianness)
bool TEST_CANRX_CheckIfMcuWaferInformationIsRequested(uint64_t messageData, CAN_ENDIANNESS_e endianness)
uint8_t TEST_CANRX_GetDay(uint64_t messageData, CAN_ENDIANNESS_e endianness)
void TEST_CANRX_TriggerBmsSoftwareVersionMessage(void)
bool TEST_CANRX_CheckIfBmsSoftwareVersionIsRequested(uint64_t messageData, CAN_ENDIANNESS_e endianness)
void TEST_CANRX_ProcessTimeInfoMux(uint64_t messageData, CAN_ENDIANNESS_e endianness)
void TEST_CANRX_HandleAerosolSensorStatus(const CAN_SHIM_s *const kpkCanShim, uint16_t signalData)
void TEST_CANRX_SetParticulateMatterConcentration(const CAN_SHIM_s *const kpkCanShim, uint16_t signalData)
uint8_t TEST_CANRX_GetSeconds(uint64_t messageData, CAN_ENDIANNESS_e endianness)
uint8_t TEST_CANRX_GetMonth(uint64_t messageData, CAN_ENDIANNESS_e endianness)
uint32_t CANRX_ImdInfo(CAN_MESSAGE_PROPERTIES_s message, const uint8_t *const kpkCanData, const CAN_SHIM_s *const kpkCanShim)
can rx callback function for IMD info messages
bool TEST_CANRX_CheckIfCommitHashIsRequested(uint64_t messageData, CAN_ENDIANNESS_e endianness)
Headers for the configuration for the CAN module.
CAN_ENDIANNESS_e
Definition: can_cfg.h:156