Fork of the official mbed C/C SDK provides the software platform and libraries to build your applications for RenBED.

Dependents:   1-RenBuggyTimed RenBED_RGB RenBED_RGB_PWM RenBED_RGB

Fork of mbed by mbed official

Committer:
elijahorr
Date:
Thu Apr 14 07:28:54 2016 +0000
Revision:
121:672067c3ada4
Parent:
107:4f6c30876dfa
.

Who changed what in which revision?

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