Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:23:38

0001 /**
0002   ******************************************************************************
0003   * @file    stm32h7xx_ll_spi.h
0004   * @author  MCD Application Team
0005   * @brief   Header file of SPI LL module.
0006   ******************************************************************************
0007   * @attention
0008   *
0009   * Copyright (c) 2017 STMicroelectronics.
0010   * All rights reserved.
0011   *
0012   * This software is licensed under terms that can be found in the LICENSE file
0013   * in the root directory of this software component.
0014   * If no LICENSE file comes with this software, it is provided AS-IS.
0015   *
0016   ******************************************************************************
0017   */
0018 
0019 /* Define to prevent recursive inclusion -------------------------------------*/
0020 #ifndef STM32H7xx_LL_SPI_H
0021 #define STM32H7xx_LL_SPI_H
0022 
0023 #ifdef __cplusplus
0024 extern "C" {
0025 #endif
0026 
0027 /* Includes ------------------------------------------------------------------*/
0028 #include "stm32h7xx.h"
0029 
0030 /** @addtogroup STM32H7xx_LL_Driver
0031   * @{
0032   */
0033 
0034 #if defined(SPI1) || defined(SPI2) || defined(SPI3) || defined(SPI4) || defined(SPI5) || defined(SPI6)
0035 
0036 /** @defgroup SPI_LL SPI
0037   * @ingroup RTEMSBSPsARMSTM32H7
0038   * @{
0039   */
0040 
0041 /* Private variables ---------------------------------------------------------*/
0042 
0043 /* Private constants ---------------------------------------------------------*/
0044 
0045 /* Private macros ------------------------------------------------------------*/
0046 /** @defgroup SPI_LL_Private_Macros SPI Private Macros
0047   * @ingroup RTEMSBSPsARMSTM32H7
0048   * @{
0049   */
0050 /**
0051   * @}
0052   */
0053 
0054 /* Exported types ------------------------------------------------------------*/
0055 #if defined(USE_FULL_LL_DRIVER) || defined(__rtems__)
0056 /** @defgroup SPI_LL_Exported_Types SPI Exported Types
0057   * @ingroup RTEMSBSPsARMSTM32H7
0058   * @{
0059   */
0060 
0061 /**
0062   * @brief  SPI Init structures definition
0063   */
0064 typedef struct
0065 {
0066   uint32_t TransferDirection;       /*!< Specifies the SPI unidirectional or bidirectional data mode.
0067                                          This parameter can be a value of @ref SPI_LL_EC_TRANSFER_MODE.
0068 
0069                                          This feature can be modified afterwards using unitary function
0070                                          @ref LL_SPI_SetTransferDirection().*/
0071 
0072   uint32_t Mode;                    /*!< Specifies the SPI mode (Master/Slave).
0073                                          This parameter can be a value of @ref SPI_LL_EC_MODE.
0074 
0075                                          This feature can be modified afterwards using unitary function
0076                                          @ref LL_SPI_SetMode().*/
0077 
0078   uint32_t DataWidth;               /*!< Specifies the SPI data width.
0079                                          This parameter can be a value of @ref SPI_LL_EC_DATAWIDTH.
0080 
0081                                          This feature can be modified afterwards using unitary function
0082                                          @ref LL_SPI_SetDataWidth().*/
0083 
0084   uint32_t ClockPolarity;           /*!< Specifies the serial clock steady state.
0085                                          This parameter can be a value of @ref SPI_LL_EC_POLARITY.
0086 
0087                                          This feature can be modified afterwards using unitary function
0088                                          @ref LL_SPI_SetClockPolarity().*/
0089 
0090   uint32_t ClockPhase;              /*!< Specifies the clock active edge for the bit capture.
0091                                          This parameter can be a value of @ref SPI_LL_EC_PHASE.
0092 
0093                                          This feature can be modified afterwards using unitary function
0094                                          @ref LL_SPI_SetClockPhase().*/
0095 
0096   uint32_t NSS;                     /*!< Specifies whether the NSS signal is managed by hardware (NSS pin)
0097                                          or by software using the SSI bit.
0098 
0099                                          This parameter can be a value of @ref SPI_LL_EC_NSS_MODE.
0100 
0101                                          This feature can be modified afterwards using unitary function
0102                                          @ref LL_SPI_SetNSSMode().*/
0103 
0104   uint32_t BaudRate;                /*!< Specifies the BaudRate prescaler value which will be used to configure
0105                                          the transmit and receive SCK clock.
0106                                          This parameter can be a value of @ref SPI_LL_EC_BAUDRATEPRESCALER.
0107                                          @note The communication clock is derived from the master clock.
0108                                          The slave clock does not need to be set.
0109 
0110                                          This feature can be modified afterwards using unitary function
0111                                          @ref LL_SPI_SetBaudRatePrescaler().*/
0112 
0113   uint32_t BitOrder;                /*!< Specifies whether data transfers start from MSB or LSB bit.
0114                                          This parameter can be a value of @ref SPI_LL_EC_BIT_ORDER.
0115 
0116                                          This feature can be modified afterwards using unitary function
0117                                          @ref LL_SPI_SetTransferBitOrder().*/
0118 
0119   uint32_t CRCCalculation;          /*!< Specifies if the CRC calculation is enabled or not.
0120                                          This parameter can be a value of @ref SPI_LL_EC_CRC_CALCULATION.
0121 
0122                                          This feature can be modified afterwards using unitary functions
0123                                          @ref LL_SPI_EnableCRC() and @ref LL_SPI_DisableCRC().*/
0124 
0125   uint32_t CRCPoly;                 /*!< Specifies the polynomial used for the CRC calculation.
0126                                          This parameter must be a number between Min_Data = 0x00
0127                                          and Max_Data = 0xFFFFFFFF.
0128 
0129                                          This feature can be modified afterwards using unitary function
0130                                          @ref LL_SPI_SetCRCPolynomial().*/
0131 
0132 } LL_SPI_InitTypeDef;
0133 
0134 /**
0135   * @}
0136   */
0137 #endif /*USE_FULL_LL_DRIVER*/
0138 
0139 /* Exported types ------------------------------------------------------------*/
0140 
0141 /* Exported constants --------------------------------------------------------*/
0142 /** @defgroup SPI_LL_Exported_Constants SPI Exported Constants
0143   * @ingroup RTEMSBSPsARMSTM32H7
0144   * @{
0145   */
0146 
0147 /** @defgroup SPI_LL_EC_GET_FLAG Get Flags Defines
0148   * @ingroup RTEMSBSPsARMSTM32H7
0149   * @brief    Flags defines which can be used with LL_SPI_ReadReg function
0150   * @{
0151   */
0152 #define LL_SPI_SR_RXP                              (SPI_SR_RXP)
0153 #define LL_SPI_SR_TXP                              (SPI_SR_TXP)
0154 #define LL_SPI_SR_DXP                              (SPI_SR_DXP)
0155 #define LL_SPI_SR_EOT                              (SPI_SR_EOT)
0156 #define LL_SPI_SR_TXTF                             (SPI_SR_TXTF)
0157 #define LL_SPI_SR_UDR                              (SPI_SR_UDR)
0158 #define LL_SPI_SR_CRCE                             (SPI_SR_CRCE)
0159 #define LL_SPI_SR_MODF                             (SPI_SR_MODF)
0160 #define LL_SPI_SR_OVR                              (SPI_SR_OVR)
0161 #define LL_SPI_SR_TIFRE                            (SPI_SR_TIFRE)
0162 #define LL_SPI_SR_TSERF                            (SPI_SR_TSERF)
0163 #define LL_SPI_SR_SUSP                             (SPI_SR_SUSP)
0164 #define LL_SPI_SR_TXC                              (SPI_SR_TXC)
0165 #define LL_SPI_SR_RXWNE                            (SPI_SR_RXWNE)
0166 /**
0167   * @}
0168   */
0169 
0170 /** @defgroup SPI_LL_EC_IT IT Defines
0171   * @ingroup RTEMSBSPsARMSTM32H7
0172   * @brief    IT defines which can be used with LL_SPI_ReadReg and  LL_SPI_WriteReg functions
0173   * @{
0174   */
0175 #define LL_SPI_IER_RXPIE                           (SPI_IER_RXPIE)
0176 #define LL_SPI_IER_TXPIE                           (SPI_IER_TXPIE)
0177 #define LL_SPI_IER_DXPIE                           (SPI_IER_DXPIE)
0178 #define LL_SPI_IER_EOTIE                           (SPI_IER_EOTIE)
0179 #define LL_SPI_IER_TXTFIE                          (SPI_IER_TXTFIE)
0180 #define LL_SPI_IER_UDRIE                           (SPI_IER_UDRIE)
0181 #define LL_SPI_IER_OVRIE                           (SPI_IER_OVRIE)
0182 #define LL_SPI_IER_CRCEIE                          (SPI_IER_CRCEIE)
0183 #define LL_SPI_IER_TIFREIE                         (SPI_IER_TIFREIE)
0184 #define LL_SPI_IER_MODFIE                          (SPI_IER_MODFIE)
0185 #define LL_SPI_IER_TSERFIE                         (SPI_IER_TSERFIE)
0186 /**
0187   * @}
0188   */
0189 
0190 /** @defgroup SPI_LL_EC_MODE Mode
0191   * @ingroup RTEMSBSPsARMSTM32H7
0192   * @{
0193   */
0194 #define LL_SPI_MODE_MASTER                         (SPI_CFG2_MASTER)
0195 #define LL_SPI_MODE_SLAVE                          (0x00000000UL)
0196 /**
0197   * @}
0198   */
0199 
0200 /** @defgroup SPI_LL_EC_SS_LEVEL SS Level
0201   * @ingroup RTEMSBSPsARMSTM32H7
0202   * @{
0203   */
0204 #define LL_SPI_SS_LEVEL_HIGH                       (SPI_CR1_SSI)
0205 #define LL_SPI_SS_LEVEL_LOW                        (0x00000000UL)
0206 /**
0207   * @}
0208   */
0209 
0210 /** @defgroup SPI_LL_EC_SS_IDLENESS SS Idleness
0211   * @ingroup RTEMSBSPsARMSTM32H7
0212   * @{
0213   */
0214 #define LL_SPI_SS_IDLENESS_00CYCLE                 (0x00000000UL)
0215 #define LL_SPI_SS_IDLENESS_01CYCLE                 (SPI_CFG2_MSSI_0)
0216 #define LL_SPI_SS_IDLENESS_02CYCLE                 (SPI_CFG2_MSSI_1)
0217 #define LL_SPI_SS_IDLENESS_03CYCLE                 (SPI_CFG2_MSSI_0 | SPI_CFG2_MSSI_1)
0218 #define LL_SPI_SS_IDLENESS_04CYCLE                 (SPI_CFG2_MSSI_2)
0219 #define LL_SPI_SS_IDLENESS_05CYCLE                 (SPI_CFG2_MSSI_2 | SPI_CFG2_MSSI_0)
0220 #define LL_SPI_SS_IDLENESS_06CYCLE                 (SPI_CFG2_MSSI_2 | SPI_CFG2_MSSI_1)
0221 #define LL_SPI_SS_IDLENESS_07CYCLE                 (SPI_CFG2_MSSI_2 | SPI_CFG2_MSSI_1 | SPI_CFG2_MSSI_0)
0222 #define LL_SPI_SS_IDLENESS_08CYCLE                 (SPI_CFG2_MSSI_3)
0223 #define LL_SPI_SS_IDLENESS_09CYCLE                 (SPI_CFG2_MSSI_3 | SPI_CFG2_MSSI_0)
0224 #define LL_SPI_SS_IDLENESS_10CYCLE                 (SPI_CFG2_MSSI_3 | SPI_CFG2_MSSI_1)
0225 #define LL_SPI_SS_IDLENESS_11CYCLE                 (SPI_CFG2_MSSI_3 | SPI_CFG2_MSSI_1 | SPI_CFG2_MSSI_0)
0226 #define LL_SPI_SS_IDLENESS_12CYCLE                 (SPI_CFG2_MSSI_3 | SPI_CFG2_MSSI_2)
0227 #define LL_SPI_SS_IDLENESS_13CYCLE                 (SPI_CFG2_MSSI_3 | SPI_CFG2_MSSI_2 | SPI_CFG2_MSSI_0)
0228 #define LL_SPI_SS_IDLENESS_14CYCLE                 (SPI_CFG2_MSSI_3 | SPI_CFG2_MSSI_2 | SPI_CFG2_MSSI_1)
0229 #define LL_SPI_SS_IDLENESS_15CYCLE                 (SPI_CFG2_MSSI_3\
0230                                                     | SPI_CFG2_MSSI_2 | SPI_CFG2_MSSI_1 | SPI_CFG2_MSSI_0)
0231 /**
0232   * @}
0233   */
0234 
0235 /** @defgroup SPI_LL_EC_ID_IDLENESS Master Inter-Data Idleness
0236   * @ingroup RTEMSBSPsARMSTM32H7
0237   * @{
0238   */
0239 #define LL_SPI_ID_IDLENESS_00CYCLE                 (0x00000000UL)
0240 #define LL_SPI_ID_IDLENESS_01CYCLE                 (SPI_CFG2_MIDI_0)
0241 #define LL_SPI_ID_IDLENESS_02CYCLE                 (SPI_CFG2_MIDI_1)
0242 #define LL_SPI_ID_IDLENESS_03CYCLE                 (SPI_CFG2_MIDI_0 | SPI_CFG2_MIDI_1)
0243 #define LL_SPI_ID_IDLENESS_04CYCLE                 (SPI_CFG2_MIDI_2)
0244 #define LL_SPI_ID_IDLENESS_05CYCLE                 (SPI_CFG2_MIDI_2 | SPI_CFG2_MIDI_0)
0245 #define LL_SPI_ID_IDLENESS_06CYCLE                 (SPI_CFG2_MIDI_2 | SPI_CFG2_MIDI_1)
0246 #define LL_SPI_ID_IDLENESS_07CYCLE                 (SPI_CFG2_MIDI_2 | SPI_CFG2_MIDI_1 | SPI_CFG2_MIDI_0)
0247 #define LL_SPI_ID_IDLENESS_08CYCLE                 (SPI_CFG2_MIDI_3)
0248 #define LL_SPI_ID_IDLENESS_09CYCLE                 (SPI_CFG2_MIDI_3 | SPI_CFG2_MIDI_0)
0249 #define LL_SPI_ID_IDLENESS_10CYCLE                 (SPI_CFG2_MIDI_3 | SPI_CFG2_MIDI_1)
0250 #define LL_SPI_ID_IDLENESS_11CYCLE                 (SPI_CFG2_MIDI_3 | SPI_CFG2_MIDI_1 | SPI_CFG2_MIDI_0)
0251 #define LL_SPI_ID_IDLENESS_12CYCLE                 (SPI_CFG2_MIDI_3 | SPI_CFG2_MIDI_2)
0252 #define LL_SPI_ID_IDLENESS_13CYCLE                 (SPI_CFG2_MIDI_3 | SPI_CFG2_MIDI_2 | SPI_CFG2_MIDI_0)
0253 #define LL_SPI_ID_IDLENESS_14CYCLE                 (SPI_CFG2_MIDI_3 | SPI_CFG2_MIDI_2 | SPI_CFG2_MIDI_1)
0254 #define LL_SPI_ID_IDLENESS_15CYCLE                 (SPI_CFG2_MIDI_3\
0255                                                     | SPI_CFG2_MIDI_2 | SPI_CFG2_MIDI_1 | SPI_CFG2_MIDI_0)
0256 /**
0257   * @}
0258   */
0259 
0260 /** @defgroup SPI_LL_EC_TXCRCINIT_ALL TXCRC Init All
0261   * @ingroup RTEMSBSPsARMSTM32H7
0262   * @{
0263   */
0264 #define LL_SPI_TXCRCINIT_ALL_ZERO_PATTERN          (0x00000000UL)
0265 #define LL_SPI_TXCRCINIT_ALL_ONES_PATTERN          (SPI_CR1_TCRCINI)
0266 /**
0267   * @}
0268   */
0269 
0270 /** @defgroup SPI_LL_EC_RXCRCINIT_ALL RXCRC Init All
0271   * @ingroup RTEMSBSPsARMSTM32H7
0272   * @{
0273   */
0274 #define LL_SPI_RXCRCINIT_ALL_ZERO_PATTERN          (0x00000000UL)
0275 #define LL_SPI_RXCRCINIT_ALL_ONES_PATTERN          (SPI_CR1_RCRCINI)
0276 /**
0277   * @}
0278   */
0279 
0280 /** @defgroup SPI_LL_EC_UDR_CONFIG_REGISTER UDR Config Register
0281   * @ingroup RTEMSBSPsARMSTM32H7
0282   * @{
0283   */
0284 #define LL_SPI_UDR_CONFIG_REGISTER_PATTERN         (0x00000000UL)
0285 #define LL_SPI_UDR_CONFIG_LAST_RECEIVED            (SPI_CFG1_UDRCFG_0)
0286 #define LL_SPI_UDR_CONFIG_LAST_TRANSMITTED         (SPI_CFG1_UDRCFG_1)
0287 /**
0288   * @}
0289   */
0290 
0291 /** @defgroup SPI_LL_EC_UDR_DETECT_BEGIN_DATA UDR Detect Begin Data
0292   * @ingroup RTEMSBSPsARMSTM32H7
0293   * @{
0294   */
0295 #define LL_SPI_UDR_DETECT_BEGIN_DATA_FRAME         (0x00000000UL)
0296 #define LL_SPI_UDR_DETECT_END_DATA_FRAME           (SPI_CFG1_UDRDET_0)
0297 #define LL_SPI_UDR_DETECT_BEGIN_ACTIVE_NSS         (SPI_CFG1_UDRDET_1)
0298 /**
0299   * @}
0300   */
0301 
0302 /** @defgroup SPI_LL_EC_PROTOCOL Protocol
0303   * @ingroup RTEMSBSPsARMSTM32H7
0304   * @{
0305   */
0306 #define LL_SPI_PROTOCOL_MOTOROLA                   (0x00000000UL)
0307 #define LL_SPI_PROTOCOL_TI                         (SPI_CFG2_SP_0)
0308 /**
0309   * @}
0310   */
0311 
0312 /** @defgroup SPI_LL_EC_PHASE Phase
0313   * @ingroup RTEMSBSPsARMSTM32H7
0314   * @{
0315   */
0316 #define LL_SPI_PHASE_1EDGE                         (0x00000000UL)
0317 #define LL_SPI_PHASE_2EDGE                         (SPI_CFG2_CPHA)
0318 /**
0319   * @}
0320   */
0321 
0322 /** @defgroup SPI_LL_EC_POLARITY Polarity
0323   * @ingroup RTEMSBSPsARMSTM32H7
0324   * @{
0325   */
0326 #define LL_SPI_POLARITY_LOW                        (0x00000000UL)
0327 #define LL_SPI_POLARITY_HIGH                       (SPI_CFG2_CPOL)
0328 /**
0329   * @}
0330   */
0331 
0332 /** @defgroup SPI_LL_EC_NSS_POLARITY NSS Polarity
0333   * @ingroup RTEMSBSPsARMSTM32H7
0334   * @{
0335   */
0336 #define LL_SPI_NSS_POLARITY_LOW                    (0x00000000UL)
0337 #define LL_SPI_NSS_POLARITY_HIGH                   (SPI_CFG2_SSIOP)
0338 /**
0339   * @}
0340   */
0341 
0342 /** @defgroup SPI_LL_EC_BAUDRATEPRESCALER Baud Rate Prescaler
0343   * @ingroup RTEMSBSPsARMSTM32H7
0344   * @{
0345   */
0346 #define LL_SPI_BAUDRATEPRESCALER_DIV2              (0x00000000UL)
0347 #define LL_SPI_BAUDRATEPRESCALER_DIV4              (SPI_CFG1_MBR_0)
0348 #define LL_SPI_BAUDRATEPRESCALER_DIV8              (SPI_CFG1_MBR_1)
0349 #define LL_SPI_BAUDRATEPRESCALER_DIV16             (SPI_CFG1_MBR_1 | SPI_CFG1_MBR_0)
0350 #define LL_SPI_BAUDRATEPRESCALER_DIV32             (SPI_CFG1_MBR_2)
0351 #define LL_SPI_BAUDRATEPRESCALER_DIV64             (SPI_CFG1_MBR_2 | SPI_CFG1_MBR_0)
0352 #define LL_SPI_BAUDRATEPRESCALER_DIV128            (SPI_CFG1_MBR_2 | SPI_CFG1_MBR_1)
0353 #define LL_SPI_BAUDRATEPRESCALER_DIV256            (SPI_CFG1_MBR_2 | SPI_CFG1_MBR_1 | SPI_CFG1_MBR_0)
0354 /**
0355   * @}
0356   */
0357 
0358 /** @defgroup SPI_LL_EC_BIT_ORDER Bit Order
0359   * @ingroup RTEMSBSPsARMSTM32H7
0360   * @{
0361   */
0362 #define LL_SPI_LSB_FIRST                           (SPI_CFG2_LSBFRST)
0363 #define LL_SPI_MSB_FIRST                           (0x00000000UL)
0364 /**
0365   * @}
0366   */
0367 
0368 /** @defgroup SPI_LL_EC_TRANSFER_MODE Transfer Mode
0369   * @ingroup RTEMSBSPsARMSTM32H7
0370   * @{
0371   */
0372 #define LL_SPI_FULL_DUPLEX                         (0x00000000UL)
0373 #define LL_SPI_SIMPLEX_TX                          (SPI_CFG2_COMM_0)
0374 #define LL_SPI_SIMPLEX_RX                          (SPI_CFG2_COMM_1)
0375 #define LL_SPI_HALF_DUPLEX_RX                      (SPI_CFG2_COMM_0|SPI_CFG2_COMM_1)
0376 #define LL_SPI_HALF_DUPLEX_TX                      (SPI_CFG2_COMM_0|SPI_CFG2_COMM_1|SPI_CR1_HDDIR)
0377 /**
0378   * @}
0379   */
0380 
0381 /** @defgroup SPI_LL_EC_DATAWIDTH Data Width
0382   * @ingroup RTEMSBSPsARMSTM32H7
0383   * @{
0384   */
0385 #define LL_SPI_DATAWIDTH_4BIT                      (SPI_CFG1_DSIZE_0 | SPI_CFG1_DSIZE_1)
0386 #define LL_SPI_DATAWIDTH_5BIT                      (SPI_CFG1_DSIZE_2)
0387 #define LL_SPI_DATAWIDTH_6BIT                      (SPI_CFG1_DSIZE_2 | SPI_CFG1_DSIZE_0)
0388 #define LL_SPI_DATAWIDTH_7BIT                      (SPI_CFG1_DSIZE_2 | SPI_CFG1_DSIZE_1)
0389 #define LL_SPI_DATAWIDTH_8BIT                      (SPI_CFG1_DSIZE_2 | SPI_CFG1_DSIZE_1 | SPI_CFG1_DSIZE_0)
0390 #define LL_SPI_DATAWIDTH_9BIT                      (SPI_CFG1_DSIZE_3)
0391 #define LL_SPI_DATAWIDTH_10BIT                     (SPI_CFG1_DSIZE_3 | SPI_CFG1_DSIZE_0)
0392 #define LL_SPI_DATAWIDTH_11BIT                     (SPI_CFG1_DSIZE_3 | SPI_CFG1_DSIZE_1)
0393 #define LL_SPI_DATAWIDTH_12BIT                     (SPI_CFG1_DSIZE_3 | SPI_CFG1_DSIZE_1 | SPI_CFG1_DSIZE_0)
0394 #define LL_SPI_DATAWIDTH_13BIT                     (SPI_CFG1_DSIZE_3 | SPI_CFG1_DSIZE_2)
0395 #define LL_SPI_DATAWIDTH_14BIT                     (SPI_CFG1_DSIZE_3 | SPI_CFG1_DSIZE_2 | SPI_CFG1_DSIZE_0)
0396 #define LL_SPI_DATAWIDTH_15BIT                     (SPI_CFG1_DSIZE_3 | SPI_CFG1_DSIZE_2 | SPI_CFG1_DSIZE_1)
0397 #define LL_SPI_DATAWIDTH_16BIT                     (SPI_CFG1_DSIZE_3\
0398                                                     | SPI_CFG1_DSIZE_2 | SPI_CFG1_DSIZE_1 | SPI_CFG1_DSIZE_0)
0399 #define LL_SPI_DATAWIDTH_17BIT                     (SPI_CFG1_DSIZE_4)
0400 #define LL_SPI_DATAWIDTH_18BIT                     (SPI_CFG1_DSIZE_4 | SPI_CFG1_DSIZE_0)
0401 #define LL_SPI_DATAWIDTH_19BIT                     (SPI_CFG1_DSIZE_4 | SPI_CFG1_DSIZE_1)
0402 #define LL_SPI_DATAWIDTH_20BIT                     (SPI_CFG1_DSIZE_4 | SPI_CFG1_DSIZE_0 | SPI_CFG1_DSIZE_1)
0403 #define LL_SPI_DATAWIDTH_21BIT                     (SPI_CFG1_DSIZE_4 | SPI_CFG1_DSIZE_2)
0404 #define LL_SPI_DATAWIDTH_22BIT                     (SPI_CFG1_DSIZE_4 | SPI_CFG1_DSIZE_2 | SPI_CFG1_DSIZE_0)
0405 #define LL_SPI_DATAWIDTH_23BIT                     (SPI_CFG1_DSIZE_4 | SPI_CFG1_DSIZE_2 | SPI_CFG1_DSIZE_1)
0406 #define LL_SPI_DATAWIDTH_24BIT                     (SPI_CFG1_DSIZE_4\
0407                                                     | SPI_CFG1_DSIZE_2 | SPI_CFG1_DSIZE_1 | SPI_CFG1_DSIZE_0)
0408 #define LL_SPI_DATAWIDTH_25BIT                     (SPI_CFG1_DSIZE_4 | SPI_CFG1_DSIZE_3)
0409 #define LL_SPI_DATAWIDTH_26BIT                     (SPI_CFG1_DSIZE_4 | SPI_CFG1_DSIZE_3 | SPI_CFG1_DSIZE_0)
0410 #define LL_SPI_DATAWIDTH_27BIT                     (SPI_CFG1_DSIZE_4 | SPI_CFG1_DSIZE_3 | SPI_CFG1_DSIZE_1)
0411 #define LL_SPI_DATAWIDTH_28BIT                     (SPI_CFG1_DSIZE_4\
0412                                                     | SPI_CFG1_DSIZE_3 | SPI_CFG1_DSIZE_1 | SPI_CFG1_DSIZE_0)
0413 #define LL_SPI_DATAWIDTH_29BIT                     (SPI_CFG1_DSIZE_4 | SPI_CFG1_DSIZE_3 | SPI_CFG1_DSIZE_2)
0414 #define LL_SPI_DATAWIDTH_30BIT                     (SPI_CFG1_DSIZE_4\
0415                                                     | SPI_CFG1_DSIZE_3 | SPI_CFG1_DSIZE_2 | SPI_CFG1_DSIZE_0)
0416 #define LL_SPI_DATAWIDTH_31BIT                     (SPI_CFG1_DSIZE_4\
0417                                                     | SPI_CFG1_DSIZE_3 | SPI_CFG1_DSIZE_2 | SPI_CFG1_DSIZE_1)
0418 #define LL_SPI_DATAWIDTH_32BIT                     (SPI_CFG1_DSIZE_4 | SPI_CFG1_DSIZE_3\
0419                                                     | SPI_CFG1_DSIZE_2 | SPI_CFG1_DSIZE_1 | SPI_CFG1_DSIZE_0)
0420 /**
0421   * @}
0422   */
0423 
0424 /** @defgroup SPI_LL_EC_FIFO_TH FIFO Threshold
0425   * @ingroup RTEMSBSPsARMSTM32H7
0426   * @{
0427   */
0428 #define LL_SPI_FIFO_TH_01DATA                      (0x00000000UL)
0429 #define LL_SPI_FIFO_TH_02DATA                      (SPI_CFG1_FTHLV_0)
0430 #define LL_SPI_FIFO_TH_03DATA                      (SPI_CFG1_FTHLV_1)
0431 #define LL_SPI_FIFO_TH_04DATA                      (SPI_CFG1_FTHLV_0 | SPI_CFG1_FTHLV_1)
0432 #define LL_SPI_FIFO_TH_05DATA                      (SPI_CFG1_FTHLV_2)
0433 #define LL_SPI_FIFO_TH_06DATA                      (SPI_CFG1_FTHLV_2 | SPI_CFG1_FTHLV_0)
0434 #define LL_SPI_FIFO_TH_07DATA                      (SPI_CFG1_FTHLV_2 | SPI_CFG1_FTHLV_1)
0435 #define LL_SPI_FIFO_TH_08DATA                      (SPI_CFG1_FTHLV_2 | SPI_CFG1_FTHLV_1 | SPI_CFG1_FTHLV_0)
0436 #define LL_SPI_FIFO_TH_09DATA                      (SPI_CFG1_FTHLV_3)
0437 #define LL_SPI_FIFO_TH_10DATA                      (SPI_CFG1_FTHLV_3 | SPI_CFG1_FTHLV_0)
0438 #define LL_SPI_FIFO_TH_11DATA                      (SPI_CFG1_FTHLV_3 | SPI_CFG1_FTHLV_1)
0439 #define LL_SPI_FIFO_TH_12DATA                      (SPI_CFG1_FTHLV_3 | SPI_CFG1_FTHLV_1 | SPI_CFG1_FTHLV_0)
0440 #define LL_SPI_FIFO_TH_13DATA                      (SPI_CFG1_FTHLV_3 | SPI_CFG1_FTHLV_2)
0441 #define LL_SPI_FIFO_TH_14DATA                      (SPI_CFG1_FTHLV_3 | SPI_CFG1_FTHLV_2 | SPI_CFG1_FTHLV_0)
0442 #define LL_SPI_FIFO_TH_15DATA                      (SPI_CFG1_FTHLV_3 | SPI_CFG1_FTHLV_2 | SPI_CFG1_FTHLV_1)
0443 #define LL_SPI_FIFO_TH_16DATA                      (SPI_CFG1_FTHLV_3\
0444                                                     | SPI_CFG1_FTHLV_2 | SPI_CFG1_FTHLV_1 | SPI_CFG1_FTHLV_0)
0445 /**
0446   * @}
0447   */
0448 
0449 #if defined(USE_FULL_LL_DRIVER) || defined(__rtems__)
0450 
0451 /** @defgroup SPI_LL_EC_CRC_CALCULATION CRC Calculation
0452   * @ingroup RTEMSBSPsARMSTM32H7
0453   * @{
0454   */
0455 #define LL_SPI_CRCCALCULATION_DISABLE              (0x00000000UL)            /*!< CRC calculation disabled */
0456 #define LL_SPI_CRCCALCULATION_ENABLE               (SPI_CFG1_CRCEN)          /*!< CRC calculation enabled  */
0457 /**
0458   * @}
0459   */
0460 #endif /* USE_FULL_LL_DRIVER */
0461 
0462 /** @defgroup SPI_LL_EC_CRC CRC
0463   * @ingroup RTEMSBSPsARMSTM32H7
0464   * @{
0465   */
0466 #define LL_SPI_CRC_4BIT                            (SPI_CFG1_CRCSIZE_0 | SPI_CFG1_CRCSIZE_1)
0467 #define LL_SPI_CRC_5BIT                            (SPI_CFG1_CRCSIZE_2)
0468 #define LL_SPI_CRC_6BIT                            (SPI_CFG1_CRCSIZE_2 | SPI_CFG1_CRCSIZE_0)
0469 #define LL_SPI_CRC_7BIT                            (SPI_CFG1_CRCSIZE_2 | SPI_CFG1_CRCSIZE_1)
0470 #define LL_SPI_CRC_8BIT                            (SPI_CFG1_CRCSIZE_2 | SPI_CFG1_CRCSIZE_1 | SPI_CFG1_CRCSIZE_0)
0471 #define LL_SPI_CRC_9BIT                            (SPI_CFG1_CRCSIZE_3)
0472 #define LL_SPI_CRC_10BIT                           (SPI_CFG1_CRCSIZE_3 | SPI_CFG1_CRCSIZE_0)
0473 #define LL_SPI_CRC_11BIT                           (SPI_CFG1_CRCSIZE_3 | SPI_CFG1_CRCSIZE_1)
0474 #define LL_SPI_CRC_12BIT                           (SPI_CFG1_CRCSIZE_3 | SPI_CFG1_CRCSIZE_1 | SPI_CFG1_CRCSIZE_0)
0475 #define LL_SPI_CRC_13BIT                           (SPI_CFG1_CRCSIZE_3 | SPI_CFG1_CRCSIZE_2)
0476 #define LL_SPI_CRC_14BIT                           (SPI_CFG1_CRCSIZE_3 | SPI_CFG1_CRCSIZE_2 | SPI_CFG1_CRCSIZE_0)
0477 #define LL_SPI_CRC_15BIT                           (SPI_CFG1_CRCSIZE_3 | SPI_CFG1_CRCSIZE_2 | SPI_CFG1_CRCSIZE_1)
0478 #define LL_SPI_CRC_16BIT                           (SPI_CFG1_CRCSIZE_3\
0479                                                     | SPI_CFG1_CRCSIZE_2 | SPI_CFG1_CRCSIZE_1 | SPI_CFG1_CRCSIZE_0)
0480 #define LL_SPI_CRC_17BIT                           (SPI_CFG1_CRCSIZE_4)
0481 #define LL_SPI_CRC_18BIT                           (SPI_CFG1_CRCSIZE_4 | SPI_CFG1_CRCSIZE_0)
0482 #define LL_SPI_CRC_19BIT                           (SPI_CFG1_CRCSIZE_4 | SPI_CFG1_CRCSIZE_1)
0483 #define LL_SPI_CRC_20BIT                           (SPI_CFG1_CRCSIZE_4 | SPI_CFG1_CRCSIZE_0 | SPI_CFG1_CRCSIZE_1)
0484 #define LL_SPI_CRC_21BIT                           (SPI_CFG1_CRCSIZE_4 | SPI_CFG1_CRCSIZE_2)
0485 #define LL_SPI_CRC_22BIT                           (SPI_CFG1_CRCSIZE_4 | SPI_CFG1_CRCSIZE_2 | SPI_CFG1_CRCSIZE_0)
0486 #define LL_SPI_CRC_23BIT                           (SPI_CFG1_CRCSIZE_4 | SPI_CFG1_CRCSIZE_2 | SPI_CFG1_CRCSIZE_1)
0487 #define LL_SPI_CRC_24BIT                           (SPI_CFG1_CRCSIZE_4\
0488                                                     | SPI_CFG1_CRCSIZE_2 | SPI_CFG1_CRCSIZE_1 | SPI_CFG1_CRCSIZE_0)
0489 #define LL_SPI_CRC_25BIT                           (SPI_CFG1_CRCSIZE_4 | SPI_CFG1_CRCSIZE_3)
0490 #define LL_SPI_CRC_26BIT                           (SPI_CFG1_CRCSIZE_4 | SPI_CFG1_CRCSIZE_3 | SPI_CFG1_CRCSIZE_0)
0491 #define LL_SPI_CRC_27BIT                           (SPI_CFG1_CRCSIZE_4 | SPI_CFG1_CRCSIZE_3 | SPI_CFG1_CRCSIZE_1)
0492 #define LL_SPI_CRC_28BIT                           (SPI_CFG1_CRCSIZE_4\
0493                                                     | SPI_CFG1_CRCSIZE_3 | SPI_CFG1_CRCSIZE_1 | SPI_CFG1_CRCSIZE_0)
0494 #define LL_SPI_CRC_29BIT                           (SPI_CFG1_CRCSIZE_4 | SPI_CFG1_CRCSIZE_3 | SPI_CFG1_CRCSIZE_2)
0495 #define LL_SPI_CRC_30BIT                           (SPI_CFG1_CRCSIZE_4\
0496                                                     | SPI_CFG1_CRCSIZE_3 | SPI_CFG1_CRCSIZE_2 | SPI_CFG1_CRCSIZE_0)
0497 #define LL_SPI_CRC_31BIT                           (SPI_CFG1_CRCSIZE_4\
0498                                                     | SPI_CFG1_CRCSIZE_3 | SPI_CFG1_CRCSIZE_2 | SPI_CFG1_CRCSIZE_1)
0499 #define LL_SPI_CRC_32BIT                           (SPI_CFG1_CRCSIZE_4 | SPI_CFG1_CRCSIZE_3\
0500                                                     | SPI_CFG1_CRCSIZE_2 | SPI_CFG1_CRCSIZE_1 | SPI_CFG1_CRCSIZE_0)
0501 /**
0502   * @}
0503   */
0504 
0505 /** @defgroup SPI_LL_EC_NSS_MODE NSS Mode
0506   * @ingroup RTEMSBSPsARMSTM32H7
0507   * @{
0508   */
0509 #define LL_SPI_NSS_SOFT                            (SPI_CFG2_SSM)
0510 #define LL_SPI_NSS_HARD_INPUT                      (0x00000000UL)
0511 #define LL_SPI_NSS_HARD_OUTPUT                     (SPI_CFG2_SSOE)
0512 /**
0513   * @}
0514   */
0515 
0516 /** @defgroup SPI_LL_EC_RX_FIFO RxFIFO Packing LeVel
0517   * @ingroup RTEMSBSPsARMSTM32H7
0518   * @{
0519   */
0520 #define LL_SPI_RX_FIFO_0PACKET               (0x00000000UL)    /* 0 or multiple of 4 packet available is the RxFIFO */
0521 #define LL_SPI_RX_FIFO_1PACKET               (SPI_SR_RXPLVL_0)
0522 #define LL_SPI_RX_FIFO_2PACKET               (SPI_SR_RXPLVL_1)
0523 #define LL_SPI_RX_FIFO_3PACKET               (SPI_SR_RXPLVL_1 | SPI_SR_RXPLVL_0)
0524 /**
0525   * @}
0526   */
0527 
0528 /**
0529   * @}
0530   */
0531 
0532 /* Exported macro ------------------------------------------------------------*/
0533 /** @defgroup SPI_LL_Exported_Macros SPI Exported Macros
0534   * @ingroup RTEMSBSPsARMSTM32H7
0535   * @{
0536   */
0537 
0538 /** @defgroup SPI_LL_EM_WRITE_READ Common Write and read registers Macros
0539   * @ingroup RTEMSBSPsARMSTM32H7
0540   * @{
0541   */
0542 
0543 /**
0544   * @brief  Write a value in SPI register
0545   * @param  __INSTANCE__ SPI Instance
0546   * @param  __REG__ Register to be written
0547   * @param  __VALUE__ Value to be written in the register
0548   * @retval None
0549   */
0550 #define LL_SPI_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, (__VALUE__))
0551 
0552 /**
0553   * @brief  Read a value in SPI register
0554   * @param  __INSTANCE__ SPI Instance
0555   * @param  __REG__ Register to be read
0556   * @retval Register value
0557   */
0558 #define LL_SPI_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__)
0559 /**
0560   * @}
0561   */
0562 
0563 /**
0564   * @}
0565   */
0566 
0567 
0568 /* Exported functions --------------------------------------------------------*/
0569 
0570 /** @defgroup SPI_LL_Exported_Functions SPI Exported Functions
0571   * @ingroup RTEMSBSPsARMSTM32H7
0572   * @{
0573   */
0574 
0575 /** @defgroup SPI_LL_EF_Configuration Configuration
0576   * @ingroup RTEMSBSPsARMSTM32H7
0577   * @{
0578   */
0579 
0580 /**
0581   * @brief  Enable SPI peripheral
0582   * @rmtoll CR1          SPE           LL_SPI_Enable
0583   * @param  SPIx SPI Instance
0584   * @retval None
0585   */
0586 __STATIC_INLINE void LL_SPI_Enable(SPI_TypeDef *SPIx)
0587 {
0588   SET_BIT(SPIx->CR1, SPI_CR1_SPE);
0589 }
0590 
0591 /**
0592   * @brief  Disable SPI peripheral
0593   * @note   When disabling the SPI, follow the procedure described in the Reference Manual.
0594   * @rmtoll CR1          SPE           LL_SPI_Disable
0595   * @param  SPIx SPI Instance
0596   * @retval None
0597   */
0598 __STATIC_INLINE void LL_SPI_Disable(SPI_TypeDef *SPIx)
0599 {
0600   CLEAR_BIT(SPIx->CR1, SPI_CR1_SPE);
0601 }
0602 
0603 /**
0604   * @brief  Check if SPI peripheral is enabled
0605   * @rmtoll CR1          SPE           LL_SPI_IsEnabled
0606   * @param  SPIx SPI Instance
0607   * @retval State of bit (1 or 0)
0608   */
0609 __STATIC_INLINE uint32_t LL_SPI_IsEnabled(const SPI_TypeDef *SPIx)
0610 {
0611   return ((READ_BIT(SPIx->CR1, SPI_CR1_SPE) == (SPI_CR1_SPE)) ? 1UL : 0UL);
0612 }
0613 
0614 /**
0615   * @brief  Swap the MOSI and MISO pin
0616   * @note   This configuration can not be changed when SPI is enabled.
0617   * @rmtoll CFG2         IOSWP         LL_SPI_EnableIOSwap
0618   * @param  SPIx SPI Instance
0619   * @retval None
0620   */
0621 __STATIC_INLINE void LL_SPI_EnableIOSwap(SPI_TypeDef *SPIx)
0622 {
0623   SET_BIT(SPIx->CFG2, SPI_CFG2_IOSWP);
0624 }
0625 
0626 /**
0627   * @brief  Restore default function for MOSI and MISO pin
0628   * @note   This configuration can not be changed when SPI is enabled.
0629   * @rmtoll CFG2         IOSWP         LL_SPI_DisableIOSwap
0630   * @param  SPIx SPI Instance
0631   * @retval None
0632   */
0633 __STATIC_INLINE void LL_SPI_DisableIOSwap(SPI_TypeDef *SPIx)
0634 {
0635   CLEAR_BIT(SPIx->CFG2, SPI_CFG2_IOSWP);
0636 }
0637 
0638 /**
0639   * @brief  Check if MOSI and MISO pin are swapped
0640   * @rmtoll CFG2         IOSWP         LL_SPI_IsEnabledIOSwap
0641   * @param  SPIx SPI Instance
0642   * @retval State of bit (1 or 0)
0643   */
0644 __STATIC_INLINE uint32_t LL_SPI_IsEnabledIOSwap(const SPI_TypeDef *SPIx)
0645 {
0646   return ((READ_BIT(SPIx->CFG2, SPI_CFG2_IOSWP) == (SPI_CFG2_IOSWP)) ? 1UL : 0UL);
0647 }
0648 
0649 /**
0650   * @brief  Enable GPIO control
0651   * @note   This configuration can not be changed when SPI is enabled.
0652   * @rmtoll CFG2         AFCNTR        LL_SPI_EnableGPIOControl
0653   * @param  SPIx SPI Instance
0654   * @retval None
0655   */
0656 __STATIC_INLINE void LL_SPI_EnableGPIOControl(SPI_TypeDef *SPIx)
0657 {
0658   SET_BIT(SPIx->CFG2, SPI_CFG2_AFCNTR);
0659 }
0660 
0661 /**
0662   * @brief  Disable GPIO control
0663   * @note   This configuration can not be changed when SPI is enabled.
0664   * @rmtoll CFG2         AFCNTR        LL_SPI_DisableGPIOControl
0665   * @param  SPIx SPI Instance
0666   * @retval None
0667   */
0668 __STATIC_INLINE void LL_SPI_DisableGPIOControl(SPI_TypeDef *SPIx)
0669 {
0670   CLEAR_BIT(SPIx->CFG2, SPI_CFG2_AFCNTR);
0671 }
0672 
0673 /**
0674   * @brief  Check if GPIO control is active
0675   * @rmtoll CFG2         AFCNTR        LL_SPI_IsEnabledGPIOControl
0676   * @param  SPIx SPI Instance
0677   * @retval State of bit (1 or 0)
0678   */
0679 __STATIC_INLINE uint32_t LL_SPI_IsEnabledGPIOControl(const SPI_TypeDef *SPIx)
0680 {
0681   return ((READ_BIT(SPIx->CFG2, SPI_CFG2_AFCNTR) == (SPI_CFG2_AFCNTR)) ? 1UL : 0UL);
0682 }
0683 
0684 /**
0685   * @brief  Set SPI Mode to Master or Slave
0686   * @note   This configuration can not be changed when SPI is enabled.
0687   * @rmtoll CFG2         MASTER        LL_SPI_SetMode
0688   * @param  SPIx SPI Instance
0689   * @param  Mode This parameter can be one of the following values:
0690   *         @arg @ref LL_SPI_MODE_MASTER
0691   *         @arg @ref LL_SPI_MODE_SLAVE
0692   * @retval None
0693   */
0694 __STATIC_INLINE void LL_SPI_SetMode(SPI_TypeDef *SPIx, uint32_t Mode)
0695 {
0696   MODIFY_REG(SPIx->CFG2, SPI_CFG2_MASTER, Mode);
0697 }
0698 
0699 /**
0700   * @brief  Get SPI Mode (Master or Slave)
0701   * @rmtoll CFG2         MASTER        LL_SPI_GetMode
0702   * @param  SPIx SPI Instance
0703   * @retval Returned value can be one of the following values:
0704   *         @arg @ref LL_SPI_MODE_MASTER
0705   *         @arg @ref LL_SPI_MODE_SLAVE
0706   */
0707 __STATIC_INLINE uint32_t LL_SPI_GetMode(const SPI_TypeDef *SPIx)
0708 {
0709   return (uint32_t)(READ_BIT(SPIx->CFG2, SPI_CFG2_MASTER));
0710 }
0711 
0712 /**
0713   * @brief  Configure the Idleness applied by master between active edge of SS and first send data
0714   * @rmtoll CFG2         MSSI          LL_SPI_SetMasterSSIdleness
0715   * @param  SPIx SPI Instance
0716   * @param  MasterSSIdleness This parameter can be one of the following values:
0717   *         @arg @ref LL_SPI_SS_IDLENESS_00CYCLE
0718   *         @arg @ref LL_SPI_SS_IDLENESS_01CYCLE
0719   *         @arg @ref LL_SPI_SS_IDLENESS_02CYCLE
0720   *         @arg @ref LL_SPI_SS_IDLENESS_03CYCLE
0721   *         @arg @ref LL_SPI_SS_IDLENESS_04CYCLE
0722   *         @arg @ref LL_SPI_SS_IDLENESS_05CYCLE
0723   *         @arg @ref LL_SPI_SS_IDLENESS_06CYCLE
0724   *         @arg @ref LL_SPI_SS_IDLENESS_07CYCLE
0725   *         @arg @ref LL_SPI_SS_IDLENESS_08CYCLE
0726   *         @arg @ref LL_SPI_SS_IDLENESS_09CYCLE
0727   *         @arg @ref LL_SPI_SS_IDLENESS_10CYCLE
0728   *         @arg @ref LL_SPI_SS_IDLENESS_11CYCLE
0729   *         @arg @ref LL_SPI_SS_IDLENESS_12CYCLE
0730   *         @arg @ref LL_SPI_SS_IDLENESS_13CYCLE
0731   *         @arg @ref LL_SPI_SS_IDLENESS_14CYCLE
0732   *         @arg @ref LL_SPI_SS_IDLENESS_15CYCLE
0733   * @retval None
0734   */
0735 __STATIC_INLINE void LL_SPI_SetMasterSSIdleness(SPI_TypeDef *SPIx, uint32_t MasterSSIdleness)
0736 {
0737   MODIFY_REG(SPIx->CFG2, SPI_CFG2_MSSI, MasterSSIdleness);
0738 }
0739 
0740 /**
0741   * @brief  Get the configured Idleness applied by master
0742   * @rmtoll CFG2         MSSI          LL_SPI_GetMasterSSIdleness
0743   * @param  SPIx SPI Instance
0744   * @retval Returned value can be one of the following values:
0745   *         @arg @ref LL_SPI_SS_IDLENESS_00CYCLE
0746   *         @arg @ref LL_SPI_SS_IDLENESS_01CYCLE
0747   *         @arg @ref LL_SPI_SS_IDLENESS_02CYCLE
0748   *         @arg @ref LL_SPI_SS_IDLENESS_03CYCLE
0749   *         @arg @ref LL_SPI_SS_IDLENESS_04CYCLE
0750   *         @arg @ref LL_SPI_SS_IDLENESS_05CYCLE
0751   *         @arg @ref LL_SPI_SS_IDLENESS_06CYCLE
0752   *         @arg @ref LL_SPI_SS_IDLENESS_07CYCLE
0753   *         @arg @ref LL_SPI_SS_IDLENESS_08CYCLE
0754   *         @arg @ref LL_SPI_SS_IDLENESS_09CYCLE
0755   *         @arg @ref LL_SPI_SS_IDLENESS_10CYCLE
0756   *         @arg @ref LL_SPI_SS_IDLENESS_11CYCLE
0757   *         @arg @ref LL_SPI_SS_IDLENESS_12CYCLE
0758   *         @arg @ref LL_SPI_SS_IDLENESS_13CYCLE
0759   *         @arg @ref LL_SPI_SS_IDLENESS_14CYCLE
0760   *         @arg @ref LL_SPI_SS_IDLENESS_15CYCLE
0761   */
0762 __STATIC_INLINE uint32_t LL_SPI_GetMasterSSIdleness(const SPI_TypeDef *SPIx)
0763 {
0764   return (uint32_t)(READ_BIT(SPIx->CFG2, SPI_CFG2_MSSI));
0765 }
0766 
0767 /**
0768   * @brief  Configure the idleness applied by master between data frame
0769   * @rmtoll CFG2         MIDI          LL_SPI_SetInterDataIdleness
0770   * @param  SPIx SPI Instance
0771   * @param  MasterInterDataIdleness This parameter can be one of the following values:
0772   *         @arg @ref LL_SPI_ID_IDLENESS_00CYCLE
0773   *         @arg @ref LL_SPI_ID_IDLENESS_01CYCLE
0774   *         @arg @ref LL_SPI_ID_IDLENESS_02CYCLE
0775   *         @arg @ref LL_SPI_ID_IDLENESS_03CYCLE
0776   *         @arg @ref LL_SPI_ID_IDLENESS_04CYCLE
0777   *         @arg @ref LL_SPI_ID_IDLENESS_05CYCLE
0778   *         @arg @ref LL_SPI_ID_IDLENESS_06CYCLE
0779   *         @arg @ref LL_SPI_ID_IDLENESS_07CYCLE
0780   *         @arg @ref LL_SPI_ID_IDLENESS_08CYCLE
0781   *         @arg @ref LL_SPI_ID_IDLENESS_09CYCLE
0782   *         @arg @ref LL_SPI_ID_IDLENESS_10CYCLE
0783   *         @arg @ref LL_SPI_ID_IDLENESS_11CYCLE
0784   *         @arg @ref LL_SPI_ID_IDLENESS_12CYCLE
0785   *         @arg @ref LL_SPI_ID_IDLENESS_13CYCLE
0786   *         @arg @ref LL_SPI_ID_IDLENESS_14CYCLE
0787   *         @arg @ref LL_SPI_ID_IDLENESS_15CYCLE
0788   * @retval None
0789   */
0790 __STATIC_INLINE void LL_SPI_SetInterDataIdleness(SPI_TypeDef *SPIx, uint32_t MasterInterDataIdleness)
0791 {
0792   MODIFY_REG(SPIx->CFG2, SPI_CFG2_MIDI, MasterInterDataIdleness);
0793 }
0794 
0795 /**
0796   * @brief  Get the configured inter data idleness
0797   * @rmtoll CFG2         MIDI          LL_SPI_SetInterDataIdleness
0798   * @param  SPIx SPI Instance
0799   * @retval Returned value can be one of the following values:
0800   *         @arg @ref LL_SPI_ID_IDLENESS_00CYCLE
0801   *         @arg @ref LL_SPI_ID_IDLENESS_01CYCLE
0802   *         @arg @ref LL_SPI_ID_IDLENESS_02CYCLE
0803   *         @arg @ref LL_SPI_ID_IDLENESS_03CYCLE
0804   *         @arg @ref LL_SPI_ID_IDLENESS_04CYCLE
0805   *         @arg @ref LL_SPI_ID_IDLENESS_05CYCLE
0806   *         @arg @ref LL_SPI_ID_IDLENESS_06CYCLE
0807   *         @arg @ref LL_SPI_ID_IDLENESS_07CYCLE
0808   *         @arg @ref LL_SPI_ID_IDLENESS_08CYCLE
0809   *         @arg @ref LL_SPI_ID_IDLENESS_09CYCLE
0810   *         @arg @ref LL_SPI_ID_IDLENESS_10CYCLE
0811   *         @arg @ref LL_SPI_ID_IDLENESS_11CYCLE
0812   *         @arg @ref LL_SPI_ID_IDLENESS_12CYCLE
0813   *         @arg @ref LL_SPI_ID_IDLENESS_13CYCLE
0814   *         @arg @ref LL_SPI_ID_IDLENESS_14CYCLE
0815   *         @arg @ref LL_SPI_ID_IDLENESS_15CYCLE
0816   */
0817 __STATIC_INLINE uint32_t LL_SPI_GetInterDataIdleness(const SPI_TypeDef *SPIx)
0818 {
0819   return (uint32_t)(READ_BIT(SPIx->CFG2, SPI_CFG2_MIDI));
0820 }
0821 
0822 /**
0823   * @brief  Set transfer size
0824   * @note    Count is the number of frame to be transferred
0825   * @rmtoll CR2          TSIZE         LL_SPI_SetTransferSize
0826   * @param  SPIx SPI Instance
0827   * @param  Count 0..0xFFFF
0828   * @retval None
0829   */
0830 __STATIC_INLINE void LL_SPI_SetTransferSize(SPI_TypeDef *SPIx, uint32_t Count)
0831 {
0832   MODIFY_REG(SPIx->CR2, SPI_CR2_TSIZE, Count);
0833 }
0834 
0835 /**
0836   * @brief  Get transfer size
0837   * @note    Count is the number of frame to be transferred
0838   * @rmtoll CR2          TSIZE         LL_SPI_GetTransferSize
0839   * @param  SPIx SPI Instance
0840   * @retval 0..0xFFFF
0841   */
0842 __STATIC_INLINE uint32_t LL_SPI_GetTransferSize(const SPI_TypeDef *SPIx)
0843 {
0844   return (uint32_t)(READ_BIT(SPIx->CR2, SPI_CR2_TSIZE));
0845 }
0846 
0847 /**
0848   * @brief  Set reload transfer size
0849   * @note    Count is the number of frame to be transferred
0850   * @rmtoll CR2          TSER          LL_SPI_SetReloadSize
0851   * @param  SPIx SPI Instance
0852   * @param  Count 0..0xFFFF
0853   * @retval None
0854   */
0855 __STATIC_INLINE void LL_SPI_SetReloadSize(SPI_TypeDef *SPIx, uint32_t Count)
0856 {
0857   MODIFY_REG(SPIx->CR2, SPI_CR2_TSER, Count << SPI_CR2_TSER_Pos);
0858 }
0859 
0860 /**
0861   * @brief  Get reload transfer size
0862   * @note    Count is the number of frame to be transferred
0863   * @rmtoll CR2          TSER          LL_SPI_GetReloadSize
0864   * @param  SPIx SPI Instance
0865   * @retval 0..0xFFFF
0866   */
0867 __STATIC_INLINE uint32_t LL_SPI_GetReloadSize(const SPI_TypeDef *SPIx)
0868 {
0869   return (uint32_t)(READ_BIT(SPIx->CR2, SPI_CR2_TSER) >> SPI_CR2_TSER_Pos);
0870 }
0871 
0872 /**
0873   * @brief  Lock the AF configuration of associated IOs
0874   * @note   Once this bit is set, the AF configuration remains locked until a hardware reset occurs.
0875   *         the reset of the IOLock bit is done by hardware. for that, LL_SPI_DisableIOLock can not exist.
0876   * @rmtoll CR1          IOLOCK        LL_SPI_EnableIOLock
0877   * @param  SPIx SPI Instance
0878   * @retval None
0879   */
0880 __STATIC_INLINE void LL_SPI_EnableIOLock(SPI_TypeDef *SPIx)
0881 {
0882   SET_BIT(SPIx->CR1, SPI_CR1_IOLOCK);
0883 }
0884 
0885 /**
0886   * @brief  Check if the AF configuration is locked.
0887   * @rmtoll CR1          IOLOCK        LL_SPI_IsEnabledIOLock
0888   * @param  SPIx SPI Instance
0889   * @retval State of bit (1 or 0)
0890   */
0891 __STATIC_INLINE uint32_t LL_SPI_IsEnabledIOLock(const SPI_TypeDef *SPIx)
0892 {
0893   return ((READ_BIT(SPIx->CR1, SPI_CR1_IOLOCK) == (SPI_CR1_IOLOCK)) ? 1UL : 0UL);
0894 }
0895 
0896 /**
0897   * @brief  Set Tx CRC Initialization Pattern
0898   * @rmtoll CR1          TCRCINI         LL_SPI_SetTxCRCInitPattern
0899   * @param  SPIx SPI Instance
0900   * @param  TXCRCInitAll This parameter can be one of the following values:
0901   *         @arg @ref LL_SPI_TXCRCINIT_ALL_ZERO_PATTERN
0902   *         @arg @ref LL_SPI_TXCRCINIT_ALL_ONES_PATTERN
0903   * @retval None
0904   */
0905 __STATIC_INLINE void LL_SPI_SetTxCRCInitPattern(SPI_TypeDef *SPIx, uint32_t TXCRCInitAll)
0906 {
0907   MODIFY_REG(SPIx->CR1, SPI_CR1_TCRCINI, TXCRCInitAll);
0908 }
0909 
0910 /**
0911   * @brief  Get Tx CRC Initialization Pattern
0912   * @rmtoll CR1          TCRCINI         LL_SPI_GetTxCRCInitPattern
0913   * @param  SPIx SPI Instance
0914   * @retval Returned value can be one of the following values:
0915   *         @arg @ref LL_SPI_TXCRCINIT_ALL_ZERO_PATTERN
0916   *         @arg @ref LL_SPI_TXCRCINIT_ALL_ONES_PATTERN
0917   */
0918 __STATIC_INLINE uint32_t LL_SPI_GetTxCRCInitPattern(const SPI_TypeDef *SPIx)
0919 {
0920   return (uint32_t)(READ_BIT(SPIx->CR1, SPI_CR1_TCRCINI));
0921 }
0922 
0923 /**
0924   * @brief  Set Rx CRC Initialization Pattern
0925   * @rmtoll CR1          RCRCINI         LL_SPI_SetRxCRCInitPattern
0926   * @param  SPIx SPI Instance
0927   * @param  RXCRCInitAll This parameter can be one of the following values:
0928   *         @arg @ref LL_SPI_RXCRCINIT_ALL_ZERO_PATTERN
0929   *         @arg @ref LL_SPI_RXCRCINIT_ALL_ONES_PATTERN
0930   * @retval None
0931   */
0932 __STATIC_INLINE void LL_SPI_SetRxCRCInitPattern(SPI_TypeDef *SPIx, uint32_t RXCRCInitAll)
0933 {
0934   MODIFY_REG(SPIx->CR1, SPI_CR1_RCRCINI, RXCRCInitAll);
0935 }
0936 
0937 /**
0938   * @brief  Get Rx CRC Initialization Pattern
0939   * @rmtoll CR1          RCRCINI         LL_SPI_GetRxCRCInitPattern
0940   * @param  SPIx SPI Instance
0941   * @retval Returned value can be one of the following values:
0942   *         @arg @ref LL_SPI_RXCRCINIT_ALL_ZERO_PATTERN
0943   *         @arg @ref LL_SPI_RXCRCINIT_ALL_ONES_PATTERN
0944   */
0945 __STATIC_INLINE uint32_t LL_SPI_GetRxCRCInitPattern(const SPI_TypeDef *SPIx)
0946 {
0947   return (uint32_t)(READ_BIT(SPIx->CR1, SPI_CR1_RCRCINI));
0948 }
0949 
0950 /**
0951   * @brief  Set internal SS input level ignoring what comes from PIN.
0952   * @note   This configuration has effect only with config LL_SPI_NSS_SOFT
0953   * @rmtoll CR1          SSI           LL_SPI_SetInternalSSLevel
0954   * @param  SPIx SPI Instance
0955   * @param  SSLevel This parameter can be one of the following values:
0956   *         @arg @ref LL_SPI_SS_LEVEL_HIGH
0957   *         @arg @ref LL_SPI_SS_LEVEL_LOW
0958   * @retval None
0959   */
0960 __STATIC_INLINE void LL_SPI_SetInternalSSLevel(SPI_TypeDef *SPIx, uint32_t SSLevel)
0961 {
0962   MODIFY_REG(SPIx->CR1, SPI_CR1_SSI, SSLevel);
0963 }
0964 
0965 /**
0966   * @brief  Get internal SS input level
0967   * @rmtoll CR1          SSI           LL_SPI_GetInternalSSLevel
0968   * @param  SPIx SPI Instance
0969   * @retval Returned value can be one of the following values:
0970   *         @arg @ref LL_SPI_SS_LEVEL_HIGH
0971   *         @arg @ref LL_SPI_SS_LEVEL_LOW
0972   */
0973 __STATIC_INLINE uint32_t LL_SPI_GetInternalSSLevel(const SPI_TypeDef *SPIx)
0974 {
0975   return (uint32_t)(READ_BIT(SPIx->CR1, SPI_CR1_SSI));
0976 }
0977 
0978 /**
0979   * @brief  Enable CRC computation on 33/17 bits
0980   * @rmtoll CR1          CRC33_17      LL_SPI_EnableFullSizeCRC
0981   * @param  SPIx SPI Instance
0982   * @retval None
0983   */
0984 __STATIC_INLINE void LL_SPI_EnableFullSizeCRC(SPI_TypeDef *SPIx)
0985 {
0986   SET_BIT(SPIx->CR1, SPI_CR1_CRC33_17);
0987 }
0988 
0989 /**
0990   * @brief  Disable CRC computation on 33/17 bits
0991   * @rmtoll CR1          CRC33_17      LL_SPI_DisableFullSizeCRC
0992   * @param  SPIx SPI Instance
0993   * @retval None
0994   */
0995 __STATIC_INLINE void LL_SPI_DisableFullSizeCRC(SPI_TypeDef *SPIx)
0996 {
0997   CLEAR_BIT(SPIx->CR1, SPI_CR1_CRC33_17);
0998 }
0999 
1000 /**
1001   * @brief  Check if Enable CRC computation on 33/17 bits is enabled
1002   * @rmtoll CR1          CRC33_17      LL_SPI_IsEnabledFullSizeCRC
1003   * @param  SPIx SPI Instance
1004   * @retval State of bit (1 or 0)
1005   */
1006 __STATIC_INLINE uint32_t LL_SPI_IsEnabledFullSizeCRC(const SPI_TypeDef *SPIx)
1007 {
1008   return ((READ_BIT(SPIx->CR1, SPI_CR1_CRC33_17) == (SPI_CR1_CRC33_17)) ? 1UL : 0UL);
1009 }
1010 
1011 /**
1012   * @brief  Suspend an ongoing transfer for Master configuration
1013   * @rmtoll CR1          CSUSP         LL_SPI_SuspendMasterTransfer
1014   * @param  SPIx SPI Instance
1015   * @retval None
1016   */
1017 __STATIC_INLINE void LL_SPI_SuspendMasterTransfer(SPI_TypeDef *SPIx)
1018 {
1019   SET_BIT(SPIx->CR1, SPI_CR1_CSUSP);
1020 }
1021 
1022 /**
1023   * @brief  Start effective transfer on wire for Master configuration
1024   * @rmtoll CR1          CSTART        LL_SPI_StartMasterTransfer
1025   * @param  SPIx SPI Instance
1026   * @retval None
1027   */
1028 __STATIC_INLINE void LL_SPI_StartMasterTransfer(SPI_TypeDef *SPIx)
1029 {
1030   SET_BIT(SPIx->CR1, SPI_CR1_CSTART);
1031 }
1032 
1033 /**
1034   * @brief  Check if there is an unfinished master transfer
1035   * @rmtoll CR1          CSTART        LL_SPI_IsActiveMasterTransfer
1036   * @param  SPIx SPI Instance
1037   * @retval State of bit (1 or 0)
1038   */
1039 __STATIC_INLINE uint32_t LL_SPI_IsActiveMasterTransfer(const SPI_TypeDef *SPIx)
1040 {
1041   return ((READ_BIT(SPIx->CR1, SPI_CR1_CSTART) == (SPI_CR1_CSTART)) ? 1UL : 0UL);
1042 }
1043 
1044 /**
1045   * @brief  Enable Master Rx auto suspend in case of overrun
1046   * @rmtoll CR1          MASRX         LL_SPI_EnableMasterRxAutoSuspend
1047   * @param  SPIx SPI Instance
1048   * @retval None
1049   */
1050 __STATIC_INLINE void LL_SPI_EnableMasterRxAutoSuspend(SPI_TypeDef *SPIx)
1051 {
1052   SET_BIT(SPIx->CR1, SPI_CR1_MASRX);
1053 }
1054 
1055 /**
1056   * @brief  Disable Master Rx auto suspend in case of overrun
1057   * @rmtoll CR1          MASRX         LL_SPI_DisableMasterRxAutoSuspend
1058   * @param  SPIx SPI Instance
1059   * @retval None
1060   */
1061 __STATIC_INLINE void LL_SPI_DisableMasterRxAutoSuspend(SPI_TypeDef *SPIx)
1062 {
1063   CLEAR_BIT(SPIx->CR1, SPI_CR1_MASRX);
1064 }
1065 
1066 /**
1067   * @brief  Check if Master Rx auto suspend is activated
1068   * @rmtoll CR1          MASRX         LL_SPI_IsEnabledMasterRxAutoSuspend
1069   * @param  SPIx SPI Instance
1070   * @retval State of bit (1 or 0)
1071   */
1072 __STATIC_INLINE uint32_t LL_SPI_IsEnabledMasterRxAutoSuspend(const SPI_TypeDef *SPIx)
1073 {
1074   return ((READ_BIT(SPIx->CR1, SPI_CR1_MASRX) == (SPI_CR1_MASRX)) ? 1UL : 0UL);
1075 }
1076 
1077 /**
1078   * @brief  Set Underrun behavior
1079   * @note   This configuration can not be changed when SPI is enabled.
1080   * @rmtoll CFG1         UDRCFG        LL_SPI_SetUDRConfiguration
1081   * @param  SPIx SPI Instance
1082   * @param  UDRConfig This parameter can be one of the following values:
1083   *         @arg @ref LL_SPI_UDR_CONFIG_REGISTER_PATTERN
1084   *         @arg @ref LL_SPI_UDR_CONFIG_LAST_RECEIVED
1085   *         @arg @ref LL_SPI_UDR_CONFIG_LAST_TRANSMITTED
1086   * @retval None
1087   */
1088 __STATIC_INLINE void LL_SPI_SetUDRConfiguration(SPI_TypeDef *SPIx, uint32_t UDRConfig)
1089 {
1090   MODIFY_REG(SPIx->CFG1, SPI_CFG1_UDRCFG, UDRConfig);
1091 }
1092 
1093 /**
1094   * @brief  Get Underrun behavior
1095   * @rmtoll CFG1         UDRCFG        LL_SPI_GetUDRConfiguration
1096   * @param  SPIx SPI Instance
1097   * @retval Returned value can be one of the following values:
1098   *         @arg @ref LL_SPI_UDR_CONFIG_REGISTER_PATTERN
1099   *         @arg @ref LL_SPI_UDR_CONFIG_LAST_RECEIVED
1100   *         @arg @ref LL_SPI_UDR_CONFIG_LAST_TRANSMITTED
1101   */
1102 __STATIC_INLINE uint32_t LL_SPI_GetUDRConfiguration(const SPI_TypeDef *SPIx)
1103 {
1104   return (uint32_t)(READ_BIT(SPIx->CFG1, SPI_CFG1_UDRCFG));
1105 }
1106 
1107 /**
1108   * @brief  Set Underrun Detection method
1109   * @note   This configuration can not be changed when SPI is enabled.
1110   * @rmtoll CFG1         UDRDET        LL_SPI_SetUDRDetection
1111   * @param  SPIx SPI Instance
1112   * @param  UDRDetection This parameter can be one of the following values:
1113   *         @arg @ref LL_SPI_UDR_DETECT_BEGIN_DATA_FRAME
1114   *         @arg @ref LL_SPI_UDR_DETECT_END_DATA_FRAME
1115   *         @arg @ref LL_SPI_UDR_DETECT_BEGIN_ACTIVE_NSS
1116   * @retval None
1117   */
1118 __STATIC_INLINE void LL_SPI_SetUDRDetection(SPI_TypeDef *SPIx, uint32_t UDRDetection)
1119 {
1120   MODIFY_REG(SPIx->CFG1, SPI_CFG1_UDRDET, UDRDetection);
1121 }
1122 
1123 /**
1124   * @brief  Get Underrun Detection method
1125   * @rmtoll CFG1         UDRDET        LL_SPI_GetUDRDetection
1126   * @param  SPIx SPI Instance
1127   * @retval Returned value can be one of the following values:
1128   *         @arg @ref LL_SPI_UDR_DETECT_BEGIN_DATA_FRAME
1129   *         @arg @ref LL_SPI_UDR_DETECT_END_DATA_FRAME
1130   *         @arg @ref LL_SPI_UDR_DETECT_BEGIN_ACTIVE_NSS
1131   */
1132 __STATIC_INLINE uint32_t LL_SPI_GetUDRDetection(const SPI_TypeDef *SPIx)
1133 {
1134   return (uint32_t)(READ_BIT(SPIx->CFG1, SPI_CFG1_UDRDET));
1135 }
1136 
1137 /**
1138   * @brief  Set Serial protocol used
1139   * @note   This configuration can not be changed when SPI is enabled.
1140   * @rmtoll CFG2         SP            LL_SPI_SetStandard
1141   * @param  SPIx SPI Instance
1142   * @param  Standard This parameter can be one of the following values:
1143   *         @arg @ref LL_SPI_PROTOCOL_MOTOROLA
1144   *         @arg @ref LL_SPI_PROTOCOL_TI
1145   * @retval None
1146   */
1147 __STATIC_INLINE void LL_SPI_SetStandard(SPI_TypeDef *SPIx, uint32_t Standard)
1148 {
1149   MODIFY_REG(SPIx->CFG2, SPI_CFG2_SP, Standard);
1150 }
1151 
1152 /**
1153   * @brief  Get Serial protocol used
1154   * @rmtoll CFG2         SP            LL_SPI_GetStandard
1155   * @param  SPIx SPI Instance
1156   * @retval Returned value can be one of the following values:
1157   *         @arg @ref LL_SPI_PROTOCOL_MOTOROLA
1158   *         @arg @ref LL_SPI_PROTOCOL_TI
1159   */
1160 __STATIC_INLINE uint32_t LL_SPI_GetStandard(const SPI_TypeDef *SPIx)
1161 {
1162   return (uint32_t)(READ_BIT(SPIx->CFG2, SPI_CFG2_SP));
1163 }
1164 
1165 /**
1166   * @brief  Set Clock phase
1167   * @note   This configuration can not be changed when SPI is enabled.
1168   *         This bit is not used in SPI TI mode.
1169   * @rmtoll CFG2         CPHA          LL_SPI_SetClockPhase
1170   * @param  SPIx SPI Instance
1171   * @param  ClockPhase This parameter can be one of the following values:
1172   *         @arg @ref LL_SPI_PHASE_1EDGE
1173   *         @arg @ref LL_SPI_PHASE_2EDGE
1174   * @retval None
1175   */
1176 __STATIC_INLINE void LL_SPI_SetClockPhase(SPI_TypeDef *SPIx, uint32_t ClockPhase)
1177 {
1178   MODIFY_REG(SPIx->CFG2, SPI_CFG2_CPHA, ClockPhase);
1179 }
1180 
1181 /**
1182   * @brief  Get Clock phase
1183   * @rmtoll CFG2         CPHA          LL_SPI_GetClockPhase
1184   * @param  SPIx SPI Instance
1185   * @retval Returned value can be one of the following values:
1186   *         @arg @ref LL_SPI_PHASE_1EDGE
1187   *         @arg @ref LL_SPI_PHASE_2EDGE
1188   */
1189 __STATIC_INLINE uint32_t LL_SPI_GetClockPhase(const SPI_TypeDef *SPIx)
1190 {
1191   return (uint32_t)(READ_BIT(SPIx->CFG2, SPI_CFG2_CPHA));
1192 }
1193 
1194 /**
1195   * @brief  Set Clock polarity
1196   * @note   This configuration can not be changed when SPI is enabled.
1197   *         This bit is not used in SPI TI mode.
1198   * @rmtoll CFG2         CPOL          LL_SPI_SetClockPolarity
1199   * @param  SPIx SPI Instance
1200   * @param  ClockPolarity This parameter can be one of the following values:
1201   *         @arg @ref LL_SPI_POLARITY_LOW
1202   *         @arg @ref LL_SPI_POLARITY_HIGH
1203   * @retval None
1204   */
1205 __STATIC_INLINE void LL_SPI_SetClockPolarity(SPI_TypeDef *SPIx, uint32_t ClockPolarity)
1206 {
1207   MODIFY_REG(SPIx->CFG2, SPI_CFG2_CPOL, ClockPolarity);
1208 }
1209 
1210 /**
1211   * @brief  Get Clock polarity
1212   * @rmtoll CFG2         CPOL          LL_SPI_GetClockPolarity
1213   * @param  SPIx SPI Instance
1214   * @retval Returned value can be one of the following values:
1215   *         @arg @ref LL_SPI_POLARITY_LOW
1216   *         @arg @ref LL_SPI_POLARITY_HIGH
1217   */
1218 __STATIC_INLINE uint32_t LL_SPI_GetClockPolarity(const SPI_TypeDef *SPIx)
1219 {
1220   return (uint32_t)(READ_BIT(SPIx->CFG2, SPI_CFG2_CPOL));
1221 }
1222 
1223 /**
1224   * @brief  Set NSS polarity
1225   * @note   This configuration can not be changed when SPI is enabled.
1226   *         This bit is not used in SPI TI mode.
1227   * @rmtoll CFG2         SSIOP          LL_SPI_SetNSSPolarity
1228   * @param  SPIx SPI Instance
1229   * @param  NSSPolarity This parameter can be one of the following values:
1230   *         @arg @ref LL_SPI_NSS_POLARITY_LOW
1231   *         @arg @ref LL_SPI_NSS_POLARITY_HIGH
1232   * @retval None
1233   */
1234 __STATIC_INLINE void LL_SPI_SetNSSPolarity(SPI_TypeDef *SPIx, uint32_t NSSPolarity)
1235 {
1236   MODIFY_REG(SPIx->CFG2, SPI_CFG2_SSIOP, NSSPolarity);
1237 }
1238 
1239 /**
1240   * @brief  Get NSS polarity
1241   * @rmtoll CFG2         SSIOP          LL_SPI_GetNSSPolarity
1242   * @param  SPIx SPI Instance
1243   * @retval Returned value can be one of the following values:
1244   *         @arg @ref LL_SPI_NSS_POLARITY_LOW
1245   *         @arg @ref LL_SPI_NSS_POLARITY_HIGH
1246   */
1247 __STATIC_INLINE uint32_t LL_SPI_GetNSSPolarity(const SPI_TypeDef *SPIx)
1248 {
1249   return (uint32_t)(READ_BIT(SPIx->CFG2, SPI_CFG2_SSIOP));
1250 }
1251 
1252 /**
1253   * @brief  Set Baudrate Prescaler
1254   * @note   This configuration can not be changed when SPI is enabled.
1255   *         SPI BaudRate = fPCLK/Pescaler.
1256   * @rmtoll CFG1         MBR           LL_SPI_SetBaudRatePrescaler
1257   * @param  SPIx SPI Instance
1258   * @param  Baudrate This parameter can be one of the following values:
1259   *         @arg @ref LL_SPI_BAUDRATEPRESCALER_DIV2
1260   *         @arg @ref LL_SPI_BAUDRATEPRESCALER_DIV4
1261   *         @arg @ref LL_SPI_BAUDRATEPRESCALER_DIV8
1262   *         @arg @ref LL_SPI_BAUDRATEPRESCALER_DIV16
1263   *         @arg @ref LL_SPI_BAUDRATEPRESCALER_DIV32
1264   *         @arg @ref LL_SPI_BAUDRATEPRESCALER_DIV64
1265   *         @arg @ref LL_SPI_BAUDRATEPRESCALER_DIV128
1266   *         @arg @ref LL_SPI_BAUDRATEPRESCALER_DIV256
1267   * @retval None
1268   */
1269 __STATIC_INLINE void LL_SPI_SetBaudRatePrescaler(SPI_TypeDef *SPIx, uint32_t Baudrate)
1270 {
1271   MODIFY_REG(SPIx->CFG1, SPI_CFG1_MBR, Baudrate);
1272 }
1273 
1274 /**
1275   * @brief  Get Baudrate Prescaler
1276   * @rmtoll CFG1         MBR           LL_SPI_GetBaudRatePrescaler
1277   * @param  SPIx SPI Instance
1278   * @retval Returned value can be one of the following values:
1279   *         @arg @ref LL_SPI_BAUDRATEPRESCALER_DIV2
1280   *         @arg @ref LL_SPI_BAUDRATEPRESCALER_DIV4
1281   *         @arg @ref LL_SPI_BAUDRATEPRESCALER_DIV8
1282   *         @arg @ref LL_SPI_BAUDRATEPRESCALER_DIV16
1283   *         @arg @ref LL_SPI_BAUDRATEPRESCALER_DIV32
1284   *         @arg @ref LL_SPI_BAUDRATEPRESCALER_DIV64
1285   *         @arg @ref LL_SPI_BAUDRATEPRESCALER_DIV128
1286   *         @arg @ref LL_SPI_BAUDRATEPRESCALER_DIV256
1287   */
1288 __STATIC_INLINE uint32_t LL_SPI_GetBaudRatePrescaler(const SPI_TypeDef *SPIx)
1289 {
1290   return (uint32_t)(READ_BIT(SPIx->CFG1, SPI_CFG1_MBR));
1291 }
1292 
1293 /**
1294   * @brief  Set Transfer Bit Order
1295   * @note   This configuration can not be changed when SPI is enabled.
1296   *         This bit is not used in SPI TI mode.
1297   * @rmtoll CFG2         LSBFRST       LL_SPI_SetTransferBitOrder
1298   * @param  SPIx SPI Instance
1299   * @param  BitOrder This parameter can be one of the following values:
1300   *         @arg @ref LL_SPI_LSB_FIRST
1301   *         @arg @ref LL_SPI_MSB_FIRST
1302   * @retval None
1303   */
1304 __STATIC_INLINE void LL_SPI_SetTransferBitOrder(SPI_TypeDef *SPIx, uint32_t BitOrder)
1305 {
1306   MODIFY_REG(SPIx->CFG2, SPI_CFG2_LSBFRST, BitOrder);
1307 }
1308 
1309 /**
1310   * @brief  Get Transfer Bit Order
1311   * @rmtoll CFG2         LSBFRST       LL_SPI_GetTransferBitOrder
1312   * @param  SPIx SPI Instance
1313   * @retval Returned value can be one of the following values:
1314   *         @arg @ref LL_SPI_LSB_FIRST
1315   *         @arg @ref LL_SPI_MSB_FIRST
1316   */
1317 __STATIC_INLINE uint32_t LL_SPI_GetTransferBitOrder(const SPI_TypeDef *SPIx)
1318 {
1319   return (uint32_t)(READ_BIT(SPIx->CFG2, SPI_CFG2_LSBFRST));
1320 }
1321 
1322 /**
1323   * @brief  Set Transfer Mode
1324   * @note   This configuration can not be changed when SPI is enabled except for half duplex direction
1325   *         using LL_SPI_SetHalfDuplexDirection.
1326   * @rmtoll CR1          HDDIR         LL_SPI_SetTransferDirection\n
1327   *         CFG2         COMM          LL_SPI_SetTransferDirection
1328   * @param  SPIx SPI Instance
1329   * @param  TransferDirection This parameter can be one of the following values:
1330   *         @arg @ref LL_SPI_FULL_DUPLEX
1331   *         @arg @ref LL_SPI_SIMPLEX_TX
1332   *         @arg @ref LL_SPI_SIMPLEX_RX
1333   *         @arg @ref LL_SPI_HALF_DUPLEX_RX
1334   *         @arg @ref LL_SPI_HALF_DUPLEX_TX
1335   * @retval None
1336   */
1337 __STATIC_INLINE void LL_SPI_SetTransferDirection(SPI_TypeDef *SPIx, uint32_t TransferDirection)
1338 {
1339   MODIFY_REG(SPIx->CR1, SPI_CR1_HDDIR,  TransferDirection & SPI_CR1_HDDIR);
1340   MODIFY_REG(SPIx->CFG2, SPI_CFG2_COMM, TransferDirection & SPI_CFG2_COMM);
1341 }
1342 
1343 /**
1344   * @brief  Get Transfer Mode
1345   * @rmtoll CR1          HDDIR         LL_SPI_GetTransferDirection\n
1346   *         CFG2         COMM          LL_SPI_GetTransferDirection
1347   * @param  SPIx SPI Instance
1348   * @retval Returned value can be one of the following values:
1349   *         @arg @ref LL_SPI_FULL_DUPLEX
1350   *         @arg @ref LL_SPI_SIMPLEX_TX
1351   *         @arg @ref LL_SPI_SIMPLEX_RX
1352   *         @arg @ref LL_SPI_HALF_DUPLEX_RX
1353   *         @arg @ref LL_SPI_HALF_DUPLEX_TX
1354   */
1355 __STATIC_INLINE uint32_t LL_SPI_GetTransferDirection(const SPI_TypeDef *SPIx)
1356 {
1357   uint32_t Hddir = READ_BIT(SPIx->CR1, SPI_CR1_HDDIR);
1358   uint32_t Comm = READ_BIT(SPIx->CFG2, SPI_CFG2_COMM);
1359   return (Hddir | Comm);
1360 }
1361 
1362 /**
1363   * @brief  Set direction for Half-Duplex Mode
1364   * @note   In master mode the MOSI pin is used and in slave mode the MISO pin is used for Half-Duplex.
1365   * @rmtoll CR1          HDDIR         LL_SPI_SetHalfDuplexDirection
1366   * @param  SPIx SPI Instance
1367   * @param  HalfDuplexDirection This parameter can be one of the following values:
1368   *         @arg @ref LL_SPI_HALF_DUPLEX_RX
1369   *         @arg @ref LL_SPI_HALF_DUPLEX_TX
1370   * @retval None
1371   */
1372 __STATIC_INLINE void LL_SPI_SetHalfDuplexDirection(SPI_TypeDef *SPIx, uint32_t HalfDuplexDirection)
1373 {
1374   MODIFY_REG(SPIx->CR1, SPI_CR1_HDDIR, HalfDuplexDirection & SPI_CR1_HDDIR);
1375 }
1376 
1377 /**
1378   * @brief  Get direction for Half-Duplex Mode
1379   * @note   In master mode the MOSI pin is used and in slave mode the MISO pin is used for Half-Duplex.
1380   * @rmtoll CR1          HDDIR         LL_SPI_GetHalfDuplexDirection
1381   * @param  SPIx SPI Instance
1382   * @retval Returned value can be one of the following values:
1383   *         @arg @ref LL_SPI_HALF_DUPLEX_RX
1384   *         @arg @ref LL_SPI_HALF_DUPLEX_TX
1385   */
1386 __STATIC_INLINE uint32_t LL_SPI_GetHalfDuplexDirection(const SPI_TypeDef *SPIx)
1387 {
1388   return (uint32_t)(READ_BIT(SPIx->CR1, SPI_CR1_HDDIR) | SPI_CFG2_COMM);
1389 }
1390 
1391 /**
1392   * @brief  Set Frame Data Size
1393   * @note   This configuration can not be changed when SPI is enabled.
1394   * @rmtoll CFG1         DSIZE         LL_SPI_SetDataWidth
1395   * @param  SPIx SPI Instance
1396   * @param  DataWidth This parameter can be one of the following values:
1397   *         @arg @ref LL_SPI_DATAWIDTH_4BIT
1398   *         @arg @ref LL_SPI_DATAWIDTH_5BIT
1399   *         @arg @ref LL_SPI_DATAWIDTH_6BIT
1400   *         @arg @ref LL_SPI_DATAWIDTH_7BIT
1401   *         @arg @ref LL_SPI_DATAWIDTH_8BIT
1402   *         @arg @ref LL_SPI_DATAWIDTH_9BIT
1403   *         @arg @ref LL_SPI_DATAWIDTH_10BIT
1404   *         @arg @ref LL_SPI_DATAWIDTH_11BIT
1405   *         @arg @ref LL_SPI_DATAWIDTH_12BIT
1406   *         @arg @ref LL_SPI_DATAWIDTH_13BIT
1407   *         @arg @ref LL_SPI_DATAWIDTH_14BIT
1408   *         @arg @ref LL_SPI_DATAWIDTH_15BIT
1409   *         @arg @ref LL_SPI_DATAWIDTH_16BIT
1410   *         @arg @ref LL_SPI_DATAWIDTH_17BIT
1411   *         @arg @ref LL_SPI_DATAWIDTH_18BIT
1412   *         @arg @ref LL_SPI_DATAWIDTH_19BIT
1413   *         @arg @ref LL_SPI_DATAWIDTH_20BIT
1414   *         @arg @ref LL_SPI_DATAWIDTH_21BIT
1415   *         @arg @ref LL_SPI_DATAWIDTH_22BIT
1416   *         @arg @ref LL_SPI_DATAWIDTH_23BIT
1417   *         @arg @ref LL_SPI_DATAWIDTH_24BIT
1418   *         @arg @ref LL_SPI_DATAWIDTH_25BIT
1419   *         @arg @ref LL_SPI_DATAWIDTH_26BIT
1420   *         @arg @ref LL_SPI_DATAWIDTH_27BIT
1421   *         @arg @ref LL_SPI_DATAWIDTH_28BIT
1422   *         @arg @ref LL_SPI_DATAWIDTH_29BIT
1423   *         @arg @ref LL_SPI_DATAWIDTH_30BIT
1424   *         @arg @ref LL_SPI_DATAWIDTH_31BIT
1425   *         @arg @ref LL_SPI_DATAWIDTH_32BIT
1426   * @retval None
1427   */
1428 __STATIC_INLINE void LL_SPI_SetDataWidth(SPI_TypeDef *SPIx, uint32_t DataWidth)
1429 {
1430   MODIFY_REG(SPIx->CFG1, SPI_CFG1_DSIZE, DataWidth);
1431 }
1432 
1433 /**
1434   * @brief  Get Frame Data Size
1435   * @rmtoll CFG1         DSIZE         LL_SPI_GetDataWidth
1436   * @param  SPIx SPI Instance
1437   * @retval Returned value can be one of the following values:
1438   *         @arg @ref LL_SPI_DATAWIDTH_4BIT
1439   *         @arg @ref LL_SPI_DATAWIDTH_5BIT
1440   *         @arg @ref LL_SPI_DATAWIDTH_6BIT
1441   *         @arg @ref LL_SPI_DATAWIDTH_7BIT
1442   *         @arg @ref LL_SPI_DATAWIDTH_8BIT
1443   *         @arg @ref LL_SPI_DATAWIDTH_9BIT
1444   *         @arg @ref LL_SPI_DATAWIDTH_10BIT
1445   *         @arg @ref LL_SPI_DATAWIDTH_11BIT
1446   *         @arg @ref LL_SPI_DATAWIDTH_12BIT
1447   *         @arg @ref LL_SPI_DATAWIDTH_13BIT
1448   *         @arg @ref LL_SPI_DATAWIDTH_14BIT
1449   *         @arg @ref LL_SPI_DATAWIDTH_15BIT
1450   *         @arg @ref LL_SPI_DATAWIDTH_16BIT
1451   *         @arg @ref LL_SPI_DATAWIDTH_17BIT
1452   *         @arg @ref LL_SPI_DATAWIDTH_18BIT
1453   *         @arg @ref LL_SPI_DATAWIDTH_19BIT
1454   *         @arg @ref LL_SPI_DATAWIDTH_20BIT
1455   *         @arg @ref LL_SPI_DATAWIDTH_21BIT
1456   *         @arg @ref LL_SPI_DATAWIDTH_22BIT
1457   *         @arg @ref LL_SPI_DATAWIDTH_23BIT
1458   *         @arg @ref LL_SPI_DATAWIDTH_24BIT
1459   *         @arg @ref LL_SPI_DATAWIDTH_25BIT
1460   *         @arg @ref LL_SPI_DATAWIDTH_26BIT
1461   *         @arg @ref LL_SPI_DATAWIDTH_27BIT
1462   *         @arg @ref LL_SPI_DATAWIDTH_28BIT
1463   *         @arg @ref LL_SPI_DATAWIDTH_29BIT
1464   *         @arg @ref LL_SPI_DATAWIDTH_30BIT
1465   *         @arg @ref LL_SPI_DATAWIDTH_31BIT
1466   *         @arg @ref LL_SPI_DATAWIDTH_32BIT
1467   */
1468 __STATIC_INLINE uint32_t LL_SPI_GetDataWidth(const SPI_TypeDef *SPIx)
1469 {
1470   return (uint32_t)(READ_BIT(SPIx->CFG1, SPI_CFG1_DSIZE));
1471 }
1472 
1473 /**
1474   * @brief  Set threshold of FIFO that triggers a transfer event
1475   * @note   This configuration can not be changed when SPI is enabled.
1476   * @rmtoll CFG1         FTHLV         LL_SPI_SetFIFOThreshold
1477   * @param  SPIx SPI Instance
1478   * @param  Threshold This parameter can be one of the following values:
1479   *         @arg @ref LL_SPI_FIFO_TH_01DATA
1480   *         @arg @ref LL_SPI_FIFO_TH_02DATA
1481   *         @arg @ref LL_SPI_FIFO_TH_03DATA
1482   *         @arg @ref LL_SPI_FIFO_TH_04DATA
1483   *         @arg @ref LL_SPI_FIFO_TH_05DATA
1484   *         @arg @ref LL_SPI_FIFO_TH_06DATA
1485   *         @arg @ref LL_SPI_FIFO_TH_07DATA
1486   *         @arg @ref LL_SPI_FIFO_TH_08DATA
1487   *         @arg @ref LL_SPI_FIFO_TH_09DATA
1488   *         @arg @ref LL_SPI_FIFO_TH_10DATA
1489   *         @arg @ref LL_SPI_FIFO_TH_11DATA
1490   *         @arg @ref LL_SPI_FIFO_TH_12DATA
1491   *         @arg @ref LL_SPI_FIFO_TH_13DATA
1492   *         @arg @ref LL_SPI_FIFO_TH_14DATA
1493   *         @arg @ref LL_SPI_FIFO_TH_15DATA
1494   *         @arg @ref LL_SPI_FIFO_TH_16DATA
1495   * @retval None
1496   */
1497 __STATIC_INLINE void LL_SPI_SetFIFOThreshold(SPI_TypeDef *SPIx, uint32_t Threshold)
1498 {
1499   MODIFY_REG(SPIx->CFG1, SPI_CFG1_FTHLV, Threshold);
1500 }
1501 
1502 /**
1503   * @brief  Get threshold of FIFO that triggers a transfer event
1504   * @rmtoll CFG1         FTHLV         LL_SPI_GetFIFOThreshold
1505   * @param  SPIx SPI Instance
1506   * @retval Returned value can be one of the following values:
1507   *         @arg @ref LL_SPI_FIFO_TH_01DATA
1508   *         @arg @ref LL_SPI_FIFO_TH_02DATA
1509   *         @arg @ref LL_SPI_FIFO_TH_03DATA
1510   *         @arg @ref LL_SPI_FIFO_TH_04DATA
1511   *         @arg @ref LL_SPI_FIFO_TH_05DATA
1512   *         @arg @ref LL_SPI_FIFO_TH_06DATA
1513   *         @arg @ref LL_SPI_FIFO_TH_07DATA
1514   *         @arg @ref LL_SPI_FIFO_TH_08DATA
1515   *         @arg @ref LL_SPI_FIFO_TH_09DATA
1516   *         @arg @ref LL_SPI_FIFO_TH_10DATA
1517   *         @arg @ref LL_SPI_FIFO_TH_11DATA
1518   *         @arg @ref LL_SPI_FIFO_TH_12DATA
1519   *         @arg @ref LL_SPI_FIFO_TH_13DATA
1520   *         @arg @ref LL_SPI_FIFO_TH_14DATA
1521   *         @arg @ref LL_SPI_FIFO_TH_15DATA
1522   *         @arg @ref LL_SPI_FIFO_TH_16DATA
1523   */
1524 __STATIC_INLINE uint32_t LL_SPI_GetFIFOThreshold(const SPI_TypeDef *SPIx)
1525 {
1526   return (uint32_t)(READ_BIT(SPIx->CFG1, SPI_CFG1_FTHLV));
1527 }
1528 
1529 /**
1530   * @brief  Enable CRC
1531   * @note   This configuration can not be changed when SPI is enabled.
1532   * @rmtoll CFG1         CRCEN         LL_SPI_EnableCRC
1533   * @param  SPIx SPI Instance
1534   * @retval None
1535   */
1536 __STATIC_INLINE void LL_SPI_EnableCRC(SPI_TypeDef *SPIx)
1537 {
1538   SET_BIT(SPIx->CFG1, SPI_CFG1_CRCEN);
1539 }
1540 
1541 /**
1542   * @brief  Disable CRC
1543   * @rmtoll CFG1         CRCEN         LL_SPI_DisableCRC
1544   * @param  SPIx SPI Instance
1545   * @retval None
1546   */
1547 __STATIC_INLINE void LL_SPI_DisableCRC(SPI_TypeDef *SPIx)
1548 {
1549   CLEAR_BIT(SPIx->CFG1, SPI_CFG1_CRCEN);
1550 }
1551 
1552 /**
1553   * @brief  Check if CRC is enabled
1554   * @rmtoll CFG1         CRCEN         LL_SPI_IsEnabledCRC
1555   * @param  SPIx SPI Instance
1556   * @retval State of bit (1 or 0).
1557   */
1558 __STATIC_INLINE uint32_t LL_SPI_IsEnabledCRC(const SPI_TypeDef *SPIx)
1559 {
1560   return ((READ_BIT(SPIx->CFG1, SPI_CFG1_CRCEN) == SPI_CFG1_CRCEN) ? 1UL : 0UL);
1561 }
1562 
1563 /**
1564   * @brief  Set CRC Length
1565   * @note   This configuration can not be changed when SPI is enabled.
1566   * @rmtoll CFG1         CRCSIZE       LL_SPI_SetCRCWidth
1567   * @param  SPIx SPI Instance
1568   * @param  CRCLength This parameter can be one of the following values:
1569   *         @arg @ref LL_SPI_CRC_4BIT
1570   *         @arg @ref LL_SPI_CRC_5BIT
1571   *         @arg @ref LL_SPI_CRC_6BIT
1572   *         @arg @ref LL_SPI_CRC_7BIT
1573   *         @arg @ref LL_SPI_CRC_8BIT
1574   *         @arg @ref LL_SPI_CRC_9BIT
1575   *         @arg @ref LL_SPI_CRC_10BIT
1576   *         @arg @ref LL_SPI_CRC_11BIT
1577   *         @arg @ref LL_SPI_CRC_12BIT
1578   *         @arg @ref LL_SPI_CRC_13BIT
1579   *         @arg @ref LL_SPI_CRC_14BIT
1580   *         @arg @ref LL_SPI_CRC_15BIT
1581   *         @arg @ref LL_SPI_CRC_16BIT
1582   *         @arg @ref LL_SPI_CRC_17BIT
1583   *         @arg @ref LL_SPI_CRC_18BIT
1584   *         @arg @ref LL_SPI_CRC_19BIT
1585   *         @arg @ref LL_SPI_CRC_20BIT
1586   *         @arg @ref LL_SPI_CRC_21BIT
1587   *         @arg @ref LL_SPI_CRC_22BIT
1588   *         @arg @ref LL_SPI_CRC_23BIT
1589   *         @arg @ref LL_SPI_CRC_24BIT
1590   *         @arg @ref LL_SPI_CRC_25BIT
1591   *         @arg @ref LL_SPI_CRC_26BIT
1592   *         @arg @ref LL_SPI_CRC_27BIT
1593   *         @arg @ref LL_SPI_CRC_28BIT
1594   *         @arg @ref LL_SPI_CRC_29BIT
1595   *         @arg @ref LL_SPI_CRC_30BIT
1596   *         @arg @ref LL_SPI_CRC_31BIT
1597   *         @arg @ref LL_SPI_CRC_32BIT
1598   * @retval None
1599   */
1600 __STATIC_INLINE void LL_SPI_SetCRCWidth(SPI_TypeDef *SPIx, uint32_t CRCLength)
1601 {
1602   MODIFY_REG(SPIx->CFG1, SPI_CFG1_CRCSIZE, CRCLength);
1603 }
1604 
1605 /**
1606   * @brief  Get CRC Length
1607   * @rmtoll CFG1          CRCSIZE       LL_SPI_GetCRCWidth
1608   * @param  SPIx SPI Instance
1609   * @retval Returned value can be one of the following values:
1610   *         @arg @ref LL_SPI_CRC_4BIT
1611   *         @arg @ref LL_SPI_CRC_5BIT
1612   *         @arg @ref LL_SPI_CRC_6BIT
1613   *         @arg @ref LL_SPI_CRC_7BIT
1614   *         @arg @ref LL_SPI_CRC_8BIT
1615   *         @arg @ref LL_SPI_CRC_9BIT
1616   *         @arg @ref LL_SPI_CRC_10BIT
1617   *         @arg @ref LL_SPI_CRC_11BIT
1618   *         @arg @ref LL_SPI_CRC_12BIT
1619   *         @arg @ref LL_SPI_CRC_13BIT
1620   *         @arg @ref LL_SPI_CRC_14BIT
1621   *         @arg @ref LL_SPI_CRC_15BIT
1622   *         @arg @ref LL_SPI_CRC_16BIT
1623   *         @arg @ref LL_SPI_CRC_17BIT
1624   *         @arg @ref LL_SPI_CRC_18BIT
1625   *         @arg @ref LL_SPI_CRC_19BIT
1626   *         @arg @ref LL_SPI_CRC_20BIT
1627   *         @arg @ref LL_SPI_CRC_21BIT
1628   *         @arg @ref LL_SPI_CRC_22BIT
1629   *         @arg @ref LL_SPI_CRC_23BIT
1630   *         @arg @ref LL_SPI_CRC_24BIT
1631   *         @arg @ref LL_SPI_CRC_25BIT
1632   *         @arg @ref LL_SPI_CRC_26BIT
1633   *         @arg @ref LL_SPI_CRC_27BIT
1634   *         @arg @ref LL_SPI_CRC_28BIT
1635   *         @arg @ref LL_SPI_CRC_29BIT
1636   *         @arg @ref LL_SPI_CRC_30BIT
1637   *         @arg @ref LL_SPI_CRC_31BIT
1638   *         @arg @ref LL_SPI_CRC_32BIT
1639   */
1640 __STATIC_INLINE uint32_t LL_SPI_GetCRCWidth(const SPI_TypeDef *SPIx)
1641 {
1642   return (uint32_t)(READ_BIT(SPIx->CFG1, SPI_CFG1_CRCSIZE));
1643 }
1644 
1645 /**
1646   * @brief  Set NSS Mode
1647   * @note   This configuration can not be changed when SPI is enabled.
1648   *         This bit is not used in SPI TI mode.
1649   * @rmtoll CFG2         SSM           LL_SPI_SetNSSMode\n
1650   *         CFG2         SSOE          LL_SPI_SetNSSMode
1651   * @param  SPIx SPI Instance
1652   * @param  NSS This parameter can be one of the following values:
1653   *         @arg @ref LL_SPI_NSS_SOFT
1654   *         @arg @ref LL_SPI_NSS_HARD_INPUT
1655   *         @arg @ref LL_SPI_NSS_HARD_OUTPUT
1656   * @retval None
1657   */
1658 __STATIC_INLINE void LL_SPI_SetNSSMode(SPI_TypeDef *SPIx, uint32_t NSS)
1659 {
1660   MODIFY_REG(SPIx->CFG2, SPI_CFG2_SSM | SPI_CFG2_SSOE, NSS);
1661 }
1662 
1663 /**
1664   * @brief  Set NSS Mode
1665   * @rmtoll CFG2         SSM           LL_SPI_GetNSSMode\n
1666   *         CFG2         SSOE          LL_SPI_GetNSSMode
1667   * @param  SPIx SPI Instance
1668   * @retval Returned value can be one of the following values:
1669   *         @arg @ref LL_SPI_NSS_SOFT
1670   *         @arg @ref LL_SPI_NSS_HARD_INPUT
1671   *         @arg @ref LL_SPI_NSS_HARD_OUTPUT
1672   */
1673 __STATIC_INLINE uint32_t LL_SPI_GetNSSMode(const SPI_TypeDef *SPIx)
1674 {
1675   return (uint32_t)(READ_BIT(SPIx->CFG2, SPI_CFG2_SSM | SPI_CFG2_SSOE));
1676 }
1677 
1678 /**
1679   * @brief  Enable NSS pulse mgt
1680   * @note   This configuration can not be changed when SPI is enabled.
1681   *         This bit is not used in SPI TI mode.
1682   * @rmtoll CFG2         SSOM          LL_SPI_EnableNSSPulseMgt
1683   * @param  SPIx SPI Instance
1684   * @retval None
1685   */
1686 __STATIC_INLINE void LL_SPI_EnableNSSPulseMgt(SPI_TypeDef *SPIx)
1687 {
1688   SET_BIT(SPIx->CFG2, SPI_CFG2_SSOM);
1689 }
1690 
1691 /**
1692   * @brief  Disable NSS pulse mgt
1693   * @note   This configuration can not be changed when SPI is enabled.
1694   *         This bit is not used in SPI TI mode.
1695   * @rmtoll CFG2         SSOM          LL_SPI_DisableNSSPulseMgt
1696   * @param  SPIx SPI Instance
1697   * @retval None
1698   */
1699 __STATIC_INLINE void LL_SPI_DisableNSSPulseMgt(SPI_TypeDef *SPIx)
1700 {
1701   CLEAR_BIT(SPIx->CFG2, SPI_CFG2_SSOM);
1702 }
1703 
1704 /**
1705   * @brief  Check if NSS pulse is enabled
1706   * @rmtoll CFG2         SSOM          LL_SPI_IsEnabledNSSPulse
1707   * @param  SPIx SPI Instance
1708   * @retval State of bit (1 or 0)
1709   */
1710 __STATIC_INLINE uint32_t LL_SPI_IsEnabledNSSPulse(const SPI_TypeDef *SPIx)
1711 {
1712   return ((READ_BIT(SPIx->CFG2, SPI_CFG2_SSOM) == SPI_CFG2_SSOM) ? 1UL : 0UL);
1713 }
1714 
1715 /**
1716   * @}
1717   */
1718 
1719 /** @defgroup SPI_LL_EF_FLAG_Management FLAG_Management
1720   * @ingroup RTEMSBSPsARMSTM32H7
1721   * @{
1722   */
1723 
1724 /**
1725   * @brief  Check if there is enough data in FIFO to read a full packet
1726   * @rmtoll SR           RXP           LL_SPI_IsActiveFlag_RXP
1727   * @param  SPIx SPI Instance
1728   * @retval State of bit (1 or 0)
1729   */
1730 __STATIC_INLINE uint32_t LL_SPI_IsActiveFlag_RXP(const SPI_TypeDef *SPIx)
1731 {
1732   return ((READ_BIT(SPIx->SR, SPI_SR_RXP) == (SPI_SR_RXP)) ? 1UL : 0UL);
1733 }
1734 
1735 /**
1736   * @brief  Check if there is enough space in FIFO to hold a full packet
1737   * @rmtoll SR           TXP           LL_SPI_IsActiveFlag_TXP
1738   * @param  SPIx SPI Instance
1739   * @retval State of bit (1 or 0)
1740   */
1741 __STATIC_INLINE uint32_t LL_SPI_IsActiveFlag_TXP(const SPI_TypeDef *SPIx)
1742 {
1743   return ((READ_BIT(SPIx->SR, SPI_SR_TXP) == (SPI_SR_TXP)) ? 1UL : 0UL);
1744 }
1745 
1746 /**
1747   * @brief  Check if there enough space in FIFO to hold a full packet, AND enough data to read a full packet
1748   * @rmtoll SR           DXP           LL_SPI_IsActiveFlag_DXP
1749   * @param  SPIx SPI Instance
1750   * @retval State of bit (1 or 0)
1751   */
1752 __STATIC_INLINE uint32_t LL_SPI_IsActiveFlag_DXP(const SPI_TypeDef *SPIx)
1753 {
1754   return ((READ_BIT(SPIx->SR, SPI_SR_DXP) == (SPI_SR_DXP)) ? 1UL : 0UL);
1755 }
1756 
1757 /**
1758   * @brief  Check that end of transfer event occurred
1759   * @rmtoll SR           EOT           LL_SPI_IsActiveFlag_EOT
1760   * @param  SPIx SPI Instance
1761   * @retval State of bit (1 or 0).
1762   */
1763 __STATIC_INLINE uint32_t LL_SPI_IsActiveFlag_EOT(const SPI_TypeDef *SPIx)
1764 {
1765   return ((READ_BIT(SPIx->SR, SPI_SR_EOT) == (SPI_SR_EOT)) ? 1UL : 0UL);
1766 }
1767 
1768 /**
1769   * @brief  Check that all required data has been filled in the fifo according to transfer size
1770   * @rmtoll SR           TXTF          LL_SPI_IsActiveFlag_TXTF
1771   * @param  SPIx SPI Instance
1772   * @retval State of bit (1 or 0).
1773   */
1774 __STATIC_INLINE uint32_t LL_SPI_IsActiveFlag_TXTF(const SPI_TypeDef *SPIx)
1775 {
1776   return ((READ_BIT(SPIx->SR, SPI_SR_TXTF) == (SPI_SR_TXTF)) ? 1UL : 0UL);
1777 }
1778 
1779 /**
1780   * @brief  Get Underrun error flag
1781   * @rmtoll SR           UDR           LL_SPI_IsActiveFlag_UDR
1782   * @param  SPIx SPI Instance
1783   * @retval State of bit (1 or 0).
1784   */
1785 __STATIC_INLINE uint32_t LL_SPI_IsActiveFlag_UDR(const SPI_TypeDef *SPIx)
1786 {
1787   return ((READ_BIT(SPIx->SR, SPI_SR_UDR) == (SPI_SR_UDR)) ? 1UL : 0UL);
1788 }
1789 
1790 /**
1791   * @brief  Get CRC error flag
1792   * @rmtoll SR           CRCE        LL_SPI_IsActiveFlag_CRCERR
1793   * @param  SPIx SPI Instance
1794   * @retval State of bit (1 or 0).
1795   */
1796 __STATIC_INLINE uint32_t LL_SPI_IsActiveFlag_CRCERR(const SPI_TypeDef *SPIx)
1797 {
1798   return ((READ_BIT(SPIx->SR, SPI_SR_CRCE) == (SPI_SR_CRCE)) ? 1UL : 0UL);
1799 }
1800 
1801 /**
1802   * @brief  Get  Mode fault error flag
1803   * @rmtoll SR           MODF          LL_SPI_IsActiveFlag_MODF
1804   * @param  SPIx SPI Instance
1805   * @retval State of bit (1 or 0).
1806   */
1807 __STATIC_INLINE uint32_t LL_SPI_IsActiveFlag_MODF(const SPI_TypeDef *SPIx)
1808 {
1809   return ((READ_BIT(SPIx->SR, SPI_SR_MODF) == (SPI_SR_MODF)) ? 1UL : 0UL);
1810 }
1811 
1812 /**
1813   * @brief  Get Overrun error flag
1814   * @rmtoll SR           OVR           LL_SPI_IsActiveFlag_OVR
1815   * @param  SPIx SPI Instance
1816   * @retval State of bit (1 or 0).
1817   */
1818 __STATIC_INLINE uint32_t LL_SPI_IsActiveFlag_OVR(const SPI_TypeDef *SPIx)
1819 {
1820   return ((READ_BIT(SPIx->SR, SPI_SR_OVR) == (SPI_SR_OVR)) ? 1UL : 0UL);
1821 }
1822 
1823 /**
1824   * @brief  Get TI Frame format error flag
1825   * @rmtoll SR           TIFRE         LL_SPI_IsActiveFlag_FRE
1826   * @param  SPIx SPI Instance
1827   * @retval State of bit (1 or 0).
1828   */
1829 __STATIC_INLINE uint32_t LL_SPI_IsActiveFlag_FRE(const SPI_TypeDef *SPIx)
1830 {
1831   return ((READ_BIT(SPIx->SR, SPI_SR_TIFRE) == (SPI_SR_TIFRE)) ? 1UL : 0UL);
1832 }
1833 
1834 /**
1835   * @brief  Check if the additional number of data has been reloaded
1836   * @rmtoll SR           TSERF         LL_SPI_IsActiveFlag_TSER
1837   * @param  SPIx SPI Instance
1838   * @retval State of bit (1 or 0).
1839   */
1840 __STATIC_INLINE uint32_t LL_SPI_IsActiveFlag_TSER(const SPI_TypeDef *SPIx)
1841 {
1842   return ((READ_BIT(SPIx->SR, SPI_SR_TSERF) == (SPI_SR_TSERF)) ? 1UL : 0UL);
1843 }
1844 
1845 /**
1846   * @brief  Check if a suspend operation is done
1847   * @rmtoll SR           SUSP          LL_SPI_IsActiveFlag_SUSP
1848   * @param  SPIx SPI Instance
1849   * @retval State of bit (1 or 0)
1850   */
1851 __STATIC_INLINE uint32_t LL_SPI_IsActiveFlag_SUSP(const SPI_TypeDef *SPIx)
1852 {
1853   return ((READ_BIT(SPIx->SR, SPI_SR_SUSP) == (SPI_SR_SUSP)) ? 1UL : 0UL);
1854 }
1855 
1856 /**
1857   * @brief  Check if last TxFIFO or CRC frame transmission is completed
1858   * @rmtoll SR           TXC           LL_SPI_IsActiveFlag_TXC
1859   * @param  SPIx SPI Instance
1860   * @retval State of bit (1 or 0).
1861   */
1862 __STATIC_INLINE uint32_t LL_SPI_IsActiveFlag_TXC(const SPI_TypeDef *SPIx)
1863 {
1864   return ((READ_BIT(SPIx->SR, SPI_SR_TXC) == (SPI_SR_TXC)) ? 1UL : 0UL);
1865 }
1866 
1867 /**
1868   * @brief  Check if at least one 32-bit data is available in RxFIFO
1869   * @rmtoll SR           RXWNE         LL_SPI_IsActiveFlag_RXWNE
1870   * @param  SPIx SPI Instance
1871   * @retval State of bit (1 or 0)
1872   */
1873 __STATIC_INLINE uint32_t LL_SPI_IsActiveFlag_RXWNE(const SPI_TypeDef *SPIx)
1874 {
1875   return ((READ_BIT(SPIx->SR, SPI_SR_RXWNE) == (SPI_SR_RXWNE)) ? 1UL : 0UL);
1876 }
1877 
1878 /**
1879   * @brief  Get number of data framed remaining in current TSIZE
1880   * @rmtoll SR           CTSIZE           LL_SPI_GetRemainingDataFrames
1881   * @param  SPIx SPI Instance
1882   * @retval 0..0xFFFF
1883   */
1884 __STATIC_INLINE uint32_t LL_SPI_GetRemainingDataFrames(const SPI_TypeDef *SPIx)
1885 {
1886   return (uint32_t)(READ_BIT(SPIx->SR, SPI_SR_CTSIZE) >> SPI_SR_CTSIZE_Pos);
1887 }
1888 
1889 /**
1890   * @brief  Get RxFIFO packing Level
1891   * @rmtoll SR           RXPLVL        LL_SPI_GetRxFIFOPackingLevel
1892   * @param  SPIx SPI Instance
1893   * @retval Returned value can be one of the following values:
1894   *         @arg @ref LL_SPI_RX_FIFO_0PACKET
1895   *         @arg @ref LL_SPI_RX_FIFO_1PACKET
1896   *         @arg @ref LL_SPI_RX_FIFO_2PACKET
1897   *         @arg @ref LL_SPI_RX_FIFO_3PACKET
1898   */
1899 __STATIC_INLINE uint32_t LL_SPI_GetRxFIFOPackingLevel(const SPI_TypeDef *SPIx)
1900 {
1901   return (uint32_t)(READ_BIT(SPIx->SR, SPI_SR_RXPLVL));
1902 }
1903 
1904 /**
1905   * @brief  Clear End Of Transfer flag
1906   * @rmtoll IFCR         EOTC          LL_SPI_ClearFlag_EOT
1907   * @param  SPIx SPI Instance
1908   * @retval None
1909   */
1910 __STATIC_INLINE void LL_SPI_ClearFlag_EOT(SPI_TypeDef *SPIx)
1911 {
1912   SET_BIT(SPIx->IFCR, SPI_IFCR_EOTC);
1913 }
1914 
1915 /**
1916   * @brief  Clear TXTF flag
1917   * @rmtoll IFCR         TXTFC         LL_SPI_ClearFlag_TXTF
1918   * @param  SPIx SPI Instance
1919   * @retval None
1920   */
1921 __STATIC_INLINE void LL_SPI_ClearFlag_TXTF(SPI_TypeDef *SPIx)
1922 {
1923   SET_BIT(SPIx->IFCR, SPI_IFCR_TXTFC);
1924 }
1925 
1926 /**
1927   * @brief  Clear Underrun error flag
1928   * @rmtoll IFCR         UDRC          LL_SPI_ClearFlag_UDR
1929   * @param  SPIx SPI Instance
1930   * @retval None
1931   */
1932 __STATIC_INLINE void LL_SPI_ClearFlag_UDR(SPI_TypeDef *SPIx)
1933 {
1934   SET_BIT(SPIx->IFCR, SPI_IFCR_UDRC);
1935 }
1936 
1937 /**
1938   * @brief  Clear Overrun error flag
1939   * @rmtoll IFCR         OVRC          LL_SPI_ClearFlag_OVR
1940   * @param  SPIx SPI Instance
1941   * @retval None
1942   */
1943 __STATIC_INLINE void LL_SPI_ClearFlag_OVR(SPI_TypeDef *SPIx)
1944 {
1945   SET_BIT(SPIx->IFCR, SPI_IFCR_OVRC);
1946 }
1947 
1948 /**
1949   * @brief  Clear CRC error flag
1950   * @rmtoll IFCR         CRCEC        LL_SPI_ClearFlag_CRCERR
1951   * @param  SPIx SPI Instance
1952   * @retval None
1953   */
1954 __STATIC_INLINE void LL_SPI_ClearFlag_CRCERR(SPI_TypeDef *SPIx)
1955 {
1956   SET_BIT(SPIx->IFCR, SPI_IFCR_CRCEC);
1957 }
1958 
1959 /**
1960   * @brief  Clear  Mode fault error flag
1961   * @rmtoll IFCR         MODFC         LL_SPI_ClearFlag_MODF
1962   * @param  SPIx SPI Instance
1963   * @retval None
1964   */
1965 __STATIC_INLINE void LL_SPI_ClearFlag_MODF(SPI_TypeDef *SPIx)
1966 {
1967   SET_BIT(SPIx->IFCR, SPI_IFCR_MODFC);
1968 }
1969 
1970 /**
1971   * @brief  Clear Frame format error flag
1972   * @rmtoll IFCR         TIFREC        LL_SPI_ClearFlag_FRE
1973   * @param  SPIx SPI Instance
1974   * @retval None
1975   */
1976 __STATIC_INLINE void LL_SPI_ClearFlag_FRE(SPI_TypeDef *SPIx)
1977 {
1978   SET_BIT(SPIx->IFCR, SPI_IFCR_TIFREC);
1979 }
1980 
1981 /**
1982   * @brief  Clear TSER flag
1983   * @rmtoll IFCR         TSERFC        LL_SPI_ClearFlag_TSER
1984   * @param  SPIx SPI Instance
1985   * @retval None
1986   */
1987 __STATIC_INLINE void LL_SPI_ClearFlag_TSER(SPI_TypeDef *SPIx)
1988 {
1989   SET_BIT(SPIx->IFCR, SPI_IFCR_TSERFC);
1990 }
1991 
1992 /**
1993   * @brief  Clear SUSP flag
1994   * @rmtoll IFCR         SUSPC         LL_SPI_ClearFlag_SUSP
1995   * @param  SPIx SPI Instance
1996   * @retval None
1997   */
1998 __STATIC_INLINE void LL_SPI_ClearFlag_SUSP(SPI_TypeDef *SPIx)
1999 {
2000   SET_BIT(SPIx->IFCR, SPI_IFCR_SUSPC);
2001 }
2002 
2003 /**
2004   * @}
2005   */
2006 
2007 /** @defgroup SPI_LL_EF_IT_Management IT_Management
2008   * @ingroup RTEMSBSPsARMSTM32H7
2009   * @{
2010   */
2011 
2012 /**
2013   * @brief  Enable Rx Packet available IT
2014   * @rmtoll IER          RXPIE         LL_SPI_EnableIT_RXP
2015   * @param  SPIx SPI Instance
2016   * @retval None
2017   */
2018 __STATIC_INLINE void LL_SPI_EnableIT_RXP(SPI_TypeDef *SPIx)
2019 {
2020   SET_BIT(SPIx->IER, SPI_IER_RXPIE);
2021 }
2022 
2023 /**
2024   * @brief  Enable Tx Packet space available IT
2025   * @rmtoll IER          TXPIE         LL_SPI_EnableIT_TXP
2026   * @param  SPIx SPI Instance
2027   * @retval None
2028   */
2029 __STATIC_INLINE void LL_SPI_EnableIT_TXP(SPI_TypeDef *SPIx)
2030 {
2031   SET_BIT(SPIx->IER, SPI_IER_TXPIE);
2032 }
2033 
2034 /**
2035   * @brief  Enable Duplex Packet available IT
2036   * @rmtoll IER          DXPIE         LL_SPI_EnableIT_DXP
2037   * @param  SPIx SPI Instance
2038   * @retval None
2039   */
2040 __STATIC_INLINE void LL_SPI_EnableIT_DXP(SPI_TypeDef *SPIx)
2041 {
2042   SET_BIT(SPIx->IER, SPI_IER_DXPIE);
2043 }
2044 
2045 /**
2046   * @brief  Enable End Of Transfer IT
2047   * @rmtoll IER          EOTIE         LL_SPI_EnableIT_EOT
2048   * @param  SPIx SPI Instance
2049   * @retval None
2050   */
2051 __STATIC_INLINE void LL_SPI_EnableIT_EOT(SPI_TypeDef *SPIx)
2052 {
2053   SET_BIT(SPIx->IER, SPI_IER_EOTIE);
2054 }
2055 
2056 /**
2057   * @brief  Enable TXTF IT
2058   * @rmtoll IER          TXTFIE        LL_SPI_EnableIT_TXTF
2059   * @param  SPIx SPI Instance
2060   * @retval None
2061   */
2062 __STATIC_INLINE void LL_SPI_EnableIT_TXTF(SPI_TypeDef *SPIx)
2063 {
2064   SET_BIT(SPIx->IER, SPI_IER_TXTFIE);
2065 }
2066 
2067 /**
2068   * @brief  Enable Underrun IT
2069   * @rmtoll IER          UDRIE         LL_SPI_EnableIT_UDR
2070   * @param  SPIx SPI Instance
2071   * @retval None
2072   */
2073 __STATIC_INLINE void LL_SPI_EnableIT_UDR(SPI_TypeDef *SPIx)
2074 {
2075   SET_BIT(SPIx->IER, SPI_IER_UDRIE);
2076 }
2077 
2078 /**
2079   * @brief  Enable Overrun IT
2080   * @rmtoll IER          OVRIE         LL_SPI_EnableIT_OVR
2081   * @param  SPIx SPI Instance
2082   * @retval None
2083   */
2084 __STATIC_INLINE void LL_SPI_EnableIT_OVR(SPI_TypeDef *SPIx)
2085 {
2086   SET_BIT(SPIx->IER, SPI_IER_OVRIE);
2087 }
2088 
2089 /**
2090   * @brief  Enable CRC Error IT
2091   * @rmtoll IER          CRCEIE        LL_SPI_EnableIT_CRCERR
2092   * @param  SPIx SPI Instance
2093   * @retval None
2094   */
2095 __STATIC_INLINE void LL_SPI_EnableIT_CRCERR(SPI_TypeDef *SPIx)
2096 {
2097   SET_BIT(SPIx->IER, SPI_IER_CRCEIE);
2098 }
2099 
2100 /**
2101   * @brief  Enable TI Frame Format Error IT
2102   * @rmtoll IER          TIFREIE       LL_SPI_EnableIT_FRE
2103   * @param  SPIx SPI Instance
2104   * @retval None
2105   */
2106 __STATIC_INLINE void LL_SPI_EnableIT_FRE(SPI_TypeDef *SPIx)
2107 {
2108   SET_BIT(SPIx->IER, SPI_IER_TIFREIE);
2109 }
2110 
2111 /**
2112   * @brief  Enable MODF IT
2113   * @rmtoll IER          MODFIE        LL_SPI_EnableIT_MODF
2114   * @param  SPIx SPI Instance
2115   * @retval None
2116   */
2117 __STATIC_INLINE void LL_SPI_EnableIT_MODF(SPI_TypeDef *SPIx)
2118 {
2119   SET_BIT(SPIx->IER, SPI_IER_MODFIE);
2120 }
2121 
2122 /**
2123   * @brief  Enable TSER reload IT
2124   * @rmtoll IER          TSERFIE       LL_SPI_EnableIT_TSER
2125   * @param  SPIx SPI Instance
2126   * @retval None
2127   */
2128 __STATIC_INLINE void LL_SPI_EnableIT_TSER(SPI_TypeDef *SPIx)
2129 {
2130   SET_BIT(SPIx->IER, SPI_IER_TSERFIE);
2131 }
2132 
2133 /**
2134   * @brief  Disable Rx Packet available IT
2135   * @rmtoll IER          RXPIE         LL_SPI_DisableIT_RXP
2136   * @param  SPIx SPI Instance
2137   * @retval None
2138   */
2139 __STATIC_INLINE void LL_SPI_DisableIT_RXP(SPI_TypeDef *SPIx)
2140 {
2141   CLEAR_BIT(SPIx->IER, SPI_IER_RXPIE);
2142 }
2143 
2144 /**
2145   * @brief  Disable Tx Packet space available IT
2146   * @rmtoll IER          TXPIE         LL_SPI_DisableIT_TXP
2147   * @param  SPIx SPI Instance
2148   * @retval None
2149   */
2150 __STATIC_INLINE void LL_SPI_DisableIT_TXP(SPI_TypeDef *SPIx)
2151 {
2152   CLEAR_BIT(SPIx->IER, SPI_IER_TXPIE);
2153 }
2154 
2155 /**
2156   * @brief  Disable Duplex Packet available IT
2157   * @rmtoll IER          DXPIE         LL_SPI_DisableIT_DXP
2158   * @param  SPIx SPI Instance
2159   * @retval None
2160   */
2161 __STATIC_INLINE void LL_SPI_DisableIT_DXP(SPI_TypeDef *SPIx)
2162 {
2163   CLEAR_BIT(SPIx->IER, SPI_IER_DXPIE);
2164 }
2165 
2166 /**
2167   * @brief  Disable End Of Transfer IT
2168   * @rmtoll IER          EOTIE         LL_SPI_DisableIT_EOT
2169   * @param  SPIx SPI Instance
2170   * @retval None
2171   */
2172 __STATIC_INLINE void LL_SPI_DisableIT_EOT(SPI_TypeDef *SPIx)
2173 {
2174   CLEAR_BIT(SPIx->IER, SPI_IER_EOTIE);
2175 }
2176 
2177 /**
2178   * @brief  Disable TXTF IT
2179   * @rmtoll IER          TXTFIE        LL_SPI_DisableIT_TXTF
2180   * @param  SPIx SPI Instance
2181   * @retval None
2182   */
2183 __STATIC_INLINE void LL_SPI_DisableIT_TXTF(SPI_TypeDef *SPIx)
2184 {
2185   CLEAR_BIT(SPIx->IER, SPI_IER_TXTFIE);
2186 }
2187 
2188 /**
2189   * @brief  Disable Underrun IT
2190   * @rmtoll IER          UDRIE         LL_SPI_DisableIT_UDR
2191   * @param  SPIx SPI Instance
2192   * @retval None
2193   */
2194 __STATIC_INLINE void LL_SPI_DisableIT_UDR(SPI_TypeDef *SPIx)
2195 {
2196   CLEAR_BIT(SPIx->IER, SPI_IER_UDRIE);
2197 }
2198 
2199 /**
2200   * @brief  Disable Overrun IT
2201   * @rmtoll IER          OVRIE         LL_SPI_DisableIT_OVR
2202   * @param  SPIx SPI Instance
2203   * @retval None
2204   */
2205 __STATIC_INLINE void LL_SPI_DisableIT_OVR(SPI_TypeDef *SPIx)
2206 {
2207   CLEAR_BIT(SPIx->IER, SPI_IER_OVRIE);
2208 }
2209 
2210 /**
2211   * @brief  Disable CRC Error IT
2212   * @rmtoll IER          CRCEIE        LL_SPI_DisableIT_CRCERR
2213   * @param  SPIx SPI Instance
2214   * @retval None
2215   */
2216 __STATIC_INLINE void LL_SPI_DisableIT_CRCERR(SPI_TypeDef *SPIx)
2217 {
2218   CLEAR_BIT(SPIx->IER, SPI_IER_CRCEIE);
2219 }
2220 
2221 /**
2222   * @brief  Disable TI Frame Format Error IT
2223   * @rmtoll IER          TIFREIE       LL_SPI_DisableIT_FRE
2224   * @param  SPIx SPI Instance
2225   * @retval None
2226   */
2227 __STATIC_INLINE void LL_SPI_DisableIT_FRE(SPI_TypeDef *SPIx)
2228 {
2229   CLEAR_BIT(SPIx->IER, SPI_IER_TIFREIE);
2230 }
2231 
2232 /**
2233   * @brief  Disable MODF IT
2234   * @rmtoll IER          MODFIE        LL_SPI_DisableIT_MODF
2235   * @param  SPIx SPI Instance
2236   * @retval None
2237   */
2238 __STATIC_INLINE void LL_SPI_DisableIT_MODF(SPI_TypeDef *SPIx)
2239 {
2240   CLEAR_BIT(SPIx->IER, SPI_IER_MODFIE);
2241 }
2242 
2243 /**
2244   * @brief  Disable TSER reload IT
2245   * @rmtoll IER          TSERFIE       LL_SPI_DisableIT_TSER
2246   * @param  SPIx SPI Instance
2247   * @retval None
2248   */
2249 __STATIC_INLINE void LL_SPI_DisableIT_TSER(SPI_TypeDef *SPIx)
2250 {
2251   CLEAR_BIT(SPIx->IER, SPI_IER_TSERFIE);
2252 }
2253 
2254 /**
2255   * @brief  Check if Rx Packet available IT is enabled
2256   * @rmtoll IER          RXPIE         LL_SPI_IsEnabledIT_RXP
2257   * @param  SPIx SPI Instance
2258   * @retval State of bit (1 or 0)
2259   */
2260 __STATIC_INLINE uint32_t LL_SPI_IsEnabledIT_RXP(const SPI_TypeDef *SPIx)
2261 {
2262   return ((READ_BIT(SPIx->IER, SPI_IER_RXPIE) == (SPI_IER_RXPIE)) ? 1UL : 0UL);
2263 }
2264 
2265 /**
2266   * @brief  Check if Tx Packet space available IT is enabled
2267   * @rmtoll IER          TXPIE         LL_SPI_IsEnabledIT_TXP
2268   * @param  SPIx SPI Instance
2269   * @retval State of bit (1 or 0)
2270   */
2271 __STATIC_INLINE uint32_t LL_SPI_IsEnabledIT_TXP(const SPI_TypeDef *SPIx)
2272 {
2273   return ((READ_BIT(SPIx->IER, SPI_IER_TXPIE) == (SPI_IER_TXPIE)) ? 1UL : 0UL);
2274 }
2275 
2276 /**
2277   * @brief  Check if Duplex Packet available IT is enabled
2278   * @rmtoll IER          DXPIE         LL_SPI_IsEnabledIT_DXP
2279   * @param  SPIx SPI Instance
2280   * @retval State of bit (1 or 0)
2281   */
2282 __STATIC_INLINE uint32_t LL_SPI_IsEnabledIT_DXP(const SPI_TypeDef *SPIx)
2283 {
2284   return ((READ_BIT(SPIx->IER, SPI_IER_DXPIE) == (SPI_IER_DXPIE)) ? 1UL : 0UL);
2285 }
2286 
2287 /**
2288   * @brief  Check if End Of Transfer IT is enabled
2289   * @rmtoll IER          EOTIE         LL_SPI_IsEnabledIT_EOT
2290   * @param  SPIx SPI Instance
2291   * @retval State of bit (1 or 0)
2292   */
2293 __STATIC_INLINE uint32_t LL_SPI_IsEnabledIT_EOT(const SPI_TypeDef *SPIx)
2294 {
2295   return ((READ_BIT(SPIx->IER, SPI_IER_EOTIE) == (SPI_IER_EOTIE)) ? 1UL : 0UL);
2296 }
2297 
2298 /**
2299   * @brief  Check if TXTF IT is enabled
2300   * @rmtoll IER          TXTFIE        LL_SPI_IsEnabledIT_TXTF
2301   * @param  SPIx SPI Instance
2302   * @retval State of bit (1 or 0)
2303   */
2304 __STATIC_INLINE uint32_t LL_SPI_IsEnabledIT_TXTF(const SPI_TypeDef *SPIx)
2305 {
2306   return ((READ_BIT(SPIx->IER, SPI_IER_TXTFIE) == (SPI_IER_TXTFIE)) ? 1UL : 0UL);
2307 }
2308 
2309 /**
2310   * @brief  Check if Underrun IT is enabled
2311   * @rmtoll IER          UDRIE         LL_SPI_IsEnabledIT_UDR
2312   * @param  SPIx SPI Instance
2313   * @retval State of bit (1 or 0)
2314   */
2315 __STATIC_INLINE uint32_t LL_SPI_IsEnabledIT_UDR(const SPI_TypeDef *SPIx)
2316 {
2317   return ((READ_BIT(SPIx->IER, SPI_IER_UDRIE) == (SPI_IER_UDRIE)) ? 1UL : 0UL);
2318 }
2319 
2320 /**
2321   * @brief  Check if Overrun IT is enabled
2322   * @rmtoll IER          OVRIE         LL_SPI_IsEnabledIT_OVR
2323   * @param  SPIx SPI Instance
2324   * @retval State of bit (1 or 0)
2325   */
2326 __STATIC_INLINE uint32_t LL_SPI_IsEnabledIT_OVR(const SPI_TypeDef *SPIx)
2327 {
2328   return ((READ_BIT(SPIx->IER, SPI_IER_OVRIE) == (SPI_IER_OVRIE)) ? 1UL : 0UL);
2329 }
2330 
2331 /**
2332   * @brief  Check if CRC Error IT is enabled
2333   * @rmtoll IER          CRCEIE        LL_SPI_IsEnabledIT_CRCERR
2334   * @param  SPIx SPI Instance
2335   * @retval State of bit (1 or 0)
2336   */
2337 __STATIC_INLINE uint32_t LL_SPI_IsEnabledIT_CRCERR(const SPI_TypeDef *SPIx)
2338 {
2339   return ((READ_BIT(SPIx->IER, SPI_IER_CRCEIE) == (SPI_IER_CRCEIE)) ? 1UL : 0UL);
2340 }
2341 
2342 /**
2343   * @brief  Check if TI Frame Format Error IT is enabled
2344   * @rmtoll IER          TIFREIE       LL_SPI_IsEnabledIT_FRE
2345   * @param  SPIx SPI Instance
2346   * @retval State of bit (1 or 0)
2347   */
2348 __STATIC_INLINE uint32_t LL_SPI_IsEnabledIT_FRE(const SPI_TypeDef *SPIx)
2349 {
2350   return ((READ_BIT(SPIx->IER, SPI_IER_TIFREIE) == (SPI_IER_TIFREIE)) ? 1UL : 0UL);
2351 }
2352 
2353 /**
2354   * @brief  Check if MODF IT is enabled
2355   * @rmtoll IER          MODFIE        LL_SPI_IsEnabledIT_MODF
2356   * @param  SPIx SPI Instance
2357   * @retval State of bit (1 or 0)
2358   */
2359 __STATIC_INLINE uint32_t LL_SPI_IsEnabledIT_MODF(const SPI_TypeDef *SPIx)
2360 {
2361   return ((READ_BIT(SPIx->IER, SPI_IER_MODFIE) == (SPI_IER_MODFIE)) ? 1UL : 0UL);
2362 }
2363 
2364 /**
2365   * @brief  Check if TSER reload IT is enabled
2366   * @rmtoll IER          TSERFIE       LL_SPI_IsEnabledIT_TSER
2367   * @param  SPIx SPI Instance
2368   * @retval State of bit (1 or 0)
2369   */
2370 __STATIC_INLINE uint32_t LL_SPI_IsEnabledIT_TSER(const SPI_TypeDef *SPIx)
2371 {
2372   return ((READ_BIT(SPIx->IER, SPI_IER_TSERFIE) == (SPI_IER_TSERFIE)) ? 1UL : 0UL);
2373 }
2374 
2375 /**
2376   * @}
2377   */
2378 
2379 /** @defgroup SPI_LL_EF_DMA_Management DMA Management
2380   * @ingroup RTEMSBSPsARMSTM32H7
2381   * @{
2382   */
2383 
2384 /**
2385   * @brief  Enable DMA Rx
2386   * @rmtoll CFG1         RXDMAEN       LL_SPI_EnableDMAReq_RX
2387   * @param  SPIx SPI Instance
2388   * @retval None
2389   */
2390 __STATIC_INLINE void LL_SPI_EnableDMAReq_RX(SPI_TypeDef *SPIx)
2391 {
2392   SET_BIT(SPIx->CFG1, SPI_CFG1_RXDMAEN);
2393 }
2394 
2395 /**
2396   * @brief  Disable DMA Rx
2397   * @rmtoll CFG1         RXDMAEN       LL_SPI_DisableDMAReq_RX
2398   * @param  SPIx SPI Instance
2399   * @retval None
2400   */
2401 __STATIC_INLINE void LL_SPI_DisableDMAReq_RX(SPI_TypeDef *SPIx)
2402 {
2403   CLEAR_BIT(SPIx->CFG1, SPI_CFG1_RXDMAEN);
2404 }
2405 
2406 /**
2407   * @brief  Check if DMA Rx is enabled
2408   * @rmtoll CFG1         RXDMAEN       LL_SPI_IsEnabledDMAReq_RX
2409   * @param  SPIx SPI Instance
2410   * @retval State of bit (1 or 0)
2411   */
2412 __STATIC_INLINE uint32_t LL_SPI_IsEnabledDMAReq_RX(const SPI_TypeDef *SPIx)
2413 {
2414   return ((READ_BIT(SPIx->CFG1, SPI_CFG1_RXDMAEN) == (SPI_CFG1_RXDMAEN)) ? 1UL : 0UL);
2415 }
2416 
2417 /**
2418   * @brief  Enable DMA Tx
2419   * @rmtoll CFG1         TXDMAEN       LL_SPI_EnableDMAReq_TX
2420   * @param  SPIx SPI Instance
2421   * @retval None
2422   */
2423 __STATIC_INLINE void LL_SPI_EnableDMAReq_TX(SPI_TypeDef *SPIx)
2424 {
2425   SET_BIT(SPIx->CFG1, SPI_CFG1_TXDMAEN);
2426 }
2427 
2428 /**
2429   * @brief  Disable DMA Tx
2430   * @rmtoll CFG1         TXDMAEN       LL_SPI_DisableDMAReq_TX
2431   * @param  SPIx SPI Instance
2432   * @retval None
2433   */
2434 __STATIC_INLINE void LL_SPI_DisableDMAReq_TX(SPI_TypeDef *SPIx)
2435 {
2436   CLEAR_BIT(SPIx->CFG1, SPI_CFG1_TXDMAEN);
2437 }
2438 
2439 /**
2440   * @brief  Check if DMA Tx is enabled
2441   * @rmtoll CFG1         TXDMAEN       LL_SPI_IsEnabledDMAReq_TX
2442   * @param  SPIx SPI Instance
2443   * @retval State of bit (1 or 0)
2444   */
2445 __STATIC_INLINE uint32_t LL_SPI_IsEnabledDMAReq_TX(const SPI_TypeDef *SPIx)
2446 {
2447   return ((READ_BIT(SPIx->CFG1, SPI_CFG1_TXDMAEN) == (SPI_CFG1_TXDMAEN)) ? 1UL : 0UL);
2448 }
2449 /**
2450   * @brief  Get the data register address used for DMA transfer
2451   * @rmtoll TXDR           TXDR            LL_SPI_DMA_GetTxRegAddr
2452   * @param  SPIx SPI Instance
2453   * @retval Address of data register
2454   */
2455 __STATIC_INLINE uint32_t LL_SPI_DMA_GetTxRegAddr(const SPI_TypeDef *SPIx)
2456 {
2457   return (uint32_t) &(SPIx->TXDR);
2458 }
2459 
2460 /**
2461   * @brief  Get the data register address used for DMA transfer
2462   * @rmtoll RXDR           RXDR            LL_SPI_DMA_GetRxRegAddr
2463   * @param  SPIx SPI Instance
2464   * @retval Address of data register
2465   */
2466 __STATIC_INLINE uint32_t LL_SPI_DMA_GetRxRegAddr(const SPI_TypeDef *SPIx)
2467 {
2468   return (uint32_t) &(SPIx->RXDR);
2469 }
2470 /**
2471   * @}
2472   */
2473 
2474 /** @defgroup SPI_LL_EF_DATA_Management DATA_Management
2475   * @ingroup RTEMSBSPsARMSTM32H7
2476   * @{
2477   */
2478 
2479 /**
2480   * @brief  Read Data Register
2481   * @rmtoll RXDR         .       LL_SPI_ReceiveData8
2482   * @param  SPIx SPI Instance
2483   * @retval 0..0xFF
2484   */
2485 __STATIC_INLINE uint8_t LL_SPI_ReceiveData8(SPI_TypeDef *SPIx) /* Derogation MISRAC2012-Rule-8.13 */
2486 {
2487   return (*((__IO uint8_t *)&SPIx->RXDR));
2488 }
2489 
2490 /**
2491   * @brief  Read Data Register
2492   * @rmtoll RXDR         .       LL_SPI_ReceiveData16
2493   * @param  SPIx SPI Instance
2494   * @retval 0..0xFFFF
2495   */
2496 __STATIC_INLINE uint16_t LL_SPI_ReceiveData16(SPI_TypeDef *SPIx) /* Derogation MISRAC2012-Rule-8.13 */
2497 {
2498 #if defined (__GNUC__)
2499   __IO uint16_t *spirxdr = (__IO uint16_t *)(&(SPIx->RXDR));
2500   return (*spirxdr);
2501 #else
2502   return (*((__IO uint16_t *)&SPIx->RXDR));
2503 #endif /* __GNUC__ */
2504 }
2505 
2506 /**
2507   * @brief  Read Data Register
2508   * @rmtoll RXDR         .       LL_SPI_ReceiveData32
2509   * @param  SPIx SPI Instance
2510   * @retval  0..0xFFFFFFFF
2511   */
2512 __STATIC_INLINE uint32_t LL_SPI_ReceiveData32(SPI_TypeDef *SPIx) /* Derogation MISRAC2012-Rule-8.13 */
2513 {
2514   return (*((__IO uint32_t *)&SPIx->RXDR));
2515 }
2516 
2517 /**
2518   * @brief  Write Data Register
2519   * @rmtoll TXDR         .       LL_SPI_TransmitData8
2520   * @param  SPIx SPI Instance
2521   * @param  TxData 0..0xFF
2522   * @retval None
2523   */
2524 __STATIC_INLINE void LL_SPI_TransmitData8(SPI_TypeDef *SPIx, uint8_t TxData)
2525 {
2526   *((__IO uint8_t *)&SPIx->TXDR) = TxData;
2527 }
2528 
2529 /**
2530   * @brief  Write Data Register
2531   * @rmtoll TXDR         .       LL_SPI_TransmitData16
2532   * @param  SPIx SPI Instance
2533   * @param  TxData 0..0xFFFF
2534   * @retval None
2535   */
2536 __STATIC_INLINE void LL_SPI_TransmitData16(SPI_TypeDef *SPIx, uint16_t TxData)
2537 {
2538 #if defined (__GNUC__)
2539   __IO uint16_t *spitxdr = ((__IO uint16_t *)&SPIx->TXDR);
2540   *spitxdr = TxData;
2541 #else
2542   *((__IO uint16_t *)&SPIx->TXDR) = TxData;
2543 #endif /* __GNUC__ */
2544 }
2545 
2546 /**
2547   * @brief  Write Data Register
2548   * @rmtoll TXDR         .       LL_SPI_TransmitData32
2549   * @param  SPIx SPI Instance
2550   * @param  TxData 0..0xFFFFFFFF
2551   * @retval None
2552   */
2553 __STATIC_INLINE void LL_SPI_TransmitData32(SPI_TypeDef *SPIx, uint32_t TxData)
2554 {
2555   *((__IO uint32_t *)&SPIx->TXDR) = TxData;
2556 }
2557 
2558 /**
2559   * @brief  Set polynomial for CRC calcul
2560   * @rmtoll CRCPOLY      CRCPOLY       LL_SPI_SetCRCPolynomial
2561   * @param  SPIx SPI Instance
2562   * @param  CRCPoly 0..0xFFFFFFFF
2563   * @retval None
2564   */
2565 __STATIC_INLINE void LL_SPI_SetCRCPolynomial(SPI_TypeDef *SPIx, uint32_t CRCPoly)
2566 {
2567   WRITE_REG(SPIx->CRCPOLY, CRCPoly);
2568 }
2569 
2570 /**
2571   * @brief  Get polynomial for CRC calcul
2572   * @rmtoll CRCPOLY      CRCPOLY       LL_SPI_GetCRCPolynomial
2573   * @param  SPIx SPI Instance
2574   * @retval 0..0xFFFFFFFF
2575   */
2576 __STATIC_INLINE uint32_t LL_SPI_GetCRCPolynomial(const SPI_TypeDef *SPIx)
2577 {
2578   return (uint32_t)(READ_REG(SPIx->CRCPOLY));
2579 }
2580 
2581 /**
2582   * @brief  Set the underrun pattern
2583   * @rmtoll UDRDR        UDRDR         LL_SPI_SetUDRPattern
2584   * @param  SPIx SPI Instance
2585   * @param  Pattern 0..0xFFFFFFFF
2586   * @retval None
2587   */
2588 __STATIC_INLINE void LL_SPI_SetUDRPattern(SPI_TypeDef *SPIx, uint32_t Pattern)
2589 {
2590   WRITE_REG(SPIx->UDRDR, Pattern);
2591 }
2592 
2593 /**
2594   * @brief  Get the underrun pattern
2595   * @rmtoll UDRDR        UDRDR         LL_SPI_GetUDRPattern
2596   * @param  SPIx SPI Instance
2597   * @retval 0..0xFFFFFFFF
2598   */
2599 __STATIC_INLINE uint32_t LL_SPI_GetUDRPattern(const SPI_TypeDef *SPIx)
2600 {
2601   return (uint32_t)(READ_REG(SPIx->UDRDR));
2602 }
2603 
2604 /**
2605   * @brief  Get Rx CRC
2606   * @rmtoll RXCRCR       RXCRC         LL_SPI_GetRxCRC
2607   * @param  SPIx SPI Instance
2608   * @retval 0..0xFFFFFFFF
2609   */
2610 __STATIC_INLINE uint32_t LL_SPI_GetRxCRC(const SPI_TypeDef *SPIx)
2611 {
2612   return (uint32_t)(READ_REG(SPIx->RXCRC));
2613 }
2614 
2615 /**
2616   * @brief  Get Tx CRC
2617   * @rmtoll TXCRCR       TXCRC         LL_SPI_GetTxCRC
2618   * @param  SPIx SPI Instance
2619   * @retval 0..0xFFFFFFFF
2620   */
2621 __STATIC_INLINE uint32_t LL_SPI_GetTxCRC(const SPI_TypeDef *SPIx)
2622 {
2623   return (uint32_t)(READ_REG(SPIx->TXCRC));
2624 }
2625 
2626 /**
2627   * @}
2628   */
2629 
2630 #if defined(USE_FULL_LL_DRIVER) || defined(__rtems__)
2631 /** @defgroup SPI_LL_EF_Init Initialization and de-initialization functions
2632   * @ingroup RTEMSBSPsARMSTM32H7
2633   * @{
2634   */
2635 
2636 ErrorStatus LL_SPI_DeInit(const SPI_TypeDef *SPIx);
2637 ErrorStatus LL_SPI_Init(SPI_TypeDef *SPIx, LL_SPI_InitTypeDef *SPI_InitStruct);
2638 void        LL_SPI_StructInit(LL_SPI_InitTypeDef *SPI_InitStruct);
2639 
2640 /**
2641   * @}
2642   */
2643 #endif /* USE_FULL_LL_DRIVER */
2644 /**
2645   * @}
2646   */
2647 /**
2648   * @}
2649   */
2650 
2651 /** @defgroup I2S_LL I2S
2652   * @ingroup RTEMSBSPsARMSTM32H7
2653   * @{
2654   */
2655 
2656 /* Private variables ---------------------------------------------------------*/
2657 /* Private constants ---------------------------------------------------------*/
2658 /* Private macros ------------------------------------------------------------*/
2659 
2660 /* Exported types ------------------------------------------------------------*/
2661 #if defined(USE_FULL_LL_DRIVER) || defined(__rtems__)
2662 /** @defgroup I2S_LL_ES_INIT I2S Exported Init structure
2663   * @ingroup RTEMSBSPsARMSTM32H7
2664   * @{
2665   */
2666 
2667 /**
2668   * @brief  I2S Init structure definition
2669   */
2670 
2671 typedef struct
2672 {
2673   uint32_t Mode;                    /*!< Specifies the I2S operating mode.
2674                                          This parameter can be a value of @ref I2S_LL_EC_MODE
2675 
2676                                          This feature can be modified afterwards using unitary function
2677                                          @ref LL_I2S_SetTransferMode().*/
2678 
2679   uint32_t Standard;                /*!< Specifies the standard used for the I2S communication.
2680                                          This parameter can be a value of @ref I2S_LL_EC_STANDARD
2681 
2682                                          This feature can be modified afterwards using unitary function
2683                                          @ref LL_I2S_SetStandard().*/
2684 
2685 
2686   uint32_t DataFormat;              /*!< Specifies the data format for the I2S communication.
2687                                          This parameter can be a value of @ref I2S_LL_EC_DATA_FORMAT
2688 
2689                                          This feature can be modified afterwards using unitary function
2690                                          @ref LL_I2S_SetDataFormat().*/
2691 
2692 
2693   uint32_t MCLKOutput;              /*!< Specifies whether the I2S MCLK output is enabled or not.
2694                                          This parameter can be a value of @ref I2S_LL_EC_MCLK_OUTPUT
2695 
2696                                          This feature can be modified afterwards using unitary functions
2697                                          @ref LL_I2S_EnableMasterClock() or @ref LL_I2S_DisableMasterClock.*/
2698 
2699 
2700   uint32_t AudioFreq;               /*!< Specifies the frequency selected for the I2S communication.
2701                                          This parameter can be a value of @ref I2S_LL_EC_AUDIO_FREQ
2702 
2703                                          Audio Frequency can be modified afterwards using Reference manual formulas
2704                                          to calculate Prescaler Linear, Parity and unitary functions
2705                                          @ref LL_I2S_SetPrescalerLinear() and @ref LL_I2S_SetPrescalerParity()
2706                                          to set it.*/
2707 
2708 
2709   uint32_t ClockPolarity;           /*!< Specifies the idle state of the I2S clock.
2710                                          This parameter can be a value of @ref I2S_LL_EC_POLARITY
2711 
2712                                          This feature can be modified afterwards using unitary function
2713                                          @ref LL_I2S_SetClockPolarity().*/
2714 
2715 } LL_I2S_InitTypeDef;
2716 
2717 /**
2718   * @}
2719   */
2720 #endif /*USE_FULL_LL_DRIVER*/
2721 
2722 /* Exported constants --------------------------------------------------------*/
2723 /** @defgroup I2S_LL_Exported_Constants I2S Exported Constants
2724   * @ingroup RTEMSBSPsARMSTM32H7
2725   * @{
2726   */
2727 
2728 /** @defgroup I2S_LL_EC_DATA_FORMAT Data Format
2729   * @ingroup RTEMSBSPsARMSTM32H7
2730   * @{
2731   */
2732 #define LL_I2S_DATAFORMAT_16B               (0x00000000UL)
2733 #define LL_I2S_DATAFORMAT_16B_EXTENDED      (SPI_I2SCFGR_CHLEN)
2734 #define LL_I2S_DATAFORMAT_24B               (SPI_I2SCFGR_CHLEN | SPI_I2SCFGR_DATLEN_0)
2735 #define LL_I2S_DATAFORMAT_24B_LEFT_ALIGNED  (SPI_I2SCFGR_CHLEN | SPI_I2SCFGR_DATLEN_0 | SPI_I2SCFGR_DATFMT)
2736 #define LL_I2S_DATAFORMAT_32B               (SPI_I2SCFGR_CHLEN | SPI_I2SCFGR_DATLEN_1)
2737 /**
2738   * @}
2739   */
2740 
2741 /** @defgroup I2S_LL_EC_CHANNEL_LENGTH_TYPE Type of Channel Length
2742   * @ingroup RTEMSBSPsARMSTM32H7
2743   * @{
2744   */
2745 #define LL_I2S_SLAVE_VARIABLE_CH_LENGTH     (0x00000000UL)
2746 #define LL_I2S_SLAVE_FIXED_CH_LENGTH        (SPI_I2SCFGR_FIXCH)
2747 /**
2748   * @}
2749   */
2750 
2751 /** @defgroup I2S_LL_EC_POLARITY Clock Polarity
2752   * @ingroup RTEMSBSPsARMSTM32H7
2753   * @{
2754   */
2755 #define LL_I2S_POLARITY_LOW                 (0x00000000UL)
2756 #define LL_I2S_POLARITY_HIGH                (SPI_I2SCFGR_CKPOL)
2757 /**
2758   * @}
2759   */
2760 
2761 /** @defgroup I2S_LL_EC_STANDARD I2S Standard
2762   * @ingroup RTEMSBSPsARMSTM32H7
2763   * @{
2764   */
2765 #define LL_I2S_STANDARD_PHILIPS             (0x00000000UL)
2766 #define LL_I2S_STANDARD_MSB                 (SPI_I2SCFGR_I2SSTD_0)
2767 #define LL_I2S_STANDARD_LSB                 (SPI_I2SCFGR_I2SSTD_1)
2768 #define LL_I2S_STANDARD_PCM_SHORT           (SPI_I2SCFGR_I2SSTD_0 | SPI_I2SCFGR_I2SSTD_1)
2769 #define LL_I2S_STANDARD_PCM_LONG            (SPI_I2SCFGR_I2SSTD_0 | SPI_I2SCFGR_I2SSTD_1 | SPI_I2SCFGR_PCMSYNC)
2770 /**
2771   * @}
2772   */
2773 
2774 /** @defgroup I2S_LL_EC_MODE Operation Mode
2775   * @ingroup RTEMSBSPsARMSTM32H7
2776   * @{
2777   */
2778 #define LL_I2S_MODE_SLAVE_TX                (0x00000000UL)
2779 #define LL_I2S_MODE_SLAVE_RX                (SPI_I2SCFGR_I2SCFG_0)
2780 #define LL_I2S_MODE_SLAVE_FULL_DUPLEX       (SPI_I2SCFGR_I2SCFG_2)
2781 #define LL_I2S_MODE_MASTER_TX               (SPI_I2SCFGR_I2SCFG_1)
2782 #define LL_I2S_MODE_MASTER_RX               (SPI_I2SCFGR_I2SCFG_1 | SPI_I2SCFGR_I2SCFG_0)
2783 #define LL_I2S_MODE_MASTER_FULL_DUPLEX      (SPI_I2SCFGR_I2SCFG_2 | SPI_I2SCFGR_I2SCFG_0)
2784 /**
2785   * @}
2786   */
2787 
2788 /** @defgroup I2S_LL_EC_PRESCALER_PARITY Prescaler Factor
2789   * @ingroup RTEMSBSPsARMSTM32H7
2790   * @{
2791   */
2792 #define LL_I2S_PRESCALER_PARITY_EVEN        (0x00000000UL)   /*!< Odd factor: Real divider value is =  I2SDIV * 2    */
2793 #define LL_I2S_PRESCALER_PARITY_ODD         (0x00000001UL)   /*!< Odd factor: Real divider value is = (I2SDIV * 2)+1 */
2794 /**
2795   * @}
2796   */
2797 
2798 /** @defgroup I2S_LL_EC_FIFO_TH FIFO Threshold Level
2799   * @ingroup RTEMSBSPsARMSTM32H7
2800   * @{
2801   */
2802 #define LL_I2S_FIFO_TH_01DATA               (LL_SPI_FIFO_TH_01DATA)
2803 #define LL_I2S_FIFO_TH_02DATA               (LL_SPI_FIFO_TH_02DATA)
2804 #define LL_I2S_FIFO_TH_03DATA               (LL_SPI_FIFO_TH_03DATA)
2805 #define LL_I2S_FIFO_TH_04DATA               (LL_SPI_FIFO_TH_04DATA)
2806 #define LL_I2S_FIFO_TH_05DATA               (LL_SPI_FIFO_TH_05DATA)
2807 #define LL_I2S_FIFO_TH_06DATA               (LL_SPI_FIFO_TH_06DATA)
2808 #define LL_I2S_FIFO_TH_07DATA               (LL_SPI_FIFO_TH_07DATA)
2809 #define LL_I2S_FIFO_TH_08DATA               (LL_SPI_FIFO_TH_08DATA)
2810 /**
2811   * @}
2812   */
2813 
2814 /** @defgroup I2S_LL_EC_BIT_ORDER Transmission Bit Order
2815   * @ingroup RTEMSBSPsARMSTM32H7
2816   * @{
2817   */
2818 #define LL_I2S_LSB_FIRST                    (LL_SPI_LSB_FIRST)
2819 #define LL_I2S_MSB_FIRST                    (LL_SPI_MSB_FIRST)
2820 /**
2821   * @}
2822   */
2823 
2824 #if defined(USE_FULL_LL_DRIVER) || defined(__rtems__)
2825 
2826 /** @defgroup I2S_LL_EC_MCLK_OUTPUT MCLK Output
2827   * @ingroup RTEMSBSPsARMSTM32H7
2828   * @{
2829   */
2830 #define LL_I2S_MCLK_OUTPUT_DISABLE          (0x00000000UL)
2831 #define LL_I2S_MCLK_OUTPUT_ENABLE           (SPI_I2SCFGR_MCKOE)
2832 /**
2833   * @}
2834   */
2835 
2836 /** @defgroup I2S_LL_EC_AUDIO_FREQ Audio Frequency
2837   * @ingroup RTEMSBSPsARMSTM32H7
2838   * @{
2839   */
2840 
2841 #define LL_I2S_AUDIOFREQ_192K               192000UL       /*!< Audio Frequency configuration 192000 Hz       */
2842 #define LL_I2S_AUDIOFREQ_96K                96000UL        /*!< Audio Frequency configuration  96000 Hz       */
2843 #define LL_I2S_AUDIOFREQ_48K                48000UL        /*!< Audio Frequency configuration  48000 Hz       */
2844 #define LL_I2S_AUDIOFREQ_44K                44100UL        /*!< Audio Frequency configuration  44100 Hz       */
2845 #define LL_I2S_AUDIOFREQ_32K                32000UL        /*!< Audio Frequency configuration  32000 Hz       */
2846 #define LL_I2S_AUDIOFREQ_22K                22050UL        /*!< Audio Frequency configuration  22050 Hz       */
2847 #define LL_I2S_AUDIOFREQ_16K                16000UL        /*!< Audio Frequency configuration  16000 Hz       */
2848 #define LL_I2S_AUDIOFREQ_11K                11025UL        /*!< Audio Frequency configuration  11025 Hz       */
2849 #define LL_I2S_AUDIOFREQ_8K                 8000UL         /*!< Audio Frequency configuration   8000 Hz       */
2850 #define LL_I2S_AUDIOFREQ_DEFAULT            0UL            /*!< Audio Freq not specified. Register I2SDIV = 0 */
2851 /**
2852   * @}
2853   */
2854 #endif /* USE_FULL_LL_DRIVER */
2855 
2856 /**
2857   * @}
2858   */
2859 
2860 /* Exported macro ------------------------------------------------------------*/
2861 /** @defgroup I2S_LL_Exported_Macros I2S Exported Macros
2862   * @ingroup RTEMSBSPsARMSTM32H7
2863   * @{
2864   */
2865 
2866 /** @defgroup I2S_LL_EM_WRITE_READ Common Write and read registers Macros
2867   * @ingroup RTEMSBSPsARMSTM32H7
2868   * @{
2869   */
2870 
2871 /**
2872   * @brief  Write a value in I2S register
2873   * @param  __INSTANCE__ I2S Instance
2874   * @param  __REG__ Register to be written
2875   * @param  __VALUE__ Value to be written in the register
2876   * @retval None
2877   */
2878 #define LL_I2S_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, (__VALUE__))
2879 
2880 /**
2881   * @brief  Read a value in I2S register
2882   * @param  __INSTANCE__ I2S Instance
2883   * @param  __REG__ Register to be read
2884   * @retval Register value
2885   */
2886 #define LL_I2S_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__)
2887 /**
2888   * @}
2889   */
2890 
2891 /**
2892   * @}
2893   */
2894 
2895 
2896 /* Exported functions --------------------------------------------------------*/
2897 
2898 /** @defgroup I2S_LL_Exported_Functions I2S Exported Functions
2899   * @ingroup RTEMSBSPsARMSTM32H7
2900   * @{
2901   */
2902 
2903 /** @defgroup I2S_LL_EF_Configuration Configuration
2904   * @ingroup RTEMSBSPsARMSTM32H7
2905   * @{
2906   */
2907 
2908 /**
2909   * @brief  Set I2S Data frame format
2910   * @rmtoll I2SCFGR      DATLEN        LL_I2S_SetDataFormat\n
2911   *         I2SCFGR      CHLEN         LL_I2S_SetDataFormat\n
2912   *         I2SCFGR      DATFMT        LL_I2S_SetDataFormat
2913   * @param  SPIx SPI Handle
2914   * @param  DataLength This parameter can be one of the following values:
2915   *         @arg @ref LL_I2S_DATAFORMAT_16B
2916   *         @arg @ref LL_I2S_DATAFORMAT_16B_EXTENDED
2917   *         @arg @ref LL_I2S_DATAFORMAT_24B
2918   *         @arg @ref LL_I2S_DATAFORMAT_24B_LEFT_ALIGNED
2919   *         @arg @ref LL_I2S_DATAFORMAT_32B
2920   * @retval None
2921   */
2922 __STATIC_INLINE void LL_I2S_SetDataFormat(SPI_TypeDef *SPIx, uint32_t DataLength)
2923 {
2924   MODIFY_REG(SPIx->I2SCFGR, SPI_I2SCFGR_DATLEN | SPI_I2SCFGR_CHLEN | SPI_I2SCFGR_DATFMT, DataLength);
2925 }
2926 
2927 /**
2928   * @brief  Get I2S Data frame format
2929   * @rmtoll I2SCFGR      DATLEN        LL_I2S_GetDataFormat\n
2930   *         I2SCFGR      CHLEN         LL_I2S_GetDataFormat\n
2931   *         I2SCFGR      DATFMT        LL_I2S_GetDataFormat
2932   * @param  SPIx SPI Handle
2933   * @retval Return value can be one of the following values:
2934   *         @arg @ref LL_I2S_DATAFORMAT_16B
2935   *         @arg @ref LL_I2S_DATAFORMAT_16B_EXTENDED
2936   *         @arg @ref LL_I2S_DATAFORMAT_24B
2937   *         @arg @ref LL_I2S_DATAFORMAT_24B_LEFT_ALIGNED
2938   *         @arg @ref LL_I2S_DATAFORMAT_32B
2939   */
2940 __STATIC_INLINE uint32_t LL_I2S_GetDataFormat(const SPI_TypeDef *SPIx)
2941 {
2942   return (uint32_t)(READ_BIT(SPIx->I2SCFGR, SPI_I2SCFGR_DATLEN | SPI_I2SCFGR_CHLEN | SPI_I2SCFGR_DATFMT));
2943 }
2944 
2945 /**
2946   * @brief  Set I2S Channel Length Type
2947   * @note   This feature is useful with SLAVE only
2948   * @rmtoll I2SCFGR      FIXCH        LL_I2S_SetChannelLengthType
2949   * @param  SPIx SPI Handle
2950   * @param  ChannelLengthType This parameter can be one of the following values:
2951   *         @arg @ref LL_I2S_SLAVE_VARIABLE_CH_LENGTH
2952   *         @arg @ref LL_I2S_SLAVE_FIXED_CH_LENGTH
2953   * @retval None
2954   */
2955 __STATIC_INLINE void LL_I2S_SetChannelLengthType(SPI_TypeDef *SPIx, uint32_t ChannelLengthType)
2956 {
2957   MODIFY_REG(SPIx->I2SCFGR, SPI_I2SCFGR_FIXCH, ChannelLengthType);
2958 }
2959 
2960 /**
2961   * @brief  Get I2S Channel Length Type
2962   * @note   This feature is useful with SLAVE only
2963   * @rmtoll I2SCFGR      FIXCH         LL_I2S_GetChannelLengthType
2964   * @param  SPIx SPI Handle
2965   * @retval Return value can be one of the following values:
2966   *         @arg @ref LL_I2S_SLAVE_VARIABLE_CH_LENGTH
2967   *         @arg @ref LL_I2S_SLAVE_FIXED_CH_LENGTH
2968   */
2969 __STATIC_INLINE uint32_t LL_I2S_GetChannelLengthType(const SPI_TypeDef *SPIx)
2970 {
2971   return (uint32_t)(READ_BIT(SPIx->I2SCFGR, SPI_I2SCFGR_FIXCH));
2972 }
2973 
2974 /**
2975   * @brief  Invert the default polarity of WS signal
2976   * @rmtoll I2SCFGR      WSINV         LL_I2S_EnableWordSelectInversion
2977   * @param  SPIx SPI Handle
2978   * @retval None
2979   */
2980 __STATIC_INLINE void LL_I2S_EnableWordSelectInversion(SPI_TypeDef *SPIx)
2981 {
2982   SET_BIT(SPIx->I2SCFGR, SPI_I2SCFGR_WSINV);
2983 }
2984 
2985 /**
2986   * @brief  Use the default polarity of WS signal
2987   * @rmtoll I2SCFGR      WSINV         LL_I2S_DisableWordSelectInversion
2988   * @param  SPIx SPI Handle
2989   * @retval None
2990   */
2991 __STATIC_INLINE void LL_I2S_DisableWordSelectInversion(SPI_TypeDef *SPIx)
2992 {
2993   CLEAR_BIT(SPIx->I2SCFGR, SPI_I2SCFGR_WSINV);
2994 }
2995 
2996 /**
2997   * @brief  Check if polarity of WS signal is inverted
2998   * @rmtoll I2SCFGR      WSINV         LL_I2S_IsEnabledWordSelectInversion
2999   * @param  SPIx SPI Handle
3000   * @retval State of bit (1 or 0)
3001   */
3002 __STATIC_INLINE uint32_t LL_I2S_IsEnabledWordSelectInversion(const SPI_TypeDef *SPIx)
3003 {
3004   return ((READ_BIT(SPIx->I2SCFGR, SPI_I2SCFGR_WSINV) == (SPI_I2SCFGR_WSINV)) ? 1UL : 0UL);
3005 }
3006 
3007 /**
3008   * @brief  Set 2S Clock Polarity
3009   * @rmtoll I2SCFGR      CKPOL         LL_I2S_SetClockPolarity
3010   * @param  SPIx SPI Handle
3011   * @param  ClockPolarity This parameter can be one of the following values:
3012   *         @arg @ref LL_I2S_POLARITY_LOW
3013   *         @arg @ref LL_I2S_POLARITY_HIGH
3014   * @retval None
3015   */
3016 __STATIC_INLINE void LL_I2S_SetClockPolarity(SPI_TypeDef *SPIx, uint32_t ClockPolarity)
3017 {
3018   MODIFY_REG(SPIx->I2SCFGR, SPI_I2SCFGR_CKPOL, ClockPolarity);
3019 }
3020 
3021 /**
3022   * @brief  Get 2S Clock Polarity
3023   * @rmtoll I2SCFGR      CKPOL         LL_I2S_GetClockPolarity
3024   * @param  SPIx SPI Handle
3025   * @retval Return value can be one of the following values:
3026   *         @arg @ref LL_I2S_POLARITY_LOW
3027   *         @arg @ref LL_I2S_POLARITY_HIGH
3028   */
3029 __STATIC_INLINE uint32_t LL_I2S_GetClockPolarity(const SPI_TypeDef *SPIx)
3030 {
3031   return (uint32_t)(READ_BIT(SPIx->I2SCFGR, SPI_I2SCFGR_CKPOL));
3032 }
3033 
3034 /**
3035   * @brief  Set I2S standard
3036   * @rmtoll I2SCFGR      I2SSTD        LL_I2S_SetStandard\n
3037   *         I2SCFGR      PCMSYNC       LL_I2S_SetStandard
3038   * @param  SPIx SPI Handle
3039   * @param  Standard This parameter can be one of the following values:
3040   *         @arg @ref LL_I2S_STANDARD_PHILIPS
3041   *         @arg @ref LL_I2S_STANDARD_MSB
3042   *         @arg @ref LL_I2S_STANDARD_LSB
3043   *         @arg @ref LL_I2S_STANDARD_PCM_SHORT
3044   *         @arg @ref LL_I2S_STANDARD_PCM_LONG
3045   * @retval None
3046   */
3047 __STATIC_INLINE void LL_I2S_SetStandard(SPI_TypeDef *SPIx, uint32_t Standard)
3048 {
3049   MODIFY_REG(SPIx->I2SCFGR, SPI_I2SCFGR_I2SSTD | SPI_I2SCFGR_PCMSYNC, Standard);
3050 }
3051 
3052 /**
3053   * @brief  Get I2S standard
3054   * @rmtoll I2SCFGR      I2SSTD        LL_I2S_GetStandard\n
3055   *         I2SCFGR      PCMSYNC       LL_I2S_GetStandard
3056   * @param  SPIx SPI Handle
3057   * @retval Return value can be one of the following values:
3058   *         @arg @ref LL_I2S_STANDARD_PHILIPS
3059   *         @arg @ref LL_I2S_STANDARD_MSB
3060   *         @arg @ref LL_I2S_STANDARD_LSB
3061   *         @arg @ref LL_I2S_STANDARD_PCM_SHORT
3062   *         @arg @ref LL_I2S_STANDARD_PCM_LONG
3063   */
3064 __STATIC_INLINE uint32_t LL_I2S_GetStandard(const SPI_TypeDef *SPIx)
3065 {
3066   return (uint32_t)(READ_BIT(SPIx->I2SCFGR, SPI_I2SCFGR_I2SSTD | SPI_I2SCFGR_PCMSYNC));
3067 }
3068 
3069 /**
3070   * @brief  Set I2S config
3071   * @rmtoll I2SCFGR      I2SCFG        LL_I2S_SetTransferMode
3072   * @param  SPIx SPI Handle
3073   * @param  Standard This parameter can be one of the following values:
3074   *         @arg @ref LL_I2S_MODE_SLAVE_TX
3075   *         @arg @ref LL_I2S_MODE_SLAVE_RX
3076   *         @arg @ref LL_I2S_MODE_SLAVE_FULL_DUPLEX
3077   *         @arg @ref LL_I2S_MODE_MASTER_TX
3078   *         @arg @ref LL_I2S_MODE_MASTER_RX
3079   *         @arg @ref LL_I2S_MODE_MASTER_FULL_DUPLEX
3080   * @retval None
3081   */
3082 __STATIC_INLINE void LL_I2S_SetTransferMode(SPI_TypeDef *SPIx, uint32_t Standard)
3083 {
3084   MODIFY_REG(SPIx->I2SCFGR, SPI_I2SCFGR_I2SCFG, Standard);
3085 }
3086 
3087 /**
3088   * @brief  Get I2S config
3089   * @rmtoll I2SCFGR      I2SCFG        LL_I2S_GetTransferMode
3090   * @param  SPIx SPI Handle
3091   * @retval Return value can be one of the following values:
3092   *         @arg @ref LL_I2S_MODE_SLAVE_TX
3093   *         @arg @ref LL_I2S_MODE_SLAVE_RX
3094   *         @arg @ref LL_I2S_MODE_SLAVE_FULL_DUPLEX
3095   *         @arg @ref LL_I2S_MODE_MASTER_TX
3096   *         @arg @ref LL_I2S_MODE_MASTER_RX
3097   *         @arg @ref LL_I2S_MODE_MASTER_FULL_DUPLEX
3098   */
3099 __STATIC_INLINE uint32_t LL_I2S_GetTransferMode(const SPI_TypeDef *SPIx)
3100 {
3101   return (uint32_t)(READ_BIT(SPIx->I2SCFGR, SPI_I2SCFGR_I2SCFG));
3102 }
3103 
3104 /**
3105   * @brief  Select I2S mode and Enable I2S peripheral
3106   * @rmtoll I2SCFGR      I2SMOD        LL_I2S_Enable\n
3107   *         CR1          SPE           LL_I2S_Enable
3108   * @param  SPIx SPI Handle
3109   * @retval None
3110   */
3111 __STATIC_INLINE void LL_I2S_Enable(SPI_TypeDef *SPIx)
3112 {
3113   SET_BIT(SPIx->I2SCFGR, SPI_I2SCFGR_I2SMOD);
3114   SET_BIT(SPIx->CR1, SPI_CR1_SPE);
3115 }
3116 
3117 /**
3118   * @brief  Disable I2S peripheral and disable I2S mode
3119   * @rmtoll CR1          SPE           LL_I2S_Disable\n
3120   *         I2SCFGR      I2SMOD        LL_I2S_Disable
3121   * @param  SPIx SPI Handle
3122   * @retval None
3123   */
3124 __STATIC_INLINE void LL_I2S_Disable(SPI_TypeDef *SPIx)
3125 {
3126   CLEAR_BIT(SPIx->CR1, SPI_CR1_SPE);
3127   CLEAR_BIT(SPIx->I2SCFGR, SPI_I2SCFGR_I2SMOD);
3128 }
3129 
3130 /**
3131   * @brief  Swap the SDO and SDI pin
3132   * @note   This configuration can not be changed when I2S is enabled.
3133   * @rmtoll CFG2         IOSWP         LL_I2S_EnableIOSwap
3134   * @param  SPIx SPI Instance
3135   * @retval None
3136   */
3137 __STATIC_INLINE void LL_I2S_EnableIOSwap(SPI_TypeDef *SPIx)
3138 {
3139   LL_SPI_EnableIOSwap(SPIx);
3140 }
3141 
3142 /**
3143   * @brief  Restore default function for SDO and SDI pin
3144   * @note   This configuration can not be changed when I2S is enabled.
3145   * @rmtoll CFG2         IOSWP         LL_I2S_DisableIOSwap
3146   * @param  SPIx SPI Instance
3147   * @retval None
3148   */
3149 __STATIC_INLINE void LL_I2S_DisableIOSwap(SPI_TypeDef *SPIx)
3150 {
3151   LL_SPI_DisableIOSwap(SPIx);
3152 }
3153 
3154 /**
3155   * @brief  Check if SDO and SDI pin are swapped
3156   * @rmtoll CFG2         IOSWP         LL_I2S_IsEnabledIOSwap
3157   * @param  SPIx SPI Instance
3158   * @retval State of bit (1 or 0)
3159   */
3160 __STATIC_INLINE uint32_t LL_I2S_IsEnabledIOSwap(const SPI_TypeDef *SPIx)
3161 {
3162   return LL_SPI_IsEnabledIOSwap(SPIx);
3163 }
3164 
3165 /**
3166   * @brief  Enable GPIO control
3167   * @note   This configuration can not be changed when I2S is enabled.
3168   * @rmtoll CFG2         AFCNTR        LL_I2S_EnableGPIOControl
3169   * @param  SPIx SPI Instance
3170   * @retval None
3171   */
3172 __STATIC_INLINE void LL_I2S_EnableGPIOControl(SPI_TypeDef *SPIx)
3173 {
3174   LL_SPI_EnableGPIOControl(SPIx);
3175 }
3176 
3177 /**
3178   * @brief  Disable GPIO control
3179   * @note   This configuration can not be changed when I2S is enabled.
3180   * @rmtoll CFG2         AFCNTR        LL_I2S_DisableGPIOControl
3181   * @param  SPIx SPI Instance
3182   * @retval None
3183   */
3184 __STATIC_INLINE void LL_I2S_DisableGPIOControl(SPI_TypeDef *SPIx)
3185 {
3186   LL_SPI_DisableGPIOControl(SPIx);
3187 }
3188 
3189 /**
3190   * @brief  Check if GPIO control is active
3191   * @rmtoll CFG2         AFCNTR        LL_I2S_IsEnabledGPIOControl
3192   * @param  SPIx SPI Instance
3193   * @retval State of bit (1 or 0)
3194   */
3195 __STATIC_INLINE uint32_t LL_I2S_IsEnabledGPIOControl(const SPI_TypeDef *SPIx)
3196 {
3197   return LL_SPI_IsEnabledGPIOControl(SPIx);
3198 }
3199 
3200 /**
3201   * @brief  Lock the AF configuration of associated IOs
3202   * @note   Once this bit is set, the SPI_CFG2 register content can not be modified until a hardware reset occurs.
3203   *         The reset of the IOLock bit is done by hardware. for that, LL_SPI_DisableIOLock can not exist.
3204   * @rmtoll CR1          IOLOCK        LL_SPI_EnableIOLock
3205   * @param  SPIx SPI Instance
3206   * @retval None
3207   */
3208 __STATIC_INLINE void LL_I2S_EnableIOLock(SPI_TypeDef *SPIx)
3209 {
3210   LL_SPI_EnableIOLock(SPIx);
3211 }
3212 
3213 /**
3214   * @brief  Check if the the SPI_CFG2 register is locked
3215   * @rmtoll CR1          IOLOCK        LL_I2S_IsEnabledIOLock
3216   * @param  SPIx SPI Instance
3217   * @retval State of bit (1 or 0)
3218   */
3219 __STATIC_INLINE uint32_t LL_I2S_IsEnabledIOLock(const SPI_TypeDef *SPIx)
3220 {
3221   return LL_SPI_IsEnabledIOLock(SPIx);
3222 }
3223 
3224 /**
3225   * @brief  Set Transfer Bit Order
3226   * @note   This configuration can not be changed when I2S is enabled.
3227   * @rmtoll CFG2         LSBFRST       LL_I2S_SetTransferBitOrder
3228   * @param  SPIx SPI Instance
3229   * @param  BitOrder This parameter can be one of the following values:
3230   *         @arg @ref LL_I2S_LSB_FIRST
3231   *         @arg @ref LL_I2S_MSB_FIRST
3232   * @retval None
3233   */
3234 __STATIC_INLINE void LL_I2S_SetTransferBitOrder(SPI_TypeDef *SPIx, uint32_t BitOrder)
3235 {
3236   LL_SPI_SetTransferBitOrder(SPIx, BitOrder);
3237 }
3238 /**
3239   * @brief  Get Transfer Bit Order
3240   * @rmtoll CFG2         LSBFRST       LL_I2S_GetTransferBitOrder
3241   * @param  SPIx SPI Instance
3242   * @retval Returned value can be one of the following values:
3243   *         @arg @ref LL_I2S_LSB_FIRST
3244   *         @arg @ref LL_I2S_MSB_FIRST
3245   */
3246 __STATIC_INLINE uint32_t LL_I2S_GetTransferBitOrder(const SPI_TypeDef *SPIx)
3247 {
3248   return LL_SPI_GetTransferBitOrder(SPIx);
3249 }
3250 
3251 /**
3252   * @brief  Start effective transfer on wire
3253   * @rmtoll CR1          CSTART        LL_I2S_StartTransfer
3254   * @param  SPIx SPI Instance
3255   * @retval None
3256   */
3257 __STATIC_INLINE void LL_I2S_StartTransfer(SPI_TypeDef *SPIx)
3258 {
3259   LL_SPI_StartMasterTransfer(SPIx);
3260 }
3261 
3262 /**
3263   * @brief  Check if there is an unfinished transfer
3264   * @rmtoll CR1          CSTART        LL_I2S_IsActiveTransfer
3265   * @param  SPIx SPI Instance
3266   * @retval State of bit (1 or 0)
3267   */
3268 __STATIC_INLINE uint32_t LL_I2S_IsActiveTransfer(const SPI_TypeDef *SPIx)
3269 {
3270   return LL_SPI_IsActiveMasterTransfer(SPIx);
3271 }
3272 
3273 /**
3274   * @brief  Set threshold of FIFO that triggers a transfer event
3275   * @note   This configuration can not be changed when I2S is enabled.
3276   * @rmtoll CFG1         FTHLV         LL_I2S_SetFIFOThreshold
3277   * @param  SPIx SPI Instance
3278   * @param  Threshold This parameter can be one of the following values:
3279   *         @arg @ref LL_I2S_FIFO_TH_01DATA
3280   *         @arg @ref LL_I2S_FIFO_TH_02DATA
3281   *         @arg @ref LL_I2S_FIFO_TH_03DATA
3282   *         @arg @ref LL_I2S_FIFO_TH_04DATA
3283   *         @arg @ref LL_I2S_FIFO_TH_05DATA
3284   *         @arg @ref LL_I2S_FIFO_TH_06DATA
3285   *         @arg @ref LL_I2S_FIFO_TH_07DATA
3286   *         @arg @ref LL_I2S_FIFO_TH_08DATA
3287   * @retval None
3288   */
3289 __STATIC_INLINE void LL_I2S_SetFIFOThreshold(SPI_TypeDef *SPIx, uint32_t Threshold)
3290 {
3291   LL_SPI_SetFIFOThreshold(SPIx, Threshold);
3292 }
3293 
3294 /**
3295   * @brief  Get threshold of FIFO that triggers a transfer event
3296   * @rmtoll CFG1         FTHLV         LL_I2S_GetFIFOThreshold
3297   * @param  SPIx SPI Instance
3298   * @retval Returned value can be one of the following values:
3299   *         @arg @ref LL_I2S_FIFO_TH_01DATA
3300   *         @arg @ref LL_I2S_FIFO_TH_02DATA
3301   *         @arg @ref LL_I2S_FIFO_TH_03DATA
3302   *         @arg @ref LL_I2S_FIFO_TH_04DATA
3303   *         @arg @ref LL_I2S_FIFO_TH_05DATA
3304   *         @arg @ref LL_I2S_FIFO_TH_06DATA
3305   *         @arg @ref LL_I2S_FIFO_TH_07DATA
3306   *         @arg @ref LL_I2S_FIFO_TH_08DATA
3307   */
3308 __STATIC_INLINE uint32_t LL_I2S_GetFIFOThreshold(const SPI_TypeDef *SPIx)
3309 {
3310   return LL_SPI_GetFIFOThreshold(SPIx);
3311 }
3312 
3313 /**
3314   * @brief  Set I2S linear prescaler
3315   * @rmtoll I2SCFGR        I2SDIV        LL_I2S_SetPrescalerLinear
3316   * @param  SPIx SPI Instance
3317   * @param  PrescalerLinear Value between Min_Data=0x00 and Max_Data=0xFF
3318   * @note   PrescalerLinear '1' is not authorized with parity LL_I2S_PRESCALER_PARITY_ODD
3319   * @retval None
3320   */
3321 __STATIC_INLINE void LL_I2S_SetPrescalerLinear(SPI_TypeDef *SPIx, uint32_t PrescalerLinear)
3322 {
3323   MODIFY_REG(SPIx->I2SCFGR, SPI_I2SCFGR_I2SDIV, (PrescalerLinear << SPI_I2SCFGR_I2SDIV_Pos));
3324 }
3325 
3326 /**
3327   * @brief  Get I2S linear prescaler
3328   * @rmtoll I2SCFGR        I2SDIV        LL_I2S_GetPrescalerLinear
3329   * @param  SPIx SPI Instance
3330   * @retval PrescalerLinear Value between Min_Data=0x00 and Max_Data=0xFF
3331   */
3332 __STATIC_INLINE uint32_t LL_I2S_GetPrescalerLinear(const SPI_TypeDef *SPIx)
3333 {
3334   return (uint32_t)(READ_BIT(SPIx->I2SCFGR, SPI_I2SCFGR_I2SDIV) >> SPI_I2SCFGR_I2SDIV_Pos);
3335 }
3336 
3337 /**
3338   * @brief  Set I2S parity prescaler
3339   * @rmtoll I2SCFGR        ODD           LL_I2S_SetPrescalerParity
3340   * @param  SPIx SPI Instance
3341   * @param  PrescalerParity This parameter can be one of the following values:
3342   *         @arg @ref LL_I2S_PRESCALER_PARITY_EVEN
3343   *         @arg @ref LL_I2S_PRESCALER_PARITY_ODD
3344   * @retval None
3345   */
3346 __STATIC_INLINE void LL_I2S_SetPrescalerParity(SPI_TypeDef *SPIx, uint32_t PrescalerParity)
3347 {
3348   MODIFY_REG(SPIx->I2SCFGR, SPI_I2SCFGR_ODD, PrescalerParity << SPI_I2SCFGR_ODD_Pos);
3349 }
3350 
3351 /**
3352   * @brief  Get I2S parity prescaler
3353   * @rmtoll I2SCFGR        ODD           LL_I2S_GetPrescalerParity
3354   * @param  SPIx SPI Instance
3355   * @retval Returned value can be one of the following values:
3356   *         @arg @ref LL_I2S_PRESCALER_PARITY_EVEN
3357   *         @arg @ref LL_I2S_PRESCALER_PARITY_ODD
3358   */
3359 __STATIC_INLINE uint32_t LL_I2S_GetPrescalerParity(const SPI_TypeDef *SPIx)
3360 {
3361   return (uint32_t)(READ_BIT(SPIx->I2SCFGR, SPI_I2SCFGR_ODD) >> SPI_I2SCFGR_ODD_Pos);
3362 }
3363 
3364 /**
3365   * @brief  Enable the Master Clock Output (Pin MCK)
3366   * @rmtoll I2SCFGR      MCKOE         LL_I2S_EnableMasterClock
3367   * @param  SPIx SPI Handle
3368   * @retval None
3369   */
3370 __STATIC_INLINE void LL_I2S_EnableMasterClock(SPI_TypeDef *SPIx)
3371 {
3372   SET_BIT(SPIx->I2SCFGR, SPI_I2SCFGR_MCKOE);
3373 }
3374 
3375 /**
3376   * @brief  Disable the Master Clock Output (Pin MCK)
3377   * @rmtoll I2SCFGR      MCKOE         LL_I2S_DisableMasterClock
3378   * @param  SPIx SPI Handle
3379   * @retval None
3380   */
3381 __STATIC_INLINE void LL_I2S_DisableMasterClock(SPI_TypeDef *SPIx)
3382 {
3383   CLEAR_BIT(SPIx->I2SCFGR, SPI_I2SCFGR_MCKOE);
3384 }
3385 
3386 /**
3387   * @brief  Check if the master clock output (Pin MCK) is enabled
3388   * @rmtoll I2SCFGR        MCKOE         LL_I2S_IsEnabledMasterClock
3389   * @param  SPIx SPI Instance
3390   * @retval State of bit (1 or 0)
3391   */
3392 __STATIC_INLINE uint32_t LL_I2S_IsEnabledMasterClock(const SPI_TypeDef *SPIx)
3393 {
3394   return ((READ_BIT(SPIx->I2SCFGR, SPI_I2SCFGR_MCKOE) == (SPI_I2SCFGR_MCKOE)) ? 1UL : 0UL);
3395 }
3396 
3397 /**
3398   * @}
3399   */
3400 
3401 
3402 /** @defgroup I2S_LL_EF_FLAG_Management FLAG_Management
3403   * @ingroup RTEMSBSPsARMSTM32H7
3404   * @{
3405   */
3406 
3407 /**
3408   * @brief  Check if there enough data in FIFO to read a full packet
3409   * @rmtoll SR           RXP           LL_I2S_IsActiveFlag_RXP
3410   * @param  SPIx SPI Instance
3411   * @retval State of bit (1 or 0)
3412   */
3413 __STATIC_INLINE uint32_t LL_I2S_IsActiveFlag_RXP(const SPI_TypeDef *SPIx)
3414 {
3415   return LL_SPI_IsActiveFlag_RXP(SPIx);
3416 }
3417 
3418 /**
3419   * @brief  Check if there enough space in FIFO to hold a full packet
3420   * @rmtoll SR           TXP           LL_I2S_IsActiveFlag_TXP
3421   * @param  SPIx SPI Instance
3422   * @retval State of bit (1 or 0)
3423   */
3424 __STATIC_INLINE uint32_t LL_I2S_IsActiveFlag_TXP(const SPI_TypeDef *SPIx)
3425 {
3426   return LL_SPI_IsActiveFlag_TXP(SPIx);
3427 }
3428 
3429 /**
3430   * @brief  Get Underrun error flag
3431   * @rmtoll SR           UDR           LL_I2S_IsActiveFlag_UDR
3432   * @param  SPIx SPI Instance
3433   * @retval State of bit (1 or 0)
3434   */
3435 __STATIC_INLINE uint32_t LL_I2S_IsActiveFlag_UDR(const SPI_TypeDef *SPIx)
3436 {
3437   return LL_SPI_IsActiveFlag_UDR(SPIx);
3438 }
3439 
3440 /**
3441   * @brief  Get Overrun error flag
3442   * @rmtoll SR           OVR           LL_I2S_IsActiveFlag_OVR
3443   * @param  SPIx SPI Instance
3444   * @retval State of bit (1 or 0).
3445   */
3446 __STATIC_INLINE uint32_t LL_I2S_IsActiveFlag_OVR(const SPI_TypeDef *SPIx)
3447 {
3448   return LL_SPI_IsActiveFlag_OVR(SPIx);
3449 }
3450 
3451 /**
3452   * @brief  Get TI Frame format error flag
3453   * @rmtoll SR           TIFRE         LL_I2S_IsActiveFlag_FRE
3454   * @param  SPIx SPI Instance
3455   * @retval State of bit (1 or 0).
3456   */
3457 __STATIC_INLINE uint32_t LL_I2S_IsActiveFlag_FRE(const SPI_TypeDef *SPIx)
3458 {
3459   return LL_SPI_IsActiveFlag_FRE(SPIx);
3460 }
3461 
3462 /**
3463   * @brief  Clear Underrun error flag
3464   * @rmtoll IFCR         UDRC          LL_I2S_ClearFlag_UDR
3465   * @param  SPIx SPI Instance
3466   * @retval None
3467   */
3468 __STATIC_INLINE void LL_I2S_ClearFlag_UDR(SPI_TypeDef *SPIx)
3469 {
3470   LL_SPI_ClearFlag_UDR(SPIx);
3471 }
3472 
3473 /**
3474   * @brief  Clear Overrun error flag
3475   * @rmtoll IFCR         OVRC          LL_I2S_ClearFlag_OVR
3476   * @param  SPIx SPI Instance
3477   * @retval None
3478   */
3479 __STATIC_INLINE void LL_I2S_ClearFlag_OVR(SPI_TypeDef *SPIx)
3480 {
3481   LL_SPI_ClearFlag_OVR(SPIx);
3482 }
3483 
3484 /**
3485   * @brief  Clear Frame format error flag
3486   * @rmtoll IFCR         TIFREC        LL_I2S_ClearFlag_FRE
3487   * @param  SPIx SPI Instance
3488   * @retval None
3489   */
3490 __STATIC_INLINE void LL_I2S_ClearFlag_FRE(SPI_TypeDef *SPIx)
3491 {
3492   LL_SPI_ClearFlag_FRE(SPIx);
3493 }
3494 
3495 /**
3496   * @}
3497   */
3498 
3499 /** @defgroup I2S_LL_EF_IT_Management IT_Management
3500   * @ingroup RTEMSBSPsARMSTM32H7
3501   * @{
3502   */
3503 
3504 /**
3505   * @brief  Enable Rx Packet available IT
3506   * @rmtoll IER          RXPIE         LL_I2S_EnableIT_RXP
3507   * @param  SPIx SPI Instance
3508   * @retval None
3509   */
3510 __STATIC_INLINE void LL_I2S_EnableIT_RXP(SPI_TypeDef *SPIx)
3511 {
3512   LL_SPI_EnableIT_RXP(SPIx);
3513 }
3514 
3515 /**
3516   * @brief  Enable Tx Packet space available IT
3517   * @rmtoll IER          TXPIE         LL_I2S_EnableIT_TXP
3518   * @param  SPIx SPI Instance
3519   * @retval None
3520   */
3521 __STATIC_INLINE void LL_I2S_EnableIT_TXP(SPI_TypeDef *SPIx)
3522 {
3523   LL_SPI_EnableIT_TXP(SPIx);
3524 }
3525 
3526 /**
3527   * @brief  Enable Underrun IT
3528   * @rmtoll IER          UDRIE         LL_I2S_EnableIT_UDR
3529   * @param  SPIx SPI Instance
3530   * @retval None
3531   */
3532 __STATIC_INLINE void LL_I2S_EnableIT_UDR(SPI_TypeDef *SPIx)
3533 {
3534   LL_SPI_EnableIT_UDR(SPIx);
3535 }
3536 
3537 /**
3538   * @brief  Enable Overrun IT
3539   * @rmtoll IER          OVRIE         LL_I2S_EnableIT_OVR
3540   * @param  SPIx SPI Instance
3541   * @retval None
3542   */
3543 __STATIC_INLINE void LL_I2S_EnableIT_OVR(SPI_TypeDef *SPIx)
3544 {
3545   LL_SPI_EnableIT_OVR(SPIx);
3546 }
3547 
3548 /**
3549   * @brief  Enable TI Frame Format Error IT
3550   * @rmtoll IER          TIFREIE       LL_I2S_EnableIT_FRE
3551   * @param  SPIx SPI Instance
3552   * @retval None
3553   */
3554 __STATIC_INLINE void LL_I2S_EnableIT_FRE(SPI_TypeDef *SPIx)
3555 {
3556   LL_SPI_EnableIT_FRE(SPIx);
3557 }
3558 
3559 /**
3560   * @brief  Disable Rx Packet available IT
3561   * @rmtoll IER          RXPIE         LL_I2S_DisableIT_RXP
3562   * @param  SPIx SPI Instance
3563   * @retval None
3564   */
3565 __STATIC_INLINE void LL_I2S_DisableIT_RXP(SPI_TypeDef *SPIx)
3566 {
3567   LL_SPI_DisableIT_RXP(SPIx);
3568 }
3569 
3570 /**
3571   * @brief  Disable Tx Packet space available IT
3572   * @rmtoll IER          TXPIE         LL_I2S_DisableIT_TXP
3573   * @param  SPIx SPI Instance
3574   * @retval None
3575   */
3576 __STATIC_INLINE void LL_I2S_DisableIT_TXP(SPI_TypeDef *SPIx)
3577 {
3578   LL_SPI_DisableIT_TXP(SPIx);
3579 }
3580 
3581 /**
3582   * @brief  Disable Underrun IT
3583   * @rmtoll IER          UDRIE         LL_I2S_DisableIT_UDR
3584   * @param  SPIx SPI Instance
3585   * @retval None
3586   */
3587 __STATIC_INLINE void LL_I2S_DisableIT_UDR(SPI_TypeDef *SPIx)
3588 {
3589   LL_SPI_DisableIT_UDR(SPIx);
3590 }
3591 
3592 /**
3593   * @brief  Disable Overrun IT
3594   * @rmtoll IER          OVRIE         LL_I2S_DisableIT_OVR
3595   * @param  SPIx SPI Instance
3596   * @retval None
3597   */
3598 __STATIC_INLINE void LL_I2S_DisableIT_OVR(SPI_TypeDef *SPIx)
3599 {
3600   LL_SPI_DisableIT_OVR(SPIx);
3601 }
3602 
3603 /**
3604   * @brief  Disable TI Frame Format Error IT
3605   * @rmtoll IER          TIFREIE       LL_I2S_DisableIT_FRE
3606   * @param  SPIx SPI Instance
3607   * @retval None
3608   */
3609 __STATIC_INLINE void LL_I2S_DisableIT_FRE(SPI_TypeDef *SPIx)
3610 {
3611   LL_SPI_DisableIT_FRE(SPIx);
3612 }
3613 
3614 /**
3615   * @brief  Check if Rx Packet available IT is enabled
3616   * @rmtoll IER          RXPIE         LL_I2S_IsEnabledIT_RXP
3617   * @param  SPIx SPI Instance
3618   * @retval State of bit (1 or 0)
3619   */
3620 __STATIC_INLINE uint32_t LL_I2S_IsEnabledIT_RXP(const SPI_TypeDef *SPIx)
3621 {
3622   return LL_SPI_IsEnabledIT_RXP(SPIx);
3623 }
3624 
3625 /**
3626   * @brief  Check if Tx Packet space available IT is enabled
3627   * @rmtoll IER          TXPIE         LL_I2S_IsEnabledIT_TXP
3628   * @param  SPIx SPI Instance
3629   * @retval State of bit (1 or 0)
3630   */
3631 __STATIC_INLINE uint32_t LL_I2S_IsEnabledIT_TXP(const SPI_TypeDef *SPIx)
3632 {
3633   return LL_SPI_IsEnabledIT_TXP(SPIx);
3634 }
3635 
3636 /**
3637   * @brief  Check if Underrun IT is enabled
3638   * @rmtoll IER          UDRIE         LL_I2S_IsEnabledIT_UDR
3639   * @param  SPIx SPI Instance
3640   * @retval State of bit (1 or 0)
3641   */
3642 __STATIC_INLINE uint32_t LL_I2S_IsEnabledIT_UDR(const SPI_TypeDef *SPIx)
3643 {
3644   return LL_SPI_IsEnabledIT_UDR(SPIx);
3645 }
3646 
3647 /**
3648   * @brief  Check if Overrun IT is enabled
3649   * @rmtoll IER          OVRIE         LL_I2S_IsEnabledIT_OVR
3650   * @param  SPIx SPI Instance
3651   * @retval State of bit (1 or 0)
3652   */
3653 __STATIC_INLINE uint32_t LL_I2S_IsEnabledIT_OVR(const SPI_TypeDef *SPIx)
3654 {
3655   return LL_SPI_IsEnabledIT_OVR(SPIx);
3656 }
3657 
3658 /**
3659   * @brief  Check if TI Frame Format Error IT is enabled
3660   * @rmtoll IER          TIFREIE       LL_I2S_IsEnabledIT_FRE
3661   * @param  SPIx SPI Instance
3662   * @retval State of bit (1 or 0)
3663   */
3664 __STATIC_INLINE uint32_t LL_I2S_IsEnabledIT_FRE(const SPI_TypeDef *SPIx)
3665 {
3666   return LL_SPI_IsEnabledIT_FRE(SPIx);
3667 }
3668 
3669 /**
3670   * @}
3671   */
3672 
3673 /** @defgroup I2S_LL_EF_DMA_Management DMA_Management
3674   * @ingroup RTEMSBSPsARMSTM32H7
3675   * @{
3676   */
3677 
3678 /**
3679   * @brief  Enable DMA Rx
3680   * @rmtoll CFG1         RXDMAEN       LL_I2S_EnableDMAReq_RX
3681   * @param  SPIx SPI Instance
3682   * @retval None
3683   */
3684 __STATIC_INLINE void LL_I2S_EnableDMAReq_RX(SPI_TypeDef *SPIx)
3685 {
3686   LL_SPI_EnableDMAReq_RX(SPIx);
3687 }
3688 
3689 /**
3690   * @brief  Disable DMA Rx
3691   * @rmtoll CFG1         RXDMAEN       LL_I2S_DisableDMAReq_RX
3692   * @param  SPIx SPI Instance
3693   * @retval None
3694   */
3695 __STATIC_INLINE void LL_I2S_DisableDMAReq_RX(SPI_TypeDef *SPIx)
3696 {
3697   LL_SPI_DisableDMAReq_RX(SPIx);
3698 }
3699 
3700 /**
3701   * @brief  Check if DMA Rx is enabled
3702   * @rmtoll CFG1         RXDMAEN       LL_I2S_IsEnabledDMAReq_RX
3703   * @param  SPIx SPI Instance
3704   * @retval State of bit (1 or 0)
3705   */
3706 __STATIC_INLINE uint32_t LL_I2S_IsEnabledDMAReq_RX(const SPI_TypeDef *SPIx)
3707 {
3708   return LL_SPI_IsEnabledDMAReq_RX(SPIx);
3709 }
3710 
3711 /**
3712   * @brief  Enable DMA Tx
3713   * @rmtoll CFG1         TXDMAEN       LL_I2S_EnableDMAReq_TX
3714   * @param  SPIx SPI Instance
3715   * @retval None
3716   */
3717 __STATIC_INLINE void LL_I2S_EnableDMAReq_TX(SPI_TypeDef *SPIx)
3718 {
3719   LL_SPI_EnableDMAReq_TX(SPIx);
3720 }
3721 
3722 /**
3723   * @brief  Disable DMA Tx
3724   * @rmtoll CFG1         TXDMAEN       LL_I2S_DisableDMAReq_TX
3725   * @param  SPIx SPI Instance
3726   * @retval None
3727   */
3728 __STATIC_INLINE void LL_I2S_DisableDMAReq_TX(SPI_TypeDef *SPIx)
3729 {
3730   LL_SPI_DisableDMAReq_TX(SPIx);
3731 }
3732 
3733 /**
3734   * @brief  Check if DMA Tx is enabled
3735   * @rmtoll CFG1         TXDMAEN       LL_I2S_IsEnabledDMAReq_TX
3736   * @param  SPIx SPI Instance
3737   * @retval State of bit (1 or 0)
3738   */
3739 __STATIC_INLINE uint32_t LL_I2S_IsEnabledDMAReq_TX(const SPI_TypeDef *SPIx)
3740 {
3741   return LL_SPI_IsEnabledDMAReq_TX(SPIx);
3742 }
3743 
3744 /**
3745   * @}
3746   */
3747 
3748 /** @defgroup I2S_LL_EF_DATA_Management DATA_Management
3749   * @ingroup RTEMSBSPsARMSTM32H7
3750   * @{
3751   */
3752 
3753 /**
3754   * @brief  Read Data Register
3755   * @rmtoll RXDR         .       LL_I2S_ReceiveData16
3756   * @param  SPIx SPI Instance
3757   * @retval 0..0xFFFF
3758   */
3759 __STATIC_INLINE uint16_t LL_I2S_ReceiveData16(SPI_TypeDef *SPIx) /* Derogation MISRAC2012-Rule-8.13 */
3760 {
3761   return LL_SPI_ReceiveData16(SPIx);
3762 }
3763 
3764 /**
3765   * @brief  Read Data Register
3766   * @rmtoll RXDR         .       LL_I2S_ReceiveData32
3767   * @param  SPIx SPI Instance
3768   * @retval  0..0xFFFFFFFF
3769   */
3770 __STATIC_INLINE uint32_t LL_I2S_ReceiveData32(SPI_TypeDef *SPIx) /* Derogation MISRAC2012-Rule-8.13 */
3771 {
3772   return LL_SPI_ReceiveData32(SPIx);
3773 }
3774 
3775 /**
3776   * @brief  Write Data Register
3777   * @rmtoll TXDR         .       LL_I2S_TransmitData16
3778   * @param  SPIx SPI Instance
3779   * @param  TxData 0..0xFFFF
3780   * @retval None
3781   */
3782 __STATIC_INLINE void LL_I2S_TransmitData16(SPI_TypeDef *SPIx, uint16_t TxData)
3783 {
3784   LL_SPI_TransmitData16(SPIx, TxData);
3785 }
3786 
3787 /**
3788   * @brief  Write Data Register
3789   * @rmtoll TXDR         .       LL_I2S_TransmitData32
3790   * @param  SPIx SPI Instance
3791   * @param  TxData 0..0xFFFFFFFF
3792   * @retval None
3793   */
3794 __STATIC_INLINE void LL_I2S_TransmitData32(SPI_TypeDef *SPIx, uint32_t TxData)
3795 {
3796   LL_SPI_TransmitData32(SPIx, TxData);
3797 }
3798 
3799 
3800 /**
3801   * @}
3802   */
3803 
3804 
3805 #if defined(USE_FULL_LL_DRIVER) || defined(__rtems__)
3806 /** @defgroup I2S_LL_EF_Init Initialization and de-initialization functions
3807   * @ingroup RTEMSBSPsARMSTM32H7
3808   * @{
3809   */
3810 
3811 ErrorStatus LL_I2S_DeInit(const SPI_TypeDef *SPIx);
3812 ErrorStatus LL_I2S_Init(SPI_TypeDef *SPIx, const LL_I2S_InitTypeDef *I2S_InitStruct);
3813 void        LL_I2S_StructInit(LL_I2S_InitTypeDef *I2S_InitStruct);
3814 void        LL_I2S_ConfigPrescaler(SPI_TypeDef *SPIx, uint32_t PrescalerLinear, uint32_t PrescalerParity);
3815 
3816 /**
3817   * @}
3818   */
3819 #endif /* USE_FULL_LL_DRIVER */
3820 
3821 /**
3822   * @}
3823   */
3824 
3825 /**
3826   * @}
3827   */
3828 
3829 #endif /* defined(SPI1) || defined(SPI2) || defined(SPI3) || defined(SPI4) || defined(SPI5) || defined(SPI6) */
3830 
3831 /**
3832   * @}
3833   */
3834 
3835 #ifdef __cplusplus
3836 }
3837 #endif
3838 
3839 #endif /* STM32H7xx_LL_SPI_H */