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

Configuration for the SPI module. More...

#include "spi_cfg.h"
#include "spi_cfg-helper.h"
Include dependency graph for spi_cfg.c:

Go to the source code of this file.

Functions

void SPI_SpsInterfaceSwitchToHighSpeed (SPI_INTERFACE_CONFIG_s *pSpiSpsInterface)
 Switch the SPS spi handle to high speed. More...
 
void SPI_SpsInterfaceSwitchToLowSpeed (SPI_INTERFACE_CONFIG_s *pSpiSpsInterface)
 Switch the SPS spi handle to low speed. More...
 

Variables

static spiDAT1_t spi_kLtcDataConfig [BS_NR_OF_STRINGS]
 
static spiDAT1_t spi_kMxmDataConfig
 
static spiDAT1_t spi_kNxp775DataConfigTx [BS_NR_OF_STRINGS]
 
static spiDAT1_t spi_kNxp775DataConfigRx [BS_NR_OF_STRINGS]
 
static spiDAT1_t spi_kFramDataConfig
 
static spiDAT1_t spi_kSpsDataConfigLowSpeed
 
static spiDAT1_t spi_kSpsDataConfigHighSpeed
 
static spiDAT1_t spi_kAdc0DataConfig
 
static spiDAT1_t spi_kAdc1DataConfig
 
static spiDAT1_t spi_kSbcDataConfig
 
SPI_INTERFACE_CONFIG_s spi_ltcInterface [BS_NR_OF_STRINGS]
 
SPI_INTERFACE_CONFIG_s spi_MxmInterface
 
SPI_INTERFACE_CONFIG_s spi_nxp775InterfaceTx [BS_NR_OF_STRINGS]
 
SPI_INTERFACE_CONFIG_s spi_nxp775InterfaceRx [BS_NR_OF_STRINGS]
 
SPI_INTERFACE_CONFIG_s spi_framInterface
 
SPI_INTERFACE_CONFIG_s spi_spsInterface
 
SPI_INTERFACE_CONFIG_s spi_adc0Interface
 
SPI_INTERFACE_CONFIG_s spi_adc1Interface
 
SPI_INTERFACE_CONFIG_s spi_kSbcMcuInterface
 
SPI_BUSY_STATE_e spi_busyFlags []
 
const uint8_t spi_nrBusyFlags = sizeof(spi_busyFlags) / sizeof(SPI_BUSY_STATE_e)
 

Detailed Description

Configuration for the SPI 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-03-05 (date of creation)
Updated
2022-05-30 (date of last update)
Version
v1.3.0
Prefix
SPI

Definition in file spi_cfg.c.

Function Documentation

◆ SPI_SpsInterfaceSwitchToHighSpeed()

void SPI_SpsInterfaceSwitchToHighSpeed ( SPI_INTERFACE_CONFIG_s pSpiSpsInterface)

Switch the SPS spi handle to high speed.

Parameters
[out]pSpiSpsInterfacehandle of the SPS spi config

Definition at line 278 of file spi_cfg.c.

◆ SPI_SpsInterfaceSwitchToLowSpeed()

void SPI_SpsInterfaceSwitchToLowSpeed ( SPI_INTERFACE_CONFIG_s pSpiSpsInterface)

Switch the SPS spi handle to low speed.

Parameters
[out]pSpiSpsInterfacehandle of the SPS spi config

Definition at line 283 of file spi_cfg.c.

Variable Documentation

◆ spi_adc0Interface

SPI_INTERFACE_CONFIG_s spi_adc0Interface
Initial value:
= {
.pConfig = &spi_kAdc0DataConfig,
.pNode = spiREG3,
.pGioPort = &(spiREG3->PC3),
.csPin = 4u,
}
static spiDAT1_t spi_kAdc0DataConfig
Definition: spi_cfg.c:146
@ SPI_CHIP_SELECT_SOFTWARE
Definition: spi_cfg.h:134

SPI interface configuration for ADC communication

Definition at line 235 of file spi_cfg.c.

◆ spi_adc1Interface

SPI_INTERFACE_CONFIG_s spi_adc1Interface
Initial value:
= {
.pConfig = &spi_kAdc1DataConfig,
.pNode = spiREG3,
.pGioPort = &(spiREG3->PC3),
.csPin = 5u,
}
static spiDAT1_t spi_kAdc1DataConfig
Definition: spi_cfg.c:154

SPI interface configuration for ADC communication

Definition at line 244 of file spi_cfg.c.

◆ spi_busyFlags

SPI_BUSY_STATE_e spi_busyFlags[]
Initial value:

struct containing the lock state of the SPI interfaces

Definition at line 262 of file spi_cfg.c.

◆ spi_framInterface

SPI_INTERFACE_CONFIG_s spi_framInterface
Initial value:
= {
.pConfig = &spi_kFramDataConfig,
.pNode = spiREG3,
.pGioPort = &(spiREG3->PC3),
.csPin = 1u,
}
static spiDAT1_t spi_kFramDataConfig
Definition: spi_cfg.c:121

SPI interface configuration for FRAM communication

Definition at line 217 of file spi_cfg.c.

◆ spi_kAdc0DataConfig

spiDAT1_t spi_kAdc0DataConfig
static
Initial value:
= {
.CS_HOLD = TRUE,
.WDEL = TRUE,
.DFSEL = SPI_FMT_2,
#define SPI_HARDWARE_CHIP_SELECT_4_ACTIVE

SPI data configuration struct for ADC communication

Definition at line 146 of file spi_cfg.c.

◆ spi_kAdc1DataConfig

spiDAT1_t spi_kAdc1DataConfig
static
Initial value:
= {
.CS_HOLD = TRUE,
.WDEL = TRUE,
.DFSEL = SPI_FMT_2,
#define SPI_HARDWARE_CHIP_SELECT_5_ACTIVE

SPI data configuration struct for ADC communication

Definition at line 154 of file spi_cfg.c.

◆ spi_kFramDataConfig

spiDAT1_t spi_kFramDataConfig
static
Initial value:
= {
.CS_HOLD = TRUE,
.WDEL = TRUE,
.DFSEL = SPI_FMT_1,
#define SPI_HARDWARE_CHIP_SELECT_DISABLE_ALL

SPI data configuration struct for FRAM communication

Definition at line 121 of file spi_cfg.c.

◆ spi_kLtcDataConfig

spiDAT1_t spi_kLtcDataConfig[BS_NR_OF_STRINGS]
static
Initial value:
= {
{
.CS_HOLD = TRUE,
.WDEL = FALSE,
.DFSEL = SPI_FMT_0,
}
#define SPI_HARDWARE_CHIP_SELECT_2_ACTIVE

SPI data configuration struct for LTC communication

Definition at line 89 of file spi_cfg.c.

◆ spi_kMxmDataConfig

spiDAT1_t spi_kMxmDataConfig
static
Initial value:
= {
.CS_HOLD = TRUE,
.WDEL = TRUE,
.DFSEL = SPI_FMT_1,
#define SPI_HARDWARE_CHIP_SELECT_0_ACTIVE

SPI data configuration struct for MXM communication

Definition at line 98 of file spi_cfg.c.

◆ spi_kNxp775DataConfigRx

spiDAT1_t spi_kNxp775DataConfigRx[BS_NR_OF_STRINGS]
static
Initial value:
= {
{.CS_HOLD = TRUE,
.WDEL = TRUE,
.DFSEL = SPI_FMT_0,
}

SPI data configuration struct for NXP MC33775A communication, Rx part

Definition at line 113 of file spi_cfg.c.

◆ spi_kNxp775DataConfigTx

spiDAT1_t spi_kNxp775DataConfigTx[BS_NR_OF_STRINGS]
static
Initial value:
= {
{.CS_HOLD = TRUE,
.WDEL = TRUE,
.DFSEL = SPI_FMT_0,
}

SPI data configuration struct for NXP MC33775A communication, Tx part

Definition at line 105 of file spi_cfg.c.

◆ spi_kSbcDataConfig

spiDAT1_t spi_kSbcDataConfig
static
Initial value:
= {
.CS_HOLD = TRUE,
.WDEL = TRUE,
.DFSEL = SPI_FMT_0,
#define SPI_HARDWARE_CHIP_SELECT_1_ACTIVE

SPI configuration struct for SBC communication

Definition at line 162 of file spi_cfg.c.

◆ spi_kSbcMcuInterface

SPI_INTERFACE_CONFIG_s spi_kSbcMcuInterface
Initial value:
= {
.pConfig = &spi_kSbcDataConfig,
.pNode = spiREG2,
.pGioPort = &(spiREG2->PC3),
.csPin = 0u,
}
static spiDAT1_t spi_kSbcDataConfig
Definition: spi_cfg.c:162
@ SPI_CHIP_SELECT_HARDWARE
Definition: spi_cfg.h:133

SPI interface configuration for SBC communication

Definition at line 253 of file spi_cfg.c.

◆ spi_kSpsDataConfigHighSpeed

spiDAT1_t spi_kSpsDataConfigHighSpeed
static
Initial value:
= {
.CS_HOLD = TRUE,
.WDEL = TRUE,
.DFSEL = SPI_FMT_2,

SPI data configuration struct for SPS communication in high speed (10MHz)

Definition at line 138 of file spi_cfg.c.

◆ spi_kSpsDataConfigLowSpeed

spiDAT1_t spi_kSpsDataConfigLowSpeed
static
Initial value:
= {
.CS_HOLD = TRUE,
.WDEL = TRUE,
.DFSEL = SPI_FMT_1,
}

SPI data configuration struct for SPS communication in low speed (4MHz)

Definition at line 129 of file spi_cfg.c.

◆ spi_ltcInterface

Initial value:
= {
{
.pConfig = &spi_kLtcDataConfig[0u],
.pNode = spiREG1,
.pGioPort = &(spiREG1->PC3),
.csPin = 2u,
},
}
static spiDAT1_t spi_kLtcDataConfig[BS_NR_OF_STRINGS]
Definition: spi_cfg.c:89

SPI interface configuration for LTC communication This is a list of structs because of multistring

Definition at line 175 of file spi_cfg.c.

◆ spi_MxmInterface

SPI_INTERFACE_CONFIG_s spi_MxmInterface
Initial value:
= {
.pConfig = &spi_kMxmDataConfig,
.pNode = spiREG4,
.pGioPort = &(spiREG4->PC3),
.csPin = 0u,
}
static spiDAT1_t spi_kMxmDataConfig
Definition: spi_cfg.c:98

SPI interface configuration for MXM communication

Definition at line 186 of file spi_cfg.c.

◆ spi_nrBusyFlags

const uint8_t spi_nrBusyFlags = sizeof(spi_busyFlags) / sizeof(SPI_BUSY_STATE_e)

size of spi_busyFlags

Definition at line 271 of file spi_cfg.c.

◆ spi_nxp775InterfaceRx

SPI_INTERFACE_CONFIG_s spi_nxp775InterfaceRx[BS_NR_OF_STRINGS]
Initial value:
= {
{
.pConfig = &spi_kNxp775DataConfigRx[0u],
.pNode = spiREG4,
.pGioPort = &(spiREG4->PC3),
.csPin = 0u,
},
}
static spiDAT1_t spi_kNxp775DataConfigRx[BS_NR_OF_STRINGS]
Definition: spi_cfg.c:113

SPI interface configuration for N775 communication, Rx part

Definition at line 206 of file spi_cfg.c.

◆ spi_nxp775InterfaceTx

SPI_INTERFACE_CONFIG_s spi_nxp775InterfaceTx[BS_NR_OF_STRINGS]
Initial value:
= {
{
.pConfig = &spi_kNxp775DataConfigTx[0u],
.pNode = spiREG1,
.pGioPort = &(spiREG1->PC3),
.csPin = 2u,
},
}
static spiDAT1_t spi_kNxp775DataConfigTx[BS_NR_OF_STRINGS]
Definition: spi_cfg.c:105

SPI interface configuration for N775 communication Tx part

Definition at line 195 of file spi_cfg.c.

◆ spi_spsInterface

SPI_INTERFACE_CONFIG_s spi_spsInterface
Initial value:
= {
.pNode = spiREG2,
.pGioPort = &SPS_SPI_CS_GIOPORT,
.csPin = SPS_SPI_CS_PIN,
}
static spiDAT1_t spi_kSpsDataConfigLowSpeed
Definition: spi_cfg.c:129
#define SPS_SPI_CS_PIN
Definition: spi_cfg.h:108
#define SPS_SPI_CS_GIOPORT
Definition: spi_cfg.h:106

SPI interface configuration for SPS communication

Definition at line 226 of file spi_cfg.c.