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.
TARGET_NUCLEO_L432KC/stm32l4xx_hal_swpmi.h@122:f9eeca106725, 2016-07-07 (annotated)
- Committer:
- Kojto
- Date:
- Thu Jul 07 14:34:11 2016 +0100
- Revision:
- 122:f9eeca106725
Release 122 of the mbed library
Changes:
- new targets - Nucleo L432KC, Beetle, Nucleo F446ZE, Nucleo L011K4
- Thread safety addition - mbed API should contain a statement about thread safety
- critical section API addition
- CAS API (core_util_atomic_incr/decr)
- DEVICE_ are generated from targets.json file, device.h deprecated
- Callback replaces FunctionPointer to provide std like interface
- mbed HAL API docs improvements
- toolchain - prexif attributes with MBED_
- add new attributes - packed, weak, forcedinline, align
- target.json - contains targets definitions
- ST - L1XX - Cube update to 1.5
- SPI clock selection fix (clock from APB domain)
- F7 - Cube update v1.4.0
- L0 - baudrate init fix
- L1 - Cube update v1.5
- F3 - baudrate init fix, 3 targets CAN support
- F4 - Cube update v1.12.0, 3 targets CAN support
- L4XX - Cube update v1.5.1
- F0 - update Cube to v1.5.0
- L4 - 2 targets (L476RG/VG) CAN support
- NXP - pwm clock fix for KSDK2 MCU
- LPC2368 - remove ARM toolchain support - due to regression
- KSDK2 - fix SPI , I2C address and repeat start
- Silabs - some fixes backported from mbed 3
- Renesas - RZ_A1H - SystemCoreClockUpdate addition
Who changed what in which revision?
User | Revision | Line number | New 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 |
Kojto | 122:f9eeca106725 | 5 | * @version V1.5.1 |
Kojto | 122:f9eeca106725 | 6 | * @date 31-May-2016 |
Kojto | 122:f9eeca106725 | 7 | * @brief Header file of SWPMI HAL module. |
Kojto | 122:f9eeca106725 | 8 | ****************************************************************************** |
Kojto | 122:f9eeca106725 | 9 | * @attention |
Kojto | 122:f9eeca106725 | 10 | * |
Kojto | 122:f9eeca106725 | 11 | * <h2><center>© COPYRIGHT(c) 2016 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 | |
Kojto | 122:f9eeca106725 | 46 | /* Includes ------------------------------------------------------------------*/ |
Kojto | 122:f9eeca106725 | 47 | #include "stm32l4xx_hal_def.h" |
Kojto | 122:f9eeca106725 | 48 | |
Kojto | 122:f9eeca106725 | 49 | /** @addtogroup STM32L4xx_HAL_Driver |
Kojto | 122:f9eeca106725 | 50 | * @{ |
Kojto | 122:f9eeca106725 | 51 | */ |
Kojto | 122:f9eeca106725 | 52 | |
Kojto | 122:f9eeca106725 | 53 | /** @addtogroup SWPMI |
Kojto | 122:f9eeca106725 | 54 | * @{ |
Kojto | 122:f9eeca106725 | 55 | */ |
Kojto | 122:f9eeca106725 | 56 | |
Kojto | 122:f9eeca106725 | 57 | /* Exported types ------------------------------------------------------------*/ |
Kojto | 122:f9eeca106725 | 58 | /** @defgroup SWPMI_Exported_Types SWPMI Exported Types |
Kojto | 122:f9eeca106725 | 59 | * @{ |
Kojto | 122:f9eeca106725 | 60 | */ |
Kojto | 122:f9eeca106725 | 61 | |
Kojto | 122:f9eeca106725 | 62 | /** |
Kojto | 122:f9eeca106725 | 63 | * @brief SWPMI Init Structure definition |
Kojto | 122:f9eeca106725 | 64 | */ |
Kojto | 122:f9eeca106725 | 65 | typedef struct |
Kojto | 122:f9eeca106725 | 66 | { |
Kojto | 122:f9eeca106725 | 67 | uint32_t VoltageClass; /*!< Specifies the SWP Voltage Class. |
Kojto | 122:f9eeca106725 | 68 | This parameter can be a value of @ref SWPMI_Voltage_Class */ |
Kojto | 122:f9eeca106725 | 69 | |
Kojto | 122:f9eeca106725 | 70 | uint32_t BitRate; /*!< Specifies the SWPMI Bitrate. |
Kojto | 122:f9eeca106725 | 71 | This parameter must be a number between 0 and 63. |
Kojto | 122:f9eeca106725 | 72 | The Bitrate is computed using the following formula: |
Kojto | 122:f9eeca106725 | 73 | SWPMI_freq = SWPMI_clk / (((BitRate) + 1) * 4) |
Kojto | 122:f9eeca106725 | 74 | */ |
Kojto | 122:f9eeca106725 | 75 | |
Kojto | 122:f9eeca106725 | 76 | uint32_t TxBufferingMode; /*!< Specifies the transmission buffering mode. |
Kojto | 122:f9eeca106725 | 77 | This parameter can be a value of @ref SWPMI_Tx_Buffering_Mode */ |
Kojto | 122:f9eeca106725 | 78 | |
Kojto | 122:f9eeca106725 | 79 | uint32_t RxBufferingMode; /*!< Specifies the reception buffering mode. |
Kojto | 122:f9eeca106725 | 80 | This parameter can be a value of @ref SWPMI_Rx_Buffering_Mode */ |
Kojto | 122:f9eeca106725 | 81 | |
Kojto | 122:f9eeca106725 | 82 | }SWPMI_InitTypeDef; |
Kojto | 122:f9eeca106725 | 83 | |
Kojto | 122:f9eeca106725 | 84 | |
Kojto | 122:f9eeca106725 | 85 | /** |
Kojto | 122:f9eeca106725 | 86 | * @brief HAL SWPMI State structures definition |
Kojto | 122:f9eeca106725 | 87 | */ |
Kojto | 122:f9eeca106725 | 88 | typedef enum |
Kojto | 122:f9eeca106725 | 89 | { |
Kojto | 122:f9eeca106725 | 90 | HAL_SWPMI_STATE_RESET = 0x00, /*!< Peripheral Reset state */ |
Kojto | 122:f9eeca106725 | 91 | HAL_SWPMI_STATE_READY = 0x01, /*!< Peripheral Initialized and ready for use */ |
Kojto | 122:f9eeca106725 | 92 | HAL_SWPMI_STATE_BUSY = 0x02, /*!< an internal process is ongoing */ |
Kojto | 122:f9eeca106725 | 93 | HAL_SWPMI_STATE_BUSY_TX = 0x12, /*!< Data Transmission process is ongoing */ |
Kojto | 122:f9eeca106725 | 94 | HAL_SWPMI_STATE_BUSY_RX = 0x22, /*!< Data Reception process is ongoing */ |
Kojto | 122:f9eeca106725 | 95 | HAL_SWPMI_STATE_BUSY_TX_RX = 0x32, /*!< Data Transmission and Reception process is ongoing */ |
Kojto | 122:f9eeca106725 | 96 | HAL_SWPMI_STATE_TIMEOUT = 0x03, /*!< Timeout state */ |
Kojto | 122:f9eeca106725 | 97 | HAL_SWPMI_STATE_ERROR = 0x04 /*!< Error */ |
Kojto | 122:f9eeca106725 | 98 | }HAL_SWPMI_StateTypeDef; |
Kojto | 122:f9eeca106725 | 99 | |
Kojto | 122:f9eeca106725 | 100 | /** |
Kojto | 122:f9eeca106725 | 101 | * @brief SWPMI handle Structure definition |
Kojto | 122:f9eeca106725 | 102 | */ |
Kojto | 122:f9eeca106725 | 103 | typedef struct |
Kojto | 122:f9eeca106725 | 104 | { |
Kojto | 122:f9eeca106725 | 105 | SWPMI_TypeDef *Instance; /* SWPMI registers base address */ |
Kojto | 122:f9eeca106725 | 106 | |
Kojto | 122:f9eeca106725 | 107 | SWPMI_InitTypeDef Init; /* SWMPI communication parameters */ |
Kojto | 122:f9eeca106725 | 108 | |
Kojto | 122:f9eeca106725 | 109 | uint32_t *pTxBuffPtr; /* Pointer to SWPMI Tx transfer Buffer */ |
Kojto | 122:f9eeca106725 | 110 | |
Kojto | 122:f9eeca106725 | 111 | uint32_t TxXferSize; /* SWPMI Tx Transfer size */ |
Kojto | 122:f9eeca106725 | 112 | |
Kojto | 122:f9eeca106725 | 113 | uint32_t TxXferCount; /* SWPMI Tx Transfer Counter */ |
Kojto | 122:f9eeca106725 | 114 | |
Kojto | 122:f9eeca106725 | 115 | uint32_t *pRxBuffPtr; /* Pointer to SWPMI Rx transfer Buffer */ |
Kojto | 122:f9eeca106725 | 116 | |
Kojto | 122:f9eeca106725 | 117 | uint32_t RxXferSize; /* SWPMI Rx Transfer size */ |
Kojto | 122:f9eeca106725 | 118 | |
Kojto | 122:f9eeca106725 | 119 | uint32_t RxXferCount; /* SWPMI Rx Transfer Counter */ |
Kojto | 122:f9eeca106725 | 120 | |
Kojto | 122:f9eeca106725 | 121 | DMA_HandleTypeDef *hdmatx; /* SWPMI Tx DMA Handle parameters */ |
Kojto | 122:f9eeca106725 | 122 | |
Kojto | 122:f9eeca106725 | 123 | DMA_HandleTypeDef *hdmarx; /* SWPMI Rx DMA Handle parameters */ |
Kojto | 122:f9eeca106725 | 124 | |
Kojto | 122:f9eeca106725 | 125 | HAL_LockTypeDef Lock; /* SWPMI object */ |
Kojto | 122:f9eeca106725 | 126 | |
Kojto | 122:f9eeca106725 | 127 | __IO HAL_SWPMI_StateTypeDef State; /* SWPMI communication state */ |
Kojto | 122:f9eeca106725 | 128 | |
Kojto | 122:f9eeca106725 | 129 | __IO uint32_t ErrorCode; /* SWPMI Error code */ |
Kojto | 122:f9eeca106725 | 130 | |
Kojto | 122:f9eeca106725 | 131 | }SWPMI_HandleTypeDef; |
Kojto | 122:f9eeca106725 | 132 | |
Kojto | 122:f9eeca106725 | 133 | /** |
Kojto | 122:f9eeca106725 | 134 | * @} |
Kojto | 122:f9eeca106725 | 135 | */ |
Kojto | 122:f9eeca106725 | 136 | |
Kojto | 122:f9eeca106725 | 137 | /* Exported constants --------------------------------------------------------*/ |
Kojto | 122:f9eeca106725 | 138 | /** @defgroup SWPMI_Exported_Constants SWPMI Exported Constants |
Kojto | 122:f9eeca106725 | 139 | * @{ |
Kojto | 122:f9eeca106725 | 140 | */ |
Kojto | 122:f9eeca106725 | 141 | |
Kojto | 122:f9eeca106725 | 142 | /** |
Kojto | 122:f9eeca106725 | 143 | * @defgroup SWPMI_Error_Code SWPMI Error Code Bitmap |
Kojto | 122:f9eeca106725 | 144 | * @{ |
Kojto | 122:f9eeca106725 | 145 | */ |
Kojto | 122:f9eeca106725 | 146 | #define HAL_SWPMI_ERROR_NONE ((uint32_t)0x00000000) /*!< No error */ |
Kojto | 122:f9eeca106725 | 147 | #define HAL_SWPMI_ERROR_CRC ((uint32_t)0x00000004) /*!< frame error */ |
Kojto | 122:f9eeca106725 | 148 | #define HAL_SWPMI_ERROR_OVR ((uint32_t)0x00000008) /*!< Overrun error */ |
Kojto | 122:f9eeca106725 | 149 | #define HAL_SWPMI_ERROR_UDR ((uint32_t)0x0000000C) /*!< Underrun error */ |
Kojto | 122:f9eeca106725 | 150 | #define HAL_SWPMI_ERROR_DMA ((uint32_t)0x00000010) /*!< DMA transfer error */ |
Kojto | 122:f9eeca106725 | 151 | /** |
Kojto | 122:f9eeca106725 | 152 | * @} |
Kojto | 122:f9eeca106725 | 153 | */ |
Kojto | 122:f9eeca106725 | 154 | |
Kojto | 122:f9eeca106725 | 155 | /** @defgroup SWPMI_Voltage_Class SWPMI Voltage Class |
Kojto | 122:f9eeca106725 | 156 | * @{ |
Kojto | 122:f9eeca106725 | 157 | */ |
Kojto | 122:f9eeca106725 | 158 | #define SWPMI_VOLTAGE_CLASS_C ((uint32_t)0x00000000) |
Kojto | 122:f9eeca106725 | 159 | #define SWPMI_VOLTAGE_CLASS_B SWPMI_OR_CLASS |
Kojto | 122:f9eeca106725 | 160 | /** |
Kojto | 122:f9eeca106725 | 161 | * @} |
Kojto | 122:f9eeca106725 | 162 | */ |
Kojto | 122:f9eeca106725 | 163 | |
Kojto | 122:f9eeca106725 | 164 | /** @defgroup SWPMI_Tx_Buffering_Mode SWPMI Tx Buffering Mode |
Kojto | 122:f9eeca106725 | 165 | * @{ |
Kojto | 122:f9eeca106725 | 166 | */ |
Kojto | 122:f9eeca106725 | 167 | #define SWPMI_TX_NO_SOFTWAREBUFFER ((uint32_t)0x00000000) |
Kojto | 122:f9eeca106725 | 168 | #define SWPMI_TX_SINGLE_SOFTWAREBUFFER ((uint32_t)0x00000000) |
Kojto | 122:f9eeca106725 | 169 | #define SWPMI_TX_MULTI_SOFTWAREBUFFER SWPMI_CR_TXMODE |
Kojto | 122:f9eeca106725 | 170 | /** |
Kojto | 122:f9eeca106725 | 171 | * @} |
Kojto | 122:f9eeca106725 | 172 | */ |
Kojto | 122:f9eeca106725 | 173 | |
Kojto | 122:f9eeca106725 | 174 | /** @defgroup SWPMI_Rx_Buffering_Mode SWPMI Rx Buffering Mode |
Kojto | 122:f9eeca106725 | 175 | * @{ |
Kojto | 122:f9eeca106725 | 176 | */ |
Kojto | 122:f9eeca106725 | 177 | #define SWPMI_RX_NO_SOFTWAREBUFFER ((uint32_t)0x00000000) |
Kojto | 122:f9eeca106725 | 178 | #define SWPMI_RX_SINGLE_SOFTWAREBUFFER ((uint32_t)0x00000000) |
Kojto | 122:f9eeca106725 | 179 | #define SWPMI_RX_MULTI_SOFTWAREBUFFER SWPMI_CR_RXMODE |
Kojto | 122:f9eeca106725 | 180 | /** |
Kojto | 122:f9eeca106725 | 181 | * @} |
Kojto | 122:f9eeca106725 | 182 | */ |
Kojto | 122:f9eeca106725 | 183 | |
Kojto | 122:f9eeca106725 | 184 | /** @defgroup SWPMI_Flags SWPMI Status Flags |
Kojto | 122:f9eeca106725 | 185 | * Elements values convention: 0xXXXXXXXX |
Kojto | 122:f9eeca106725 | 186 | * - 0xXXXXXXXX : Flag mask in the ISR register |
Kojto | 122:f9eeca106725 | 187 | * @{ |
Kojto | 122:f9eeca106725 | 188 | */ |
Kojto | 122:f9eeca106725 | 189 | #define SWPMI_FLAG_RXBFF SWPMI_ISR_RXBFF |
Kojto | 122:f9eeca106725 | 190 | #define SWPMI_FLAG_TXBEF SWPMI_ISR_TXBEF |
Kojto | 122:f9eeca106725 | 191 | #define SWPMI_FLAG_RXBERF SWPMI_ISR_RXBERF |
Kojto | 122:f9eeca106725 | 192 | #define SWPMI_FLAG_RXOVRF SWPMI_ISR_RXOVRF |
Kojto | 122:f9eeca106725 | 193 | #define SWPMI_FLAG_TXUNRF SWPMI_ISR_TXUNRF |
Kojto | 122:f9eeca106725 | 194 | #define SWPMI_FLAG_RXNE SWPMI_ISR_RXNE |
Kojto | 122:f9eeca106725 | 195 | #define SWPMI_FLAG_TXE SWPMI_ISR_TXE |
Kojto | 122:f9eeca106725 | 196 | #define SWPMI_FLAG_TCF SWPMI_ISR_TCF |
Kojto | 122:f9eeca106725 | 197 | #define SWPMI_FLAG_SRF SWPMI_ISR_SRF |
Kojto | 122:f9eeca106725 | 198 | #define SWPMI_FLAG_SUSP SWPMI_ISR_SUSP |
Kojto | 122:f9eeca106725 | 199 | #define SWPMI_FLAG_DEACTF SWPMI_ISR_DEACTF |
Kojto | 122:f9eeca106725 | 200 | /** |
Kojto | 122:f9eeca106725 | 201 | * @} |
Kojto | 122:f9eeca106725 | 202 | */ |
Kojto | 122:f9eeca106725 | 203 | |
Kojto | 122:f9eeca106725 | 204 | /** @defgroup SWPMI_Interrupt_definition SWPMI Interrupts Definition |
Kojto | 122:f9eeca106725 | 205 | * Elements values convention: 0xXXXX |
Kojto | 122:f9eeca106725 | 206 | * - 0xXXXX : Flag mask in the IER register |
Kojto | 122:f9eeca106725 | 207 | * @{ |
Kojto | 122:f9eeca106725 | 208 | */ |
Kojto | 122:f9eeca106725 | 209 | #define SWPMI_IT_SRIE SWPMI_IER_SRIE |
Kojto | 122:f9eeca106725 | 210 | #define SWPMI_IT_TCIE SWPMI_IER_TCIE |
Kojto | 122:f9eeca106725 | 211 | #define SWPMI_IT_TIE SWPMI_IER_TIE |
Kojto | 122:f9eeca106725 | 212 | #define SWPMI_IT_RIE SWPMI_IER_RIE |
Kojto | 122:f9eeca106725 | 213 | #define SWPMI_IT_TXUNRIE SWPMI_IER_TXUNRIE |
Kojto | 122:f9eeca106725 | 214 | #define SWPMI_IT_RXOVRIE SWPMI_IER_RXOVRIE |
Kojto | 122:f9eeca106725 | 215 | #define SWPMI_IT_RXBERIE SWPMI_IER_RXBERIE |
Kojto | 122:f9eeca106725 | 216 | #define SWPMI_IT_TXBEIE SWPMI_IER_TXBEIE |
Kojto | 122:f9eeca106725 | 217 | #define SWPMI_IT_RXBFIE SWPMI_IER_RXBFIE |
Kojto | 122:f9eeca106725 | 218 | /** |
Kojto | 122:f9eeca106725 | 219 | * @} |
Kojto | 122:f9eeca106725 | 220 | */ |
Kojto | 122:f9eeca106725 | 221 | |
Kojto | 122:f9eeca106725 | 222 | /** |
Kojto | 122:f9eeca106725 | 223 | * @} |
Kojto | 122:f9eeca106725 | 224 | */ |
Kojto | 122:f9eeca106725 | 225 | |
Kojto | 122:f9eeca106725 | 226 | /* Exported macros -----------------------------------------------------------*/ |
Kojto | 122:f9eeca106725 | 227 | /** @defgroup SWPMI_Exported_Macros SWPMI Exported Macros |
Kojto | 122:f9eeca106725 | 228 | * @{ |
Kojto | 122:f9eeca106725 | 229 | */ |
Kojto | 122:f9eeca106725 | 230 | |
Kojto | 122:f9eeca106725 | 231 | /** @brief Reset SWPMI handle state. |
Kojto | 122:f9eeca106725 | 232 | * @param __HANDLE__: specifies the SWPMI Handle. |
Kojto | 122:f9eeca106725 | 233 | * @retval None |
Kojto | 122:f9eeca106725 | 234 | */ |
Kojto | 122:f9eeca106725 | 235 | #define __HAL_SWPMI_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_SWPMI_STATE_RESET) |
Kojto | 122:f9eeca106725 | 236 | |
Kojto | 122:f9eeca106725 | 237 | /** |
Kojto | 122:f9eeca106725 | 238 | * @brief Enable the SWPMI peripheral. |
Kojto | 122:f9eeca106725 | 239 | * @param __HANDLE__: SWPMI handle |
Kojto | 122:f9eeca106725 | 240 | * @retval None |
Kojto | 122:f9eeca106725 | 241 | */ |
Kojto | 122:f9eeca106725 | 242 | #define __HAL_SWPMI_ENABLE(__HANDLE__) SET_BIT((__HANDLE__)->Instance->CR, SWPMI_CR_SWPACT) |
Kojto | 122:f9eeca106725 | 243 | |
Kojto | 122:f9eeca106725 | 244 | /** |
Kojto | 122:f9eeca106725 | 245 | * @brief Disable the SWPMI peripheral. |
Kojto | 122:f9eeca106725 | 246 | * @param __HANDLE__: SWPMI handle |
Kojto | 122:f9eeca106725 | 247 | * @retval None |
Kojto | 122:f9eeca106725 | 248 | */ |
Kojto | 122:f9eeca106725 | 249 | #define __HAL_SWPMI_DISABLE(__HANDLE__) CLEAR_BIT((__HANDLE__)->Instance->CR, SWPMI_CR_SWPACT) |
Kojto | 122:f9eeca106725 | 250 | |
Kojto | 122:f9eeca106725 | 251 | /** @brief Check whether the specified SWPMI flag is set or not. |
Kojto | 122:f9eeca106725 | 252 | * @param __HANDLE__: specifies the SWPMI Handle. |
Kojto | 122:f9eeca106725 | 253 | * @param __FLAG__: specifies the flag to check. |
Kojto | 122:f9eeca106725 | 254 | * This parameter can be one of the following values: |
Kojto | 122:f9eeca106725 | 255 | * @arg SWPMI_FLAG_RXBFF : Receive buffer full flag. |
Kojto | 122:f9eeca106725 | 256 | * @arg SWPMI_FLAG_TXBEF : Transmit buffer empty flag. |
Kojto | 122:f9eeca106725 | 257 | * @arg SWPMI_FLAG_RXBERF : Receive CRC error flag. |
Kojto | 122:f9eeca106725 | 258 | * @arg SWPMI_FLAG_RXOVRF : Receive overrun error flag. |
Kojto | 122:f9eeca106725 | 259 | * @arg SWPMI_FLAG_TXUNRF : Transmit underrun error flag. |
Kojto | 122:f9eeca106725 | 260 | * @arg SWPMI_FLAG_RXNE : Receive data register not empty. |
Kojto | 122:f9eeca106725 | 261 | * @arg SWPMI_FLAG_TXE : Transmit data register empty. |
Kojto | 122:f9eeca106725 | 262 | * @arg SWPMI_FLAG_TCF : Transfer complete flag. |
Kojto | 122:f9eeca106725 | 263 | * @arg SWPMI_FLAG_SRF : Slave resume flag. |
Kojto | 122:f9eeca106725 | 264 | * @arg SWPMI_FLAG_SUSP : SUSPEND flag. |
Kojto | 122:f9eeca106725 | 265 | * @arg SWPMI_FLAG_DEACTF : DEACTIVATED flag. |
Kojto | 122:f9eeca106725 | 266 | * @retval The new state of __FLAG__ (TRUE or FALSE). |
Kojto | 122:f9eeca106725 | 267 | */ |
Kojto | 122:f9eeca106725 | 268 | #define __HAL_SWPMI_GET_FLAG(__HANDLE__, __FLAG__) (READ_BIT((__HANDLE__)->Instance->ISR, (__FLAG__)) == (__FLAG__)) |
Kojto | 122:f9eeca106725 | 269 | |
Kojto | 122:f9eeca106725 | 270 | /** @brief Clear the specified SWPMI ISR flag. |
Kojto | 122:f9eeca106725 | 271 | * @param __HANDLE__: specifies the SWPMI Handle. |
Kojto | 122:f9eeca106725 | 272 | * @param __FLAG__: specifies the flag to clear. |
Kojto | 122:f9eeca106725 | 273 | * This parameter can be one of the following values: |
Kojto | 122:f9eeca106725 | 274 | * @arg SWPMI_FLAG_RXBFF : Receive buffer full flag. |
Kojto | 122:f9eeca106725 | 275 | * @arg SWPMI_FLAG_TXBEF : Transmit buffer empty flag. |
Kojto | 122:f9eeca106725 | 276 | * @arg SWPMI_FLAG_RXBERF : Receive CRC error flag. |
Kojto | 122:f9eeca106725 | 277 | * @arg SWPMI_FLAG_RXOVRF : Receive overrun error flag. |
Kojto | 122:f9eeca106725 | 278 | * @arg SWPMI_FLAG_TXUNRF : Transmit underrun error flag. |
Kojto | 122:f9eeca106725 | 279 | * @arg SWPMI_FLAG_TCF : Transfer complete flag. |
Kojto | 122:f9eeca106725 | 280 | * @arg SWPMI_FLAG_SRF : Slave resume flag. |
Kojto | 122:f9eeca106725 | 281 | * @retval None |
Kojto | 122:f9eeca106725 | 282 | */ |
Kojto | 122:f9eeca106725 | 283 | #define __HAL_SWPMI_CLEAR_FLAG(__HANDLE__, __FLAG__) WRITE_REG((__HANDLE__)->Instance->ICR, (__FLAG__)) |
Kojto | 122:f9eeca106725 | 284 | |
Kojto | 122:f9eeca106725 | 285 | /** @brief Enable the specified SWPMI interrupt. |
Kojto | 122:f9eeca106725 | 286 | * @param __HANDLE__: specifies the SWPMI Handle. |
Kojto | 122:f9eeca106725 | 287 | * @param __INTERRUPT__: specifies the SWPMI interrupt source to enable. |
Kojto | 122:f9eeca106725 | 288 | * This parameter can be one of the following values: |
Kojto | 122:f9eeca106725 | 289 | * @arg SWPMI_IT_SRIE : Slave resume interrupt. |
Kojto | 122:f9eeca106725 | 290 | * @arg SWPMI_IT_TCIE : Transmit complete interrupt. |
Kojto | 122:f9eeca106725 | 291 | * @arg SWPMI_IT_TIE : Transmit interrupt. |
Kojto | 122:f9eeca106725 | 292 | * @arg SWPMI_IT_RIE : Receive interrupt. |
Kojto | 122:f9eeca106725 | 293 | * @arg SWPMI_IT_TXUNRIE : Transmit underrun error interrupt. |
Kojto | 122:f9eeca106725 | 294 | * @arg SWPMI_IT_RXOVRIE : Receive overrun error interrupt. |
Kojto | 122:f9eeca106725 | 295 | * @arg SWPMI_IT_RXBEIE : Receive CRC error interrupt. |
Kojto | 122:f9eeca106725 | 296 | * @arg SWPMI_IT_TXBEIE : Transmit buffer empty interrupt. |
Kojto | 122:f9eeca106725 | 297 | * @arg SWPMI_IT_RXBFIE : Receive buffer full interrupt. |
Kojto | 122:f9eeca106725 | 298 | * @retval None |
Kojto | 122:f9eeca106725 | 299 | */ |
Kojto | 122:f9eeca106725 | 300 | #define __HAL_SWPMI_ENABLE_IT(__HANDLE__, __INTERRUPT__) SET_BIT((__HANDLE__)->Instance->IER, (__INTERRUPT__)) |
Kojto | 122:f9eeca106725 | 301 | |
Kojto | 122:f9eeca106725 | 302 | /** @brief Disable the specified SWPMI interrupt. |
Kojto | 122:f9eeca106725 | 303 | * @param __HANDLE__: specifies the SWPMI Handle. |
Kojto | 122:f9eeca106725 | 304 | * @param __INTERRUPT__: specifies the SWPMI interrupt source to disable. |
Kojto | 122:f9eeca106725 | 305 | * This parameter can be one of the following values: |
Kojto | 122:f9eeca106725 | 306 | * @arg SWPMI_IT_SRIE : Slave resume interrupt. |
Kojto | 122:f9eeca106725 | 307 | * @arg SWPMI_IT_TCIE : Transmit complete interrupt. |
Kojto | 122:f9eeca106725 | 308 | * @arg SWPMI_IT_TIE : Transmit interrupt. |
Kojto | 122:f9eeca106725 | 309 | * @arg SWPMI_IT_RIE : Receive interrupt. |
Kojto | 122:f9eeca106725 | 310 | * @arg SWPMI_IT_TXUNRIE : Transmit underrun error interrupt. |
Kojto | 122:f9eeca106725 | 311 | * @arg SWPMI_IT_RXOVRIE : Receive overrun error interrupt. |
Kojto | 122:f9eeca106725 | 312 | * @arg SWPMI_IT_RXBEIE : Receive CRC error interrupt. |
Kojto | 122:f9eeca106725 | 313 | * @arg SWPMI_IT_TXBEIE : Transmit buffer empty interrupt. |
Kojto | 122:f9eeca106725 | 314 | * @arg SWPMI_IT_RXBFIE : Receive buffer full interrupt. |
Kojto | 122:f9eeca106725 | 315 | * @retval None |
Kojto | 122:f9eeca106725 | 316 | */ |
Kojto | 122:f9eeca106725 | 317 | #define __HAL_SWPMI_DISABLE_IT(__HANDLE__, __INTERRUPT__) CLEAR_BIT((__HANDLE__)->Instance->IER, (__INTERRUPT__)) |
Kojto | 122:f9eeca106725 | 318 | |
Kojto | 122:f9eeca106725 | 319 | /** @brief Check whether the specified SWPMI interrupt has occurred or not. |
Kojto | 122:f9eeca106725 | 320 | * @param __HANDLE__: specifies the SWPMI Handle. |
Kojto | 122:f9eeca106725 | 321 | * @param __IT__: specifies the SWPMI interrupt to check. |
Kojto | 122:f9eeca106725 | 322 | * This parameter can be one of the following values: |
Kojto | 122:f9eeca106725 | 323 | * @arg SWPMI_IT_SRIE : Slave resume interrupt. |
Kojto | 122:f9eeca106725 | 324 | * @arg SWPMI_IT_TCIE : Transmit complete interrupt. |
Kojto | 122:f9eeca106725 | 325 | * @arg SWPMI_IT_TIE : Transmit interrupt. |
Kojto | 122:f9eeca106725 | 326 | * @arg SWPMI_IT_RIE : Receive interrupt. |
Kojto | 122:f9eeca106725 | 327 | * @arg SWPMI_IT_TXUNRIE : Transmit underrun error interrupt. |
Kojto | 122:f9eeca106725 | 328 | * @arg SWPMI_IT_RXOVRIE : Receive overrun error interrupt. |
Kojto | 122:f9eeca106725 | 329 | * @arg SWPMI_IT_RXBERIE : Receive CRC error interrupt. |
Kojto | 122:f9eeca106725 | 330 | * @arg SWPMI_IT_TXBEIE : Transmit buffer empty interrupt. |
Kojto | 122:f9eeca106725 | 331 | * @arg SWPMI_IT_RXBFIE : Receive buffer full interrupt. |
Kojto | 122:f9eeca106725 | 332 | * @retval The new state of __IT__ (TRUE or FALSE). |
Kojto | 122:f9eeca106725 | 333 | */ |
Kojto | 122:f9eeca106725 | 334 | #define __HAL_SWPMI_GET_IT(__HANDLE__, __IT__) (READ_BIT((__HANDLE__)->Instance->ISR,(__IT__)) == (__IT__)) |
Kojto | 122:f9eeca106725 | 335 | |
Kojto | 122:f9eeca106725 | 336 | /** @brief Check whether the specified SWPMI interrupt source is enabled or not. |
Kojto | 122:f9eeca106725 | 337 | * @param __HANDLE__: specifies the SWPMI Handle. |
Kojto | 122:f9eeca106725 | 338 | * @param __IT__: specifies the SWPMI interrupt source to check. |
Kojto | 122:f9eeca106725 | 339 | * This parameter can be one of the following values: |
Kojto | 122:f9eeca106725 | 340 | * @arg SWPMI_IT_SRIE : Slave resume interrupt. |
Kojto | 122:f9eeca106725 | 341 | * @arg SWPMI_IT_TCIE : Transmit complete interrupt. |
Kojto | 122:f9eeca106725 | 342 | * @arg SWPMI_IT_TIE : Transmit interrupt. |
Kojto | 122:f9eeca106725 | 343 | * @arg SWPMI_IT_RIE : Receive interrupt. |
Kojto | 122:f9eeca106725 | 344 | * @arg SWPMI_IT_TXUNRIE : Transmit underrun error interrupt. |
Kojto | 122:f9eeca106725 | 345 | * @arg SWPMI_IT_RXOVRIE : Receive overrun error interrupt. |
Kojto | 122:f9eeca106725 | 346 | * @arg SWPMI_IT_RXBERIE : Receive CRC error interrupt. |
Kojto | 122:f9eeca106725 | 347 | * @arg SWPMI_IT_TXBEIE : Transmit buffer empty interrupt. |
Kojto | 122:f9eeca106725 | 348 | * @arg SWPMI_IT_RXBFIE : Receive buffer full interrupt. |
Kojto | 122:f9eeca106725 | 349 | * @retval The new state of __IT__ (TRUE or FALSE). |
Kojto | 122:f9eeca106725 | 350 | */ |
Kojto | 122:f9eeca106725 | 351 | #define __HAL_SWPMI_GET_IT_SOURCE(__HANDLE__, __IT__) ((READ_BIT((__HANDLE__)->Instance->IER, (__IT__)) == (__IT__)) ? SET : RESET) |
Kojto | 122:f9eeca106725 | 352 | |
Kojto | 122:f9eeca106725 | 353 | /** |
Kojto | 122:f9eeca106725 | 354 | * @} |
Kojto | 122:f9eeca106725 | 355 | */ |
Kojto | 122:f9eeca106725 | 356 | |
Kojto | 122:f9eeca106725 | 357 | /* Exported functions --------------------------------------------------------*/ |
Kojto | 122:f9eeca106725 | 358 | /** @defgroup SWPMI_Exported_Functions SWPMI Exported Functions |
Kojto | 122:f9eeca106725 | 359 | * @{ |
Kojto | 122:f9eeca106725 | 360 | */ |
Kojto | 122:f9eeca106725 | 361 | /* Initialization/de-initialization functions ********************************/ |
Kojto | 122:f9eeca106725 | 362 | HAL_StatusTypeDef HAL_SWPMI_Init(SWPMI_HandleTypeDef *hswpmi); |
Kojto | 122:f9eeca106725 | 363 | HAL_StatusTypeDef HAL_SWPMI_DeInit(SWPMI_HandleTypeDef *hswpmi); |
Kojto | 122:f9eeca106725 | 364 | void HAL_SWPMI_MspInit(SWPMI_HandleTypeDef *hswpmi); |
Kojto | 122:f9eeca106725 | 365 | void HAL_SWPMI_MspDeInit(SWPMI_HandleTypeDef *hswpmi); |
Kojto | 122:f9eeca106725 | 366 | |
Kojto | 122:f9eeca106725 | 367 | /* IO operation functions *****************************************************/ |
Kojto | 122:f9eeca106725 | 368 | HAL_StatusTypeDef HAL_SWPMI_Transmit(SWPMI_HandleTypeDef *hswpmi, uint32_t *pData, uint16_t Size, uint32_t Timeout); |
Kojto | 122:f9eeca106725 | 369 | HAL_StatusTypeDef HAL_SWPMI_Receive(SWPMI_HandleTypeDef *hswpmi, uint32_t *pData, uint16_t Size, uint32_t Timeout); |
Kojto | 122:f9eeca106725 | 370 | HAL_StatusTypeDef HAL_SWPMI_Transmit_IT(SWPMI_HandleTypeDef *hswpmi, uint32_t *pData, uint16_t Size); |
Kojto | 122:f9eeca106725 | 371 | HAL_StatusTypeDef HAL_SWPMI_Receive_IT(SWPMI_HandleTypeDef *hswpmi, uint32_t *pData, uint16_t Size); |
Kojto | 122:f9eeca106725 | 372 | HAL_StatusTypeDef HAL_SWPMI_Transmit_DMA(SWPMI_HandleTypeDef *hswpmi, uint32_t *pData, uint16_t Size); |
Kojto | 122:f9eeca106725 | 373 | HAL_StatusTypeDef HAL_SWPMI_Receive_DMA(SWPMI_HandleTypeDef *hswpmi, uint32_t *pData, uint16_t Size); |
Kojto | 122:f9eeca106725 | 374 | HAL_StatusTypeDef HAL_SWPMI_DMAStop(SWPMI_HandleTypeDef *hswpmi); |
Kojto | 122:f9eeca106725 | 375 | HAL_StatusTypeDef HAL_SWPMI_EnableLoopback(SWPMI_HandleTypeDef *hswpmi); |
Kojto | 122:f9eeca106725 | 376 | HAL_StatusTypeDef HAL_SWPMI_DisableLoopback(SWPMI_HandleTypeDef *hswpmi); |
Kojto | 122:f9eeca106725 | 377 | void HAL_SWPMI_IRQHandler(SWPMI_HandleTypeDef *hswpmi); |
Kojto | 122:f9eeca106725 | 378 | void HAL_SWPMI_TxCpltCallback(SWPMI_HandleTypeDef *hswpmi); |
Kojto | 122:f9eeca106725 | 379 | void HAL_SWPMI_TxHalfCpltCallback(SWPMI_HandleTypeDef *hswpmi); |
Kojto | 122:f9eeca106725 | 380 | void HAL_SWPMI_RxCpltCallback(SWPMI_HandleTypeDef *hswpmi); |
Kojto | 122:f9eeca106725 | 381 | void HAL_SWPMI_RxHalfCpltCallback(SWPMI_HandleTypeDef *hswpmi); |
Kojto | 122:f9eeca106725 | 382 | void HAL_SWPMI_ErrorCallback(SWPMI_HandleTypeDef *hswpmi); |
Kojto | 122:f9eeca106725 | 383 | |
Kojto | 122:f9eeca106725 | 384 | /* Peripheral Control and State functions ************************************/ |
Kojto | 122:f9eeca106725 | 385 | HAL_SWPMI_StateTypeDef HAL_SWPMI_GetState(SWPMI_HandleTypeDef *hswpmi); |
Kojto | 122:f9eeca106725 | 386 | uint32_t HAL_SWPMI_GetError(SWPMI_HandleTypeDef *hswpmi); |
Kojto | 122:f9eeca106725 | 387 | |
Kojto | 122:f9eeca106725 | 388 | /** |
Kojto | 122:f9eeca106725 | 389 | * @} |
Kojto | 122:f9eeca106725 | 390 | */ |
Kojto | 122:f9eeca106725 | 391 | |
Kojto | 122:f9eeca106725 | 392 | /* Private types -------------------------------------------------------------*/ |
Kojto | 122:f9eeca106725 | 393 | /** @defgroup SWPMI_Private_Types SWPMI Private Types |
Kojto | 122:f9eeca106725 | 394 | * @{ |
Kojto | 122:f9eeca106725 | 395 | */ |
Kojto | 122:f9eeca106725 | 396 | |
Kojto | 122:f9eeca106725 | 397 | /** |
Kojto | 122:f9eeca106725 | 398 | * @} |
Kojto | 122:f9eeca106725 | 399 | */ |
Kojto | 122:f9eeca106725 | 400 | |
Kojto | 122:f9eeca106725 | 401 | /* Private variables ---------------------------------------------------------*/ |
Kojto | 122:f9eeca106725 | 402 | /** @defgroup SWPMI_Private_Variables SWPMI Private Variables |
Kojto | 122:f9eeca106725 | 403 | * @{ |
Kojto | 122:f9eeca106725 | 404 | */ |
Kojto | 122:f9eeca106725 | 405 | |
Kojto | 122:f9eeca106725 | 406 | /** |
Kojto | 122:f9eeca106725 | 407 | * @} |
Kojto | 122:f9eeca106725 | 408 | */ |
Kojto | 122:f9eeca106725 | 409 | |
Kojto | 122:f9eeca106725 | 410 | /* Private constants ---------------------------------------------------------*/ |
Kojto | 122:f9eeca106725 | 411 | /** @defgroup SWPMI_Private_Constants SWPMI Private Constants |
Kojto | 122:f9eeca106725 | 412 | * @{ |
Kojto | 122:f9eeca106725 | 413 | */ |
Kojto | 122:f9eeca106725 | 414 | |
Kojto | 122:f9eeca106725 | 415 | /** |
Kojto | 122:f9eeca106725 | 416 | * @} |
Kojto | 122:f9eeca106725 | 417 | */ |
Kojto | 122:f9eeca106725 | 418 | |
Kojto | 122:f9eeca106725 | 419 | /* Private macros ------------------------------------------------------------*/ |
Kojto | 122:f9eeca106725 | 420 | /** @defgroup SWPMI_Private_Macros SWPMI Private Macros |
Kojto | 122:f9eeca106725 | 421 | * @{ |
Kojto | 122:f9eeca106725 | 422 | */ |
Kojto | 122:f9eeca106725 | 423 | |
Kojto | 122:f9eeca106725 | 424 | |
Kojto | 122:f9eeca106725 | 425 | #define IS_SWPMI_VOLTAGE_CLASS(__CLASS__) (((__CLASS__) == SWPMI_VOLTAGE_CLASS_C) || \ |
Kojto | 122:f9eeca106725 | 426 | ((__CLASS__) == SWPMI_VOLTAGE_CLASS_B)) |
Kojto | 122:f9eeca106725 | 427 | |
Kojto | 122:f9eeca106725 | 428 | #define IS_SWPMI_BITRATE_VALUE(__VALUE__) (((__VALUE__) <= 63)) |
Kojto | 122:f9eeca106725 | 429 | |
Kojto | 122:f9eeca106725 | 430 | |
Kojto | 122:f9eeca106725 | 431 | #define IS_SWPMI_TX_BUFFERING_MODE(__MODE__) (((__MODE__) == SWPMI_TX_NO_SOFTWAREBUFFER) || \ |
Kojto | 122:f9eeca106725 | 432 | ((__MODE__) == SWPMI_TX_MULTI_SOFTWAREBUFFER)) |
Kojto | 122:f9eeca106725 | 433 | |
Kojto | 122:f9eeca106725 | 434 | |
Kojto | 122:f9eeca106725 | 435 | #define IS_SWPMI_RX_BUFFERING_MODE(__MODE__) (((__MODE__) == SWPMI_RX_NO_SOFTWAREBUFFER) || \ |
Kojto | 122:f9eeca106725 | 436 | ((__MODE__) == SWPMI_RX_MULTI_SOFTWAREBUFFER)) |
Kojto | 122:f9eeca106725 | 437 | |
Kojto | 122:f9eeca106725 | 438 | /** |
Kojto | 122:f9eeca106725 | 439 | * @} |
Kojto | 122:f9eeca106725 | 440 | */ |
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 | #ifdef __cplusplus |
Kojto | 122:f9eeca106725 | 451 | } |
Kojto | 122:f9eeca106725 | 452 | #endif |
Kojto | 122:f9eeca106725 | 453 | |
Kojto | 122:f9eeca106725 | 454 | #endif /* __STM32L4xx_HAL_SWPMI_H */ |
Kojto | 122:f9eeca106725 | 455 | |
Kojto | 122:f9eeca106725 | 456 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |