foxBMS - Unit Tests  1.2.0
The foxBMS Unit Tests API Documentation
test_ltc_afe.c File Reference

Test of the afe.c module. More...

#include "general.h"
#include "unity.h"
#include "MockHL_sys_dma.h"
#include "Mockltc.h"
#include "ltc_cfg.h"
#include "afe.h"
Include dependency graph for test_ltc_afe.c:

Go to the source code of this file.

Macros

#define DMA_REQ_LINE_SPI1_TX   (DMA_REQ1)
 
#define DMA_REQ_LINE_SPI1_RX   (DMA_REQ0)
 
#define DMA_REQ_LINE_SPI2_TX   (DMA_REQ3)
 
#define DMA_REQ_LINE_SPI2_RX   (DMA_REQ2)
 
#define DMA_REQ_LINE_SPI3_TX   (DMA_REQ15)
 
#define DMA_REQ_LINE_SPI3_RX   (DMA_REQ14)
 
#define BIG_ENDIAN   (3U)
 
#define ELEMENT_COUNT   (1U)
 
#define DMAREQEN_BIT   (0x10000U)
 
#define SPIEN_BIT   (0x1000000U)
 
#define DMA_REQ_LINE_TX   (DMA_REQ_LINE_SPI1_TX)
 
#define DMA_REQ_LINE_RX   (DMA_REQ_LINE_SPI1_RX)
 

Functions

void setUp (void)
 
void tearDown (void)
 
void testAFE_TriggerIcAlwaysReturnsSTD_OK (void)
 

Variables

uint8_t ltc_RXPECbuffer [LTC_N_BYTES_FOR_DATA_TRANSMISSION] = {0}
 
uint8_t ltc_TXPECbuffer [LTC_N_BYTES_FOR_DATA_TRANSMISSION] = {0}
 
g_dmaCTRL afe_ltcDmaControlPacketTx
 
g_dmaCTRL afe_ltcDmaControlPacketRx
 
LTC_STATE_s ltc_stateBase = {0}
 

Detailed Description

Test of the afe.c module.

SPDX-License-Identifier: BSD-3-Clause

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

We kindly request you to use one or more of the following phrases to refer to foxBMS in your hardware, software, documentation or advertising materials:

  • ″This product uses parts of foxBMS®″
  • ″This product includes parts of foxBMS®″
  • ″This product is derived from foxBMS®″
Author
foxBMS Team
Date
2020-05-25 (date of creation)
Updated
2020-06-17 (date of last update)
Prefix
TEST

Definition in file test_ltc_afe.c.

Macro Definition Documentation

◆ BIG_ENDIAN

#define BIG_ENDIAN   (3U)

Definition at line 80 of file test_ltc_afe.c.

◆ DMA_REQ_LINE_RX

#define DMA_REQ_LINE_RX   (DMA_REQ_LINE_SPI1_RX)

Definition at line 86 of file test_ltc_afe.c.

◆ DMA_REQ_LINE_SPI1_RX

#define DMA_REQ_LINE_SPI1_RX   (DMA_REQ0)

Definition at line 74 of file test_ltc_afe.c.

◆ DMA_REQ_LINE_SPI1_TX

#define DMA_REQ_LINE_SPI1_TX   (DMA_REQ1)

Definition at line 73 of file test_ltc_afe.c.

◆ DMA_REQ_LINE_SPI2_RX

#define DMA_REQ_LINE_SPI2_RX   (DMA_REQ2)

Definition at line 76 of file test_ltc_afe.c.

◆ DMA_REQ_LINE_SPI2_TX

#define DMA_REQ_LINE_SPI2_TX   (DMA_REQ3)

Definition at line 75 of file test_ltc_afe.c.

◆ DMA_REQ_LINE_SPI3_RX

#define DMA_REQ_LINE_SPI3_RX   (DMA_REQ14)

Definition at line 78 of file test_ltc_afe.c.

◆ DMA_REQ_LINE_SPI3_TX

#define DMA_REQ_LINE_SPI3_TX   (DMA_REQ15)

Definition at line 77 of file test_ltc_afe.c.

◆ DMA_REQ_LINE_TX

#define DMA_REQ_LINE_TX   (DMA_REQ_LINE_SPI1_TX)

Definition at line 85 of file test_ltc_afe.c.

◆ DMAREQEN_BIT

#define DMAREQEN_BIT   (0x10000U)

Definition at line 82 of file test_ltc_afe.c.

◆ ELEMENT_COUNT

#define ELEMENT_COUNT   (1U)

Definition at line 81 of file test_ltc_afe.c.

◆ SPIEN_BIT

#define SPIEN_BIT   (0x1000000U)

Definition at line 83 of file test_ltc_afe.c.

Function Documentation

◆ setUp()

void setUp ( void  )

Definition at line 130 of file test_ltc_afe.c.

◆ tearDown()

void tearDown ( void  )

Definition at line 133 of file test_ltc_afe.c.

◆ testAFE_TriggerIcAlwaysReturnsSTD_OK()

void testAFE_TriggerIcAlwaysReturnsSTD_OK ( void  )

Definition at line 137 of file test_ltc_afe.c.

Here is the call graph for this function:

Variable Documentation

◆ afe_ltcDmaControlPacketRx

g_dmaCTRL afe_ltcDmaControlPacketRx
Initial value:
= {
.SADD = 0,
.DADD = 0,
.CHCTRL = 0U,
.ELCNT = ELEMENT_COUNT,
.ELDOFFSET = 0U,
.ELSOFFSET = 0U,
.FRDOFFSET = 0U,
.FRSOFFSET = 0U,
.PORTASGN = PORTB_READ_PORTA_WRITE,
.RDSIZE = ACCESS_8_BIT,
.WRSIZE = ACCESS_8_BIT,
.TTYPE = FRAME_TRANSFER,
.ADDMODERD = ADDR_FIXED,
.ADDMODEWR = ADDR_INC1,
.AUTOINIT = AUTOINIT_OFF,
}
#define LTC_N_BYTES_FOR_DATA_TRANSMISSION
Definition: ltc_cfg.h:77
#define ELEMENT_COUNT
Definition: test_ltc_afe.c:81

Definition at line 108 of file test_ltc_afe.c.

◆ afe_ltcDmaControlPacketTx

g_dmaCTRL afe_ltcDmaControlPacketTx
Initial value:
= {
.SADD = 0,
.DADD = 0,
.CHCTRL = 0U,
.ELCNT = ELEMENT_COUNT,
.ELDOFFSET = 0U,
.ELSOFFSET = 0U,
.FRDOFFSET = 0U,
.FRSOFFSET = 0U,
.PORTASGN = PORTA_READ_PORTB_WRITE,
.RDSIZE = ACCESS_8_BIT,
.WRSIZE = ACCESS_8_BIT,
.TTYPE = FRAME_TRANSFER,
.ADDMODERD = ADDR_INC1,
.ADDMODEWR = ADDR_FIXED,
.AUTOINIT = AUTOINIT_OFF,
}

Definition at line 89 of file test_ltc_afe.c.

◆ ltc_RXPECbuffer

uint8_t ltc_RXPECbuffer[LTC_N_BYTES_FOR_DATA_TRANSMISSION] = {0}

Definition at line 70 of file test_ltc_afe.c.

◆ ltc_stateBase

LTC_STATE_s ltc_stateBase = {0}

This variable contains the internal state of the LTC state machine.

Definition at line 127 of file test_ltc_afe.c.

◆ ltc_TXPECbuffer

uint8_t ltc_TXPECbuffer[LTC_N_BYTES_FOR_DATA_TRANSMISSION] = {0}

Definition at line 71 of file test_ltc_afe.c.