foxBMS - Unit Tests  1.6.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 <stdbool.h>
#include <stdint.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
2023-10-12 (date of last update)
Version
v1.6.0
Prefix
TEST

Definition in file test_ltc_afe_dma.c.

Macro Definition Documentation

◆ BIG_ENDIAN

#define BIG_ENDIAN   (3u)

Definition at line 92 of file test_ltc_afe_dma.c.

◆ DMA_REQ_LINE_RX

#define DMA_REQ_LINE_RX   (DMA_REQ_LINE_SPI1_RX)

Definition at line 98 of file test_ltc_afe_dma.c.

◆ DMA_REQ_LINE_SPI1_RX

#define DMA_REQ_LINE_SPI1_RX   (DMA_REQ0)

Definition at line 86 of file test_ltc_afe_dma.c.

◆ DMA_REQ_LINE_SPI1_TX

#define DMA_REQ_LINE_SPI1_TX   (DMA_REQ1)

Definition at line 85 of file test_ltc_afe_dma.c.

◆ DMA_REQ_LINE_SPI2_RX

#define DMA_REQ_LINE_SPI2_RX   (DMA_REQ2)

Definition at line 88 of file test_ltc_afe_dma.c.

◆ DMA_REQ_LINE_SPI2_TX

#define DMA_REQ_LINE_SPI2_TX   (DMA_REQ3)

Definition at line 87 of file test_ltc_afe_dma.c.

◆ DMA_REQ_LINE_SPI3_RX

#define DMA_REQ_LINE_SPI3_RX   (DMA_REQ14)

Definition at line 90 of file test_ltc_afe_dma.c.

◆ DMA_REQ_LINE_SPI3_TX

#define DMA_REQ_LINE_SPI3_TX   (DMA_REQ15)

Definition at line 89 of file test_ltc_afe_dma.c.

◆ DMA_REQ_LINE_TX

#define DMA_REQ_LINE_TX   (DMA_REQ_LINE_SPI1_TX)

Definition at line 97 of file test_ltc_afe_dma.c.

◆ DMAREQEN_BIT

#define DMAREQEN_BIT   (0x10000u)

Definition at line 94 of file test_ltc_afe_dma.c.

◆ ELEMENT_COUNT

#define ELEMENT_COUNT   (1u)

Definition at line 93 of file test_ltc_afe_dma.c.

◆ SPIEN_BIT

#define SPIEN_BIT   (0x1000000u)

Definition at line 95 of file test_ltc_afe_dma.c.

Function Documentation

◆ setUp()

void setUp ( void  )

Definition at line 171 of file test_ltc_afe_dma.c.

◆ tearDown()

void tearDown ( void  )

Definition at line 174 of file test_ltc_afe_dma.c.

◆ testDummy()

void testDummy ( void  )

Definition at line 179 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:79
#define ELEMENT_COUNT

Definition at line 151 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 132 of file test_ltc_afe_dma.c.

◆ ltc_RXPECbuffer

uint8_t ltc_RXPECbuffer[LTC_N_BYTES_FOR_DATA_TRANSMISSION] = {0}

Definition at line 82 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:84
#define NULL_PTR
Null pointer.
Definition: fstd_types.h:77
@ LTC_STATE_NO_REQUEST
Definition: ltc_defs.h:395
@ LTC_STATEMACH_UNINITIALIZED
Definition: ltc_defs.h:124
@ LTC_ADCMEAS_UNDEFINED
Definition: ltc_defs.h:109
@ LTC_ADCMODE_FAST_DCP0
Definition: ltc_defs.h:99

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

Definition at line 100 of file test_ltc_afe_dma.c.

◆ ltc_TXPECbuffer

uint8_t ltc_TXPECbuffer[LTC_N_BYTES_FOR_DATA_TRANSMISSION] = {0}

Definition at line 83 of file test_ltc_afe_dma.c.