foxBMS - Unit Tests  1.2.0
The foxBMS Unit Tests API Documentation
spi_cfg.h File Reference

Headers for the configuration for the SPI module. More...

#include "general.h"
#include "battery_system_cfg.h"
#include "HL_het.h"
#include "HL_spi.h"
Include dependency graph for spi_cfg.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  SPI_INTERFACE_CONFIG
 

Macros

#define LTC_SPI_NODE   (spiREG1)
 
#define SPS_SPI_CS_GIOPORT   (hetREG2->DOUT)
 
#define SPS_SPI_CS_GIOPORT_DIR   (hetREG2->DIR)
 
#define SPS_SPI_CS_PIN   (1u)
 
#define N775_SPI_TX_NODE   (spiREG1)
 
#define N775_SPI_TX_GIOPORT   (N775_SPI_TX_NODE->PC3)
 
#define N775_SPI_TX_CS_PIN   (2U)
 
#define N775_SPI_RX_NODE   (spiREG5)
 
#define N775_SPI_RX_GIOPORT   (N775_SPI_TX_NODE->PC3)
 
#define N775_SPI_RX_CS_PIN   (2U)
 

Typedefs

typedef enum SPI_BUSY_STATE SPI_BUSY_STATE_e
 
typedef enum SPI_INTERFACE SPI_INTERFACE_e
 
typedef struct SPI_INTERFACE_CONFIG SPI_INTERFACE_CONFIG_s
 

Enumerations

enum  SPI_BUSY_STATE { SPI_IDLE , SPI_BUSY }
 
enum  SPI_INTERFACE {
  SPI_Interface1 , SPI_Interface2 , SPI_Interface3 , SPI_Interface4 ,
  SPI_Interface5
}
 

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

SPI_INTERFACE_CONFIG_s spi_ltcInterface [BS_NR_OF_STRINGS]
 
SPI_INTERFACE_CONFIG_s spi_MxmInterface
 
SPI_INTERFACE_CONFIG_s spi_nxp775Interface
 
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_INTERFACE_CONFIG_s spi_dmaTransmission []
 Variable used for SPI over DMA transmission. Retains the CS pin to deactivate in DMA callback. More...
 
uint32_t spi_saveFmt0 []
 
SPI_BUSY_STATE_e spi_busyFlags []
 
const uint8_t spi_nrBusyFlags
 

Detailed Description

Headers for the 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
2020-09-30 (date of last update)
Prefix
SPI

Definition in file spi_cfg.h.

Macro Definition Documentation

◆ LTC_SPI_NODE

#define LTC_SPI_NODE   (spiREG1)

SPI defines for LTC

Definition at line 70 of file spi_cfg.h.

◆ N775_SPI_RX_CS_PIN

#define N775_SPI_RX_CS_PIN   (2U)

SPI defines for NXP MC33775A

Definition at line 88 of file spi_cfg.h.

◆ N775_SPI_RX_GIOPORT

#define N775_SPI_RX_GIOPORT   (N775_SPI_TX_NODE->PC3)

SPI defines for NXP MC33775A

Definition at line 87 of file spi_cfg.h.

◆ N775_SPI_RX_NODE

#define N775_SPI_RX_NODE   (spiREG5)

SPI defines for NXP MC33775A

Definition at line 86 of file spi_cfg.h.

◆ N775_SPI_TX_CS_PIN

#define N775_SPI_TX_CS_PIN   (2U)

SPI defines for NXP MC33775A

Definition at line 84 of file spi_cfg.h.

◆ N775_SPI_TX_GIOPORT

#define N775_SPI_TX_GIOPORT   (N775_SPI_TX_NODE->PC3)

SPI defines for NXP MC33775A

Definition at line 83 of file spi_cfg.h.

◆ N775_SPI_TX_NODE

#define N775_SPI_TX_NODE   (spiREG1)

SPI defines for NXP MC33775A

Definition at line 82 of file spi_cfg.h.

◆ SPS_SPI_CS_GIOPORT

#define SPS_SPI_CS_GIOPORT   (hetREG2->DOUT)

GIO defines for SPI for Smart Power Switches

Definition at line 73 of file spi_cfg.h.

◆ SPS_SPI_CS_GIOPORT_DIR

#define SPS_SPI_CS_GIOPORT_DIR   (hetREG2->DIR)

GIO defines for SPI for Smart Power Switches

Definition at line 74 of file spi_cfg.h.

◆ SPS_SPI_CS_PIN

#define SPS_SPI_CS_PIN   (1u)

GIO defines for SPI for Smart Power Switches

Definition at line 75 of file spi_cfg.h.

Typedef Documentation

◆ SPI_BUSY_STATE_e

enum for spi interface state

◆ SPI_INTERFACE_CONFIG_s

configuration of the SPI interface

◆ SPI_INTERFACE_e

spi block identification numbers

Enumeration Type Documentation

◆ SPI_BUSY_STATE

enum for spi interface state

Enumerator
SPI_IDLE 
SPI_BUSY 

Definition at line 92 of file spi_cfg.h.

◆ SPI_INTERFACE

spi block identification numbers

Enumerator
SPI_Interface1 
SPI_Interface2 
SPI_Interface3 
SPI_Interface4 
SPI_Interface5 

Definition at line 98 of file spi_cfg.h.

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 320 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 325 of file spi_cfg.c.

Variable Documentation

◆ spi_adc0Interface

SPI_INTERFACE_CONFIG_s spi_adc0Interface
extern

SPI interface configuration for ADC communication

Definition at line 222 of file spi_cfg.c.

◆ spi_adc1Interface

SPI_INTERFACE_CONFIG_s spi_adc1Interface
extern

SPI interface configuration for ADC communication

Definition at line 231 of file spi_cfg.c.

◆ spi_busyFlags

SPI_BUSY_STATE_e spi_busyFlags[]
extern

struct containing the lock state of the SPI interfaces

Definition at line 304 of file spi_cfg.c.

◆ spi_dmaTransmission

SPI_INTERFACE_CONFIG_s spi_dmaTransmission[]
extern

Variable used for SPI over DMA transmission. Retains the CS pin to deactivate in DMA callback.

Definition at line 252 of file spi_cfg.c.

◆ spi_framInterface

SPI_INTERFACE_CONFIG_s spi_framInterface
extern

SPI interface configuration for FRAM communication

Definition at line 204 of file spi_cfg.c.

◆ spi_kSbcMcuInterface

SPI_INTERFACE_CONFIG_s spi_kSbcMcuInterface
extern

SPI interface configuration for SBC communication

Definition at line 240 of file spi_cfg.c.

◆ spi_ltcInterface

SPI_INTERFACE_CONFIG_s spi_ltcInterface[BS_NR_OF_STRINGS]
extern

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

Definition at line 161 of file spi_cfg.c.

◆ spi_MxmInterface

SPI_INTERFACE_CONFIG_s spi_MxmInterface
extern

SPI interface configuration for MXM communication

Definition at line 186 of file spi_cfg.c.

◆ spi_nrBusyFlags

const uint8_t spi_nrBusyFlags
extern

size of spi_busyFlags

Definition at line 313 of file spi_cfg.c.

◆ spi_nxp775Interface

SPI_INTERFACE_CONFIG_s spi_nxp775Interface
extern

SPI interface configuration for N775 communication

Definition at line 195 of file spi_cfg.c.

◆ spi_saveFmt0

uint32_t spi_saveFmt0[]
extern

With DMA, only FMT0 can be used. This table stores the existing FMT0. The wanted FMT is then copied in FMT0. In the DMA callback, the existing FMT0 is restored with this table.

Definition at line 295 of file spi_cfg.c.

◆ spi_spsInterface

SPI_INTERFACE_CONFIG_s spi_spsInterface
extern

SPI interface configuration for SPS communication

Definition at line 213 of file spi_cfg.c.