foxBMS - Unit Tests  1.5.0
The foxBMS Unit Tests API Documentation
test_mxm_17841b.c
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 test_mxm_17841b.c
44  * @author foxBMS Team
45  * @date 2020-06-22 (date of creation)
46  * @updated 2023-02-03 (date of last update)
47  * @version v1.5.0
48  * @ingroup UNIT_TEST_IMPLEMENTATION
49  * @prefix MXM
50  *
51  * @brief Test for the Maxim MAX17841B driver.
52  *
53  * @details def
54  *
55  */
56 
57 /*========== Includes =======================================================*/
58 #include "unity.h"
59 #include "Mockfassert.h"
60 #include "Mockmxm_cfg.h"
61 #include "Mockos.h"
62 
63 #include "mxm_17841b.h"
64 #include "mxm_bitextract.h"
65 #include "test_assert_helper.h"
66 
67 #include <stdbool.h>
68 #include <stdint.h>
69 
70 TEST_FILE("mxm_17841b.c")
71 
72 /*========== Definitions and Implementations for Unit Test ==================*/
73 /** replicating the config register length in the driver */
74 #define MXM_41B_CONFIG_REGISTER_LENGTH (7u)
75 
78  .substate = MXM_41B_ENTRY_SUBSTATE,
79  .extendMessageBytes = 0,
80  .waitCounter = 0,
81  .regRXIntEnable = 0x00u,
82  .regTXIntEnable = 0x00u,
83  .regRXStatus = 0x00u,
84  .regTXStatus = 0x00u,
85  .regConfig1 = MXM_41B_CONFIG_1_DEFAULT_VALUE,
86  .regConfig2 = MXM_41B_CONFIG_2_DEFAULT_VALUE,
87  .regConfig3 = MXM_41B_CONFIG_3_DEFAULT_VALUE,
88  .hwModel = 0,
89  .hwMaskRevision = 0,
90  .spiRXBuffer = {0},
91  .spiTXBuffer = {0},
92 };
93 
94 uint16_t commandBuffer[10] = {0};
95 uint16_t rxBuffer[100] = {0};
96 
98 
99 /*========== Setup and Teardown =============================================*/
100 void setUp(void) {
103 
104  commandBuffer[0] = 0;
105  commandBuffer[1] = 0;
106  commandBuffer[2] = 0;
107  commandBuffer[3] = 0;
108  commandBuffer[4] = 0;
109  commandBuffer[5] = 0;
110  commandBuffer[6] = 0;
111  commandBuffer[7] = 0;
112  commandBuffer[8] = 0;
113  commandBuffer[9] = 0;
114 
116 }
117 
118 void tearDown(void) {
119 }
120 
121 /*========== Test Cases =====================================================*/
122 /**
123  * \defgroup mxm41b-set-state-request tests for function MXM_41BSetStateRequest
124  * @{
125  */
126 
127 /**
128  * @brief Test with an invalid pointer
129  * @details This test calls #MXM_41BSetStateRequest() with an invalid pointer
130  * value and expects an assertion to be triggered.
131  */
135 }
136 
137 /**
138  * @brief Test that the only transition from uninitialized is initialization
139  * @details This test expects the state machine to be in state
140  * #MXM_STATEMACH_41B_UNINITIALIZED and various transitions to other
141  * states. The only valid transition has to be to
142  * #MXM_STATEMACH_41B_INIT. This is check by evaluating the return
143  * value of #MXM_41BSetStateRequest().
144  */
146  TEST_ASSERT_EQUAL(
147  STD_NOT_OK,
150  TEST_ASSERT_EQUAL(
151  STD_NOT_OK,
154  TEST_ASSERT_EQUAL(
155  STD_NOT_OK,
158  TEST_ASSERT_EQUAL(
159  STD_OK,
161 }
162 
164  /* start in Idle state */
166 
167  TEST_ASSERT_EQUAL(
168  STD_OK,
171 
172  /* try additional transition (even though not in idle state anymore) */
173  TEST_ASSERT_EQUAL(
174  STD_NOT_OK,
177 }
178 
180  TEST_ASSERT_EQUAL(
181  STD_OK,
183 }
184 
186  TEST_ASSERT_EQUAL(
187  STD_NOT_OK,
189 
190  TEST_ASSERT_EQUAL(
191  STD_NOT_OK,
193 
194  TEST_ASSERT_EQUAL(
195  STD_OK,
197 }
198 
200  TEST_ASSERT_EQUAL(
201  STD_NOT_OK,
203 
204  TEST_ASSERT_EQUAL(
205  STD_NOT_OK,
207 
208  TEST_ASSERT_EQUAL(
209  STD_OK,
211 }
212 
214  TEST_ASSERT_EQUAL(
215  STD_NOT_OK,
217 }
218 
219 /** @}
220  * end of tests for function MXM_41BSetStateRequest */
221 
222 /**
223  * \defgroup mxm41b-write-register-function tests for function MXM_41BWriteRegisterFunction
224  * @{
225  */
227  TEST_ASSERT_EQUAL(STD_NOT_OK, MXM_41BWriteRegisterFunction(&mxm_41bState, 0xFF, 0));
229 }
230 
232  /* standard state should be only fourth bit set */
233  TEST_ASSERT_EQUAL(0x10u, mxm_41bState.regConfig2);
234  TEST_ASSERT_EQUAL(
236  TEST_ASSERT_EQUAL(0x10u, mxm_41bState.regConfig2);
237 
238  /* after writing register, fifth bit should be set in addition */
239  TEST_ASSERT_EQUAL(
241  TEST_ASSERT_EQUAL((0x10u | (1u << 5u)), mxm_41bState.regConfig2);
242 
243  /* standard state should be third, second, first and zero bit set */
244  TEST_ASSERT_EQUAL(0xFu, mxm_41bState.regConfig3);
245 
246  /* 0us --> 0 */
247  TEST_ASSERT_EQUAL(
248  STD_OK,
250  TEST_ASSERT_EQUAL(0x0u, mxm_41bState.regConfig3);
251 
252  /* 10us --> 1 */
253  TEST_ASSERT_EQUAL(
254  STD_OK,
256  TEST_ASSERT_EQUAL(0x1u, mxm_41bState.regConfig3);
257 
258  /* 640us --> 0x7 */
259  TEST_ASSERT_EQUAL(
260  STD_OK,
262  TEST_ASSERT_EQUAL(0x7u, mxm_41bState.regConfig3);
263 
264  /* INF DLY --> 0xF */
265  TEST_ASSERT_EQUAL(
266  STD_OK,
268  TEST_ASSERT_EQUAL(0xFu, mxm_41bState.regConfig3);
269 
270  /* standard state should be zero */
271  TEST_ASSERT_EQUAL(0x0u, mxm_41bState.regRXIntEnable);
272 
273  /* rx error int on --> 0x80 */
274  TEST_ASSERT_EQUAL(
276  TEST_ASSERT_EQUAL(0x80u, mxm_41bState.regRXIntEnable);
277 
278  /* rx error int off --> 0 */
279  TEST_ASSERT_EQUAL(
281  TEST_ASSERT_EQUAL(0x0u, mxm_41bState.regRXIntEnable);
282 
283  /* standard state should be zero */
284  TEST_ASSERT_EQUAL(0x0u, mxm_41bState.regRXIntEnable);
285 
286  /* rx overflow int on --> 0x8 */
287  TEST_ASSERT_EQUAL(
289  TEST_ASSERT_EQUAL(0x8u, mxm_41bState.regRXIntEnable);
290 
291  /* rx overflow int off --> 0 */
292  TEST_ASSERT_EQUAL(
294  TEST_ASSERT_EQUAL(0x0u, mxm_41bState.regRXIntEnable);
295 }
296 /** @}
297  * end of tests for function MXM_41BWriteRegisterFunction */
298 
299 /**
300  * \defgroup mxm41b-read-register-function tests for function MXM_41BReadRegisterFunction
301  * @{
302  */
304  MXM_41B_REG_BIT_VALUE result = {0};
305  TEST_ASSERT_EQUAL(STD_NOT_OK, MXM_41BReadRegisterFunction(&mxm_41bState, 0xFF, &result));
308 }
310  MXM_41B_REG_BIT_VALUE result = 42;
311  /* set register */
313 
314  /* read all functions in this register */
316  TEST_ASSERT_EQUAL(MXM_41B_REG_FALSE, result);
317 
318  TEST_ASSERT_EQUAL(
320  TEST_ASSERT_EQUAL(MXM_41B_REG_FALSE, result);
321 
322  /* set register with bit RX_EMPTY */
324 
325  /* read all functions in this register */
327  TEST_ASSERT_EQUAL(MXM_41B_REG_FALSE, result);
328 
329  TEST_ASSERT_EQUAL(
331  TEST_ASSERT_EQUAL(MXM_41B_REG_TRUE, result);
332 
333  /* set register with bit RX_BUSY */
334  mxm_41bState.regRXStatus = 0x20u;
335 
336  /* read all functions in this register */
338  TEST_ASSERT_EQUAL(MXM_41B_REG_TRUE, result);
339 
340  TEST_ASSERT_EQUAL(
342  TEST_ASSERT_EQUAL(MXM_41B_REG_FALSE, result);
343 
344  /* set register to zero */
346 
347  /* read all functions in this register */
349  TEST_ASSERT_EQUAL(MXM_41B_REG_FALSE, result);
350 
351  /* set register with TX_PREAMBLES */
352  mxm_41bState.regConfig2 = 0x20u;
353 
354  /* read all functions in this register */
356  TEST_ASSERT_EQUAL(MXM_41B_REG_TRUE, result);
357 }
358 /** @}
359  * end of tests for function MXM_41BReadRegisterFunction */
360 
361 /**
362  * \defgroup mxm41b-state-machine tests for the MXM_41b-state-machine
363  * @{
364  */
369 }
370 
372  /* force state-machine in idle state */
374 
375  TEST_ASSERT_EQUAL(MXM_STATEMACH_41B_IDLE, mxm_41bState.state);
377  TEST_ASSERT_EQUAL(MXM_STATEMACH_41B_IDLE, mxm_41bState.state);
378 }
379 
380 void testStateCheckFMEA(void) {
381  /* force state-machine in check_fmea state */
383 
384  TEST_ASSERT_EQUAL(MXM_STATEMACH_41B_CHECK_FMEA, mxm_41bState.state);
385 
386  /* create a buffer with the assumed output of the ASCI and inject into SPI read */
387  uint16_t rxBuffer[10] = {0x13u, 0x00u};
388  MXM_ReceiveData_ExpectAndReturn(mxm_41bState.spiTXBuffer, mxm_41bState.spiRXBuffer, 2, STD_OK);
389  MXM_ReceiveData_ReturnArrayThruPtr_rxBuffer(rxBuffer, 2);
391  TEST_ASSERT_EQUAL(MXM_STATEMACH_41B_CHECK_FMEA, mxm_41bState.state);
392 
393  /* check if the values are parsed correctly */
394  MXM_GetSPIStateReady_ExpectAndReturn(STD_OK);
396  TEST_ASSERT_EQUAL(MXM_STATEMACH_41B_IDLE, mxm_41bState.state);
397  TEST_ASSERT_EQUAL(MXM_41B_STATE_PROCESSED, status41b);
398 }
399 
401  /* force state-machine in check_fmea state */
403 
404  TEST_ASSERT_EQUAL(MXM_STATEMACH_41B_CHECK_FMEA, mxm_41bState.state);
405 
406  /* create a buffer with the assumed output of the ASCI and inject into SPI read */
407  /* simulate an GNDL Alert in FMEA register */
408  uint16_t rxBuffer[10] = {0x13u, 0x01u};
409  MXM_ReceiveData_ExpectAndReturn(mxm_41bState.spiTXBuffer, mxm_41bState.spiRXBuffer, 2, STD_OK);
410  MXM_ReceiveData_ReturnArrayThruPtr_rxBuffer(rxBuffer, 2);
412  TEST_ASSERT_EQUAL(MXM_STATEMACH_41B_CHECK_FMEA, mxm_41bState.state);
413 
414  /* check if the values are parsed correctly */
415  MXM_GetSPIStateReady_ExpectAndReturn(STD_OK);
417  TEST_ASSERT_EQUAL(MXM_STATEMACH_41B_IDLE, mxm_41bState.state);
418  TEST_ASSERT_EQUAL(MXM_41B_STATE_ERROR, status41b);
419 }
420 
422  /* force state-machine in get_version state */
424 
426 
427  /* create a buffer with the assumed output of the ASCI and inject into SPI read */
428  uint16_t rxBuffer[10] = {0x15u, 0x84u, 0x12u};
429  MXM_ReceiveData_ExpectAndReturn(mxm_41bState.spiTXBuffer, mxm_41bState.spiRXBuffer, 3, STD_OK);
430  MXM_ReceiveData_ReturnArrayThruPtr_rxBuffer(rxBuffer, 3);
433 
434  /* check if the values are parsed correctly */
435  MXM_GetSPIStateReady_ExpectAndReturn(STD_OK);
437  TEST_ASSERT_EQUAL(0x841u, mxm_41bState.hwModel);
438  TEST_ASSERT_EQUAL(0x2u, mxm_41bState.hwMaskRevision);
439 }
440 
442  /* force state-machine in clear_receive_buffer state */
444 
446 
447  /* create a buffer with the assumed input to the ASCI */
448  uint16_t tx_buffer[10] = {0xE0u};
449  MXM_SendData_ExpectAndReturn(tx_buffer, 1, STD_OK);
451 
452  /* check if the write was successful */
453  TEST_ASSERT_EQUAL(MXM_STATEMACH_41B_IDLE, mxm_41bState.state);
454  TEST_ASSERT_EQUAL(MXM_41B_STATE_PROCESSED, status41b);
455 }
456 
458  /* force state-machine in clear_receive_buffer state */
460 
462 
463  /* create a buffer with the assumed input to the ASCI */
464  uint16_t tx_buffer[10] = {0xE0u};
465  /* simulate a failure of writing */
466  MXM_SendData_ExpectAndReturn(tx_buffer, 1, STD_NOT_OK);
468 
469  /* check if the write was successful */
470  TEST_ASSERT_EQUAL(MXM_STATEMACH_41B_IDLE, mxm_41bState.state);
471  TEST_ASSERT_EQUAL(MXM_41B_STATE_ERROR, status41b);
472 }
473 
475  /* force state-machine in clear_transmit_buffer state */
477 
479 
480  /* create a buffer with the assumed input to the ASCI */
481  uint16_t tx_buffer[10] = {0x20u};
482  MXM_SendData_ExpectAndReturn(tx_buffer, 1, STD_OK);
484 
485  /* check if the write was successful */
486  TEST_ASSERT_EQUAL(MXM_STATEMACH_41B_IDLE, mxm_41bState.state);
487  TEST_ASSERT_EQUAL(MXM_41B_STATE_PROCESSED, status41b);
488 }
489 
491  /* force state-machine in clear_transmit_buffer state */
493 
495 
496  /* create a buffer with the assumed input to the ASCI */
497  uint16_t tx_buffer[10] = {0x20u};
498  /* simulate a failure of writing */
499  MXM_SendData_ExpectAndReturn(tx_buffer, 1, STD_NOT_OK);
501 
502  /* check if the write was successful */
503  TEST_ASSERT_EQUAL(MXM_STATEMACH_41B_IDLE, mxm_41bState.state);
504  TEST_ASSERT_EQUAL(MXM_41B_STATE_ERROR, status41b);
505 }
506 
508  /* force state-machine in MXM_41B_UART_WAIT_FOR_RX_STATUS_CHANGE_READ_AND_READ_BACK_RCV_BUF */
511  /* prepare RX buffer with not received RX_Stop_Status bit */
512  mxm_41bState.spiRXBuffer[1] = 0;
513 
514  /* transition */
516 
518 }
519 
521  /* force state-machine in MXM_41B_UART_WAIT_FOR_RX_STATUS_CHANGE_READ_AND_READ_BACK_RCV_BUF */
524  /* prepare RX buffer with received RX_Stop_Status bit */
525  mxm_41bState.spiRXBuffer[1] |= (0x01u << 1u);
526 
527  /* transition */
528  MXM_ReceiveData_IgnoreAndReturn(STD_OK);
530 
532 }
533 
534 void testStateDefault(void) {
535  /* force state-machine in invalid state */
538 
539  /* transition */
540  MXM_ReceiveData_IgnoreAndReturn(STD_OK);
542 }
543 
544 /** tests the normally to be expected flow through the initialization state */
546  /* force state-machine in init state */
548 
549  TEST_ASSERT_EQUAL(MXM_STATEMACH_41B_INIT, mxm_41bState.state);
550  TEST_ASSERT_EQUAL(MXM_41B_ENTRY_SUBSTATE, mxm_41bState.substate);
551 
552  /* first the bridge IC should be shut down */
553  MXM_ShutDownBridgeIc_Expect();
554  /* timestamp for the shutdown */
555  const uint32_t shutdownTimestamp = 42u;
556  OS_GetTickCount_ExpectAndReturn(shutdownTimestamp);
558 
559  /* next call the timestamp will be checked, simulate time is not up yet */
560  OS_CheckTimeHasPassed_ExpectAndReturn(shutdownTimestamp, 0u, false);
561  OS_CheckTimeHasPassed_IgnoreArg_timeToPass_ms();
563 
564  /* next call the timestamp will be checked again, simulate time is up */
565  OS_CheckTimeHasPassed_ExpectAndReturn(shutdownTimestamp, 0u, true);
566  OS_CheckTimeHasPassed_IgnoreArg_timeToPass_ms();
567  /* now the bridge IC should be reenabled */
568  MXM_EnableBridgeIc_Expect();
570 
571  /* now the default configuration should be sent to the bridge IC */
572  MXM_SendData_ExpectAndReturn(mxm_41bState.spiTXBuffer, 8, STD_OK);
574 
575  /* default values to check against */
576  const uint8_t mxm_41B_reg_default_values[MXM_41B_CONFIG_REGISTER_LENGTH] = {
584  MXM_ReceiveData_ExpectAndReturn(
587 
588  /* inject the values by copying into the pointer (can be done since we know the address) */
589  for (uint8_t i = 0u; i < MXM_41B_CONFIG_REGISTER_LENGTH; i++) {
590  mxm_41bState.spiRXBuffer[i + 1u] = mxm_41B_reg_default_values[i];
591  }
592 
593  MXM_GetSPIStateReady_ExpectAndReturn(STD_OK);
595 
596  /* and now we should be done and back in idle */
597  TEST_ASSERT_EQUAL(MXM_STATEMACH_41B_IDLE, mxm_41bState.state);
598  TEST_ASSERT_EQUAL(MXM_41B_ENTRY_SUBSTATE, mxm_41bState.substate);
599 }
600 
601 /** @}
602  * end tests for the state-machine */
@ STD_NOT_OK
Definition: fstd_types.h:84
@ STD_OK
Definition: fstd_types.h:83
#define NULL_PTR
Null pointer.
Definition: fstd_types.h:77
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.
Definition: mxm_17841b.c:788
void MXM_41BStateMachine(MXM_41B_INSTANCE_s *pInstance)
Execute state-machine for the MAX17841B.
Definition: mxm_17841b.c:931
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.
Definition: mxm_17841b.c:850
void MXM_41BInitializeStateStruct(MXM_41B_INSTANCE_s *pInstance)
Initializes the state struct with default values.
Definition: mxm_17841b.c:977
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.
Definition: mxm_17841b.c:896
Headers for the driver for the MAX17841B ASCI and MAX1785x analog front-end.
@ MXM_STATEMACH_41B_MAXSTATE
Definition: mxm_17841b.h:98
@ MXM_STATEMACH_41B_GET_VERSION
Definition: mxm_17841b.h:92
@ MXM_STATEMACH_41B_CLEAR_RECEIVE_BUFFER
Definition: mxm_17841b.h:96
@ MXM_STATEMACH_41B_CLEAR_TRANSMIT_BUFFER
Definition: mxm_17841b.h:97
@ MXM_STATEMACH_41B_UNINITIALIZED
Definition: mxm_17841b.h:88
@ MXM_STATEMACH_41B_INIT
Definition: mxm_17841b.h:89
@ MXM_STATEMACH_41B_CHECK_FMEA
Definition: mxm_17841b.h:91
@ MXM_STATEMACH_41B_IDLE
Definition: mxm_17841b.h:90
@ MXM_STATEMACH_41B_UART_TRANSACTION
Definition: mxm_17841b.h:95
@ MXM_41B_UART_WAIT_FOR_RX_STATUS_CHANGE_WRITE
Definition: mxm_17841b.h:121
@ MXM_41B_UART_READ_BACK_RECEIVE_BUFFER_SAVE
Definition: mxm_17841b.h:123
@ MXM_41B_ENTRY_SUBSTATE
Definition: mxm_17841b.h:105
@ MXM_41B_UART_WAIT_FOR_RX_STATUS_CHANGE_READ_AND_READ_BACK_RCV_BUF
Definition: mxm_17841b.h:122
@ MXM_41B_REG_FUNCTION_RX_BUSY_STATUS
Definition: mxm_17841b.h:145
@ MXM_41B_REG_FUNCTION_RX_EMPTY_STATUS
Definition: mxm_17841b.h:148
@ MXM_41B_REG_FUNCTION_TX_PREAMBLES
Definition: mxm_17841b.h:149
@ MXM_41B_REG_FUNCTION_RX_ERROR_INT
Definition: mxm_17841b.h:151
@ MXM_41B_REG_FUNCTION_KEEP_ALIVE
Definition: mxm_17841b.h:150
@ MXM_41B_REG_FUNCTION_RX_OVERFLOW_INT
Definition: mxm_17841b.h:152
MXM_41B_STATE_REQUEST_STATUS_e
Request status of MAX17841B states.
Definition: mxm_17841b.h:134
@ MXM_41B_STATE_ERROR
Definition: mxm_17841b.h:138
@ MXM_41B_STATE_UNPROCESSED
Definition: mxm_17841b.h:136
@ MXM_41B_STATE_PROCESSED
Definition: mxm_17841b.h:137
Bit extraction function for MXM_17841b.
#define MXM_41B_REG_FALSE
uint8_t MXM_41B_REG_BIT_VALUE
Bit-values for registers.
#define MXM_41B_REG_KEEP_ALIVE_0US
#define MXM_41B_REG_TRUE
#define MXM_41B_REG_KEEP_ALIVE_10US
#define MXM_41B_REG_KEEP_ALIVE_640US
#define MXM_41B_REG_KEEP_ALIVE_INF_DLY
#define MXM_41B_CONFIG_3_DEFAULT_VALUE
Definition: mxm_cfg.h:111
#define MXM_41B_CONFIG_1_DEFAULT_VALUE
Definition: mxm_cfg.h:99
#define MXM_41B_CONFIG_2_DEFAULT_VALUE
Definition: mxm_cfg.h:105
#define MXM_41B_RX_INT_ENABLE_DEFAULT_VALUE
Definition: mxm_cfg.h:88
#define MXM_41B_RX_INT_FLAG_DEFAULT_VALUE
Definition: mxm_cfg.h:90
#define MXM_41B_TX_INT_ENABLE_DEFAULT_VALUE
Definition: mxm_cfg.h:89
#define MXM_41B_TX_INT_FLAG_DEFAULT_VALUE
Definition: mxm_cfg.h:91
Struct for the state-variable of state-machine.
Definition: mxm_17841b.h:161
uint8_t regRXIntEnable
Definition: mxm_17841b.h:171
uint8_t hwMaskRevision
Definition: mxm_17841b.h:181
MXM_41B_STATE_REQUEST_STATUS_e * processed
Definition: mxm_17841b.h:168
uint16_t spiRXBuffer[MXM_SPI_RX_BUFFER_LENGTH]
Definition: mxm_17841b.h:183
uint16_t spiTXBuffer[MXM_SPI_TX_BUFFER_LENGTH]
Definition: mxm_17841b.h:184
MXM_41B_SUBSTATES_e substate
Definition: mxm_17841b.h:163
MXM_STATEMACH_41B_e state
Definition: mxm_17841b.h:162
Helper for unit tests.
#define TEST_ASSERT_FAIL_ASSERT(_code_under_test)
assert whether assert macro has failed
uint16_t rxBuffer[100]
uint16_t commandBuffer[10]
#define MXM_41B_CONFIG_REGISTER_LENGTH
MXM_41B_STATE_REQUEST_STATUS_e status41b
static MXM_41B_INSTANCE_s mxm_41bState
void setUp(void)
void tearDown(void)