The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

mbed 2

This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.

Committer:
AnnaBridge
Date:
Wed Jun 21 17:31:38 2017 +0100
Revision:
145:64910690c574
Parent:
128:9bcdf88f62b0
Release 145 of the mbed library.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Kojto 122:f9eeca106725 1 /**
Kojto 122:f9eeca106725 2 ******************************************************************************
Kojto 122:f9eeca106725 3 * @file stm32l4xx_hal_swpmi.h
Kojto 122:f9eeca106725 4 * @author MCD Application Team
AnnaBridge 145:64910690c574 5 * @version V1.7.1
AnnaBridge 145:64910690c574 6 * @date 21-April-2017
Kojto 122:f9eeca106725 7 * @brief Header file of SWPMI HAL module.
Kojto 122:f9eeca106725 8 ******************************************************************************
Kojto 122:f9eeca106725 9 * @attention
Kojto 122:f9eeca106725 10 *
AnnaBridge 145:64910690c574 11 * <h2><center>&copy; COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
Kojto 122:f9eeca106725 12 *
Kojto 122:f9eeca106725 13 * Redistribution and use in source and binary forms, with or without modification,
Kojto 122:f9eeca106725 14 * are permitted provided that the following conditions are met:
Kojto 122:f9eeca106725 15 * 1. Redistributions of source code must retain the above copyright notice,
Kojto 122:f9eeca106725 16 * this list of conditions and the following disclaimer.
Kojto 122:f9eeca106725 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
Kojto 122:f9eeca106725 18 * this list of conditions and the following disclaimer in the documentation
Kojto 122:f9eeca106725 19 * and/or other materials provided with the distribution.
Kojto 122:f9eeca106725 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
Kojto 122:f9eeca106725 21 * may be used to endorse or promote products derived from this software
Kojto 122:f9eeca106725 22 * without specific prior written permission.
Kojto 122:f9eeca106725 23 *
Kojto 122:f9eeca106725 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
Kojto 122:f9eeca106725 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Kojto 122:f9eeca106725 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
Kojto 122:f9eeca106725 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
Kojto 122:f9eeca106725 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
Kojto 122:f9eeca106725 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
Kojto 122:f9eeca106725 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
Kojto 122:f9eeca106725 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
Kojto 122:f9eeca106725 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Kojto 122:f9eeca106725 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Kojto 122:f9eeca106725 34 *
Kojto 122:f9eeca106725 35 ******************************************************************************
Kojto 122:f9eeca106725 36 */
Kojto 122:f9eeca106725 37
Kojto 122:f9eeca106725 38 /* Define to prevent recursive inclusion -------------------------------------*/
Kojto 122:f9eeca106725 39 #ifndef __STM32L4xx_HAL_SWPMI_H
Kojto 122:f9eeca106725 40 #define __STM32L4xx_HAL_SWPMI_H
Kojto 122:f9eeca106725 41
Kojto 122:f9eeca106725 42 #ifdef __cplusplus
Kojto 122:f9eeca106725 43 extern "C" {
Kojto 122:f9eeca106725 44 #endif
Kojto 122:f9eeca106725 45
AnnaBridge 145:64910690c574 46 #if defined(STM32L431xx) || defined(STM32L432xx) || defined(STM32L433xx) || defined(STM32L442xx) || defined(STM32L443xx) || \
AnnaBridge 145:64910690c574 47 defined(STM32L471xx) || defined(STM32L475xx) || defined(STM32L476xx) || defined(STM32L485xx) || defined(STM32L486xx) || \
AnnaBridge 145:64910690c574 48 defined(STM32L496xx) || defined(STM32L4A6xx)
AnnaBridge 145:64910690c574 49
Kojto 122:f9eeca106725 50 /* Includes ------------------------------------------------------------------*/
Kojto 122:f9eeca106725 51 #include "stm32l4xx_hal_def.h"
Kojto 122:f9eeca106725 52
Kojto 122:f9eeca106725 53 /** @addtogroup STM32L4xx_HAL_Driver
Kojto 122:f9eeca106725 54 * @{
Kojto 122:f9eeca106725 55 */
Kojto 122:f9eeca106725 56
Kojto 122:f9eeca106725 57 /** @addtogroup SWPMI
Kojto 122:f9eeca106725 58 * @{
Kojto 122:f9eeca106725 59 */
Kojto 122:f9eeca106725 60
Kojto 122:f9eeca106725 61 /* Exported types ------------------------------------------------------------*/
Kojto 122:f9eeca106725 62 /** @defgroup SWPMI_Exported_Types SWPMI Exported Types
Kojto 122:f9eeca106725 63 * @{
Kojto 122:f9eeca106725 64 */
Kojto 122:f9eeca106725 65
Kojto 122:f9eeca106725 66 /**
Kojto 122:f9eeca106725 67 * @brief SWPMI Init Structure definition
Kojto 122:f9eeca106725 68 */
Kojto 122:f9eeca106725 69 typedef struct
Kojto 122:f9eeca106725 70 {
Kojto 122:f9eeca106725 71 uint32_t VoltageClass; /*!< Specifies the SWP Voltage Class.
Kojto 122:f9eeca106725 72 This parameter can be a value of @ref SWPMI_Voltage_Class */
Kojto 122:f9eeca106725 73
Kojto 122:f9eeca106725 74 uint32_t BitRate; /*!< Specifies the SWPMI Bitrate.
Kojto 122:f9eeca106725 75 This parameter must be a number between 0 and 63.
Kojto 122:f9eeca106725 76 The Bitrate is computed using the following formula:
Kojto 122:f9eeca106725 77 SWPMI_freq = SWPMI_clk / (((BitRate) + 1) * 4)
Kojto 122:f9eeca106725 78 */
Kojto 122:f9eeca106725 79
Kojto 122:f9eeca106725 80 uint32_t TxBufferingMode; /*!< Specifies the transmission buffering mode.
Kojto 122:f9eeca106725 81 This parameter can be a value of @ref SWPMI_Tx_Buffering_Mode */
Kojto 122:f9eeca106725 82
Kojto 122:f9eeca106725 83 uint32_t RxBufferingMode; /*!< Specifies the reception buffering mode.
Kojto 122:f9eeca106725 84 This parameter can be a value of @ref SWPMI_Rx_Buffering_Mode */
Kojto 122:f9eeca106725 85
Kojto 122:f9eeca106725 86 }SWPMI_InitTypeDef;
Kojto 122:f9eeca106725 87
Kojto 122:f9eeca106725 88
Kojto 122:f9eeca106725 89 /**
Kojto 122:f9eeca106725 90 * @brief HAL SWPMI State structures definition
Kojto 122:f9eeca106725 91 */
Kojto 122:f9eeca106725 92 typedef enum
Kojto 122:f9eeca106725 93 {
Kojto 122:f9eeca106725 94 HAL_SWPMI_STATE_RESET = 0x00, /*!< Peripheral Reset state */
Kojto 122:f9eeca106725 95 HAL_SWPMI_STATE_READY = 0x01, /*!< Peripheral Initialized and ready for use */
Kojto 122:f9eeca106725 96 HAL_SWPMI_STATE_BUSY = 0x02, /*!< an internal process is ongoing */
Kojto 122:f9eeca106725 97 HAL_SWPMI_STATE_BUSY_TX = 0x12, /*!< Data Transmission process is ongoing */
Kojto 122:f9eeca106725 98 HAL_SWPMI_STATE_BUSY_RX = 0x22, /*!< Data Reception process is ongoing */
Kojto 122:f9eeca106725 99 HAL_SWPMI_STATE_BUSY_TX_RX = 0x32, /*!< Data Transmission and Reception process is ongoing */
Kojto 122:f9eeca106725 100 HAL_SWPMI_STATE_TIMEOUT = 0x03, /*!< Timeout state */
Kojto 122:f9eeca106725 101 HAL_SWPMI_STATE_ERROR = 0x04 /*!< Error */
Kojto 122:f9eeca106725 102 }HAL_SWPMI_StateTypeDef;
Kojto 122:f9eeca106725 103
Kojto 122:f9eeca106725 104 /**
Kojto 122:f9eeca106725 105 * @brief SWPMI handle Structure definition
Kojto 122:f9eeca106725 106 */
Kojto 122:f9eeca106725 107 typedef struct
Kojto 122:f9eeca106725 108 {
Kojto 122:f9eeca106725 109 SWPMI_TypeDef *Instance; /* SWPMI registers base address */
Kojto 122:f9eeca106725 110
Kojto 122:f9eeca106725 111 SWPMI_InitTypeDef Init; /* SWMPI communication parameters */
Kojto 122:f9eeca106725 112
Kojto 122:f9eeca106725 113 uint32_t *pTxBuffPtr; /* Pointer to SWPMI Tx transfer Buffer */
Kojto 122:f9eeca106725 114
Kojto 122:f9eeca106725 115 uint32_t TxXferSize; /* SWPMI Tx Transfer size */
Kojto 122:f9eeca106725 116
Kojto 122:f9eeca106725 117 uint32_t TxXferCount; /* SWPMI Tx Transfer Counter */
Kojto 122:f9eeca106725 118
Kojto 122:f9eeca106725 119 uint32_t *pRxBuffPtr; /* Pointer to SWPMI Rx transfer Buffer */
Kojto 122:f9eeca106725 120
Kojto 122:f9eeca106725 121 uint32_t RxXferSize; /* SWPMI Rx Transfer size */
Kojto 122:f9eeca106725 122
Kojto 122:f9eeca106725 123 uint32_t RxXferCount; /* SWPMI Rx Transfer Counter */
Kojto 122:f9eeca106725 124
Kojto 122:f9eeca106725 125 DMA_HandleTypeDef *hdmatx; /* SWPMI Tx DMA Handle parameters */
Kojto 122:f9eeca106725 126
Kojto 122:f9eeca106725 127 DMA_HandleTypeDef *hdmarx; /* SWPMI Rx DMA Handle parameters */
Kojto 122:f9eeca106725 128
Kojto 122:f9eeca106725 129 HAL_LockTypeDef Lock; /* SWPMI object */
Kojto 122:f9eeca106725 130
Kojto 122:f9eeca106725 131 __IO HAL_SWPMI_StateTypeDef State; /* SWPMI communication state */
Kojto 122:f9eeca106725 132
Kojto 122:f9eeca106725 133 __IO uint32_t ErrorCode; /* SWPMI Error code */
Kojto 122:f9eeca106725 134
Kojto 122:f9eeca106725 135 }SWPMI_HandleTypeDef;
Kojto 122:f9eeca106725 136
Kojto 122:f9eeca106725 137 /**
Kojto 122:f9eeca106725 138 * @}
Kojto 122:f9eeca106725 139 */
Kojto 122:f9eeca106725 140
Kojto 122:f9eeca106725 141 /* Exported constants --------------------------------------------------------*/
Kojto 122:f9eeca106725 142 /** @defgroup SWPMI_Exported_Constants SWPMI Exported Constants
Kojto 122:f9eeca106725 143 * @{
Kojto 122:f9eeca106725 144 */
Kojto 122:f9eeca106725 145
Kojto 122:f9eeca106725 146 /**
Kojto 122:f9eeca106725 147 * @defgroup SWPMI_Error_Code SWPMI Error Code Bitmap
Kojto 122:f9eeca106725 148 * @{
Kojto 122:f9eeca106725 149 */
Kojto 122:f9eeca106725 150 #define HAL_SWPMI_ERROR_NONE ((uint32_t)0x00000000) /*!< No error */
Kojto 122:f9eeca106725 151 #define HAL_SWPMI_ERROR_CRC ((uint32_t)0x00000004) /*!< frame error */
Kojto 122:f9eeca106725 152 #define HAL_SWPMI_ERROR_OVR ((uint32_t)0x00000008) /*!< Overrun error */
Kojto 122:f9eeca106725 153 #define HAL_SWPMI_ERROR_UDR ((uint32_t)0x0000000C) /*!< Underrun error */
Kojto 122:f9eeca106725 154 #define HAL_SWPMI_ERROR_DMA ((uint32_t)0x00000010) /*!< DMA transfer error */
Kojto 122:f9eeca106725 155 /**
Kojto 122:f9eeca106725 156 * @}
Kojto 122:f9eeca106725 157 */
Kojto 122:f9eeca106725 158
Kojto 122:f9eeca106725 159 /** @defgroup SWPMI_Voltage_Class SWPMI Voltage Class
Kojto 122:f9eeca106725 160 * @{
Kojto 122:f9eeca106725 161 */
Kojto 122:f9eeca106725 162 #define SWPMI_VOLTAGE_CLASS_C ((uint32_t)0x00000000)
Kojto 122:f9eeca106725 163 #define SWPMI_VOLTAGE_CLASS_B SWPMI_OR_CLASS
Kojto 122:f9eeca106725 164 /**
Kojto 122:f9eeca106725 165 * @}
Kojto 122:f9eeca106725 166 */
Kojto 122:f9eeca106725 167
Kojto 122:f9eeca106725 168 /** @defgroup SWPMI_Tx_Buffering_Mode SWPMI Tx Buffering Mode
Kojto 122:f9eeca106725 169 * @{
Kojto 122:f9eeca106725 170 */
Kojto 122:f9eeca106725 171 #define SWPMI_TX_NO_SOFTWAREBUFFER ((uint32_t)0x00000000)
Kojto 122:f9eeca106725 172 #define SWPMI_TX_SINGLE_SOFTWAREBUFFER ((uint32_t)0x00000000)
Kojto 122:f9eeca106725 173 #define SWPMI_TX_MULTI_SOFTWAREBUFFER SWPMI_CR_TXMODE
Kojto 122:f9eeca106725 174 /**
Kojto 122:f9eeca106725 175 * @}
Kojto 122:f9eeca106725 176 */
Kojto 122:f9eeca106725 177
Kojto 122:f9eeca106725 178 /** @defgroup SWPMI_Rx_Buffering_Mode SWPMI Rx Buffering Mode
Kojto 122:f9eeca106725 179 * @{
Kojto 122:f9eeca106725 180 */
Kojto 122:f9eeca106725 181 #define SWPMI_RX_NO_SOFTWAREBUFFER ((uint32_t)0x00000000)
Kojto 122:f9eeca106725 182 #define SWPMI_RX_SINGLE_SOFTWAREBUFFER ((uint32_t)0x00000000)
Kojto 122:f9eeca106725 183 #define SWPMI_RX_MULTI_SOFTWAREBUFFER SWPMI_CR_RXMODE
Kojto 122:f9eeca106725 184 /**
Kojto 122:f9eeca106725 185 * @}
Kojto 122:f9eeca106725 186 */
Kojto 122:f9eeca106725 187
Kojto 122:f9eeca106725 188 /** @defgroup SWPMI_Flags SWPMI Status Flags
Kojto 122:f9eeca106725 189 * Elements values convention: 0xXXXXXXXX
Kojto 122:f9eeca106725 190 * - 0xXXXXXXXX : Flag mask in the ISR register
Kojto 122:f9eeca106725 191 * @{
Kojto 122:f9eeca106725 192 */
Kojto 122:f9eeca106725 193 #define SWPMI_FLAG_RXBFF SWPMI_ISR_RXBFF
Kojto 122:f9eeca106725 194 #define SWPMI_FLAG_TXBEF SWPMI_ISR_TXBEF
Kojto 122:f9eeca106725 195 #define SWPMI_FLAG_RXBERF SWPMI_ISR_RXBERF
Kojto 122:f9eeca106725 196 #define SWPMI_FLAG_RXOVRF SWPMI_ISR_RXOVRF
Kojto 122:f9eeca106725 197 #define SWPMI_FLAG_TXUNRF SWPMI_ISR_TXUNRF
Kojto 122:f9eeca106725 198 #define SWPMI_FLAG_RXNE SWPMI_ISR_RXNE
Kojto 122:f9eeca106725 199 #define SWPMI_FLAG_TXE SWPMI_ISR_TXE
Kojto 122:f9eeca106725 200 #define SWPMI_FLAG_TCF SWPMI_ISR_TCF
Kojto 122:f9eeca106725 201 #define SWPMI_FLAG_SRF SWPMI_ISR_SRF
Kojto 122:f9eeca106725 202 #define SWPMI_FLAG_SUSP SWPMI_ISR_SUSP
Kojto 122:f9eeca106725 203 #define SWPMI_FLAG_DEACTF SWPMI_ISR_DEACTF
Kojto 122:f9eeca106725 204 /**
Kojto 122:f9eeca106725 205 * @}
Kojto 122:f9eeca106725 206 */
Kojto 122:f9eeca106725 207
Kojto 122:f9eeca106725 208 /** @defgroup SWPMI_Interrupt_definition SWPMI Interrupts Definition
Kojto 122:f9eeca106725 209 * Elements values convention: 0xXXXX
Kojto 122:f9eeca106725 210 * - 0xXXXX : Flag mask in the IER register
Kojto 122:f9eeca106725 211 * @{
Kojto 122:f9eeca106725 212 */
Kojto 122:f9eeca106725 213 #define SWPMI_IT_SRIE SWPMI_IER_SRIE
Kojto 122:f9eeca106725 214 #define SWPMI_IT_TCIE SWPMI_IER_TCIE
Kojto 122:f9eeca106725 215 #define SWPMI_IT_TIE SWPMI_IER_TIE
Kojto 122:f9eeca106725 216 #define SWPMI_IT_RIE SWPMI_IER_RIE
Kojto 122:f9eeca106725 217 #define SWPMI_IT_TXUNRIE SWPMI_IER_TXUNRIE
Kojto 122:f9eeca106725 218 #define SWPMI_IT_RXOVRIE SWPMI_IER_RXOVRIE
Kojto 122:f9eeca106725 219 #define SWPMI_IT_RXBERIE SWPMI_IER_RXBERIE
Kojto 122:f9eeca106725 220 #define SWPMI_IT_TXBEIE SWPMI_IER_TXBEIE
Kojto 122:f9eeca106725 221 #define SWPMI_IT_RXBFIE SWPMI_IER_RXBFIE
Kojto 122:f9eeca106725 222 /**
Kojto 122:f9eeca106725 223 * @}
Kojto 122:f9eeca106725 224 */
Kojto 122:f9eeca106725 225
Kojto 122:f9eeca106725 226 /**
Kojto 122:f9eeca106725 227 * @}
Kojto 122:f9eeca106725 228 */
Kojto 122:f9eeca106725 229
Kojto 122:f9eeca106725 230 /* Exported macros -----------------------------------------------------------*/
Kojto 122:f9eeca106725 231 /** @defgroup SWPMI_Exported_Macros SWPMI Exported Macros
Kojto 122:f9eeca106725 232 * @{
Kojto 122:f9eeca106725 233 */
Kojto 122:f9eeca106725 234
Kojto 122:f9eeca106725 235 /** @brief Reset SWPMI handle state.
Kojto 122:f9eeca106725 236 * @param __HANDLE__: specifies the SWPMI Handle.
Kojto 122:f9eeca106725 237 * @retval None
Kojto 122:f9eeca106725 238 */
Kojto 122:f9eeca106725 239 #define __HAL_SWPMI_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_SWPMI_STATE_RESET)
Kojto 122:f9eeca106725 240
Kojto 122:f9eeca106725 241 /**
Kojto 122:f9eeca106725 242 * @brief Enable the SWPMI peripheral.
Kojto 122:f9eeca106725 243 * @param __HANDLE__: SWPMI handle
Kojto 122:f9eeca106725 244 * @retval None
Kojto 122:f9eeca106725 245 */
Kojto 122:f9eeca106725 246 #define __HAL_SWPMI_ENABLE(__HANDLE__) SET_BIT((__HANDLE__)->Instance->CR, SWPMI_CR_SWPACT)
Kojto 122:f9eeca106725 247
Kojto 122:f9eeca106725 248 /**
Kojto 122:f9eeca106725 249 * @brief Disable the SWPMI peripheral.
Kojto 122:f9eeca106725 250 * @param __HANDLE__: SWPMI handle
Kojto 122:f9eeca106725 251 * @retval None
Kojto 122:f9eeca106725 252 */
Kojto 122:f9eeca106725 253 #define __HAL_SWPMI_DISABLE(__HANDLE__) CLEAR_BIT((__HANDLE__)->Instance->CR, SWPMI_CR_SWPACT)
Kojto 122:f9eeca106725 254
Kojto 122:f9eeca106725 255 /** @brief Check whether the specified SWPMI flag is set or not.
Kojto 122:f9eeca106725 256 * @param __HANDLE__: specifies the SWPMI Handle.
Kojto 122:f9eeca106725 257 * @param __FLAG__: specifies the flag to check.
Kojto 122:f9eeca106725 258 * This parameter can be one of the following values:
Kojto 122:f9eeca106725 259 * @arg SWPMI_FLAG_RXBFF : Receive buffer full flag.
Kojto 122:f9eeca106725 260 * @arg SWPMI_FLAG_TXBEF : Transmit buffer empty flag.
Kojto 122:f9eeca106725 261 * @arg SWPMI_FLAG_RXBERF : Receive CRC error flag.
Kojto 122:f9eeca106725 262 * @arg SWPMI_FLAG_RXOVRF : Receive overrun error flag.
Kojto 122:f9eeca106725 263 * @arg SWPMI_FLAG_TXUNRF : Transmit underrun error flag.
Kojto 122:f9eeca106725 264 * @arg SWPMI_FLAG_RXNE : Receive data register not empty.
Kojto 122:f9eeca106725 265 * @arg SWPMI_FLAG_TXE : Transmit data register empty.
Kojto 122:f9eeca106725 266 * @arg SWPMI_FLAG_TCF : Transfer complete flag.
Kojto 122:f9eeca106725 267 * @arg SWPMI_FLAG_SRF : Slave resume flag.
Kojto 122:f9eeca106725 268 * @arg SWPMI_FLAG_SUSP : SUSPEND flag.
Kojto 122:f9eeca106725 269 * @arg SWPMI_FLAG_DEACTF : DEACTIVATED flag.
Kojto 122:f9eeca106725 270 * @retval The new state of __FLAG__ (TRUE or FALSE).
Kojto 122:f9eeca106725 271 */
Kojto 122:f9eeca106725 272 #define __HAL_SWPMI_GET_FLAG(__HANDLE__, __FLAG__) (READ_BIT((__HANDLE__)->Instance->ISR, (__FLAG__)) == (__FLAG__))
Kojto 122:f9eeca106725 273
Kojto 122:f9eeca106725 274 /** @brief Clear the specified SWPMI ISR flag.
Kojto 122:f9eeca106725 275 * @param __HANDLE__: specifies the SWPMI Handle.
Kojto 122:f9eeca106725 276 * @param __FLAG__: specifies the flag to clear.
Kojto 122:f9eeca106725 277 * This parameter can be one of the following values:
Kojto 122:f9eeca106725 278 * @arg SWPMI_FLAG_RXBFF : Receive buffer full flag.
Kojto 122:f9eeca106725 279 * @arg SWPMI_FLAG_TXBEF : Transmit buffer empty flag.
Kojto 122:f9eeca106725 280 * @arg SWPMI_FLAG_RXBERF : Receive CRC error flag.
Kojto 122:f9eeca106725 281 * @arg SWPMI_FLAG_RXOVRF : Receive overrun error flag.
Kojto 122:f9eeca106725 282 * @arg SWPMI_FLAG_TXUNRF : Transmit underrun error flag.
Kojto 122:f9eeca106725 283 * @arg SWPMI_FLAG_TCF : Transfer complete flag.
Kojto 122:f9eeca106725 284 * @arg SWPMI_FLAG_SRF : Slave resume flag.
Kojto 122:f9eeca106725 285 * @retval None
Kojto 122:f9eeca106725 286 */
Kojto 122:f9eeca106725 287 #define __HAL_SWPMI_CLEAR_FLAG(__HANDLE__, __FLAG__) WRITE_REG((__HANDLE__)->Instance->ICR, (__FLAG__))
Kojto 122:f9eeca106725 288
Kojto 122:f9eeca106725 289 /** @brief Enable the specified SWPMI interrupt.
Kojto 122:f9eeca106725 290 * @param __HANDLE__: specifies the SWPMI Handle.
Kojto 122:f9eeca106725 291 * @param __INTERRUPT__: specifies the SWPMI interrupt source to enable.
Kojto 122:f9eeca106725 292 * This parameter can be one of the following values:
Kojto 122:f9eeca106725 293 * @arg SWPMI_IT_SRIE : Slave resume interrupt.
Kojto 122:f9eeca106725 294 * @arg SWPMI_IT_TCIE : Transmit complete interrupt.
Kojto 122:f9eeca106725 295 * @arg SWPMI_IT_TIE : Transmit interrupt.
Kojto 122:f9eeca106725 296 * @arg SWPMI_IT_RIE : Receive interrupt.
Kojto 122:f9eeca106725 297 * @arg SWPMI_IT_TXUNRIE : Transmit underrun error interrupt.
Kojto 122:f9eeca106725 298 * @arg SWPMI_IT_RXOVRIE : Receive overrun error interrupt.
Kojto 122:f9eeca106725 299 * @arg SWPMI_IT_RXBEIE : Receive CRC error interrupt.
Kojto 122:f9eeca106725 300 * @arg SWPMI_IT_TXBEIE : Transmit buffer empty interrupt.
Kojto 122:f9eeca106725 301 * @arg SWPMI_IT_RXBFIE : Receive buffer full interrupt.
Kojto 122:f9eeca106725 302 * @retval None
Kojto 122:f9eeca106725 303 */
Kojto 122:f9eeca106725 304 #define __HAL_SWPMI_ENABLE_IT(__HANDLE__, __INTERRUPT__) SET_BIT((__HANDLE__)->Instance->IER, (__INTERRUPT__))
Kojto 122:f9eeca106725 305
Kojto 122:f9eeca106725 306 /** @brief Disable the specified SWPMI interrupt.
Kojto 122:f9eeca106725 307 * @param __HANDLE__: specifies the SWPMI Handle.
Kojto 122:f9eeca106725 308 * @param __INTERRUPT__: specifies the SWPMI interrupt source to disable.
Kojto 122:f9eeca106725 309 * This parameter can be one of the following values:
Kojto 122:f9eeca106725 310 * @arg SWPMI_IT_SRIE : Slave resume interrupt.
Kojto 122:f9eeca106725 311 * @arg SWPMI_IT_TCIE : Transmit complete interrupt.
Kojto 122:f9eeca106725 312 * @arg SWPMI_IT_TIE : Transmit interrupt.
Kojto 122:f9eeca106725 313 * @arg SWPMI_IT_RIE : Receive interrupt.
Kojto 122:f9eeca106725 314 * @arg SWPMI_IT_TXUNRIE : Transmit underrun error interrupt.
Kojto 122:f9eeca106725 315 * @arg SWPMI_IT_RXOVRIE : Receive overrun error interrupt.
Kojto 122:f9eeca106725 316 * @arg SWPMI_IT_RXBEIE : Receive CRC error interrupt.
Kojto 122:f9eeca106725 317 * @arg SWPMI_IT_TXBEIE : Transmit buffer empty interrupt.
Kojto 122:f9eeca106725 318 * @arg SWPMI_IT_RXBFIE : Receive buffer full interrupt.
Kojto 122:f9eeca106725 319 * @retval None
Kojto 122:f9eeca106725 320 */
Kojto 122:f9eeca106725 321 #define __HAL_SWPMI_DISABLE_IT(__HANDLE__, __INTERRUPT__) CLEAR_BIT((__HANDLE__)->Instance->IER, (__INTERRUPT__))
Kojto 122:f9eeca106725 322
Kojto 122:f9eeca106725 323 /** @brief Check whether the specified SWPMI interrupt has occurred or not.
Kojto 122:f9eeca106725 324 * @param __HANDLE__: specifies the SWPMI Handle.
Kojto 122:f9eeca106725 325 * @param __IT__: specifies the SWPMI interrupt to check.
Kojto 122:f9eeca106725 326 * This parameter can be one of the following values:
Kojto 122:f9eeca106725 327 * @arg SWPMI_IT_SRIE : Slave resume interrupt.
Kojto 122:f9eeca106725 328 * @arg SWPMI_IT_TCIE : Transmit complete interrupt.
Kojto 122:f9eeca106725 329 * @arg SWPMI_IT_TIE : Transmit interrupt.
Kojto 122:f9eeca106725 330 * @arg SWPMI_IT_RIE : Receive interrupt.
Kojto 122:f9eeca106725 331 * @arg SWPMI_IT_TXUNRIE : Transmit underrun error interrupt.
Kojto 122:f9eeca106725 332 * @arg SWPMI_IT_RXOVRIE : Receive overrun error interrupt.
Kojto 122:f9eeca106725 333 * @arg SWPMI_IT_RXBERIE : Receive CRC error interrupt.
Kojto 122:f9eeca106725 334 * @arg SWPMI_IT_TXBEIE : Transmit buffer empty interrupt.
Kojto 122:f9eeca106725 335 * @arg SWPMI_IT_RXBFIE : Receive buffer full interrupt.
Kojto 122:f9eeca106725 336 * @retval The new state of __IT__ (TRUE or FALSE).
Kojto 122:f9eeca106725 337 */
Kojto 122:f9eeca106725 338 #define __HAL_SWPMI_GET_IT(__HANDLE__, __IT__) (READ_BIT((__HANDLE__)->Instance->ISR,(__IT__)) == (__IT__))
Kojto 122:f9eeca106725 339
Kojto 122:f9eeca106725 340 /** @brief Check whether the specified SWPMI interrupt source is enabled or not.
Kojto 122:f9eeca106725 341 * @param __HANDLE__: specifies the SWPMI Handle.
Kojto 122:f9eeca106725 342 * @param __IT__: specifies the SWPMI interrupt source to check.
Kojto 122:f9eeca106725 343 * This parameter can be one of the following values:
Kojto 122:f9eeca106725 344 * @arg SWPMI_IT_SRIE : Slave resume interrupt.
Kojto 122:f9eeca106725 345 * @arg SWPMI_IT_TCIE : Transmit complete interrupt.
Kojto 122:f9eeca106725 346 * @arg SWPMI_IT_TIE : Transmit interrupt.
Kojto 122:f9eeca106725 347 * @arg SWPMI_IT_RIE : Receive interrupt.
Kojto 122:f9eeca106725 348 * @arg SWPMI_IT_TXUNRIE : Transmit underrun error interrupt.
Kojto 122:f9eeca106725 349 * @arg SWPMI_IT_RXOVRIE : Receive overrun error interrupt.
Kojto 122:f9eeca106725 350 * @arg SWPMI_IT_RXBERIE : Receive CRC error interrupt.
Kojto 122:f9eeca106725 351 * @arg SWPMI_IT_TXBEIE : Transmit buffer empty interrupt.
Kojto 122:f9eeca106725 352 * @arg SWPMI_IT_RXBFIE : Receive buffer full interrupt.
Kojto 122:f9eeca106725 353 * @retval The new state of __IT__ (TRUE or FALSE).
Kojto 122:f9eeca106725 354 */
Kojto 122:f9eeca106725 355 #define __HAL_SWPMI_GET_IT_SOURCE(__HANDLE__, __IT__) ((READ_BIT((__HANDLE__)->Instance->IER, (__IT__)) == (__IT__)) ? SET : RESET)
Kojto 122:f9eeca106725 356
Kojto 122:f9eeca106725 357 /**
Kojto 122:f9eeca106725 358 * @}
Kojto 122:f9eeca106725 359 */
Kojto 122:f9eeca106725 360
Kojto 122:f9eeca106725 361 /* Exported functions --------------------------------------------------------*/
Kojto 122:f9eeca106725 362 /** @defgroup SWPMI_Exported_Functions SWPMI Exported Functions
Kojto 122:f9eeca106725 363 * @{
Kojto 122:f9eeca106725 364 */
Kojto 122:f9eeca106725 365 /* Initialization/de-initialization functions ********************************/
Kojto 122:f9eeca106725 366 HAL_StatusTypeDef HAL_SWPMI_Init(SWPMI_HandleTypeDef *hswpmi);
Kojto 122:f9eeca106725 367 HAL_StatusTypeDef HAL_SWPMI_DeInit(SWPMI_HandleTypeDef *hswpmi);
Kojto 122:f9eeca106725 368 void HAL_SWPMI_MspInit(SWPMI_HandleTypeDef *hswpmi);
Kojto 122:f9eeca106725 369 void HAL_SWPMI_MspDeInit(SWPMI_HandleTypeDef *hswpmi);
Kojto 122:f9eeca106725 370
Kojto 122:f9eeca106725 371 /* IO operation functions *****************************************************/
Kojto 122:f9eeca106725 372 HAL_StatusTypeDef HAL_SWPMI_Transmit(SWPMI_HandleTypeDef *hswpmi, uint32_t *pData, uint16_t Size, uint32_t Timeout);
Kojto 122:f9eeca106725 373 HAL_StatusTypeDef HAL_SWPMI_Receive(SWPMI_HandleTypeDef *hswpmi, uint32_t *pData, uint16_t Size, uint32_t Timeout);
Kojto 122:f9eeca106725 374 HAL_StatusTypeDef HAL_SWPMI_Transmit_IT(SWPMI_HandleTypeDef *hswpmi, uint32_t *pData, uint16_t Size);
Kojto 122:f9eeca106725 375 HAL_StatusTypeDef HAL_SWPMI_Receive_IT(SWPMI_HandleTypeDef *hswpmi, uint32_t *pData, uint16_t Size);
Kojto 122:f9eeca106725 376 HAL_StatusTypeDef HAL_SWPMI_Transmit_DMA(SWPMI_HandleTypeDef *hswpmi, uint32_t *pData, uint16_t Size);
Kojto 122:f9eeca106725 377 HAL_StatusTypeDef HAL_SWPMI_Receive_DMA(SWPMI_HandleTypeDef *hswpmi, uint32_t *pData, uint16_t Size);
Kojto 122:f9eeca106725 378 HAL_StatusTypeDef HAL_SWPMI_DMAStop(SWPMI_HandleTypeDef *hswpmi);
Kojto 122:f9eeca106725 379 HAL_StatusTypeDef HAL_SWPMI_EnableLoopback(SWPMI_HandleTypeDef *hswpmi);
Kojto 122:f9eeca106725 380 HAL_StatusTypeDef HAL_SWPMI_DisableLoopback(SWPMI_HandleTypeDef *hswpmi);
Kojto 122:f9eeca106725 381 void HAL_SWPMI_IRQHandler(SWPMI_HandleTypeDef *hswpmi);
Kojto 122:f9eeca106725 382 void HAL_SWPMI_TxCpltCallback(SWPMI_HandleTypeDef *hswpmi);
Kojto 122:f9eeca106725 383 void HAL_SWPMI_TxHalfCpltCallback(SWPMI_HandleTypeDef *hswpmi);
Kojto 122:f9eeca106725 384 void HAL_SWPMI_RxCpltCallback(SWPMI_HandleTypeDef *hswpmi);
Kojto 122:f9eeca106725 385 void HAL_SWPMI_RxHalfCpltCallback(SWPMI_HandleTypeDef *hswpmi);
Kojto 122:f9eeca106725 386 void HAL_SWPMI_ErrorCallback(SWPMI_HandleTypeDef *hswpmi);
Kojto 122:f9eeca106725 387
Kojto 122:f9eeca106725 388 /* Peripheral Control and State functions ************************************/
Kojto 122:f9eeca106725 389 HAL_SWPMI_StateTypeDef HAL_SWPMI_GetState(SWPMI_HandleTypeDef *hswpmi);
Kojto 122:f9eeca106725 390 uint32_t HAL_SWPMI_GetError(SWPMI_HandleTypeDef *hswpmi);
Kojto 122:f9eeca106725 391
Kojto 122:f9eeca106725 392 /**
Kojto 122:f9eeca106725 393 * @}
Kojto 122:f9eeca106725 394 */
Kojto 122:f9eeca106725 395
Kojto 122:f9eeca106725 396 /* Private types -------------------------------------------------------------*/
Kojto 122:f9eeca106725 397 /** @defgroup SWPMI_Private_Types SWPMI Private Types
Kojto 122:f9eeca106725 398 * @{
Kojto 122:f9eeca106725 399 */
Kojto 122:f9eeca106725 400
Kojto 122:f9eeca106725 401 /**
Kojto 122:f9eeca106725 402 * @}
Kojto 122:f9eeca106725 403 */
Kojto 122:f9eeca106725 404
Kojto 122:f9eeca106725 405 /* Private variables ---------------------------------------------------------*/
Kojto 122:f9eeca106725 406 /** @defgroup SWPMI_Private_Variables SWPMI Private Variables
Kojto 122:f9eeca106725 407 * @{
Kojto 122:f9eeca106725 408 */
Kojto 122:f9eeca106725 409
Kojto 122:f9eeca106725 410 /**
Kojto 122:f9eeca106725 411 * @}
Kojto 122:f9eeca106725 412 */
Kojto 122:f9eeca106725 413
Kojto 122:f9eeca106725 414 /* Private constants ---------------------------------------------------------*/
Kojto 122:f9eeca106725 415 /** @defgroup SWPMI_Private_Constants SWPMI Private Constants
Kojto 122:f9eeca106725 416 * @{
Kojto 122:f9eeca106725 417 */
Kojto 122:f9eeca106725 418
Kojto 122:f9eeca106725 419 /**
Kojto 122:f9eeca106725 420 * @}
Kojto 122:f9eeca106725 421 */
Kojto 122:f9eeca106725 422
Kojto 122:f9eeca106725 423 /* Private macros ------------------------------------------------------------*/
Kojto 122:f9eeca106725 424 /** @defgroup SWPMI_Private_Macros SWPMI Private Macros
Kojto 122:f9eeca106725 425 * @{
Kojto 122:f9eeca106725 426 */
Kojto 122:f9eeca106725 427
Kojto 122:f9eeca106725 428
Kojto 122:f9eeca106725 429 #define IS_SWPMI_VOLTAGE_CLASS(__CLASS__) (((__CLASS__) == SWPMI_VOLTAGE_CLASS_C) || \
Kojto 122:f9eeca106725 430 ((__CLASS__) == SWPMI_VOLTAGE_CLASS_B))
Kojto 122:f9eeca106725 431
Kojto 122:f9eeca106725 432 #define IS_SWPMI_BITRATE_VALUE(__VALUE__) (((__VALUE__) <= 63))
Kojto 122:f9eeca106725 433
Kojto 122:f9eeca106725 434
Kojto 122:f9eeca106725 435 #define IS_SWPMI_TX_BUFFERING_MODE(__MODE__) (((__MODE__) == SWPMI_TX_NO_SOFTWAREBUFFER) || \
Kojto 122:f9eeca106725 436 ((__MODE__) == SWPMI_TX_MULTI_SOFTWAREBUFFER))
Kojto 122:f9eeca106725 437
Kojto 122:f9eeca106725 438
Kojto 122:f9eeca106725 439 #define IS_SWPMI_RX_BUFFERING_MODE(__MODE__) (((__MODE__) == SWPMI_RX_NO_SOFTWAREBUFFER) || \
Kojto 122:f9eeca106725 440 ((__MODE__) == SWPMI_RX_MULTI_SOFTWAREBUFFER))
Kojto 122:f9eeca106725 441
Kojto 122:f9eeca106725 442 /**
Kojto 122:f9eeca106725 443 * @}
Kojto 122:f9eeca106725 444 */
Kojto 122:f9eeca106725 445
Kojto 122:f9eeca106725 446 /**
Kojto 122:f9eeca106725 447 * @}
Kojto 122:f9eeca106725 448 */
Kojto 122:f9eeca106725 449
Kojto 122:f9eeca106725 450 /**
Kojto 122:f9eeca106725 451 * @}
Kojto 122:f9eeca106725 452 */
Kojto 122:f9eeca106725 453
AnnaBridge 145:64910690c574 454 #endif /* STM32L431xx || STM32L432xx || STM32L433xx || STM32L442xx || STM32L443xx || */
AnnaBridge 145:64910690c574 455 /* STM32L471xx || STM32L475xx || STM32L476xx || STM32L485xx || STM32L486xx || */
AnnaBridge 145:64910690c574 456 /* STM32L496xx || STM32L4A6xx */
AnnaBridge 145:64910690c574 457
Kojto 122:f9eeca106725 458 #ifdef __cplusplus
Kojto 122:f9eeca106725 459 }
Kojto 122:f9eeca106725 460 #endif
Kojto 122:f9eeca106725 461
Kojto 122:f9eeca106725 462 #endif /* __STM32L4xx_HAL_SWPMI_H */
Kojto 122:f9eeca106725 463
Kojto 122:f9eeca106725 464 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/