foxBMS - Unit Tests  1.3.0
The foxBMS Unit Tests API Documentation
test_ltc_afe_dma.c File Reference

Test of the ltc_afe_dma.c module in ltc. More...

#include "unity.h"
#include "MockHL_sys_dma.h"
#include "Mockfassert.h"
#include "Mockio.h"
#include "Mockltc.h"
#include "Mockspi.h"
#include "ltc_cfg.h"
#include "spi_cfg.h"
#include "ltc_afe_dma.h"
Include dependency graph for test_ltc_afe_dma.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 testDummy (void)
 

Variables

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

Detailed Description

Test of the ltc_afe_dma.c module in ltc.

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-06-10 (date of creation)
Updated
2022-05-30 (date of last update)
Version
v1.3.0
Prefix
TEST

Definition in file test_ltc_afe_dma.c.

Macro Definition Documentation

◆ BIG_ENDIAN

#define BIG_ENDIAN   (3U)

Definition at line 79 of file test_ltc_afe_dma.c.

◆ DMA_REQ_LINE_RX

#define DMA_REQ_LINE_RX   (DMA_REQ_LINE_SPI1_RX)

Definition at line 85 of file test_ltc_afe_dma.c.

◆ DMA_REQ_LINE_SPI1_RX

#define DMA_REQ_LINE_SPI1_RX   (DMA_REQ0)

Definition at line 73 of file test_ltc_afe_dma.c.

◆ DMA_REQ_LINE_SPI1_TX

#define DMA_REQ_LINE_SPI1_TX   (DMA_REQ1)

Definition at line 72 of file test_ltc_afe_dma.c.

◆ DMA_REQ_LINE_SPI2_RX

#define DMA_REQ_LINE_SPI2_RX   (DMA_REQ2)

Definition at line 75 of file test_ltc_afe_dma.c.

◆ DMA_REQ_LINE_SPI2_TX

#define DMA_REQ_LINE_SPI2_TX   (DMA_REQ3)

Definition at line 74 of file test_ltc_afe_dma.c.

◆ DMA_REQ_LINE_SPI3_RX

#define DMA_REQ_LINE_SPI3_RX   (DMA_REQ14)

Definition at line 77 of file test_ltc_afe_dma.c.

◆ DMA_REQ_LINE_SPI3_TX

#define DMA_REQ_LINE_SPI3_TX   (DMA_REQ15)

Definition at line 76 of file test_ltc_afe_dma.c.

◆ DMA_REQ_LINE_TX

#define DMA_REQ_LINE_TX   (DMA_REQ_LINE_SPI1_TX)

Definition at line 84 of file test_ltc_afe_dma.c.

◆ DMAREQEN_BIT

#define DMAREQEN_BIT   (0x10000U)

Definition at line 81 of file test_ltc_afe_dma.c.

◆ ELEMENT_COUNT

#define ELEMENT_COUNT   (1U)

Definition at line 80 of file test_ltc_afe_dma.c.

◆ SPIEN_BIT

#define SPIEN_BIT   (0x1000000U)

Definition at line 82 of file test_ltc_afe_dma.c.

Function Documentation

◆ setUp()

void setUp ( void  )

Definition at line 158 of file test_ltc_afe_dma.c.

◆ tearDown()

void tearDown ( void  )

Definition at line 161 of file test_ltc_afe_dma.c.

◆ testDummy()

void testDummy ( void  )

Definition at line 166 of file test_ltc_afe_dma.c.

Variable Documentation

◆ afe_ltcDmaControlPacketRx

g_dmaCTRL afe_ltcDmaControlPacketRx
Initial value:
= {
.SADD = 0u,
.DADD = 0u,
.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:78
#define ELEMENT_COUNT

Definition at line 138 of file test_ltc_afe_dma.c.

◆ afe_ltcDmaControlPacketTx

g_dmaCTRL afe_ltcDmaControlPacketTx
Initial value:
= {
.SADD = 0u,
.DADD = 0u,
.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 119 of file test_ltc_afe_dma.c.

◆ ltc_RXPECbuffer

uint8_t ltc_RXPECbuffer[LTC_N_BYTES_FOR_DATA_TRANSMISSION] = {0}

Definition at line 69 of file test_ltc_afe_dma.c.

◆ ltc_stateBase

LTC_STATE_s ltc_stateBase
Initial value:
= {
.timer = 0,
.statereq = LTC_STATE_NO_REQUEST,
.substate = 0,
.lastsubstate = 0,
.adcModereq = LTC_ADCMODE_FAST_DCP0,
.adcMeasChreq = LTC_ADCMEAS_UNDEFINED,
.adcMeasCh = LTC_ADCMEAS_UNDEFINED,
.numberOfMeasuredMux = 32,
.triggerentry = 0,
.ErrRetryCounter = 0,
.ErrRequestCounter = 0,
.VoltageSampleTime = 0,
.muxSampleTime = 0,
.commandDataTransferTime = 3,
.commandTransferTime = 3,
.gpioClocksTransferTime = 3,
.muxmeas_seqptr = NULL_PTR,
.muxmeas_seqendptr = NULL_PTR,
.muxmeas_nr_end = 0,
.first_measurement_made = false,
.ltc_muxcycle_finished = STD_NOT_OK,
.check_spi_flag = STD_NOT_OK,
.balance_control_done = STD_NOT_OK,
.transmit_ongoing = false,
.dummyByte_ongoing = STD_NOT_OK,
}
@ STD_NOT_OK
Definition: fstd_types.h:83
#define NULL_PTR
Null pointer.
Definition: fstd_types.h:76
@ LTC_STATE_NO_REQUEST
Definition: ltc_defs.h:391
@ LTC_STATEMACH_UNINITIALIZED
Definition: ltc_defs.h:120
@ LTC_ADCMEAS_UNDEFINED
Definition: ltc_defs.h:105
@ LTC_ADCMODE_FAST_DCP0
Definition: ltc_defs.h:95

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

Definition at line 87 of file test_ltc_afe_dma.c.

◆ ltc_TXPECbuffer

uint8_t ltc_TXPECbuffer[LTC_N_BYTES_FOR_DATA_TRANSMISSION] = {0}

Definition at line 70 of file test_ltc_afe_dma.c.