Mercurial > public > ostc4
comparison Common/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_i2s_ex.h @ 128:c78bcbd5deda FlipDisplay
Added current STM32 standandard libraries in version independend folder structure
author | Ideenmodellierer |
---|---|
date | Sun, 17 Feb 2019 21:12:22 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
127:1369f8660eaa | 128:c78bcbd5deda |
---|---|
1 /** | |
2 ****************************************************************************** | |
3 * @file stm32f4xx_hal_i2s_ex.h | |
4 * @author MCD Application Team | |
5 * @brief Header file of I2S HAL module. | |
6 ****************************************************************************** | |
7 * @attention | |
8 * | |
9 * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2> | |
10 * | |
11 * Redistribution and use in source and binary forms, with or without modification, | |
12 * are permitted provided that the following conditions are met: | |
13 * 1. Redistributions of source code must retain the above copyright notice, | |
14 * this list of conditions and the following disclaimer. | |
15 * 2. Redistributions in binary form must reproduce the above copyright notice, | |
16 * this list of conditions and the following disclaimer in the documentation | |
17 * and/or other materials provided with the distribution. | |
18 * 3. Neither the name of STMicroelectronics nor the names of its contributors | |
19 * may be used to endorse or promote products derived from this software | |
20 * without specific prior written permission. | |
21 * | |
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | |
23 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |
25 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | |
26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | |
28 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | |
29 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |
30 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
32 * | |
33 ****************************************************************************** | |
34 */ | |
35 | |
36 /* Define to prevent recursive inclusion -------------------------------------*/ | |
37 #ifndef __STM32F4xx_HAL_I2S_EX_H | |
38 #define __STM32F4xx_HAL_I2S_EX_H | |
39 | |
40 #ifdef __cplusplus | |
41 extern "C" { | |
42 #endif | |
43 | |
44 /* Includes ------------------------------------------------------------------*/ | |
45 #include "stm32f4xx_hal_def.h" | |
46 | |
47 /** @addtogroup STM32F4xx_HAL_Driver | |
48 * @{ | |
49 */ | |
50 #if defined(SPI_I2S_FULLDUPLEX_SUPPORT) | |
51 /** @addtogroup I2SEx I2SEx | |
52 * @{ | |
53 */ | |
54 | |
55 /* Exported types ------------------------------------------------------------*/ | |
56 /* Exported constants --------------------------------------------------------*/ | |
57 /* Exported macros -----------------------------------------------------------*/ | |
58 /** @defgroup I2SEx_Exported_Macros I2S Extended Exported Macros | |
59 * @{ | |
60 */ | |
61 | |
62 #define I2SxEXT(__INSTANCE__) ((__INSTANCE__) == (SPI2)? (SPI_TypeDef *)(I2S2ext_BASE): (SPI_TypeDef *)(I2S3ext_BASE)) | |
63 | |
64 /** @brief Enable or disable the specified I2SExt peripheral. | |
65 * @param __HANDLE__ specifies the I2S Handle. | |
66 * @retval None | |
67 */ | |
68 #define __HAL_I2SEXT_ENABLE(__HANDLE__) (I2SxEXT((__HANDLE__)->Instance)->I2SCFGR |= SPI_I2SCFGR_I2SE) | |
69 #define __HAL_I2SEXT_DISABLE(__HANDLE__) (I2SxEXT((__HANDLE__)->Instance)->I2SCFGR &= ~SPI_I2SCFGR_I2SE) | |
70 | |
71 /** @brief Enable or disable the specified I2SExt interrupts. | |
72 * @param __HANDLE__ specifies the I2S Handle. | |
73 * @param __INTERRUPT__ specifies the interrupt source to enable or disable. | |
74 * This parameter can be one of the following values: | |
75 * @arg I2S_IT_TXE: Tx buffer empty interrupt enable | |
76 * @arg I2S_IT_RXNE: RX buffer not empty interrupt enable | |
77 * @arg I2S_IT_ERR: Error interrupt enable | |
78 * @retval None | |
79 */ | |
80 #define __HAL_I2SEXT_ENABLE_IT(__HANDLE__, __INTERRUPT__) (I2SxEXT((__HANDLE__)->Instance)->CR2 |= (__INTERRUPT__)) | |
81 #define __HAL_I2SEXT_DISABLE_IT(__HANDLE__, __INTERRUPT__) (I2SxEXT((__HANDLE__)->Instance)->CR2 &= ~(__INTERRUPT__)) | |
82 | |
83 /** @brief Checks if the specified I2SExt interrupt source is enabled or disabled. | |
84 * @param __HANDLE__ specifies the I2S Handle. | |
85 * This parameter can be I2S where x: 1, 2, or 3 to select the I2S peripheral. | |
86 * @param __INTERRUPT__ specifies the I2S interrupt source to check. | |
87 * This parameter can be one of the following values: | |
88 * @arg I2S_IT_TXE: Tx buffer empty interrupt enable | |
89 * @arg I2S_IT_RXNE: RX buffer not empty interrupt enable | |
90 * @arg I2S_IT_ERR: Error interrupt enable | |
91 * @retval The new state of __IT__ (TRUE or FALSE). | |
92 */ | |
93 #define __HAL_I2SEXT_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (((I2SxEXT((__HANDLE__)->Instance)->CR2 & (__INTERRUPT__)) == (__INTERRUPT__)) ? SET : RESET) | |
94 | |
95 /** @brief Checks whether the specified I2SExt flag is set or not. | |
96 * @param __HANDLE__ specifies the I2S Handle. | |
97 * @param __FLAG__ specifies the flag to check. | |
98 * This parameter can be one of the following values: | |
99 * @arg I2S_FLAG_RXNE: Receive buffer not empty flag | |
100 * @arg I2S_FLAG_TXE: Transmit buffer empty flag | |
101 * @arg I2S_FLAG_UDR: Underrun flag | |
102 * @arg I2S_FLAG_OVR: Overrun flag | |
103 * @arg I2S_FLAG_FRE: Frame error flag | |
104 * @arg I2S_FLAG_CHSIDE: Channel Side flag | |
105 * @arg I2S_FLAG_BSY: Busy flag | |
106 * @retval The new state of __FLAG__ (TRUE or FALSE). | |
107 */ | |
108 #define __HAL_I2SEXT_GET_FLAG(__HANDLE__, __FLAG__) (((I2SxEXT((__HANDLE__)->Instance)->SR) & (__FLAG__)) == (__FLAG__)) | |
109 | |
110 /** @brief Clears the I2SExt OVR pending flag. | |
111 * @param __HANDLE__ specifies the I2S Handle. | |
112 * @retval None | |
113 */ | |
114 #define __HAL_I2SEXT_CLEAR_OVRFLAG(__HANDLE__) do{ \ | |
115 __IO uint32_t tmpreg_ovr = 0x00U; \ | |
116 tmpreg_ovr = I2SxEXT((__HANDLE__)->Instance)->DR;\ | |
117 tmpreg_ovr = I2SxEXT((__HANDLE__)->Instance)->SR;\ | |
118 UNUSED(tmpreg_ovr); \ | |
119 }while(0U) | |
120 /** @brief Clears the I2SExt UDR pending flag. | |
121 * @param __HANDLE__ specifies the I2S Handle. | |
122 * @retval None | |
123 */ | |
124 #define __HAL_I2SEXT_CLEAR_UDRFLAG(__HANDLE__) do{ \ | |
125 __IO uint32_t tmpreg_udr = 0x00U; \ | |
126 tmpreg_udr = I2SxEXT((__HANDLE__)->Instance)->SR;\ | |
127 UNUSED(tmpreg_udr); \ | |
128 }while(0U) | |
129 /** | |
130 * @} | |
131 */ | |
132 | |
133 /* Exported functions --------------------------------------------------------*/ | |
134 /** @addtogroup I2SEx_Exported_Functions I2S Extended Exported Functions | |
135 * @{ | |
136 */ | |
137 | |
138 /** @addtogroup I2SEx_Exported_Functions_Group1 I2S Extended IO operation functions | |
139 * @{ | |
140 */ | |
141 | |
142 /* Extended features functions *************************************************/ | |
143 /* Blocking mode: Polling */ | |
144 HAL_StatusTypeDef HAL_I2SEx_TransmitReceive(I2S_HandleTypeDef *hi2s, uint16_t *pTxData, uint16_t *pRxData, | |
145 uint16_t Size, uint32_t Timeout); | |
146 /* Non-Blocking mode: Interrupt */ | |
147 HAL_StatusTypeDef HAL_I2SEx_TransmitReceive_IT(I2S_HandleTypeDef *hi2s, uint16_t *pTxData, uint16_t *pRxData, | |
148 uint16_t Size); | |
149 /* Non-Blocking mode: DMA */ | |
150 HAL_StatusTypeDef HAL_I2SEx_TransmitReceive_DMA(I2S_HandleTypeDef *hi2s, uint16_t *pTxData, uint16_t *pRxData, | |
151 uint16_t Size); | |
152 /* I2S IRQHandler and Callbacks used in non blocking modes (Interrupt and DMA) */ | |
153 void HAL_I2SEx_FullDuplex_IRQHandler(I2S_HandleTypeDef *hi2s); | |
154 void HAL_I2SEx_TxRxHalfCpltCallback(I2S_HandleTypeDef *hi2s); | |
155 void HAL_I2SEx_TxRxCpltCallback(I2S_HandleTypeDef *hi2s); | |
156 /** | |
157 * @} | |
158 */ | |
159 | |
160 /** | |
161 * @} | |
162 */ | |
163 /* Private types -------------------------------------------------------------*/ | |
164 /* Private variables ---------------------------------------------------------*/ | |
165 /* Private constants ---------------------------------------------------------*/ | |
166 /* Private macros ------------------------------------------------------------*/ | |
167 | |
168 /** | |
169 * @} | |
170 */ | |
171 | |
172 /* Private functions ---------------------------------------------------------*/ | |
173 | |
174 /** | |
175 * @} | |
176 */ | |
177 | |
178 #endif /* SPI_I2S_FULLDUPLEX_SUPPORT */ | |
179 /** | |
180 * @} | |
181 */ | |
182 | |
183 #ifdef __cplusplus | |
184 } | |
185 #endif | |
186 | |
187 | |
188 #endif /* __STM32F4xx_HAL_I2S_EX_H */ | |
189 | |
190 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |