G32R430 Device Driver Layer v1.0.4
G32R4xx Device Driver Layer API Reference
g32r4xx_ddl_spi.h File Reference

Header file of SPI DDL module. More...

#include "g32r4xx.h"
#include "g32r430.h"

Go to the source code of this file.

Data Structures

struct  DDL_SPI_InitTypeDef
 SPI Init structures definition. More...

Macros

#define DDL_SPI_STS_RXBNEFLG   SPI_STS_RXBNEFLG
#define DDL_SPI_STS_TXBEFLG   SPI_STS_TXBEFLG
#define DDL_SPI_STS_BSYFLG   SPI_STS_BSYFLG
#define DDL_SPI_STS_CRCEFLG   SPI_STS_CRCEFLG
#define DDL_SPI_STS_MEFLG   SPI_STS_MEFLG
#define DDL_SPI_STS_OVRFLG   SPI_STS_OVRFLG
#define DDL_SPI_STS_FREFLG   SPI_STS_FREFLG
#define DDL_SPI_CTRL2_RXBNEIEN   SPI_CTRL2_RXBNEIEN
#define DDL_SPI_CTRL2_TXBEIEN   SPI_CTRL2_TXBEIEN
#define DDL_SPI_CTRL2_ERRIEN   SPI_CTRL2_ERRIEN
#define DDL_SPI_MODE_MASTER   (SPI_CTRL1_MSMCFG | SPI_CTRL1_ISSEL)
#define DDL_SPI_MODE_SLAVE   0x00000000U
#define DDL_SPI_PROTOCOL_MOTOROLA   0x00000000U
#define DDL_SPI_PROTOCOL_TI   (SPI_CTRL2_FRFCFG)
#define DDL_SPI_PHASE_1EDGE   0x00000000U
#define DDL_SPI_PHASE_2EDGE   (SPI_CTRL1_CPHA)
#define DDL_SPI_POLARITY_LOW   0x00000000U
#define DDL_SPI_POLARITY_HIGH   (SPI_CTRL1_CPOL)
#define DDL_SPI_BAUDRATEPRESCALER_DIV2   (0x00000000U)
#define DDL_SPI_BAUDRATEPRESCALER_DIV4   (SPI_CTRL1_BRSEL_0)
#define DDL_SPI_BAUDRATEPRESCALER_DIV8   (SPI_CTRL1_BRSEL_1)
#define DDL_SPI_BAUDRATEPRESCALER_DIV16   (SPI_CTRL1_BRSEL_1 | SPI_CTRL1_BRSEL_0)
#define DDL_SPI_BAUDRATEPRESCALER_DIV32   (SPI_CTRL1_BRSEL_2)
#define DDL_SPI_BAUDRATEPRESCALER_DIV64   (SPI_CTRL1_BRSEL_2 | SPI_CTRL1_BRSEL_0)
#define DDL_SPI_BAUDRATEPRESCALER_DIV128   (SPI_CTRL1_BRSEL_2 | SPI_CTRL1_BRSEL_1)
#define DDL_SPI_BAUDRATEPRESCALER_DIV256   (SPI_CTRL1_BRSEL)
#define DDL_SPI_LSB_FIRST   (SPI_CTRL1_LSBSEL)
#define DDL_SPI_MSB_FIRST   0x00000000U
#define DDL_SPI_FULL_DUPLEX   0x00000000U
#define DDL_SPI_SIMPLEX_RX   (SPI_CTRL1_RXOMEN)
#define DDL_SPI_HALF_DUPLEX_RX   (SPI_CTRL1_BMEN)
#define DDL_SPI_HALF_DUPLEX_TX   (SPI_CTRL1_BMEN | SPI_CTRL1_BMOEN)
#define DDL_SPI_NSS_SOFT   (SPI_CTRL1_SSEN)
#define DDL_SPI_NSS_HARD_INPUT   0x00000000U
#define DDL_SPI_NSS_HARD_OUTPUT   (((uint32_t)SPI_CTRL2_SSOEN << 16U))
#define DDL_SPI_DATAWIDTH_8BIT   0x00000000U
#define DDL_SPI_DATAWIDTH_16BIT   (SPI_CTRL1_DFLSEL)
#define DDL_SPI_CRCCALCULATION_DISABLE   0x00000000U
#define DDL_SPI_CRCCALCULATION_ENABLE   (SPI_CTRL1_CRCEN)
#define DDL_SPI_WriteReg(__INSTANCE__, __REG__, __VALUE__)
 Write a value in SPI register.
#define DDL_SPI_ReadReg(__INSTANCE__, __REG__)
 Read a value in SPI register.

Functions

__STATIC_INLINE void DDL_SPI_Enable (SPI_TypeDef *SPIx)
 Enable SPI peripheral.
__STATIC_INLINE void DDL_SPI_Disable (SPI_TypeDef *SPIx)
 Disable SPI peripheral.
__STATIC_INLINE uint32_t DDL_SPI_IsEnabled (SPI_TypeDef *SPIx)
 Check if SPI peripheral is enabled.
__STATIC_INLINE void DDL_SPI_SetMode (SPI_TypeDef *SPIx, uint32_t Mode)
 Set SPI operation mode to Master or Slave.
__STATIC_INLINE uint32_t DDL_SPI_GetMode (SPI_TypeDef *SPIx)
 Get SPI operation mode (Master or Slave).
__STATIC_INLINE void DDL_SPI_SetStandard (SPI_TypeDef *SPIx, uint32_t Standard)
 Set serial protocol used.
__STATIC_INLINE uint32_t DDL_SPI_GetStandard (SPI_TypeDef *SPIx)
 Get serial protocol used.
__STATIC_INLINE void DDL_SPI_SetClockPhase (SPI_TypeDef *SPIx, uint32_t ClockPhase)
 Set clock phase.
__STATIC_INLINE uint32_t DDL_SPI_GetClockPhase (SPI_TypeDef *SPIx)
 Get clock phase.
__STATIC_INLINE void DDL_SPI_SetClockPolarity (SPI_TypeDef *SPIx, uint32_t ClockPolarity)
 Set clock polarity.
__STATIC_INLINE uint32_t DDL_SPI_GetClockPolarity (SPI_TypeDef *SPIx)
 Get clock polarity.
__STATIC_INLINE void DDL_SPI_SetBaudRatePrescaler (SPI_TypeDef *SPIx, uint32_t BaudRate)
 Set baud rate prescaler.
__STATIC_INLINE uint32_t DDL_SPI_GetBaudRatePrescaler (SPI_TypeDef *SPIx)
 Get baud rate prescaler.
__STATIC_INLINE void DDL_SPI_SetTransferBitOrder (SPI_TypeDef *SPIx, uint32_t BitOrder)
 Set transfer bit order.
__STATIC_INLINE uint32_t DDL_SPI_GetTransferBitOrder (SPI_TypeDef *SPIx)
 Get transfer bit order.
__STATIC_INLINE void DDL_SPI_SetTransferDirection (SPI_TypeDef *SPIx, uint32_t TransferDirection)
 Set transfer direction mode.
__STATIC_INLINE uint32_t DDL_SPI_GetTransferDirection (SPI_TypeDef *SPIx)
 Get transfer direction mode.
__STATIC_INLINE void DDL_SPI_SetDataWidth (SPI_TypeDef *SPIx, uint32_t DataWidth)
 Set frame data width.
__STATIC_INLINE uint32_t DDL_SPI_GetDataWidth (SPI_TypeDef *SPIx)
 Get frame data width.
__STATIC_INLINE void DDL_SPI_BISS_EnableBiss (SPI_TypeDef *SPIx)
 Enable Biss-c mode.
__STATIC_INLINE void DDL_SPI_BISS_DisableBiss (SPI_TypeDef *SPIx)
 Disable Biss-c mode.
__STATIC_INLINE uint32_t DDL_SPI_BISS_IsEnabledBiss (SPI_TypeDef *SPIx)
 Check Biss-c mode is enable.
__STATIC_INLINE void DDL_SPI_BISS_EnableSsi (SPI_TypeDef *SPIx)
 Enable Ssi mode.
__STATIC_INLINE void DDL_SPI_BISS_DisableSsi (SPI_TypeDef *SPIx)
 Disable Ssi mode.
__STATIC_INLINE uint32_t DDL_SPI_BISS_IsEnabledSsi (SPI_TypeDef *SPIx)
 Check Ssi mode is enable.
__STATIC_INLINE void DDL_SPI_BISS_EnableStop (SPI_TypeDef *SPIx)
 Enable Stop mode.
__STATIC_INLINE void DDL_SPI_BISS_DisableStop (SPI_TypeDef *SPIx)
 Disable Stop mode.
__STATIC_INLINE uint32_t DDL_SPI_BISS_IsEnabledStop (SPI_TypeDef *SPIx)
 Check Stop mode is enable.
__STATIC_INLINE void DDL_SPI_BISS_SetTimeout (SPI_TypeDef *SPIx, uint32_t Timeout)
 Set BISS timeout.
__STATIC_INLINE uint32_t DDL_SPI_BISS_GetTimeout (SPI_TypeDef *SPIx)
 Get BISS timeout.
__STATIC_INLINE void DDL_SPI_BISS_SetFrequency (SPI_TypeDef *SPIx, uint32_t Frequency)
 Set BISS frequency.
__STATIC_INLINE uint32_t DDL_SPI_BISS_GetFrequency (SPI_TypeDef *SPIx)
 Get BISS frequency.
__STATIC_INLINE uint32_t DDL_SPI_BISS_ReceiveCDMData (SPI_TypeDef *SPIx)
 Receive CDM data.
__STATIC_INLINE void DDL_SPI_EnableCRC (SPI_TypeDef *SPIx)
 Enable CRC.
__STATIC_INLINE void DDL_SPI_DisableCRC (SPI_TypeDef *SPIx)
 Disable CRC.
__STATIC_INLINE uint32_t DDL_SPI_IsEnabledCRC (SPI_TypeDef *SPIx)
 Check if CRC is enabled.
__STATIC_INLINE void DDL_SPI_SetCRCNext (SPI_TypeDef *SPIx)
 Set CRCNext to transfer CRC on the line.
__STATIC_INLINE void DDL_SPI_SetCRCPolynomial (SPI_TypeDef *SPIx, uint32_t CRCPoly)
 Set polynomial for CRC calculation.
__STATIC_INLINE uint32_t DDL_SPI_GetCRCPolynomial (SPI_TypeDef *SPIx)
 Get polynomial for CRC calculation.
__STATIC_INLINE uint32_t DDL_SPI_GetRxCRC (SPI_TypeDef *SPIx)
 Get Rx CRC.
__STATIC_INLINE uint32_t DDL_SPI_GetTxCRC (SPI_TypeDef *SPIx)
 Get Tx CRC.
__STATIC_INLINE void DDL_SPI_SetNSSMode (SPI_TypeDef *SPIx, uint32_t NSS)
 Set NSS mode.
__STATIC_INLINE uint32_t DDL_SPI_GetNSSMode (SPI_TypeDef *SPIx)
 Get NSS mode.
__STATIC_INLINE uint32_t DDL_SPI_IsActiveFlag_RXNE (SPI_TypeDef *SPIx)
 Check if Rx buffer is not empty.
__STATIC_INLINE uint32_t DDL_SPI_IsActiveFlag_TXE (SPI_TypeDef *SPIx)
 Check if Tx buffer is empty.
__STATIC_INLINE uint32_t DDL_SPI_IsActiveFlag_CRCERR (SPI_TypeDef *SPIx)
 Get CRC error flag.
__STATIC_INLINE void DDL_SPI_ClearFlag_CRCERR (SPI_TypeDef *SPIx)
 Clear CRC error flag.
__STATIC_INLINE uint32_t DDL_SPI_IsActiveFlag_MODF (SPI_TypeDef *SPIx)
 Get mode fault error flag.
__STATIC_INLINE void DDL_SPI_ClearFlag_MODF (SPI_TypeDef *SPIx)
 Clear mode fault error flag.
__STATIC_INLINE uint32_t DDL_SPI_IsActiveFlag_OVR (SPI_TypeDef *SPIx)
 Get overrun error flag.
__STATIC_INLINE void DDL_SPI_ClearFlag_OVR (SPI_TypeDef *SPIx)
 Clear overrun error flag.
__STATIC_INLINE uint32_t DDL_SPI_IsActiveFlag_BSY (SPI_TypeDef *SPIx)
 Get busy flag.
__STATIC_INLINE uint32_t DDL_SPI_IsActiveFlag_FRE (SPI_TypeDef *SPIx)
 Get frame format error flag.
__STATIC_INLINE void DDL_SPI_ClearFlag_FRE (SPI_TypeDef *SPIx)
 Clear frame format error flag.
__STATIC_INLINE uint32_t DDL_SPI_IsActiveFlag_CDM_NE (SPI_TypeDef *SPIx)
 Check if CDM is not empty.
__STATIC_INLINE uint32_t DDL_SPI_IsActiveFlag_BSBUSY (SPI_TypeDef *SPIx)
 Get Biss busy flag.
__STATIC_INLINE void DDL_SPI_EnableIT_ERR (SPI_TypeDef *SPIx)
 Enable error interrupt.
__STATIC_INLINE void DDL_SPI_DisableIT_ERR (SPI_TypeDef *SPIx)
 Disable error interrupt.
__STATIC_INLINE uint32_t DDL_SPI_IsEnabledIT_ERR (SPI_TypeDef *SPIx)
 Check if error interrupt is enabled.
__STATIC_INLINE void DDL_SPI_EnableIT_RXNE (SPI_TypeDef *SPIx)
 Enable Rx buffer not empty interrupt.
__STATIC_INLINE void DDL_SPI_DisableIT_RXNE (SPI_TypeDef *SPIx)
 Disable Rx buffer not empty interrupt.
__STATIC_INLINE uint32_t DDL_SPI_IsEnabledIT_RXNE (SPI_TypeDef *SPIx)
 Check if Rx buffer not empty interrupt is enabled.
__STATIC_INLINE void DDL_SPI_EnableIT_TXE (SPI_TypeDef *SPIx)
 Enable Tx buffer empty interrupt.
__STATIC_INLINE void DDL_SPI_DisableIT_TXE (SPI_TypeDef *SPIx)
 Disable Tx buffer empty interrupt.
__STATIC_INLINE uint32_t DDL_SPI_IsEnabledIT_TXE (SPI_TypeDef *SPIx)
 Check if Tx buffer empty interrupt.
__STATIC_INLINE void DDL_SPI_EnableIT_CDM (SPI_TypeDef *SPIx)
 Enable CDM interrupt.
__STATIC_INLINE void DDL_SPI_DisableIT_CDM (SPI_TypeDef *SPIx)
 Disable CDM interrupt.
__STATIC_INLINE uint32_t DDL_SPI_IsEnabledIT_CDM (SPI_TypeDef *SPIx)
 Check if CDM interrupt is enabled.
__STATIC_INLINE void DDL_SPI_EnableDMAReq_RX (SPI_TypeDef *SPIx)
 Enable DMA Rx.
__STATIC_INLINE void DDL_SPI_DisableDMAReq_RX (SPI_TypeDef *SPIx)
 Disable DMA Rx.
__STATIC_INLINE uint32_t DDL_SPI_IsEnabledDMAReq_RX (SPI_TypeDef *SPIx)
 Check if DMA Rx is enabled.
__STATIC_INLINE void DDL_SPI_EnableDMAReq_TX (SPI_TypeDef *SPIx)
 Enable DMA Tx.
__STATIC_INLINE void DDL_SPI_DisableDMAReq_TX (SPI_TypeDef *SPIx)
 Disable DMA Tx.
__STATIC_INLINE uint32_t DDL_SPI_IsEnabledDMAReq_TX (SPI_TypeDef *SPIx)
 Check if DMA Tx is enabled.
__STATIC_INLINE void DDL_SPI_EnableDMAReq_CDM (SPI_TypeDef *SPIx)
 Enable CDM dma require.
__STATIC_INLINE void DDL_SPI_DisableDMAReq_CDM (SPI_TypeDef *SPIx)
 Disable CDM dma require.
__STATIC_INLINE uint32_t DDL_SPI_IsEnabledDMAReq_CDM (SPI_TypeDef *SPIx)
 Check if CDM dma require is enabled.
__STATIC_INLINE uint32_t DDL_SPI_DMA_GetRegAddr (SPI_TypeDef *SPIx)
 Get the data register address used for DMA transfer.
__STATIC_INLINE uint8_t DDL_SPI_ReceiveData8 (SPI_TypeDef *SPIx)
 Read 8-Bits in the data register.
__STATIC_INLINE uint16_t DDL_SPI_ReceiveData16 (SPI_TypeDef *SPIx)
 Read 16-Bits in the data register.
__STATIC_INLINE void DDL_SPI_TransmitData8 (SPI_TypeDef *SPIx, uint8_t TxData)
 Write 8-Bits in the data register.
__STATIC_INLINE void DDL_SPI_TransmitData16 (SPI_TypeDef *SPIx, uint16_t TxData)
 Write 16-Bits in the data register.
ErrorStatus DDL_SPI_DeInit (SPI_TypeDef *SPIx)
 De-initialize the SPI registers to their default reset values.
ErrorStatus DDL_SPI_Init (SPI_TypeDef *SPIx, DDL_SPI_InitTypeDef *SPI_InitStruct)
 Initialize the SPI registers according to the specified parameters in SPI_InitStruct.
void DDL_SPI_StructInit (DDL_SPI_InitTypeDef *SPI_InitStruct)
 Set each DDL_SPI_InitTypeDef field to default value.

Detailed Description

Header file of SPI DDL module.

Attention

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.

The original code has been modified by Geehy Semiconductor.

Copyright (c) 2016 STMicroelectronics. Copyright (C) 2025 Geehy Semiconductor. All rights reserved.

This software is licensed under terms that can be found in the LICENSE file in the root directory of this software component. If no LICENSE file comes with this software, it is provided AS-IS.

Definition in file g32r4xx_ddl_spi.h.