foxBMS - Unit Tests  1.2.1
The foxBMS Unit Tests API Documentation
test_mxm_17841b.c
Go to the documentation of this file.
1 /**
2  *
3  * @copyright © 2010 - 2021, 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 2021-12-06 (date of last update)
47  * @ingroup UNIT_TEST_IMPLEMENTATION
48  * @prefix MXM
49  *
50  * @brief Test for the Maxim MAX17841B driver.
51  *
52  * @details def
53  *
54  */
55 
56 /*========== Includes =======================================================*/
57 #include "unity.h"
58 #include "Mockfassert.h"
59 #include "Mockmxm_cfg.h"
60 #include "Mockos.h"
61 
62 #include "mxm_17841b.h"
63 #include "mxm_bitextract.h"
64 #include "test_assert_helper.h"
65 
66 /*========== Definitions and Implementations for Unit Test ==================*/
67 /** replicating the config register length in the driver */
68 #define MXM_41B_CONFIG_REGISTER_LENGTH (7u)
69 
72  .substate = MXM_41B_ENTRY_SUBSTATE,
73  .extendMessageBytes = 0,
74  .waitCounter = 0,
75  .regRXIntEnable = 0x00u,
76  .regTXIntEnable = 0x00u,
77  .regRXStatus = 0x00u,
78  .regTXStatus = 0x00u,
79  .regConfig1 = MXM_41B_CONFIG_1_DEFAULT_VALUE,
80  .regConfig2 = MXM_41B_CONFIG_2_DEFAULT_VALUE,
81  .regConfig3 = MXM_41B_CONFIG_3_DEFAULT_VALUE,
82  .hwModel = 0,
83  .hwMaskRevision = 0,
84  .spiRXBuffer = {0},
85  .spiTXBuffer = {0},
86 };
87 
88 uint16_t commandBuffer[10] = {0};
89 uint16_t rxBuffer[100] = {0};
90 
92 
93 /*========== Setup and Teardown =============================================*/
94 void setUp(void) {
97 
98  commandBuffer[0] = 0;
99  commandBuffer[1] = 0;
100  commandBuffer[2] = 0;
101  commandBuffer[3] = 0;
102  commandBuffer[4] = 0;
103  commandBuffer[5] = 0;
104  commandBuffer[6] = 0;
105  commandBuffer[7] = 0;
106  commandBuffer[8] = 0;
107  commandBuffer[9] = 0;
108 
110 }
111 
112 void tearDown(void) {
113 }
114 
115 /*========== Test Cases =====================================================*/
116 /**
117  * \defgroup mxm41b-set-state-request tests for function MXM_41BSetStateRequest
118  * @{
119  */
120 
121 /**
122  * @brief Test with an invalid pointer
123  * @details This test calls #MXM_41BSetStateRequest() with an invalid pointer
124  * value and expects an assertion to be triggered.
125  */
129 }
130 
131 /**
132  * @brief Test that the only transition from uninitialized is initialization
133  * @details This test expects the state machine to be in state
134  * #MXM_STATEMACH_41B_UNINITIALIZED and various transitions to other
135  * states. The only valid transition has to be to
136  * #MXM_STATEMACH_41B_INIT. This is check by evaluating the return
137  * value of #MXM_41BSetStateRequest().
138  */
140  TEST_ASSERT_EQUAL(
141  STD_NOT_OK,
144  TEST_ASSERT_EQUAL(
145  STD_NOT_OK,
148  TEST_ASSERT_EQUAL(
149  STD_NOT_OK,
152  TEST_ASSERT_EQUAL(
153  STD_OK,
155 }
156 
158  /* start in Idle state */
160 
161  TEST_ASSERT_EQUAL(
162  STD_OK,
165 
166  /* try additional transition (even though not in idle state anymore) */
167  TEST_ASSERT_EQUAL(
168  STD_NOT_OK,
171 }
172 
174  TEST_ASSERT_EQUAL(
175  STD_OK,
177 }
178 
180  TEST_ASSERT_EQUAL(
181  STD_NOT_OK,
183 
184  TEST_ASSERT_EQUAL(
185  STD_NOT_OK,
187 
188  TEST_ASSERT_EQUAL(
189  STD_OK,
191 }
192 
194  TEST_ASSERT_EQUAL(
195  STD_NOT_OK,
197 
198  TEST_ASSERT_EQUAL(
199  STD_NOT_OK,
201 
202  TEST_ASSERT_EQUAL(
203  STD_OK,
205 }
206 
208  TEST_ASSERT_EQUAL(
209  STD_NOT_OK,
211 }
212 
213 /** @}
214  * end of tests for function MXM_41BSetStateRequest */
215 
216 /**
217  * \defgroup mxm41b-write-register-function tests for function MXM_41BWriteRegisterFunction
218  * @{
219  */
221  TEST_ASSERT_EQUAL(STD_NOT_OK, MXM_41BWriteRegisterFunction(&mxm_41bState, 0xFF, 0));
223 }
224 
226  /* standard state should be only fourth bit set */
227  TEST_ASSERT_EQUAL(0x10u, mxm_41bState.regConfig2);
228  TEST_ASSERT_EQUAL(
230  TEST_ASSERT_EQUAL(0x10u, mxm_41bState.regConfig2);
231 
232  /* after writing register, fifth bit should be set in addition */
233  TEST_ASSERT_EQUAL(
235  TEST_ASSERT_EQUAL((0x10u | (1u << 5u)), mxm_41bState.regConfig2);
236 
237  /* standard state should be third, second, first and zero bit set */
238  TEST_ASSERT_EQUAL(0xFu, mxm_41bState.regConfig3);
239 
240  /* 0us --> 0 */
241  TEST_ASSERT_EQUAL(
242  STD_OK,
244  TEST_ASSERT_EQUAL(0x0u, mxm_41bState.regConfig3);
245 
246  /* 10us --> 1 */
247  TEST_ASSERT_EQUAL(
248  STD_OK,
250  TEST_ASSERT_EQUAL(0x1u, mxm_41bState.regConfig3);
251 
252  /* 640us --> 0x7 */
253  TEST_ASSERT_EQUAL(
254  STD_OK,
256  TEST_ASSERT_EQUAL(0x7u, mxm_41bState.regConfig3);
257 
258  /* INF DLY --> 0xF */
259  TEST_ASSERT_EQUAL(
260  STD_OK,
262  TEST_ASSERT_EQUAL(0xFu, mxm_41bState.regConfig3);
263 
264  /* standard state should be zero */
265  TEST_ASSERT_EQUAL(0x0u, mxm_41bState.regRXIntEnable);
266 
267  /* rx error int on --> 0x80 */
268  TEST_ASSERT_EQUAL(
270  TEST_ASSERT_EQUAL(0x80u, mxm_41bState.regRXIntEnable);
271 
272  /* rx error int off --> 0 */
273  TEST_ASSERT_EQUAL(
275  TEST_ASSERT_EQUAL(0x0u, mxm_41bState.regRXIntEnable);
276 
277  /* standard state should be zero */
278  TEST_ASSERT_EQUAL(0x0u, mxm_41bState.regRXIntEnable);
279 
280  /* rx overflow int on --> 0x8 */
281  TEST_ASSERT_EQUAL(
283  TEST_ASSERT_EQUAL(0x8u, mxm_41bState.regRXIntEnable);
284 
285  /* rx overflow int off --> 0 */
286  TEST_ASSERT_EQUAL(
288  TEST_ASSERT_EQUAL(0x0u, mxm_41bState.regRXIntEnable);
289 }
290 /** @}
291  * end of tests for function MXM_41BWriteRegisterFunction */
292 
293 /**
294  * \defgroup mxm41b-read-register-function tests for function MXM_41BReadRegisterFunction
295  * @{
296  */
298  MXM_41B_REG_BIT_VALUE result = {0};
299  TEST_ASSERT_EQUAL(STD_NOT_OK, MXM_41BReadRegisterFunction(&mxm_41bState, 0xFF, &result));
302 }
304  MXM_41B_REG_BIT_VALUE result = 42;
305  /* set register */
307 
308  /* read all functions in this register */
310  TEST_ASSERT_EQUAL(MXM_41B_REG_FALSE, result);
311 
312  TEST_ASSERT_EQUAL(
314  TEST_ASSERT_EQUAL(MXM_41B_REG_FALSE, result);
315 
316  /* set register with bit RX_EMPTY */
318 
319  /* read all functions in this register */
321  TEST_ASSERT_EQUAL(MXM_41B_REG_FALSE, result);
322 
323  TEST_ASSERT_EQUAL(
325  TEST_ASSERT_EQUAL(MXM_41B_REG_TRUE, result);
326 
327  /* set register with bit RX_BUSY */
328  mxm_41bState.regRXStatus = 0x20u;
329 
330  /* read all functions in this register */
332  TEST_ASSERT_EQUAL(MXM_41B_REG_TRUE, result);
333 
334  TEST_ASSERT_EQUAL(
336  TEST_ASSERT_EQUAL(MXM_41B_REG_FALSE, result);
337 
338  /* set register to zero */
340 
341  /* read all functions in this register */
343  TEST_ASSERT_EQUAL(MXM_41B_REG_FALSE, result);
344 
345  /* set register with TX_PREAMBLES */
346  mxm_41bState.regConfig2 = 0x20u;
347 
348  /* read all functions in this register */
350  TEST_ASSERT_EQUAL(MXM_41B_REG_TRUE, result);
351 }
352 /** @}
353  * end of tests for function MXM_41BReadRegisterFunction */
354 
355 /**
356  * \defgroup mxm41b-state-machine tests for the MXM_41b-state-machine
357  * @{
358  */
363 }
364 
366  /* force state-machine in idle state */
368 
369  TEST_ASSERT_EQUAL(MXM_STATEMACH_41B_IDLE, mxm_41bState.state);
371  TEST_ASSERT_EQUAL(MXM_STATEMACH_41B_IDLE, mxm_41bState.state);
372 }
373 
374 void testStateCheckFMEA(void) {
375  /* force state-machine in check_fmea state */
377 
378  TEST_ASSERT_EQUAL(MXM_STATEMACH_41B_CHECK_FMEA, mxm_41bState.state);
379 
380  /* create a buffer with the assumed output of the ASCI and inject into SPI read */
381  uint16_t rxBuffer[10] = {0x13u, 0x00u};
382  MXM_ReceiveData_ExpectAndReturn(mxm_41bState.spiTXBuffer, mxm_41bState.spiRXBuffer, 2, STD_OK);
383  MXM_ReceiveData_ReturnArrayThruPtr_rxBuffer(rxBuffer, 2);
385  TEST_ASSERT_EQUAL(MXM_STATEMACH_41B_CHECK_FMEA, mxm_41bState.state);
386 
387  /* check if the values are parsed correctly */
388  MXM_GetSPIStateReady_ExpectAndReturn(STD_OK);
390  TEST_ASSERT_EQUAL(MXM_STATEMACH_41B_IDLE, mxm_41bState.state);
391  TEST_ASSERT_EQUAL(MXM_41B_STATE_PROCESSED, status41b);
392 }
393 
395  /* force state-machine in check_fmea state */
397 
398  TEST_ASSERT_EQUAL(MXM_STATEMACH_41B_CHECK_FMEA, mxm_41bState.state);
399 
400  /* create a buffer with the assumed output of the ASCI and inject into SPI read */
401  /* simulate an GNDL Alert in FMEA register */
402  uint16_t rxBuffer[10] = {0x13u, 0x01u};
403  MXM_ReceiveData_ExpectAndReturn(mxm_41bState.spiTXBuffer, mxm_41bState.spiRXBuffer, 2, STD_OK);
404  MXM_ReceiveData_ReturnArrayThruPtr_rxBuffer(rxBuffer, 2);
406  TEST_ASSERT_EQUAL(MXM_STATEMACH_41B_CHECK_FMEA, mxm_41bState.state);
407 
408  /* check if the values are parsed correctly */
409  MXM_GetSPIStateReady_ExpectAndReturn(STD_OK);
411  TEST_ASSERT_EQUAL(MXM_STATEMACH_41B_IDLE, mxm_41bState.state);
412  TEST_ASSERT_EQUAL(MXM_41B_STATE_ERROR, status41b);
413 }
414 
416  /* force state-machine in get_version state */
418 
420 
421  /* create a buffer with the assumed output of the ASCI and inject into SPI read */
422  uint16_t rxBuffer[10] = {0x15u, 0x84u, 0x12u};
423  MXM_ReceiveData_ExpectAndReturn(mxm_41bState.spiTXBuffer, mxm_41bState.spiRXBuffer, 3, STD_OK);
424  MXM_ReceiveData_ReturnArrayThruPtr_rxBuffer(rxBuffer, 3);
427 
428  /* check if the values are parsed correctly */
429  MXM_GetSPIStateReady_ExpectAndReturn(STD_OK);
431  TEST_ASSERT_EQUAL(0x841u, mxm_41bState.hwModel);
432  TEST_ASSERT_EQUAL(0x2u, mxm_41bState.hwMaskRevision);
433 }
434 
436  /* force state-machine in clear_receive_buffer state */
438 
440 
441  /* create a buffer with the assumed input to the ASCI */
442  uint16_t tx_buffer[10] = {0xE0u};
443  MXM_SendData_ExpectAndReturn(tx_buffer, 1, STD_OK);
445 
446  /* check if the write was successful */
447  TEST_ASSERT_EQUAL(MXM_STATEMACH_41B_IDLE, mxm_41bState.state);
448  TEST_ASSERT_EQUAL(MXM_41B_STATE_PROCESSED, status41b);
449 }
450 
452  /* force state-machine in clear_receive_buffer state */
454 
456 
457  /* create a buffer with the assumed input to the ASCI */
458  uint16_t tx_buffer[10] = {0xE0u};
459  /* simulate a failure of writing */
460  MXM_SendData_ExpectAndReturn(tx_buffer, 1, STD_NOT_OK);
462 
463  /* check if the write was successful */
464  TEST_ASSERT_EQUAL(MXM_STATEMACH_41B_IDLE, mxm_41bState.state);
465  TEST_ASSERT_EQUAL(MXM_41B_STATE_ERROR, status41b);
466 }
467 
469  /* force state-machine in clear_transmit_buffer state */
471 
473 
474  /* create a buffer with the assumed input to the ASCI */
475  uint16_t tx_buffer[10] = {0x20u};
476  MXM_SendData_ExpectAndReturn(tx_buffer, 1, STD_OK);
478 
479  /* check if the write was successful */
480  TEST_ASSERT_EQUAL(MXM_STATEMACH_41B_IDLE, mxm_41bState.state);
481  TEST_ASSERT_EQUAL(MXM_41B_STATE_PROCESSED, status41b);
482 }
483 
485  /* force state-machine in clear_transmit_buffer state */
487 
489 
490  /* create a buffer with the assumed input to the ASCI */
491  uint16_t tx_buffer[10] = {0x20u};
492  /* simulate a failure of writing */
493  MXM_SendData_ExpectAndReturn(tx_buffer, 1, STD_NOT_OK);
495 
496  /* check if the write was successful */
497  TEST_ASSERT_EQUAL(MXM_STATEMACH_41B_IDLE, mxm_41bState.state);
498  TEST_ASSERT_EQUAL(MXM_41B_STATE_ERROR, status41b);
499 }
500 
502  /* force state-machine in MXM_41B_UART_WAIT_FOR_RX_STATUS_CHANGE_READ_AND_READ_BACK_RCV_BUF */
505  /* prepare RX buffer with not received RX_Stop_Status bit */
506  mxm_41bState.spiRXBuffer[1] = 0;
507 
508  /* transition */
510 
512 }
513 
515  /* force state-machine in MXM_41B_UART_WAIT_FOR_RX_STATUS_CHANGE_READ_AND_READ_BACK_RCV_BUF */
518  /* prepare RX buffer with received RX_Stop_Status bit */
519  mxm_41bState.spiRXBuffer[1] |= (0x01u << 1u);
520 
521  /* transition */
522  MXM_ReceiveData_IgnoreAndReturn(STD_OK);
524 
526 }
527 
528 void testStateDefault(void) {
529  /* force state-machine in invalid state */
532 
533  /* transition */
534  MXM_ReceiveData_IgnoreAndReturn(STD_OK);
536 }
537 
538 /** tests the normally to be expected flow through the initialization state */
540  /* force state-machine in init state */
542 
543  TEST_ASSERT_EQUAL(MXM_STATEMACH_41B_INIT, mxm_41bState.state);
544  TEST_ASSERT_EQUAL(MXM_41B_ENTRY_SUBSTATE, mxm_41bState.substate);
545 
546  /* first the bridge IC should be shut down */
547  MXM_ShutDownBridgeIc_Expect();
548  /* timestamp for the shutdown */
549  const uint32_t shutdownTimestamp = 42u;
550  OS_GetTickCount_ExpectAndReturn(shutdownTimestamp);
552 
553  /* next call the timestamp will be checked, simulate time is not up yet */
554  OS_CheckTimeHasPassed_ExpectAndReturn(shutdownTimestamp, 0u, false);
555  OS_CheckTimeHasPassed_IgnoreArg_timeToPass_ms();
557 
558  /* next call the timestamp will be checked again, simulate time is up */
559  OS_CheckTimeHasPassed_ExpectAndReturn(shutdownTimestamp, 0u, true);
560  OS_CheckTimeHasPassed_IgnoreArg_timeToPass_ms();
561  /* now the bridge IC should be reenabled */
562  MXM_EnableBridgeIc_Expect();
564 
565  /* now the default configuration should be sent to the bridge IC */
566  MXM_SendData_ExpectAndReturn(mxm_41bState.spiTXBuffer, 8, STD_OK);
568 
569  /* default values to check against */
570  const uint8_t mxm_41B_reg_default_values[MXM_41B_CONFIG_REGISTER_LENGTH] = {
578  MXM_ReceiveData_ExpectAndReturn(
581 
582  /* inject the values by copying into the pointer (can be done since we know the address) */
583  for (uint8_t i = 0u; i < MXM_41B_CONFIG_REGISTER_LENGTH; i++) {
584  mxm_41bState.spiRXBuffer[i + 1u] = mxm_41B_reg_default_values[i];
585  }
586 
587  MXM_GetSPIStateReady_ExpectAndReturn(STD_OK);
589 
590  /* and now we should be done and back in idle */
591  TEST_ASSERT_EQUAL(MXM_STATEMACH_41B_IDLE, mxm_41bState.state);
592  TEST_ASSERT_EQUAL(MXM_41B_ENTRY_SUBSTATE, mxm_41bState.substate);
593 }
594 
595 /** @}
596  * end tests for the state-machine */
@ STD_NOT_OK
Definition: fstd_types.h:82
@ STD_OK
Definition: fstd_types.h:81
#define NULL_PTR
Null pointer.
Definition: fstd_types.h:75
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:775
void MXM_41BStateMachine(MXM_41B_INSTANCE_s *pInstance)
Execute state-machine for the MAX17841B.
Definition: mxm_17841b.c:910
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:831
void MXM_41BInitializeStateStruct(MXM_41B_INSTANCE_s *pInstance)
Initializes the state struct with default values.
Definition: mxm_17841b.c:956
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:875
Headers for the driver for the MAX17841B ASCI and MAX1785x monitoring chip.
@ MXM_STATEMACH_41B_MAXSTATE
Definition: mxm_17841b.h:94
@ MXM_STATEMACH_41B_GET_VERSION
Definition: mxm_17841b.h:88
@ MXM_STATEMACH_41B_CLEAR_RECEIVE_BUFFER
Definition: mxm_17841b.h:92
@ MXM_STATEMACH_41B_CLEAR_TRANSMIT_BUFFER
Definition: mxm_17841b.h:93
@ MXM_STATEMACH_41B_UNINITIALIZED
Definition: mxm_17841b.h:84
@ MXM_STATEMACH_41B_INIT
Definition: mxm_17841b.h:85
@ MXM_STATEMACH_41B_CHECK_FMEA
Definition: mxm_17841b.h:87
@ MXM_STATEMACH_41B_IDLE
Definition: mxm_17841b.h:86
@ MXM_STATEMACH_41B_UART_TRANSACTION
Definition: mxm_17841b.h:91
@ MXM_41B_UART_WAIT_FOR_RX_STATUS_CHANGE_WRITE
Definition: mxm_17841b.h:117
@ MXM_41B_UART_READ_BACK_RECEIVE_BUFFER_SAVE
Definition: mxm_17841b.h:119
@ MXM_41B_ENTRY_SUBSTATE
Definition: mxm_17841b.h:101
@ MXM_41B_UART_WAIT_FOR_RX_STATUS_CHANGE_READ_AND_READ_BACK_RCV_BUF
Definition: mxm_17841b.h:118
@ MXM_41B_REG_FUNCTION_RX_BUSY_STATUS
Definition: mxm_17841b.h:141
@ MXM_41B_REG_FUNCTION_RX_EMPTY_STATUS
Definition: mxm_17841b.h:144
@ MXM_41B_REG_FUNCTION_TX_PREAMBLES
Definition: mxm_17841b.h:145
@ MXM_41B_REG_FUNCTION_RX_ERROR_INT
Definition: mxm_17841b.h:147
@ MXM_41B_REG_FUNCTION_KEEP_ALIVE
Definition: mxm_17841b.h:146
@ MXM_41B_REG_FUNCTION_RX_OVERFLOW_INT
Definition: mxm_17841b.h:148
MXM_41B_STATE_REQUEST_STATUS_e
Request status of MAX17841B states.
Definition: mxm_17841b.h:130
@ MXM_41B_STATE_ERROR
Definition: mxm_17841b.h:134
@ MXM_41B_STATE_UNPROCESSED
Definition: mxm_17841b.h:132
@ MXM_41B_STATE_PROCESSED
Definition: mxm_17841b.h:133
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:103
#define MXM_41B_CONFIG_1_DEFAULT_VALUE
Definition: mxm_cfg.h:91
#define MXM_41B_CONFIG_2_DEFAULT_VALUE
Definition: mxm_cfg.h:97
#define MXM_41B_RX_INT_ENABLE_DEFAULT_VALUE
Definition: mxm_cfg.h:80
#define MXM_41B_RX_INT_FLAG_DEFAULT_VALUE
Definition: mxm_cfg.h:82
#define MXM_41B_TX_INT_ENABLE_DEFAULT_VALUE
Definition: mxm_cfg.h:81
#define MXM_41B_TX_INT_FLAG_DEFAULT_VALUE
Definition: mxm_cfg.h:83
Struct for the state-variable of state-machine.
Definition: mxm_17841b.h:157
uint8_t regRXIntEnable
Definition: mxm_17841b.h:167
uint8_t hwMaskRevision
Definition: mxm_17841b.h:176
MXM_41B_STATE_REQUEST_STATUS_e * processed
Definition: mxm_17841b.h:164
uint16_t spiRXBuffer[MXM_SPI_RX_BUFFER_LENGTH]
Definition: mxm_17841b.h:178
uint16_t spiTXBuffer[MXM_SPI_TX_BUFFER_LENGTH]
Definition: mxm_17841b.h:179
MXM_41B_SUBSTATES_e substate
Definition: mxm_17841b.h:159
MXM_STATEMACH_41B_e state
Definition: mxm_17841b.h:158
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)