59 #include "Mockafe_plausibility.h"
60 #include "Mockdatabase.h"
62 #include "Mockfassert.h"
63 #include "Mockmxm_17841b.h"
64 #include "Mockmxm_41b_register_map.h"
65 #include "Mockmxm_battery_management.h"
66 #include "Mockmxm_cfg.h"
67 #include "Mockmxm_crc8.h"
68 #include "Mockmxm_registry.h"
82 TEST_SOURCE_FILE(
"test_mxm_1785x")
84 TEST_INCLUDE_PATH("../../src/app/driver/afe/api")
85 TEST_INCLUDE_PATH("../../src/app/driver/afe/maxim/common")
86 TEST_INCLUDE_PATH("../../src/app/driver/afe/maxim/common/config")
87 TEST_INCLUDE_PATH("../../src/app/driver/config")
88 TEST_INCLUDE_PATH("../../src/app/driver/spi")
89 TEST_INCLUDE_PATH("../../src/app/driver/ts/api")
90 TEST_INCLUDE_PATH("../../src/app/engine/
diag")
99 .allowStartup =
false,
100 .operationRequested =
false,
101 .firstMeasurementDone =
false,
102 .stopRequested =
false,
103 .openWireRequested =
false,
104 .undervoltageAlert =
false,
106 .mxmVoltageCellCounter = 0,
107 .highest5xDevice = 0,
114 .deviceAddress = 0x00,
173 TEST_PASS_MESSAGE(
"This test is skipped due to the configuration of the BMS.");
182 uint8_t voltRxBuffer = 0;
214 MXM_5XSetStateRequest_ExpectAndReturn(
230 OS_GetTickCount_ExpectAndReturn(0u);
254 const uint8_t registerAddress = 21u;
257 .regAddress = registerAddress,
262 MXM_5XSetStateRequest_ExpectAndReturn(
264 bool functionReturnValue;
266 TEST_ASSERT_EQUAL(
false, functionReturnValue);
271 bool functionReturnValue;
273 TEST_ASSERT_EQUAL(
false, functionReturnValue);
278 OS_GetTickCount_ExpectAndReturn(0u);
279 bool functionReturnValue;
281 TEST_ASSERT_EQUAL(
false, functionReturnValue);
289 bool functionReturnValue;
291 TEST_ASSERT_EQUAL(
true, functionReturnValue);
309 DATA_Write1DataBlock_IgnoreAndReturn(
STD_OK);
313 for (uint8_t i = 0u; i < 8; i = i + 2) {
316 for (uint8_t i = 1u; i < 8; i = i + 2) {
#define BS_NR_OF_CELL_BLOCKS_PER_MODULE
number of cells per module
Database configuration header.
@ DATA_BLOCK_ID_BALANCING_CONTROL
@ DATA_BLOCK_ID_OPEN_WIRE_BASE
static DIAG_DIAGNOSIS_STATE_s diag
#define NULL_PTR
Null pointer.
bool GEN_MUST_CHECK_RETURN MXM_HandleStateReadall(MXM_MONITORING_INSTANCE_s *pInstance, MXM_REG_NAME_e registerName, MXM_STATEMACHINE_OPERATION_STATES_e nextState)
Handle the state machine-transactions for a READALL.
STD_RETURN_TYPE_e MXM_ProcessOpenWire(const MXM_MONITORING_INSTANCE_s *const kpkInstance)
Processes the retrieved information on open wire.
STD_RETURN_TYPE_e TEST_MXM_ParseVoltagesIntoDB(MXM_MONITORING_INSTANCE_s *pInstance)
STD_RETURN_TYPE_e MXM_ConstructBalancingBuffer(MXM_BALANCING_STATE_s *pBalancingInstance)
Fill the balancing data structure.
void MXM_StateMachine(MXM_MONITORING_INSTANCE_s *pInstance)
Main state-machine implementation.
MXM_MONITORING_STATE_e GEN_MUST_CHECK_RETURN MXM_MonGetVoltages(MXM_MONITORING_INSTANCE_s *pState, MXM_REG_NAME_e regAddress)
Encapsulation for reading voltages from a register.
STD_RETURN_TYPE_e TEST_MXM_ParseVoltageReadallTest(MXM_MONITORING_INSTANCE_s *pInstance)
void MXM_HandleStateWriteall(MXM_MONITORING_INSTANCE_s *pInstance, MXM_STATEMACHINE_OPERATION_STATES_e nextState)
Handle the state machine-transactions for a WRITEALL.
STD_RETURN_TYPE_e TEST_MXM_ParseVoltageReadall(uint8_t *voltRxBuffer, uint16_t voltRxBufferLength, MXM_DATA_STORAGE_s *datastorage, MXM_CONVERSION_TYPE_e conversionType)
Headers for the driver for the MAX17841B ASCI and MAX1785x analog front-end.
MXM_MODEL_ID_e
Type of monitoring device.
#define MXM_MAXIMUM_NR_OF_CELLS_PER_MODULE
Maximum number of cells per module.
@ MXM_STATEMACH_5X_READALL
@ MXM_STATEMACH_5X_WRITEALL
@ MXM_5X_STATE_UNPROCESSED
MXM_REG_NAME_e
MAX1785x register names.
DATA_BLOCK_HEADER_s header
DATA_BLOCK_HEADER_s header
uint8_t openWire[BS_NR_OF_STRINGS][BS_NR_OF_MODULES_PER_STRING *(BS_NR_OF_CELL_BLOCKS_PER_MODULE+1u)]
DATA_BLOCK_BALANCING_CONTROL_s *const pBalancingControl_table
MXM_5X_COMMAND_PAYLOAD_s batteryCmdBuffer
DATA_BLOCK_OPEN_WIRE_s *const pOpenWire_table
MXM_STATEMACHINE_OPERATION_STATES_e operationSubstate
uint8_t rxBuffer[MXM_RX_BUFFER_LENGTH]
MXM_STATEMACHINE_STATES_e state
MXM_5X_INSTANCE_s *const pInstance5X
MXM_5X_STATE_REQUEST_STATUS_e requestStatus5x
#define TEST_ASSERT_PASS_ASSERT(_code_under_test)
assert whether assert macro has passed
#define TEST_ASSERT_FAIL_ASSERT(_code_under_test)
assert whether assert macro has failed
uint16_t commandBuffer[10]
void testMXM_ParseVoltageReadallTestNullPointer(void)
void testMXM_HandleStateWriteallInvalidRequestStatus(void)
void testMXM_HandleStateReadallError(void)
const bool mxm_allowSkippingPostInitSelfCheck
void testMXM_HandleStateReadallInvalidRequestStatus(void)
void testMXM_HandleStateReadallNullPointer(void)
void testMXM_StateMachineNullPointer(void)
void testMXM_ConstructBalancingBufferTest(void)
void testMXM_HandleStateWriteallError(void)
void testMXM_HandleStateWriteallEntry(void)
MXM_MODEL_ID_e MXM_GetModelIdOfDaisyChain(void)
returns the model ID of the daisy chain
void MXM_StateMachineOperation(MXM_MONITORING_INSTANCE_s *pState)
State-Machine implementation for operation state.
void testMXM_ParseVoltagesIntoDBNullPointer(void)
void testMXM_HandleStateReadallUnsent(void)
static MXM_MONITORING_INSTANCE_s mxm_instance
void testMXM_ParseVoltageReadallTest(void)
void testTEST_MXM_ParseVoltageReadallNullPointer(void)
void testMXM_HandleStateReadallUnprocessed(void)
static MXM_MODEL_ID_e modelForTest
void testMXM_MonGetVoltagesNullPointer(void)
void testMXM_ProcessOpenWire1SatelliteAlternatingPattern(void)
void testMXM_HandleStateWriteallProcessed(void)
void testMXM_ProcessOpenWireNullPointer(void)
static DATA_BLOCK_OPEN_WIRE_s mxm_tableOpenWire
void testMXM_HandleStateReadallProcessed(void)
void testMXM_HandleStateWriteallUnprocessed(void)
void testMXM_HandleStateWriteallNullPointer(void)