|
foxBMS-UnitTests
1.0.0
The foxBMS Unit Tests API Documentation
|
Go to the documentation of this file.
104 #define SPS_RESET_WAIT_TIME_TICKS (5u)
196 const uint16_t address,
198 uint16_t *pSpiTxBuffer);
233 const uint16_t address,
236 uint16_t *pSpiTxBuffer);
257 const uint16_t address,
259 uint16_t *pSpiTxBuffer) {
288 const uint16_t address,
291 uint16_t *pSpiTxBuffer) {
300 uint8_t preceedingWriteData = (pSpiTxBuffer[(
SPS_SPI_BUFFERSIZE - 1u - device)]) & 0xFFu;
400 spsDevicePositionInDaisyChain,
408 spsDevicePositionInDaisyChain,
498 if (
STD_OK == transmitRetval) {
512 if (
STD_OK == transmitRetval) {
523 if (
STD_OK == transmitRetval) {
534 if (
STD_OK == transmitRetval) {
546 if (
STD_OK == transmitRetval) {
558 if (
STD_OK == transmitRetval) {
570 if (
STD_OK == transmitRetval) {
607 if (channelCurrent_mA >
sps_channelStatus[channelIndex].thresholdFeedbackOn_mA) {
611 return channelFeedback;
620 #ifdef UNITY_UNIT_TEST
#define SPS_MODE_BIT_START
Implementation of the tasks used by the system, headers.
#define SPS_OD_IOUT1_DIAG_REGISTER_ADDRESS
void SPI_SpsInterfaceSwitchToHighSpeed(SPI_INTERFACE_CONFIG_s *pSpiSpsInterface)
Switch the SPS spi handle to high speed.
void TEST_SPS_SetSpsState(const SPS_STATE_e newState)
@ SPS_TRIGGER_CURRENT_MEASUREMENT
enum SPS_CHANNEL_FUNCTION SPS_CHANNEL_FUNCTION_e
@ SPS_READ_MEASURED_CURRENT1
static SPS_STATE_e sps_state
@ SPS_ACTION_TRIGGER_CURRENT_MEASUREMENT
enum SPS_READ_TYPE SPS_READ_TYPE_e
enum SPS_ACTION SPS_ACTION_e
@ SPS_READ_MEASURED_CURRENT2
enum STD_RETURN_TYPE STD_RETURN_TYPE_e
#define SPS_SPI_CS_GIOPORT_DIR
Headers for the driver for the SPI module.
#define SPS_OUTPUT_CONTROL_REGISTER_ADDRESS
#define SPS_OD_IOUT4_DIAG_REGISTER_ADDRESS
static STD_RETURN_TYPE_e SPS_Transmit(void)
Transmit all assembled messages for one timeframe.
@ SPS_READ_MEASURED_CURRENT4
void SPI_SpsInterfaceSwitchToLowSpeed(SPI_INTERFACE_CONFIG_s *pSpiSpsInterface)
Switch the SPS spi handle to low speed.
@ SPS_READ_DIAGNOSTIC_REGISTER
@ SPS_CONFIGURE_CONTROL_REGISTER
@ SPS_andWithCurrentValue
static void SPS_SingleDeviceRegisterWrite(uint8_t device, const uint16_t address, uint8_t writeData, SPS_WRITE_TYPE_e writeType, uint16_t *pSpiTxBuffer)
Sets the SPI Tx buffer for a register write access for a specific single SPS ICs in the daisy-chain.
uint8_t SPS_CHANNEL_INDEX
#define SPS_OD_IOUT3_DIAG_REGISTER_ADDRESS
@ SPS_replaceCurrentValue
#define SPS_SPI_BUFFERSIZE
static void SPS_SetCommandTxBuffer(const SPS_ACTION_e action)
Assemble a general command to the SPS ICs.
SPS_CHANNEL_FUNCTION_e channelRequested
static uint16_t sps_spiTxRegisterBuffer[SPS_SPI_BUFFERSIZE]
#define FAS_ASSERT(x)
Assertion macro that asserts that x is true.
static void SPS_SetContactorsTxBuffer(void)
Assemble an update to the channel state of the SPS ICs.
#define SPS_GLOBAL_CONTROL_REGISTER_ADDRESS
#define SPS_DRIVE_STRENGTH_BIT_START
static void SPS_InitializeBuffers(void)
void OS_ExitTaskCritical(void)
Exit Critical interface function for use in FreeRTOS-Tasks and FreeRTOS-ISR.
static void SPS_RequestChannelState(SPS_CHANNEL_INDEX channelIndex, SPS_CHANNEL_FUNCTION_e channelFunction)
Request the functional state of a channel.
STD_RETURN_TYPE_e SPI_TransmitReceiveData(SPI_INTERFACE_CONFIG_s *pSpiInterface, uint16 *pTxBuff, uint16 *pRxBuff, uint32 frameLength)
Transmits and receives data on SPI without DMA.
void SPS_RequestContactorState(SPS_CHANNEL_INDEX channelIndex, SPS_CHANNEL_FUNCTION_e channelFunction)
Request state of a contactor.
@ SPS_READ_CONTROL_REGISTER
void MCU_delay_us(uint32_t delay_us)
Wait blocking a certain time in microseconds.
@ SPS_ACTION_READ_CURRENT_MEASUREMENT2
SPS_CHANNEL_STATE_s sps_channelStatus[SPS_NR_OF_AVAILABLE_SPS_CHANNELS]
#define SPS_RESET_GIOPORT_DIR
uint8_t TEST_SPS_GetSpsTimer(void)
static void SPS_GlobalRegisterRead(const uint16_t address, const SPS_READ_TYPE_e controlOrDiagnostic, uint16_t *pSpiTxBuffer)
Sets the SPI Tx buffer for a register read access for all SPS ICs of the daisy-chain.
#define SPS_NR_CONTACTOR_PER_IC
Headers for the driver for the MCU module.
@ SPS_READ_MEASURED_CURRENT3
@ SPS_ACTION_READ_CURRENT_MEASUREMENT4
@ SPS_ACTION_READ_CURRENT_MEASUREMENT1
@ SPS_ACTION_CONFIGURE_CONTROL_REGISTER
#define SPS_RW_BIT_POSITION
@ SPS_ACTION_READ_CURRENT_MEASUREMENT3
void OS_EnterTaskCritical(void)
Enter Critical interface function for use in FreeRTOS-Tasks and FreeRTOS-ISR.
void TEST_SPS_RequestChannelState(SPS_CHANNEL_INDEX channelIndex, SPS_CHANNEL_FUNCTION_e channelFunction)
void SPS_Initialize(void)
Initialize IOs for the SPS driver.
#define SPS_ADDRESS_BIT_START
void SPS_RequestGeneralIOState(SPS_CHANNEL_INDEX channelIndex, SPS_CHANNEL_FUNCTION_e channelFunction)
Request state of a general IO.
void SPS_Ctrl(void)
Control function for the CONT driver state machine.
static void SPS_GlobalReadCurrent(const uint8_t outputAllDevices)
Read the current measurements for a specific output for all SPS ICs of the daisy-chain.
static uint16_t sps_spiRxReadAnswerDuringChannelControl[SPS_SPI_BUFFERSIZE]
void IO_PinReset(uint32_t *pRegisterAddress, uint32_t pin)
Set pin by writing in pin output register.
#define SPS_C_CONTROL_REGISTER_ADDRESS
SPS_STATE_e TEST_SPS_GetSpsState(void)
#define SPS_BITMASK_DIAGNOSTIC_ONDEMAND_OUTPUT_CURRENT
#define SPS_DIAG_CTRL_BIT_POSITION
Headers for the driver for the smart power switches.
#define SPS_OD_IOUT2_DIAG_REGISTER_ADDRESS
enum SPS_WRITE_TYPE SPS_WRITE_TYPE_e
enum SPS_CHANNEL_AFFILIATION SPS_CHANNEL_AFFILIATION_e
affiliation type of a sps channel
#define NULL_PTR
Null pointer.
#define SPS_RESET_GIOPORT
Header for the driver for the IO module.
static void SPS_InitializeIo(void)
static void SPS_GlobalRegisterWrite(const uint16_t address, uint8_t writeData, uint16_t *pSpiTxBuffer)
Sets the SPI Tx buffer for a register write access for all SPS ICs of the daisy-chain.
SPS_CHANNEL_AFFILIATION_e SPS_GetChannelAffiliation(SPS_CHANNEL_INDEX channelIndex)
Returns the channel affiliation.
#define SPS_NR_OF_AVAILABLE_SPS_CHANNELS
static uint16_t sps_spiTxWriteToChannelChannelControlRegister[SPS_SPI_BUFFERSIZE]
SPI_INTERFACE_CONFIG_s spi_spsInterface
void IO_PinSet(uint32_t *pRegisterAddress, uint32_t pin)
Set pin by writing in pin output register.
#define FAS_TRAP
Define that evaluates to essential boolean false thus tripping an assert.
enum SPS_STATE SPS_STATE_e
void TEST_SPS_SetSpsTimer(const uint8_t newTimer)
#define SPS_EN_IRQ_PIN_DIAG_REGISTER_ADDRESS
static uint16_t sps_spiRxRegisterBuffer[SPS_SPI_BUFFERSIZE]
SPS_CHANNEL_FUNCTION_e channel
@ SPS_ACTION_READ_EN_IRQ_PIN
#define SPS_I_MEASUREMENT_LSB_mA
CONT_ELECTRICAL_STATE_TYPE_e SPS_GetChannelFeedback(SPS_CHANNEL_INDEX channelIndex)
Get feedback value.
#define SPS_RESET_WAIT_TIME_TICKS
const SPS_CHANNEL_AFFILIATION_e affiliation