foxBMS - Unit Tests  1.5.0
The foxBMS Unit Tests API Documentation
test_spi.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_spi.c
44  * @author foxBMS Team
45  * @date 2020-04-01 (date of creation)
46  * @updated 2023-02-03 (date of last update)
47  * @version v1.5.0
48  * @ingroup UNIT_TEST_IMPLEMENTATION
49  * @prefix TEST
50  *
51  * @brief Tests for the spi module
52  *
53  */
54 
55 /*========== Includes =======================================================*/
56 #include "unity.h"
57 #include "MockHL_spi.h"
58 #include "MockHL_sys_dma.h"
59 #include "Mockdma_cfg.h"
60 #include "Mockio.h"
61 #include "Mockmcu.h"
62 #include "Mockos.h"
63 #include "Mockspi_cfg.h"
64 
65 #include "spi.h"
66 #include "spi_cfg-helper.h"
67 #include "test_assert_helper.h"
68 
69 #include <stdbool.h>
70 
71 TEST_FILE("spi.c")
72 
73 /*========== Definitions and Implementations for Unit Test ==================*/
74 
75 long FSYS_RaisePrivilege(void) {
76  return 0;
77 }
78 
79 /** SPI enumeration for DMA */
81  spiREG1, /*!< SPI1 */
82  spiREG2, /*!< SPI2 */
83  spiREG3, /*!< SPI3 */
84  spiREG4, /*!< SPI4 */
85  spiREG5, /*!< SPI5 */
86 };
87 
88 /** DMA channel configuration for SPI communication */
90  {DMA_CH0, DMA_CH1}, /*!< SPI1 */
91  {DMA_CH2, DMA_CH3}, /*!< SPI2 */
92  {DMA_CH4, DMA_CH5}, /*!< SPI3 */
93  {DMA_CH6, DMA_CH7}, /*!< SPI4 */
94  {DMA_CH8, DMA_CH9}, /*!< SPI5 */
95 };
96 
97 /** SPI data configuration struct for LTC communication */
98 static spiDAT1_t spi_kLtcDataConfig[BS_NR_OF_STRINGS] = {
99  { /* struct is implemented in the TI HAL and uses uppercase true and false */
100  .CS_HOLD = TRUE, /* If true, HW chip select kept active between words */
101  .WDEL = FALSE, /* Activation of delay between words */
102  .DFSEL = SPI_FMT_0, /* Data word format selection */
103  /* Hardware chip select is configured automatically depending on configuration in #SPI_INTERFACE_CONFIG_s */
105 };
106 
107 /** SPI data configuration struct for MXM communication */
108 static spiDAT1_t spi_kMxmDataConfig = {
109  .CS_HOLD = TRUE, /* If true, HW chip select kept active */
110  .WDEL = TRUE, /* Activation of delay between words */
111  .DFSEL = SPI_FMT_1, /* Data word format selection */
112  /* Hardware chip select is configured automatically depending on configuration in #SPI_INTERFACE_CONFIG_s */
114 };
115 
116 /** SPI data configuration struct for NXP MC33775A communication, Tx part */
118  {.CS_HOLD = TRUE, /* If true, HW chip select kept active */
119  .WDEL = TRUE, /* Activation of delay between words */
120  .DFSEL = SPI_FMT_2, /* Data word format selection */
121  /* Hardware chip select is configured automatically depending on configuration in #SPI_INTERFACE_CONFIG_s */
123 };
124 
125 /** SPI data configuration struct for NXP MC33775A communication, Rx part */
127  {.CS_HOLD = TRUE, /* If true, HW chip select kept active */
128  .WDEL = TRUE, /* Activation of delay between words */
129  .DFSEL = SPI_FMT_2, /* Data word format selection */
130  /* Hardware chip select is configured automatically depending on configuration in #SPI_INTERFACE_CONFIG_s */
132 };
133 
134 /** SPI data configuration struct for FRAM communication */
135 static spiDAT1_t spi_kFramDataConfig = {
136  /* struct is implemented in the TI HAL and uses uppercase true and false */
137  .CS_HOLD = TRUE, /* If true, HW chip select kept active */
138  .WDEL = TRUE, /* Activation of delay between words */
139  .DFSEL = SPI_FMT_1, /* Data word format selection */
140  /* Hardware chip select is configured automatically depending on configuration in #SPI_INTERFACE_CONFIG_s */
142 };
143 
144 /** SPI data configuration struct for SPS communication in low speed (4MHz) */
145 static spiDAT1_t spi_kSpsDataConfigLowSpeed = {
146  /* struct is implemented in the TI HAL and uses uppercase true and false */
147  .CS_HOLD = TRUE, /* If true, HW chip select kept active */
148  .WDEL = TRUE, /* Activation of delay between words */
149  .DFSEL = SPI_FMT_1, /* Data word format selection */
150  /* Hardware chip select is configured automatically depending on configuration in #SPI_INTERFACE_CONFIG_s */
152 };
153 
154 /** SPI data configuration struct for SPS communication in high speed (10MHz) */
155 static spiDAT1_t spi_kSpsDataConfigHighSpeed = {
156  /* struct is implemented in the TI HAL and uses uppercase true and false */
157  .CS_HOLD = TRUE, /* If true, HW chip select kept active */
158  .WDEL = TRUE, /* Activation of delay between words */
159  .DFSEL = SPI_FMT_2, /* Data word format selection */
160  /* Hardware chip select is configured automatically depending on configuration in #SPI_INTERFACE_CONFIG_s */
162 };
163 
164 /** SPI configuration struct for SBC communication */
165 static spiDAT1_t spi_kSbcDataConfig = {
166  /* struct is implemented in the TI HAL and uses uppercase true and false */
167  .CS_HOLD = TRUE, /* If true, HW chip select kept active */
168  .WDEL = TRUE, /* Activation of delay between words */
169  .DFSEL = SPI_FMT_0, /* Data word format selection */
170  /* Hardware chip select is configured automatically depending on configuration in #SPI_INTERFACE_CONFIG_s */
172 };
173 
174 /**
175  * SPI interface configuration for LTC communication
176  * This is a list of structs because of multi string
177  */
179  {
180  .pConfig = &spi_kLtcDataConfig[0u],
181  .pNode = spiREG1,
182  .pGioPort = &(spiREG1->PC3),
183  .csPin = 1u,
184  .csType = SPI_CHIP_SELECT_HARDWARE,
185  },
186 };
187 
188 /** SPI interface configuration for MXM communication */
191  .pNode = spiREG4,
192  .pGioPort = &(spiREG4->PC3),
193  .csPin = 0u,
194  .csType = SPI_CHIP_SELECT_HARDWARE,
195 };
196 
197 /** SPI interface configuration for N775 communication Tx part */
199  {
201  .pNode = spiREG1,
202  .pGioPort = &(spiREG1->PC3),
203  .csPin = 1u,
204  .csType = SPI_CHIP_SELECT_HARDWARE,
205  },
206 };
207 
208 /** SPI interface configuration for N775 communication, Rx part */
210  {
212  .pNode = spiREG4,
213  .pGioPort = &(spiREG4->PC3),
214  .csPin = 0u,
215  .csType = SPI_CHIP_SELECT_HARDWARE,
216  },
217 };
218 
219 /** SPI interface configuration for FRAM communication */
222  .pNode = spiREG3,
223  .pGioPort = &(spiREG3->PC3),
224  .csPin = 1u,
225  .csType = SPI_CHIP_SELECT_SOFTWARE,
226 };
227 
228 /** SPI interface configuration for SPS communication */
231  .pNode = spiREG2,
232  .pGioPort = &SPI_SPS_CS_GIOPORT,
233  .csPin = SPI_SPS_CS_PIN,
234  .csType = SPI_CHIP_SELECT_SOFTWARE,
235 };
236 
237 /** SPI interface configuration for SBC communication */
240  .pNode = spiREG2,
241  .pGioPort = &(spiREG2->PC3),
242  .csPin = 0u,
243  .csType = SPI_CHIP_SELECT_HARDWARE,
244 };
245 
246 /** struct containing the lock state of the SPI interfaces */
248  SPI_IDLE,
249  SPI_IDLE,
250  SPI_IDLE,
251  SPI_IDLE,
252  SPI_IDLE,
253 };
254 
255 const uint8_t spi_nrBusyFlags = sizeof(spi_busyFlags) / sizeof(SPI_BUSY_STATE_e);
256 
257 /** mock for testing with an SPI handle */
258 spiBASE_t spiMockHandle = {0};
259 
260 spi_config_reg_t spiMockConfigRegister = {0};
261 
262 /*========== Setup and Teardown =============================================*/
263 void setUp(void) {
264  /* make sure PC0 of config register is clean */
265  spiMockConfigRegister.CONFIG_PC0 = 0;
266 }
267 
268 void tearDown(void) {
269 }
270 
271 /*========== Test Cases =====================================================*/
272 /**
273  * @brief Testing static function #SPI_InitializeChipSelects
274  * @details The following cases need to be tested:
275  * - Argument validation:
276  * - none (void function)
277  * - Routine validation:
278  * - RT1/1: software chip select pin in the valid range is verbatim
279  * piped through the function
280  */
282  /* ======= Assertion tests ============================================= */
283  /* none */
284 
285  /* ======= Routine tests =============================================== */
286  /* ======= RT1/1: Test implementation */
287  const uint8_t currentString = 0u;
288 
289  /* ======= RT1/1: call function under test */
291 
292  /* ======= RT1/1: test output verification */
293  TEST_ASSERT_EQUAL(SPI_HARDWARE_CHIP_SELECT_1_ACTIVE, spi_ltcInterface[currentString].pConfig->CSNR);
294  TEST_ASSERT_EQUAL(SPI_HARDWARE_CHIP_SELECT_1_ACTIVE, spi_nxp775InterfaceTx[currentString].pConfig->CSNR);
295  TEST_ASSERT_EQUAL(SPI_HARDWARE_CHIP_SELECT_0_ACTIVE, spi_nxp775InterfaceRx[currentString].pConfig->CSNR);
297  TEST_ASSERT_EQUAL(1u, spi_framInterface.pConfig->CSNR);
298  TEST_ASSERT_EQUAL(1u, spi_spsInterface.pConfig->CSNR);
300 }
301 
302 /**
303  * @brief Testing static function #SPI_GetChipSelectPin
304  * @details The following cases need to be tested:
305  * - Argument validation:
306  * - AT1/2: invalid chip select type -> assert
307  * - AT2/2: invalid chip select pin number -> assert
308  * - Routine validation:
309  * - RT1/2: software chip select pin in the valid range is verbatim
310  * piped through the function
311  * - RT1/2: hardware chip select pin in the valid range is mapped to
312  * the correct value
313  */
315  /* ======= Assertion tests ============================================= */
316  /* ======= AT1/2 ======= */
317  const SPI_CHIP_SELECT_TYPE_e invalidChipSelectType = SPI_CHIP_SELECT_MAX;
318  const uint32_t validCsPin = 0u;
319  TEST_ASSERT_FAIL_ASSERT(TEST_SPI_GetChipSelectPin(invalidChipSelectType, validCsPin));
320  /* ======= AT2/2 ======= */
321  const SPI_CHIP_SELECT_TYPE_e validChipSelectType = SPI_CHIP_SELECT_SOFTWARE;
322  const uint32_t invalidCsPin = MCU_LARGEST_PIN_NUMBER + 1u;
323  TEST_ASSERT_FAIL_ASSERT(TEST_SPI_GetChipSelectPin(validChipSelectType, invalidCsPin));
324 
325  /* ======= Routine tests =============================================== */
326  /* ======= RT1/2: Test implementation */
327  const uint32_t validSoftwareChipSelectPin = MCU_LARGEST_PIN_NUMBER / 2u;
328  /* ======= RT1/2: call function under test */
329  const uint8_t softwareChipSelectPin =
330  TEST_SPI_GetChipSelectPin(SPI_CHIP_SELECT_SOFTWARE, validSoftwareChipSelectPin);
331  /* ======= RT1/2: test output verification */
332  TEST_ASSERT_EQUAL(validSoftwareChipSelectPin, softwareChipSelectPin);
333 
334  /* ======= RT2/2: Test implementation */
335  const uint32_t validHardwareChipSelectPin = 2u;
336  /* ======= RT2/2: call function under test */
337  const uint8_t hardwareChipSelectPin =
338  TEST_SPI_GetChipSelectPin(SPI_CHIP_SELECT_HARDWARE, validHardwareChipSelectPin);
339  /* ======= RT2/2: test output verification */
340  TEST_ASSERT_EQUAL(SPI_HARDWARE_CHIP_SELECT_2_ACTIVE, hardwareChipSelectPin);
341 }
342 
343 /**
344  * @brief Testing static function #SPI_GetHardwareChipSelectPin
345  * @details The following cases need to be tested:
346  * - Argument validation:
347  * - AT1/1: invalid pin number -> assert
348  * - Routine validation:
349  * - RT1/1: check that only valid hardware chip select
350  * configurations are returned
351  */
353  /* ======= Assertion tests ============================================= */
354  /* ======= AT1/1 ======= */
355  const uint32_t invalidHwCsPin = 7u;
357 
358  /* ======= Routine tests =============================================== */
359  const uint8_t csPin0 = 0u;
360  const uint8_t csPin1 = 1u;
361  const uint8_t csPin2 = 2u;
362  const uint8_t csPin3 = 3u;
363  const uint8_t csPin4 = 4u;
364  const uint8_t csPin5 = 5u;
365  /* ======= RT1/1: Test implementation */
366  /* ======= RT1/1: call function under test */
367  const uint8_t mappedHardwareChipSelectPin0 = TEST_SPI_GetHardwareChipSelectPin(csPin0);
368  const uint8_t mappedHardwareChipSelectPin1 = TEST_SPI_GetHardwareChipSelectPin(csPin1);
369  const uint8_t mappedHardwareChipSelectPin2 = TEST_SPI_GetHardwareChipSelectPin(csPin2);
370  const uint8_t mappedHardwareChipSelectPin3 = TEST_SPI_GetHardwareChipSelectPin(csPin3);
371  const uint8_t mappedHardwareChipSelectPin4 = TEST_SPI_GetHardwareChipSelectPin(csPin4);
372  const uint8_t mappedHardwareChipSelectPin5 = TEST_SPI_GetHardwareChipSelectPin(csPin5);
373  /* ======= RT1/1: test output verification */
374  TEST_ASSERT_EQUAL(SPI_HARDWARE_CHIP_SELECT_0_ACTIVE, mappedHardwareChipSelectPin0);
375  TEST_ASSERT_EQUAL(SPI_HARDWARE_CHIP_SELECT_1_ACTIVE, mappedHardwareChipSelectPin1);
376  TEST_ASSERT_EQUAL(SPI_HARDWARE_CHIP_SELECT_2_ACTIVE, mappedHardwareChipSelectPin2);
377  TEST_ASSERT_EQUAL(SPI_HARDWARE_CHIP_SELECT_3_ACTIVE, mappedHardwareChipSelectPin3);
378  TEST_ASSERT_EQUAL(SPI_HARDWARE_CHIP_SELECT_4_ACTIVE, mappedHardwareChipSelectPin4);
379  TEST_ASSERT_EQUAL(SPI_HARDWARE_CHIP_SELECT_5_ACTIVE, mappedHardwareChipSelectPin5);
380 }
381 
382 /** simple API test that function guards against null pointer */
385 }
386 
387 /** test intended function of SPI_SetFunctional() for setting a bit */
389  /** fake a config register that is null and inject into function */
390  spiMockConfigRegister.CONFIG_PC0 = 0;
391  spi1GetConfigValue_Expect(NULL_PTR, CurrentValue);
392  spi1GetConfigValue_IgnoreArg_config_reg();
393  spi1GetConfigValue_ReturnThruPtr_config_reg(&spiMockConfigRegister);
394 
395  /* the function should call spiSetFunctional with a 1 at bit 10 */
396  spiSetFunctional_Expect(spiREG1, ((uint32_t)1u << 10u));
397 
398  SPI_SetFunctional(spiREG1, 10, true);
399 }
400 
401 /** test intended function of SPI_SetFunctional() for clearing a bit */
403  /** fake a config register that is UINT32_MAX and inject into function */
404  spiMockConfigRegister.CONFIG_PC0 = UINT32_MAX;
405  spi1GetConfigValue_Expect(NULL_PTR, CurrentValue);
406  spi1GetConfigValue_IgnoreArg_config_reg();
407  spi1GetConfigValue_ReturnThruPtr_config_reg(&spiMockConfigRegister);
408 
409  /* the function should call spiSetFunctional with a 0 at bit 10 */
410  spiSetFunctional_Expect(spiREG1, ~((uint32_t)1u << 10u));
411 
412  SPI_SetFunctional(spiREG1, 10, false);
413 }
414 
415 /** test usage of right API functions for SPI1 */
417  /* this test will fail if another function than the intended function is
418  called */
419  spi1GetConfigValue_Ignore();
420  spiSetFunctional_Ignore();
421  SPI_SetFunctional(spiREG1, 0, false);
422 }
423 
424 /** test usage of right API functions for SPI2 */
426  /* this test will fail if another function than the intended function is
427  called */
428  spi2GetConfigValue_Ignore();
429  spiSetFunctional_Ignore();
430  SPI_SetFunctional(spiREG2, 0, false);
431 }
432 
433 /** test usage of right API functions for SPI3 */
435  /* this test will fail if another function than the intended function is
436  called */
437  spi3GetConfigValue_Ignore();
438  spiSetFunctional_Ignore();
439  SPI_SetFunctional(spiREG3, 0, false);
440 }
441 
442 /** test usage of right API functions for SPI4 */
444  /* this test will fail if another function than the intended function is
445  called */
446  spi4GetConfigValue_Ignore();
447  spiSetFunctional_Ignore();
448  SPI_SetFunctional(spiREG4, 0, false);
449 }
450 
451 /** test usage of right API functions for SPI5 */
453  /* this test will fail if another function than the intended function is
454  called */
455  spi5GetConfigValue_Ignore();
456  spiSetFunctional_Ignore();
457  SPI_SetFunctional(spiREG5, 0, false);
458 }
459 
460 /** test invalid input to SPI_CheckInterfaceAvailable */
463 }
464 
465 /** test all return codes from HAL with SPI_CheckInterfaceAvailable */
467  SpiTxStatus_ExpectAndReturn(spiREG1, SPI_READY);
468  TEST_ASSERT_EQUAL(STD_OK, SPI_CheckInterfaceAvailable(spiREG1));
469 
470  SpiTxStatus_ExpectAndReturn(spiREG1, SPI_PENDING);
471  TEST_ASSERT_EQUAL(STD_NOT_OK, SPI_CheckInterfaceAvailable(spiREG1));
472 
473  SpiTxStatus_ExpectAndReturn(spiREG1, SPI_COMPLETED);
474  TEST_ASSERT_EQUAL(STD_OK, SPI_CheckInterfaceAvailable(spiREG1));
475 }
476 
477 /**
478  * @brief Testing extern function #SPI_GetSpiIndex
479  * @details The following cases need to be tested:
480  * - Argument validation:
481  * - AT1/1: NULL_PTR for pNode -> assert
482  * - Routine validation:
483  * - RT1/2: check that the correct SPI index is returned
484  * - RT2/2: provide an invalid SPI register -> assert
485  */
487  /* ======= Assertion tests ============================================= */
488  /* ======= AT1/1 ======= */
490 
491  /* ======= Routine tests =============================================== */
492  /* ======= RT1/2: Test implementation */
493 
494  /* ======= RT1/2: call function under test */
495  const uint8_t spiIndex1 = SPI_GetSpiIndex(spiREG1);
496  const uint8_t spiIndex2 = SPI_GetSpiIndex(spiREG2);
497  const uint8_t spiIndex3 = SPI_GetSpiIndex(spiREG3);
498  const uint8_t spiIndex4 = SPI_GetSpiIndex(spiREG4);
499  const uint8_t spiIndex5 = SPI_GetSpiIndex(spiREG5);
500 
501  /* ======= RT1/2: test output verification */
502  TEST_ASSERT_EQUAL(0u, spiIndex1);
503  TEST_ASSERT_EQUAL(1u, spiIndex2);
504  TEST_ASSERT_EQUAL(2u, spiIndex3);
505  TEST_ASSERT_EQUAL(3u, spiIndex4);
506  TEST_ASSERT_EQUAL(4u, spiIndex5);
507 
508  /* ======= RT2/2: Test implementation */
509  spiBASE_t *invalidSpiRegister = (spiBASE_t *)0xFFF7FBE8u;
510 
511  /* ======= RT2/2: call function under test */
512  TEST_ASSERT_FAIL_ASSERT(SPI_GetSpiIndex(invalidSpiRegister));
513 
514  /* ======= RT2/2: test output verification */
515  /* nothing to be verified */
516 }
#define BS_NR_OF_STRINGS
Number of parallel strings in the battery pack.
#define DMA_NUMBER_SPI_INTERFACES
Definition: dma_cfg.h:115
@ 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
#define MCU_LARGEST_PIN_NUMBER
largest pin number that exists in TMS570LC4357
Definition: mcu.h:69
uint8_t TEST_SPI_GetHardwareChipSelectPin(uint8_t csPin)
Definition: spi.c:585
void SPI_SetFunctional(spiBASE_t *pNode, enum spiPinSelect bit, bool hardwareControlled)
Sets the functional of a SPI pin.
Definition: spi.c:428
STD_RETURN_TYPE_e SPI_CheckInterfaceAvailable(spiBASE_t *pNode)
Returns STD_OK if the SPI interface can be used again.
Definition: spi.c:545
void TEST_SPI_InitializeChipSelects(void)
Definition: spi.c:579
uint8_t SPI_GetSpiIndex(spiBASE_t *pNode)
Returns index of SPI node.
Definition: spi.c:555
uint8_t TEST_SPI_GetChipSelectPin(SPI_CHIP_SELECT_TYPE_e csType, uint32_t csPin)
Definition: spi.c:582
Headers for the driver for the SPI module.
Headers for the configuration for the SPI module.
#define SPI_HARDWARE_CHIP_SELECT_3_ACTIVE
#define SPI_HARDWARE_CHIP_SELECT_0_ACTIVE
#define SPI_HARDWARE_CHIP_SELECT_1_ACTIVE
#define SPI_HARDWARE_CHIP_SELECT_4_ACTIVE
#define SPI_HARDWARE_CHIP_SELECT_5_ACTIVE
#define SPI_HARDWARE_CHIP_SELECT_2_ACTIVE
#define SPI_HARDWARE_CHIP_SELECT_DISABLE_ALL
SPI_BUSY_STATE_e
Definition: spi_cfg.h:109
@ SPI_IDLE
Definition: spi_cfg.h:110
#define SPI_SPS_CS_GIOPORT
Definition: spi_cfg.h:150
SPI_CHIP_SELECT_TYPE_e
Definition: spi_cfg.h:116
@ SPI_CHIP_SELECT_SOFTWARE
Definition: spi_cfg.h:118
@ SPI_CHIP_SELECT_MAX
Definition: spi_cfg.h:119
@ SPI_CHIP_SELECT_HARDWARE
Definition: spi_cfg.h:117
#define SPI_SPS_CS_PIN
Definition: spi_cfg.h:152
spiDAT1_t * pConfig
Definition: spi_cfg.h:126
Helper for unit tests.
#define TEST_ASSERT_FAIL_ASSERT(_code_under_test)
assert whether assert macro has failed
spiBASE_t spiMockHandle
Definition: test_spi.c:258
void testSPI_CheckInterfaceAvailableInvalidInput(void)
Definition: test_spi.c:461
static spiDAT1_t spi_kNxp775DataConfigRx[BS_NR_OF_STRINGS]
Definition: test_spi.c:126
SPI_INTERFACE_CONFIG_s spi_mxmInterface
Definition: test_spi.c:189
static spiDAT1_t spi_kSbcDataConfig
Definition: test_spi.c:165
void testSPI_SetFunctionalRightApiSpi5(void)
Definition: test_spi.c:452
SPI_INTERFACE_CONFIG_s spi_sbcMcuInterface
Definition: test_spi.c:238
SPI_INTERFACE_CONFIG_s spi_nxp775InterfaceTx[BS_NR_OF_STRINGS]
Definition: test_spi.c:198
spiBASE_t * dma_spiInterfaces[DMA_NUMBER_SPI_INTERFACES]
Definition: test_spi.c:80
static spiDAT1_t spi_kNxp775DataConfigTx[BS_NR_OF_STRINGS]
Definition: test_spi.c:117
void testSPI_CheckInterfaceAvailable(void)
Definition: test_spi.c:466
SPI_BUSY_STATE_e spi_busyFlags[]
Definition: test_spi.c:247
void testSPI_SetFunctionalRightApiSpi2(void)
Definition: test_spi.c:425
void testSPI_GetHardwareChipSelectPin(void)
Testing static function SPI_GetHardwareChipSelectPin.
Definition: test_spi.c:352
void testSPI_SetFunctionalTestIntendedFunctionClear(void)
Definition: test_spi.c:402
void testSPI_SetFunctionalTestIntendedFunctionSet(void)
Definition: test_spi.c:388
void testSPI_SetFunctionalRightApiSpi4(void)
Definition: test_spi.c:443
void testSPI_SetFunctionalNullPointer(void)
Definition: test_spi.c:383
void setUp(void)
Definition: test_spi.c:263
void tearDown(void)
Definition: test_spi.c:268
SPI_INTERFACE_CONFIG_s spi_framInterface
Definition: test_spi.c:220
static spiDAT1_t spi_kFramDataConfig
Definition: test_spi.c:135
static spiDAT1_t spi_kLtcDataConfig[BS_NR_OF_STRINGS]
Definition: test_spi.c:98
void testSPI_SetFunctionalRightApiSpi3(void)
Definition: test_spi.c:434
spi_config_reg_t spiMockConfigRegister
Definition: test_spi.c:260
void testSPI_GetSpiIndex(void)
Testing extern function SPI_GetSpiIndex.
Definition: test_spi.c:486
long FSYS_RaisePrivilege(void)
Raise privilege.
Definition: test_spi.c:75
static spiDAT1_t spi_kMxmDataConfig
Definition: test_spi.c:108
SPI_INTERFACE_CONFIG_s spi_nxp775InterfaceRx[BS_NR_OF_STRINGS]
Definition: test_spi.c:209
static spiDAT1_t spi_kSpsDataConfigHighSpeed
Definition: test_spi.c:155
DMA_CHANNEL_CONFIG_s dma_spiDmaChannels[DMA_NUMBER_SPI_INTERFACES]
Definition: test_spi.c:89
void testSPI_GetChipSelectPin(void)
Testing static function SPI_GetChipSelectPin.
Definition: test_spi.c:314
void testSPI_SetFunctionalRightApiSpi1(void)
Definition: test_spi.c:416
void testSPI_InitializeChipSelects(void)
Testing static function SPI_InitializeChipSelects.
Definition: test_spi.c:281
SPI_INTERFACE_CONFIG_s spi_ltcInterface[BS_NR_OF_STRINGS]
Definition: test_spi.c:178
const uint8_t spi_nrBusyFlags
Definition: test_spi.c:255
SPI_INTERFACE_CONFIG_s spi_spsInterface
Definition: test_spi.c:229
static spiDAT1_t spi_kSpsDataConfigLowSpeed
Definition: test_spi.c:145