foxBMS - Unit Tests  1.6.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-10-12 (date of last update)
47  * @version v1.6.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 /*========== Unit Testing Framework Directives ==============================*/
71 TEST_SOURCE_FILE("mxm_17841b.c")
72 
73 TEST_INCLUDE_PATH("../../src/app/driver/afe/maxim/common")
74 TEST_INCLUDE_PATH("../../src/app/driver/afe/maxim/common/config")
75 TEST_INCLUDE_PATH("../../src/app/driver/config")
76 TEST_INCLUDE_PATH("../../src/app/driver/spi")
77 
78 /*========== Definitions and Implementations for Unit Test ==================*/
79 /** replicating the config register length in the driver */
80 #define MXM_41B_CONFIG_REGISTER_LENGTH (7u)
81 
84  .substate = MXM_41B_ENTRY_SUBSTATE,
85  .extendMessageBytes = 0,
86  .waitCounter = 0,
87  .regRxIntEnable = 0x00u,
88  .regTxIntEnable = 0x00u,
89  .regRxStatus = 0x00u,
90  .regTxStatus = 0x00u,
91  .regConfig1 = MXM_41B_CONFIG_1_DEFAULT_VALUE,
92  .regConfig2 = MXM_41B_CONFIG_2_DEFAULT_VALUE,
93  .regConfig3 = MXM_41B_CONFIG_3_DEFAULT_VALUE,
94  .hardwareModel = 0,
95  .hardwareMaskRevision = 0,
96  .spiRxBuffer = {0},
97  .spiTxBuffer = {0},
98 };
99 
100 uint16_t commandBuffer[10] = {0};
101 uint16_t rxBuffer[100] = {0};
102 
104 
105 /*========== Setup and Teardown =============================================*/
106 void setUp(void) {
109 
110  commandBuffer[0] = 0;
111  commandBuffer[1] = 0;
112  commandBuffer[2] = 0;
113  commandBuffer[3] = 0;
114  commandBuffer[4] = 0;
115  commandBuffer[5] = 0;
116  commandBuffer[6] = 0;
117  commandBuffer[7] = 0;
118  commandBuffer[8] = 0;
119  commandBuffer[9] = 0;
120 
122 }
123 
124 void tearDown(void) {
125 }
126 
127 /*========== Test Cases =====================================================*/
128 /**
129  * \defgroup mxm41b-set-state-request tests for function MXM_41BSetStateRequest
130  * @{
131  */
132 
133 /**
134  * @brief Test with an invalid pointer
135  * @details This test calls #MXM_41BSetStateRequest() with an invalid pointer
136  * value and expects an assertion to be triggered.
137  */
141 }
142 
143 /**
144  * @brief Test that the only transition from uninitialized is initialization
145  * @details This test expects the state machine to be in state
146  * #MXM_STATEMACH_41B_UNINITIALIZED and various transitions to other
147  * states. The only valid transition has to be to
148  * #MXM_STATEMACH_41B_INIT. This is check by evaluating the return
149  * value of #MXM_41BSetStateRequest().
150  */
152  TEST_ASSERT_EQUAL(
153  STD_NOT_OK,
156  TEST_ASSERT_EQUAL(
157  STD_NOT_OK,
160  TEST_ASSERT_EQUAL(
161  STD_NOT_OK,
164  TEST_ASSERT_EQUAL(
165  STD_OK,
167 }
168 
170  /* start in Idle state */
172 
173  TEST_ASSERT_EQUAL(
174  STD_OK,
177 
178  /* try additional transition (even though not in idle state anymore) */
179  TEST_ASSERT_EQUAL(
180  STD_NOT_OK,
183 }
184 
186  TEST_ASSERT_EQUAL(
187  STD_OK,
189 }
190 
192  TEST_ASSERT_EQUAL(
193  STD_NOT_OK,
195 
196  TEST_ASSERT_EQUAL(
197  STD_NOT_OK,
199 
200  TEST_ASSERT_EQUAL(
201  STD_OK,
203 }
204 
206  TEST_ASSERT_EQUAL(
207  STD_NOT_OK,
209 
210  TEST_ASSERT_EQUAL(
211  STD_NOT_OK,
213 
214  TEST_ASSERT_EQUAL(
215  STD_OK,
217 }
218 
220  TEST_ASSERT_EQUAL(
221  STD_NOT_OK,
223 }
224 
225 /** @}
226  * end of tests for function MXM_41BSetStateRequest */
227 
228 /**
229  * \defgroup mxm41b-write-register-function tests for function MXM_41BWriteRegisterFunction
230  * @{
231  */
233  TEST_ASSERT_EQUAL(STD_NOT_OK, MXM_41BWriteRegisterFunction(&mxm_41bState, 0xFF, 0));
235 }
236 
238  /* standard state should be only fourth bit set */
239  TEST_ASSERT_EQUAL(0x10u, mxm_41bState.regConfig2);
240  TEST_ASSERT_EQUAL(
242  TEST_ASSERT_EQUAL(0x10u, mxm_41bState.regConfig2);
243 
244  /* after writing register, fifth bit should be set in addition */
245  TEST_ASSERT_EQUAL(
247  TEST_ASSERT_EQUAL((0x10u | (1u << 5u)), mxm_41bState.regConfig2);
248 
249  /* standard state should be third, second, first and zero bit set */
250  TEST_ASSERT_EQUAL(0xFu, mxm_41bState.regConfig3);
251 
252  /* 0us --> 0 */
253  TEST_ASSERT_EQUAL(
254  STD_OK,
256  TEST_ASSERT_EQUAL(0x0u, mxm_41bState.regConfig3);
257 
258  /* 10us --> 1 */
259  TEST_ASSERT_EQUAL(
260  STD_OK,
262  TEST_ASSERT_EQUAL(0x1u, mxm_41bState.regConfig3);
263 
264  /* 640us --> 0x7 */
265  TEST_ASSERT_EQUAL(
266  STD_OK,
268  TEST_ASSERT_EQUAL(0x7u, mxm_41bState.regConfig3);
269 
270  /* INF DLY --> 0xF */
271  TEST_ASSERT_EQUAL(
272  STD_OK,
274  TEST_ASSERT_EQUAL(0xFu, mxm_41bState.regConfig3);
275 
276  /* standard state should be zero */
277  TEST_ASSERT_EQUAL(0x0u, mxm_41bState.regRxIntEnable);
278 
279  /* rx error int on --> 0x80 */
280  TEST_ASSERT_EQUAL(
282  TEST_ASSERT_EQUAL(0x80u, mxm_41bState.regRxIntEnable);
283 
284  /* rx error int off --> 0 */
285  TEST_ASSERT_EQUAL(
287  TEST_ASSERT_EQUAL(0x0u, mxm_41bState.regRxIntEnable);
288 
289  /* standard state should be zero */
290  TEST_ASSERT_EQUAL(0x0u, mxm_41bState.regRxIntEnable);
291 
292  /* rx overflow int on --> 0x8 */
293  TEST_ASSERT_EQUAL(
295  TEST_ASSERT_EQUAL(0x8u, mxm_41bState.regRxIntEnable);
296 
297  /* rx overflow int off --> 0 */
298  TEST_ASSERT_EQUAL(
300  TEST_ASSERT_EQUAL(0x0u, mxm_41bState.regRxIntEnable);
301 }
302 /** @}
303  * end of tests for function MXM_41BWriteRegisterFunction */
304 
305 /**
306  * \defgroup mxm41b-read-register-function tests for function MXM_41BReadRegisterFunction
307  * @{
308  */
310  MXM_41B_REG_BIT_VALUE result = {0};
311  TEST_ASSERT_EQUAL(STD_NOT_OK, MXM_41BReadRegisterFunction(&mxm_41bState, 0xFF, &result));
314 }
316  MXM_41B_REG_BIT_VALUE result = 42;
317  /* set register */
319 
320  /* read all functions in this register */
322  TEST_ASSERT_EQUAL(MXM_41B_REG_FALSE, result);
323 
324  TEST_ASSERT_EQUAL(
326  TEST_ASSERT_EQUAL(MXM_41B_REG_FALSE, result);
327 
328  /* set register with bit RX_EMPTY */
330 
331  /* read all functions in this register */
333  TEST_ASSERT_EQUAL(MXM_41B_REG_FALSE, result);
334 
335  TEST_ASSERT_EQUAL(
337  TEST_ASSERT_EQUAL(MXM_41B_REG_TRUE, result);
338 
339  /* set register with bit RX_BUSY */
340  mxm_41bState.regRxStatus = 0x20u;
341 
342  /* read all functions in this register */
344  TEST_ASSERT_EQUAL(MXM_41B_REG_TRUE, result);
345 
346  TEST_ASSERT_EQUAL(
348  TEST_ASSERT_EQUAL(MXM_41B_REG_FALSE, result);
349 
350  /* set register to zero */
352 
353  /* read all functions in this register */
355  TEST_ASSERT_EQUAL(MXM_41B_REG_FALSE, result);
356 
357  /* set register with TX_PREAMBLES */
358  mxm_41bState.regConfig2 = 0x20u;
359 
360  /* read all functions in this register */
362  TEST_ASSERT_EQUAL(MXM_41B_REG_TRUE, result);
363 }
364 /** @}
365  * end of tests for function MXM_41BReadRegisterFunction */
366 
367 /**
368  * \defgroup mxm41b-state-machine tests for the MXM_41b-state-machine
369  * @{
370  */
375 }
376 
378  /* force state-machine in idle state */
380 
381  TEST_ASSERT_EQUAL(MXM_STATEMACH_41B_IDLE, mxm_41bState.state);
383  TEST_ASSERT_EQUAL(MXM_STATEMACH_41B_IDLE, mxm_41bState.state);
384 }
385 
386 void testStateCheckFMEA(void) {
387  /* force state-machine in check_fmea state */
389 
390  TEST_ASSERT_EQUAL(MXM_STATEMACH_41B_CHECK_FMEA, mxm_41bState.state);
391 
392  /* create a buffer with the assumed output of the ASCI and inject into SPI read */
393  uint16_t rxBuffer[10] = {0x13u, 0x00u};
394  MXM_ReceiveData_ExpectAndReturn(mxm_41bState.spiTxBuffer, mxm_41bState.spiRxBuffer, 2, STD_OK);
395  MXM_ReceiveData_ReturnArrayThruPtr_rxBuffer(rxBuffer, 2);
397  TEST_ASSERT_EQUAL(MXM_STATEMACH_41B_CHECK_FMEA, mxm_41bState.state);
398 
399  /* check if the values are parsed correctly */
400  MXM_GetSPIStateReady_ExpectAndReturn(STD_OK);
402  TEST_ASSERT_EQUAL(MXM_STATEMACH_41B_IDLE, mxm_41bState.state);
403  TEST_ASSERT_EQUAL(MXM_41B_STATE_PROCESSED, status41b);
404 }
405 
407  /* force state-machine in check_fmea state */
409 
410  TEST_ASSERT_EQUAL(MXM_STATEMACH_41B_CHECK_FMEA, mxm_41bState.state);
411 
412  /* create a buffer with the assumed output of the ASCI and inject into SPI read */
413  /* simulate an GNDL Alert in FMEA register */
414  uint16_t rxBuffer[10] = {0x13u, 0x01u};
415  MXM_ReceiveData_ExpectAndReturn(mxm_41bState.spiTxBuffer, mxm_41bState.spiRxBuffer, 2, STD_OK);
416  MXM_ReceiveData_ReturnArrayThruPtr_rxBuffer(rxBuffer, 2);
418  TEST_ASSERT_EQUAL(MXM_STATEMACH_41B_CHECK_FMEA, mxm_41bState.state);
419 
420  /* check if the values are parsed correctly */
421  MXM_GetSPIStateReady_ExpectAndReturn(STD_OK);
423  TEST_ASSERT_EQUAL(MXM_STATEMACH_41B_IDLE, mxm_41bState.state);
424  TEST_ASSERT_EQUAL(MXM_41B_STATE_ERROR, status41b);
425 }
426 
428  /* force state-machine in get_version state */
430 
432 
433  /* create a buffer with the assumed output of the ASCI and inject into SPI read */
434  uint16_t rxBuffer[10] = {0x15u, 0x84u, 0x12u};
435  MXM_ReceiveData_ExpectAndReturn(mxm_41bState.spiTxBuffer, mxm_41bState.spiRxBuffer, 3, STD_OK);
436  MXM_ReceiveData_ReturnArrayThruPtr_rxBuffer(rxBuffer, 3);
439 
440  /* check if the values are parsed correctly */
441  MXM_GetSPIStateReady_ExpectAndReturn(STD_OK);
443  TEST_ASSERT_EQUAL(0x841u, mxm_41bState.hardwareModel);
444  TEST_ASSERT_EQUAL(0x2u, mxm_41bState.hardwareMaskRevision);
445 }
446 
448  /* force state-machine in clear_receive_buffer state */
450 
452 
453  /* create a buffer with the assumed input to the ASCI */
454  uint16_t tx_buffer[10] = {0xE0u};
455  MXM_SendData_ExpectAndReturn(tx_buffer, 1, STD_OK);
457 
458  /* check if the write was successful */
459  TEST_ASSERT_EQUAL(MXM_STATEMACH_41B_IDLE, mxm_41bState.state);
460  TEST_ASSERT_EQUAL(MXM_41B_STATE_PROCESSED, status41b);
461 }
462 
464  /* force state-machine in clear_receive_buffer state */
466 
468 
469  /* create a buffer with the assumed input to the ASCI */
470  uint16_t tx_buffer[10] = {0xE0u};
471  /* simulate a failure of writing */
472  MXM_SendData_ExpectAndReturn(tx_buffer, 1, STD_NOT_OK);
474 
475  /* check if the write was successful */
476  TEST_ASSERT_EQUAL(MXM_STATEMACH_41B_IDLE, mxm_41bState.state);
477  TEST_ASSERT_EQUAL(MXM_41B_STATE_ERROR, status41b);
478 }
479 
481  /* force state-machine in clear_transmit_buffer state */
483 
485 
486  /* create a buffer with the assumed input to the ASCI */
487  uint16_t tx_buffer[10] = {0x20u};
488  MXM_SendData_ExpectAndReturn(tx_buffer, 1, STD_OK);
490 
491  /* check if the write was successful */
492  TEST_ASSERT_EQUAL(MXM_STATEMACH_41B_IDLE, mxm_41bState.state);
493  TEST_ASSERT_EQUAL(MXM_41B_STATE_PROCESSED, status41b);
494 }
495 
497  /* force state-machine in clear_transmit_buffer state */
499 
501 
502  /* create a buffer with the assumed input to the ASCI */
503  uint16_t tx_buffer[10] = {0x20u};
504  /* simulate a failure of writing */
505  MXM_SendData_ExpectAndReturn(tx_buffer, 1, STD_NOT_OK);
507 
508  /* check if the write was successful */
509  TEST_ASSERT_EQUAL(MXM_STATEMACH_41B_IDLE, mxm_41bState.state);
510  TEST_ASSERT_EQUAL(MXM_41B_STATE_ERROR, status41b);
511 }
512 
514  /* force state-machine in MXM_41B_UART_WAIT_FOR_RX_STATUS_CHANGE_READ_AND_READ_BACK_RCV_BUF */
517  /* prepare RX buffer with not received RX_Stop_Status bit */
518  mxm_41bState.spiRxBuffer[1] = 0;
519 
520  /* transition */
522 
524 }
525 
527  /* force state-machine in MXM_41B_UART_WAIT_FOR_RX_STATUS_CHANGE_READ_AND_READ_BACK_RCV_BUF */
530  /* prepare RX buffer with received RX_Stop_Status bit */
531  mxm_41bState.spiRxBuffer[1] |= (0x01u << 1u);
532 
533  /* transition */
534  MXM_ReceiveData_IgnoreAndReturn(STD_OK);
536 
538 }
539 
540 void testStateDefault(void) {
541  /* force state-machine in invalid state */
544 
545  /* transition */
546  MXM_ReceiveData_IgnoreAndReturn(STD_OK);
548 }
549 
550 /** tests the normally to be expected flow through the initialization state */
552  /* force state-machine in init state */
554 
555  TEST_ASSERT_EQUAL(MXM_STATEMACH_41B_INIT, mxm_41bState.state);
556  TEST_ASSERT_EQUAL(MXM_41B_ENTRY_SUBSTATE, mxm_41bState.substate);
557 
558  /* first the bridge IC should be shut down */
559  MXM_ShutDownBridgeIc_Expect();
560  /* timestamp for the shutdown */
561  const uint32_t shutdownTimestamp = 42u;
562  OS_GetTickCount_ExpectAndReturn(shutdownTimestamp);
564 
565  /* next call the timestamp will be checked, simulate time is not up yet */
566  OS_CheckTimeHasPassed_ExpectAndReturn(shutdownTimestamp, 0u, false);
567  OS_CheckTimeHasPassed_IgnoreArg_timeToPass_ms();
569 
570  /* next call the timestamp will be checked again, simulate time is up */
571  OS_CheckTimeHasPassed_ExpectAndReturn(shutdownTimestamp, 0u, true);
572  OS_CheckTimeHasPassed_IgnoreArg_timeToPass_ms();
573  /* now the bridge IC should be reenabled */
574  MXM_EnableBridgeIc_Expect();
576 
577  /* now the default configuration should be sent to the bridge IC */
578  MXM_SendData_ExpectAndReturn(mxm_41bState.spiTxBuffer, 8, STD_OK);
580 
581  /* default values to check against */
582  const uint8_t mxm_41B_reg_default_values[MXM_41B_CONFIG_REGISTER_LENGTH] = {
590  MXM_ReceiveData_ExpectAndReturn(
593 
594  /* inject the values by copying into the pointer (can be done since we know the address) */
595  for (uint8_t i = 0u; i < MXM_41B_CONFIG_REGISTER_LENGTH; i++) {
596  mxm_41bState.spiRxBuffer[i + 1u] = mxm_41B_reg_default_values[i];
597  }
598 
599  MXM_GetSPIStateReady_ExpectAndReturn(STD_OK);
601 
602  /* and now we should be done and back in idle */
603  TEST_ASSERT_EQUAL(MXM_STATEMACH_41B_IDLE, mxm_41bState.state);
604  TEST_ASSERT_EQUAL(MXM_41B_ENTRY_SUBSTATE, mxm_41bState.substate);
605 }
606 
607 /** @}
608  * 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:785
void MXM_41BStateMachine(MXM_41B_INSTANCE_s *pInstance)
Execute state-machine for the MAX17841B.
Definition: mxm_17841b.c:928
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:847
void MXM_41BInitializeStateStruct(MXM_41B_INSTANCE_s *pInstance)
Initializes the state struct with default values.
Definition: mxm_17841b.c:974
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:893
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
uint16_t spiTxBuffer[MXM_SPI_TX_BUFFER_LENGTH]
Definition: mxm_17841b.h:184
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
MXM_41B_SUBSTATES_e substate
Definition: mxm_17841b.h:163
uint16_t hardwareModel
Definition: mxm_17841b.h:180
MXM_STATEMACH_41B_e state
Definition: mxm_17841b.h:162
uint8_t hardwareMaskRevision
Definition: mxm_17841b.h:181
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)