59 #include "Mockfassert.h"
60 #include "Mockmxm_cfg.h"
69 #define MXM_41B_CONFIG_REGISTER_LENGTH (7u)
74 .extendMessageBytes = 0,
76 .regRXIntEnable = 0x00u,
77 .regTXIntEnable = 0x00u,
382 uint16_t
rxBuffer[10] = {0x13u, 0x00u};
384 MXM_ReceiveData_ReturnArrayThruPtr_rxBuffer(
rxBuffer, 2);
389 MXM_GetSPIStateReady_ExpectAndReturn(
STD_OK);
403 uint16_t
rxBuffer[10] = {0x13u, 0x01u};
405 MXM_ReceiveData_ReturnArrayThruPtr_rxBuffer(
rxBuffer, 2);
410 MXM_GetSPIStateReady_ExpectAndReturn(
STD_OK);
423 uint16_t
rxBuffer[10] = {0x15u, 0x84u, 0x12u};
425 MXM_ReceiveData_ReturnArrayThruPtr_rxBuffer(
rxBuffer, 3);
430 MXM_GetSPIStateReady_ExpectAndReturn(
STD_OK);
443 uint16_t tx_buffer[10] = {0xE0u};
444 MXM_SendData_ExpectAndReturn(tx_buffer, 1,
STD_OK);
459 uint16_t tx_buffer[10] = {0xE0u};
461 MXM_SendData_ExpectAndReturn(tx_buffer, 1,
STD_NOT_OK);
476 uint16_t tx_buffer[10] = {0x20u};
477 MXM_SendData_ExpectAndReturn(tx_buffer, 1,
STD_OK);
492 uint16_t tx_buffer[10] = {0x20u};
494 MXM_SendData_ExpectAndReturn(tx_buffer, 1,
STD_NOT_OK);
523 MXM_ReceiveData_IgnoreAndReturn(
STD_OK);
535 MXM_ReceiveData_IgnoreAndReturn(
STD_OK);
548 MXM_ShutDownBridgeIc_Expect();
550 const uint32_t shutdownTimestamp = 42u;
551 OS_GetTickCount_ExpectAndReturn(shutdownTimestamp);
555 OS_CheckTimeHasPassed_ExpectAndReturn(shutdownTimestamp, 0u,
false);
556 OS_CheckTimeHasPassed_IgnoreArg_timeToPass_ms();
560 OS_CheckTimeHasPassed_ExpectAndReturn(shutdownTimestamp, 0u,
true);
561 OS_CheckTimeHasPassed_IgnoreArg_timeToPass_ms();
563 MXM_EnableBridgeIc_Expect();
579 MXM_ReceiveData_ExpectAndReturn(
588 MXM_GetSPIStateReady_ExpectAndReturn(
STD_OK);
#define NULL_PTR
Null pointer.
void testReadRegisterFunctionWithIllegalValues(void)
void testReadRegisterFunctionWithLegalValues(void)
void testStateRequestInconsistentInputPayload(void)
void testSetStateRequestInvalidInstancePointer(void)
Test with an invalid pointer.
void testTransitionsOnlyAllowedInIdleAfterInit(void)
void testStateRequestConsistentInput(void)
void testStateRequestInconsistentInputRXBuffer(void)
void testOnlyAllowedTransitionFromUnitializedIsInit(void)
Test that the only transition from uninitialized is initialization.
void testStateRequestInconsistentInputProcessed(void)
void testStateGetVersion(void)
void testStateClearTransmitBuffer(void)
void testStateDefault(void)
void testStateInitNormalFlow(void)
void testStateClearTransmitBufferFailedSPIWrite(void)
void testStateCheckFmeaGNDLAlert(void)
void testStateClearReceiveBufferFailedSPIWrite(void)
void testStateStayInIdle(void)
void testStateUARTWaitForRXStatusChangeFail(void)
void testStateStayInUninitialized(void)
void testStateClearReceiveBuffer(void)
void testStateCheckFMEA(void)
void testStateUARTWaitForRXStatusChangeSuccess(void)
void testWriteRegisterFunctionWithLegalValues(void)
void testWriteRegisterFunctionWithIllegalValues(void)
STD_RETURN_TYPE_e MXM_41BSetStateRequest(MXM_41B_INSTANCE_s *pInstance, MXM_STATEMACH_41B_e state, uint16_t *pPayload, uint8_t payloadLength, uint8_t extendMessageBytes, uint16_t *pRxBuffer, uint16_t rxBufferLength, MXM_41B_STATE_REQUEST_STATUS_e *processed)
Set state transition for MAX17841B-state-machine.
void MXM_41BStateMachine(MXM_41B_INSTANCE_s *pInstance)
Execute state-machine for the MAX17841B.
STD_RETURN_TYPE_e MXM_41BWriteRegisterFunction(MXM_41B_INSTANCE_s *pInstance, MXM_41B_REG_FUNCTION_e registerFunction, MXM_41B_REG_BIT_VALUE value)
Write a register function.
void MXM_41BInitializeStateStruct(MXM_41B_INSTANCE_s *pInstance)
Initializes the state struct with default values.
STD_RETURN_TYPE_e MXM_41BReadRegisterFunction(const MXM_41B_INSTANCE_s *const kpkInstance, MXM_41B_REG_FUNCTION_e registerFunction, MXM_41B_REG_BIT_VALUE *pValue)
Read the value of a register function.
Headers for the driver for the MAX17841B ASCI and MAX1785x monitoring chip.
@ MXM_STATEMACH_41B_MAXSTATE
@ MXM_STATEMACH_41B_GET_VERSION
@ MXM_STATEMACH_41B_CLEAR_RECEIVE_BUFFER
@ MXM_STATEMACH_41B_CLEAR_TRANSMIT_BUFFER
@ MXM_STATEMACH_41B_UNINITIALIZED
@ MXM_STATEMACH_41B_CHECK_FMEA
@ MXM_STATEMACH_41B_UART_TRANSACTION
@ MXM_41B_UART_WAIT_FOR_RX_STATUS_CHANGE_WRITE
@ MXM_41B_UART_READ_BACK_RECEIVE_BUFFER_SAVE
@ MXM_41B_UART_WAIT_FOR_RX_STATUS_CHANGE_READ_AND_READ_BACK_RCV_BUF
@ MXM_41B_REG_FUNCTION_RX_BUSY_STATUS
@ MXM_41B_REG_FUNCTION_RX_EMPTY_STATUS
@ MXM_41B_REG_FUNCTION_TX_PREAMBLES
@ MXM_41B_REG_FUNCTION_RX_ERROR_INT
@ MXM_41B_REG_FUNCTION_KEEP_ALIVE
@ MXM_41B_REG_FUNCTION_RX_OVERFLOW_INT
MXM_41B_STATE_REQUEST_STATUS_e
Request status of MAX17841B states.
@ MXM_41B_STATE_UNPROCESSED
@ MXM_41B_STATE_PROCESSED
#define MXM_41B_CONFIG_3_DEFAULT_VALUE
#define MXM_41B_CONFIG_1_DEFAULT_VALUE
#define MXM_41B_CONFIG_2_DEFAULT_VALUE
#define MXM_41B_RX_INT_ENABLE_DEFAULT_VALUE
#define MXM_41B_RX_INT_FLAG_DEFAULT_VALUE
#define MXM_41B_TX_INT_ENABLE_DEFAULT_VALUE
#define MXM_41B_TX_INT_FLAG_DEFAULT_VALUE
Struct for the state-variable of state-machine.
MXM_41B_STATE_REQUEST_STATUS_e * processed
uint16_t spiRXBuffer[MXM_SPI_RX_BUFFER_LENGTH]
uint16_t spiTXBuffer[MXM_SPI_TX_BUFFER_LENGTH]
MXM_41B_SUBSTATES_e substate
MXM_STATEMACH_41B_e state
#define TEST_ASSERT_FAIL_ASSERT(_code_under_test)
assert whether assert macro has failed
uint16_t commandBuffer[10]
#define MXM_41B_CONFIG_REGISTER_LENGTH
MXM_41B_STATE_REQUEST_STATUS_e status41b
static MXM_41B_INSTANCE_s mxm_41bState