57 #include "MockHL_spi.h"
58 #include "MockHL_sys_dma.h"
59 #include "Mockdma_cfg.h"
63 #include "Mockspi_cfg.h"
72 TEST_SOURCE_FILE(
"spi.c")
74 TEST_INCLUDE_PATH("../../src/app/driver/config")
75 TEST_INCLUDE_PATH("../../src/app/driver/dma")
76 TEST_INCLUDE_PATH("../../src/app/driver/io")
77 TEST_INCLUDE_PATH("../../src/app/driver/spi")
188 .pGioPort = &(spiREG1->PC3),
202 .pGioPort = &(spiREG1->PC3),
212 .pGioPort = &(spiREG4->PC3),
222 .pGioPort = &(spiREG1->PC3),
233 .pGioPort = &(spiREG4->PC3),
243 .pGioPort = &(spiREG3->PC3),
261 .pGioPort = &(spiREG2->PC3),
307 const uint8_t currentString = 0u;
339 const uint32_t validCsPin = 0u;
350 const uint8_t softwareChipSelectPin =
353 TEST_ASSERT_EQUAL(validSoftwareChipSelectPin, softwareChipSelectPin);
356 const uint32_t validHardwareChipSelectPin = 2u;
358 const uint8_t hardwareChipSelectPin =
376 const uint32_t invalidHwCsPin = 7u;
380 const uint8_t csPin0 = 0u;
381 const uint8_t csPin1 = 1u;
382 const uint8_t csPin2 = 2u;
383 const uint8_t csPin3 = 3u;
384 const uint8_t csPin4 = 4u;
385 const uint8_t csPin5 = 5u;
412 spi1GetConfigValue_Expect(
NULL_PTR, CurrentValue);
413 spi1GetConfigValue_IgnoreArg_config_reg();
417 spiSetFunctional_Expect(spiREG1, ((uint32_t)1u << 10u));
426 spi1GetConfigValue_Expect(
NULL_PTR, CurrentValue);
427 spi1GetConfigValue_IgnoreArg_config_reg();
431 spiSetFunctional_Expect(spiREG1, ~((uint32_t)1u << 10u));
440 spi1GetConfigValue_Ignore();
441 spiSetFunctional_Ignore();
449 spi2GetConfigValue_Ignore();
450 spiSetFunctional_Ignore();
458 spi3GetConfigValue_Ignore();
459 spiSetFunctional_Ignore();
467 spi4GetConfigValue_Ignore();
468 spiSetFunctional_Ignore();
476 spi5GetConfigValue_Ignore();
477 spiSetFunctional_Ignore();
488 SpiTxStatus_ExpectAndReturn(spiREG1, SPI_READY);
491 SpiTxStatus_ExpectAndReturn(spiREG1, SPI_PENDING);
494 SpiTxStatus_ExpectAndReturn(spiREG1, SPI_COMPLETED);
523 TEST_ASSERT_EQUAL(0u, spiIndex1);
524 TEST_ASSERT_EQUAL(1u, spiIndex2);
525 TEST_ASSERT_EQUAL(2u, spiIndex3);
526 TEST_ASSERT_EQUAL(3u, spiIndex4);
527 TEST_ASSERT_EQUAL(4u, spiIndex5);
530 spiBASE_t *invalidSpiRegister = (spiBASE_t *)0xFFF7FBE8u;
#define BS_NR_OF_STRINGS
Number of parallel strings in the battery pack.
#define DMA_NUMBER_SPI_INTERFACES
#define NULL_PTR
Null pointer.
#define MCU_LARGEST_PIN_NUMBER
largest pin number that exists in TMS570LC4357
uint8_t TEST_SPI_GetHardwareChipSelectPin(uint8_t csPin)
void SPI_SetFunctional(spiBASE_t *pNode, enum spiPinSelect bit, bool hardwareControlled)
Sets the functional of a SPI pin.
STD_RETURN_TYPE_e SPI_CheckInterfaceAvailable(spiBASE_t *pNode)
Returns STD_OK if the SPI interface can be used again.
void TEST_SPI_InitializeChipSelects(void)
uint8_t SPI_GetSpiIndex(spiBASE_t *pNode)
Returns index of SPI node.
uint8_t TEST_SPI_GetChipSelectPin(SPI_CHIP_SELECT_TYPE_e csType, uint32_t csPin)
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
#define SPI_SPS_CS_GIOPORT
@ SPI_CHIP_SELECT_SOFTWARE
@ SPI_CHIP_SELECT_HARDWARE
#define TEST_ASSERT_FAIL_ASSERT(_code_under_test)
assert whether assert macro has failed
void testSPI_CheckInterfaceAvailableInvalidInput(void)
static spiDAT1_t spi_kNxp775DataConfigRx[BS_NR_OF_STRINGS]
static spiDAT1_t spi_kAdiDataConfig[BS_NR_OF_STRINGS]
SPI_INTERFACE_CONFIG_s spi_mxmInterface
static spiDAT1_t spi_kSbcDataConfig
SPI_INTERFACE_CONFIG_s spi_adiInterface[BS_NR_OF_STRINGS]
void testSPI_SetFunctionalRightApiSpi5(void)
SPI_INTERFACE_CONFIG_s spi_sbcMcuInterface
SPI_INTERFACE_CONFIG_s spi_nxp775InterfaceTx[BS_NR_OF_STRINGS]
spiBASE_t * dma_spiInterfaces[DMA_NUMBER_SPI_INTERFACES]
static spiDAT1_t spi_kNxp775DataConfigTx[BS_NR_OF_STRINGS]
void testSPI_CheckInterfaceAvailable(void)
SPI_BUSY_STATE_e spi_busyFlags[]
void testSPI_SetFunctionalRightApiSpi2(void)
void testSPI_GetHardwareChipSelectPin(void)
Testing static function SPI_GetHardwareChipSelectPin.
void testSPI_SetFunctionalTestIntendedFunctionClear(void)
void testSPI_SetFunctionalTestIntendedFunctionSet(void)
void testSPI_SetFunctionalRightApiSpi4(void)
void testSPI_SetFunctionalNullPointer(void)
SPI_INTERFACE_CONFIG_s spi_framInterface
static spiDAT1_t spi_kFramDataConfig
static spiDAT1_t spi_kLtcDataConfig[BS_NR_OF_STRINGS]
void testSPI_SetFunctionalRightApiSpi3(void)
spi_config_reg_t spiMockConfigRegister
void testSPI_GetSpiIndex(void)
Testing extern function SPI_GetSpiIndex.
long FSYS_RaisePrivilege(void)
Raise privilege.
static spiDAT1_t spi_kMxmDataConfig
SPI_INTERFACE_CONFIG_s spi_nxp775InterfaceRx[BS_NR_OF_STRINGS]
DMA_CHANNEL_CONFIG_s dma_spiDmaChannels[DMA_NUMBER_SPI_INTERFACES]
void testSPI_GetChipSelectPin(void)
Testing static function SPI_GetChipSelectPin.
void testSPI_SetFunctionalRightApiSpi1(void)
void testSPI_InitializeChipSelects(void)
Testing static function SPI_InitializeChipSelects.
SPI_INTERFACE_CONFIG_s spi_ltcInterface[BS_NR_OF_STRINGS]
const uint8_t spi_nrBusyFlags
SPI_INTERFACE_CONFIG_s spi_spsInterface
static spiDAT1_t spi_kSpsDataConfigLowSpeed