PageRenderTime 44ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 0ms

/flight/pios/stm32f0x/libraries/STM32F0xx_StdPeriph_Driver/inc/stm32f0xx_syscfg.h

https://gitlab.com/sonium/librepilot
C Header | 262 lines | 120 code | 37 blank | 105 comment | 95 complexity | 45627763bc5767b63bc80d13120f974b MD5 | raw file
  1. /**
  2. ******************************************************************************
  3. * @file stm32f0xx_syscfg.h
  4. * @author MCD Application Team
  5. * @version V1.3.0
  6. * @date 16-January-2014
  7. * @brief This file contains all the functions prototypes for the SYSCFG firmware
  8. * library.
  9. ******************************************************************************
  10. * @attention
  11. *
  12. * <h2><center>&copy; COPYRIGHT 2014 STMicroelectronics</center></h2>
  13. *
  14. * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
  15. * You may not use this file except in compliance with the License.
  16. * You may obtain a copy of the License at:
  17. *
  18. * http://www.st.com/software_license_agreement_liberty_v2
  19. *
  20. * Unless required by applicable law or agreed to in writing, software
  21. * distributed under the License is distributed on an "AS IS" BASIS,
  22. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  23. * See the License for the specific language governing permissions and
  24. * limitations under the License.
  25. *
  26. ******************************************************************************
  27. */
  28. /*!< Define to prevent recursive inclusion -------------------------------------*/
  29. #ifndef __STM32F0XX_SYSCFG_H
  30. #define __STM32F0XX_SYSCFG_H
  31. #ifdef __cplusplus
  32. extern "C" {
  33. #endif
  34. /*!< Includes ------------------------------------------------------------------*/
  35. #include "stm32f0xx.h"
  36. /** @addtogroup STM32F0xx_StdPeriph_Driver
  37. * @{
  38. */
  39. /** @addtogroup SYSCFG
  40. * @{
  41. */
  42. /* Exported types ------------------------------------------------------------*/
  43. /* Exported constants --------------------------------------------------------*/
  44. /** @defgroup SYSCFG_Exported_Constants
  45. * @{
  46. */
  47. /** @defgroup SYSCFG_EXTI_Port_Sources
  48. * @{
  49. */
  50. #define EXTI_PortSourceGPIOA ((uint8_t)0x00)
  51. #define EXTI_PortSourceGPIOB ((uint8_t)0x01)
  52. #define EXTI_PortSourceGPIOC ((uint8_t)0x02)
  53. #define EXTI_PortSourceGPIOD ((uint8_t)0x03) /*!< not available for STM32F031 devices */
  54. #define EXTI_PortSourceGPIOE ((uint8_t)0x04) /*!< only available for STM32F072 devices */
  55. #define EXTI_PortSourceGPIOF ((uint8_t)0x05)
  56. #define IS_EXTI_PORT_SOURCE(PORTSOURCE) (((PORTSOURCE) == EXTI_PortSourceGPIOA) || \
  57. ((PORTSOURCE) == EXTI_PortSourceGPIOB) || \
  58. ((PORTSOURCE) == EXTI_PortSourceGPIOC) || \
  59. ((PORTSOURCE) == EXTI_PortSourceGPIOD) || \
  60. ((PORTSOURCE) == EXTI_PortSourceGPIOE) || \
  61. ((PORTSOURCE) == EXTI_PortSourceGPIOF))
  62. /**
  63. * @}
  64. */
  65. /** @defgroup SYSCFG_EXTI_Pin_sources
  66. * @{
  67. */
  68. #define EXTI_PinSource0 ((uint8_t)0x00)
  69. #define EXTI_PinSource1 ((uint8_t)0x01)
  70. #define EXTI_PinSource2 ((uint8_t)0x02)
  71. #define EXTI_PinSource3 ((uint8_t)0x03)
  72. #define EXTI_PinSource4 ((uint8_t)0x04)
  73. #define EXTI_PinSource5 ((uint8_t)0x05)
  74. #define EXTI_PinSource6 ((uint8_t)0x06)
  75. #define EXTI_PinSource7 ((uint8_t)0x07)
  76. #define EXTI_PinSource8 ((uint8_t)0x08)
  77. #define EXTI_PinSource9 ((uint8_t)0x09)
  78. #define EXTI_PinSource10 ((uint8_t)0x0A)
  79. #define EXTI_PinSource11 ((uint8_t)0x0B)
  80. #define EXTI_PinSource12 ((uint8_t)0x0C)
  81. #define EXTI_PinSource13 ((uint8_t)0x0D)
  82. #define EXTI_PinSource14 ((uint8_t)0x0E)
  83. #define EXTI_PinSource15 ((uint8_t)0x0F)
  84. #define IS_EXTI_PIN_SOURCE(PINSOURCE) (((PINSOURCE) == EXTI_PinSource0) || \
  85. ((PINSOURCE) == EXTI_PinSource1) || \
  86. ((PINSOURCE) == EXTI_PinSource2) || \
  87. ((PINSOURCE) == EXTI_PinSource3) || \
  88. ((PINSOURCE) == EXTI_PinSource4) || \
  89. ((PINSOURCE) == EXTI_PinSource5) || \
  90. ((PINSOURCE) == EXTI_PinSource6) || \
  91. ((PINSOURCE) == EXTI_PinSource7) || \
  92. ((PINSOURCE) == EXTI_PinSource8) || \
  93. ((PINSOURCE) == EXTI_PinSource9) || \
  94. ((PINSOURCE) == EXTI_PinSource10) || \
  95. ((PINSOURCE) == EXTI_PinSource11) || \
  96. ((PINSOURCE) == EXTI_PinSource12) || \
  97. ((PINSOURCE) == EXTI_PinSource13) || \
  98. ((PINSOURCE) == EXTI_PinSource14) || \
  99. ((PINSOURCE) == EXTI_PinSource15))
  100. /**
  101. * @}
  102. */
  103. /** @defgroup SYSCFG_Memory_Remap_Config
  104. * @{
  105. */
  106. #define SYSCFG_MemoryRemap_Flash ((uint8_t)0x00)
  107. #define SYSCFG_MemoryRemap_SystemMemory ((uint8_t)0x01)
  108. #define SYSCFG_MemoryRemap_SRAM ((uint8_t)0x03)
  109. #define IS_SYSCFG_MEMORY_REMAP(REMAP) (((REMAP) == SYSCFG_MemoryRemap_Flash) || \
  110. ((REMAP) == SYSCFG_MemoryRemap_SystemMemory) || \
  111. ((REMAP) == SYSCFG_MemoryRemap_SRAM))
  112. /**
  113. * @}
  114. */
  115. /** @defgroup SYSCFG_DMA_Remap_Config
  116. * @{
  117. */
  118. #define SYSCFG_DMARemap_TIM3 SYSCFG_CFGR1_TIM3_DMA_RMP /* Remap TIM3 DMA requests from channel4 to channel6,
  119. available only for STM32F072 devices */
  120. #define SYSCFG_DMARemap_TIM2 SYSCFG_CFGR1_TIM2_DMA_RMP /* Remap TIM2 DMA requests from channel3/4 to channel7,
  121. available only for STM32F072 devices */
  122. #define SYSCFG_DMARemap_TIM1 SYSCFG_CFGR1_TIM1_DMA_RMP /* Remap TIM1 DMA requests from channel2/3/4 to channel6,
  123. available only for STM32F072 devices */
  124. #define SYSCFG_DMARemap_I2C1 SYSCFG_CFGR1_I2C1_DMA_RMP /* Remap I2C1 DMA requests from channel3/2 to channel7/6,
  125. available only for STM32F072 devices */
  126. #define SYSCFG_DMARemap_USART3 SYSCFG_CFGR1_USART3_DMA_RMP /* Remap USART3 DMA requests from channel6/7 to channel3/2,
  127. available only for STM32F072 devices */
  128. #define SYSCFG_DMARemap_USART2 SYSCFG_CFGR1_USART2_DMA_RMP /* Remap USART2 DMA requests from channel4/5 to channel6/7,
  129. available only for STM32F072 devices */
  130. #define SYSCFG_DMARemap_SPI2 SYSCFG_CFGR1_SPI2_DMA_RMP /* Remap SPI2 DMA requests from channel4/5 to channel6/7,
  131. available only for STM32F072 devices */
  132. #define SYSCFG_DMARemap_TIM17_2 SYSCFG_CFGR1_TIM17_DMA_RMP2 /* Remap TIM17 DMA requests from channel1/2 to channel7,
  133. available only for STM32F072 devices */
  134. #define SYSCFG_DMARemap_TIM16_2 SYSCFG_CFGR1_TIM16_DMA_RMP2 /* Remap TIM16 DMA requests from channel3/4 to channel6,
  135. available only for STM32F072 devices */
  136. #define SYSCFG_DMARemap_TIM17 SYSCFG_CFGR1_TIM17_DMA_RMP /* Remap TIM17 DMA requests from channel1 to channel2 */
  137. #define SYSCFG_DMARemap_TIM16 SYSCFG_CFGR1_TIM16_DMA_RMP /* Remap TIM16 DMA requests from channel3 to channel4 */
  138. #define SYSCFG_DMARemap_USART1Rx SYSCFG_CFGR1_USART1RX_DMA_RMP /* Remap USART1 Rx DMA requests from channel3 to channel5 */
  139. #define SYSCFG_DMARemap_USART1Tx SYSCFG_CFGR1_USART1TX_DMA_RMP /* Remap USART1 Tx DMA requests from channel2 to channel4 */
  140. #define SYSCFG_DMARemap_ADC1 SYSCFG_CFGR1_ADC_DMA_RMP /* Remap ADC1 DMA requests from channel1 to channel2 */
  141. #define IS_SYSCFG_DMA_REMAP(REMAP) (((REMAP) == SYSCFG_DMARemap_TIM17) || \
  142. ((REMAP) == SYSCFG_DMARemap_TIM16) || \
  143. ((REMAP) == SYSCFG_DMARemap_USART1Rx) || \
  144. ((REMAP) == SYSCFG_DMARemap_USART1Tx) || \
  145. ((REMAP) == SYSCFG_CFGR1_TIM3_DMA_RMP) || \
  146. ((REMAP) == SYSCFG_CFGR1_TIM2_DMA_RMP) || \
  147. ((REMAP) == SYSCFG_CFGR1_TIM1_DMA_RMP) || \
  148. ((REMAP) == SYSCFG_CFGR1_I2C1_DMA_RMP) || \
  149. ((REMAP) == SYSCFG_CFGR1_USART3_DMA_RMP) || \
  150. ((REMAP) == SYSCFG_CFGR1_USART2_DMA_RMP) || \
  151. ((REMAP) == SYSCFG_CFGR1_SPI2_DMA_RMP) || \
  152. ((REMAP) == SYSCFG_CFGR1_TIM17_DMA_RMP2) || \
  153. ((REMAP) == SYSCFG_CFGR1_TIM16_DMA_RMP2) || \
  154. ((REMAP) == SYSCFG_DMARemap_ADC1))
  155. /**
  156. * @}
  157. */
  158. /** @defgroup SYSCFG_I2C_FastModePlus_Config
  159. * @{
  160. */
  161. #define SYSCFG_I2CFastModePlus_PB6 SYSCFG_CFGR1_I2C_FMP_PB6 /* Enable Fast Mode Plus on PB6 */
  162. #define SYSCFG_I2CFastModePlus_PB7 SYSCFG_CFGR1_I2C_FMP_PB7 /* Enable Fast Mode Plus on PB7 */
  163. #define SYSCFG_I2CFastModePlus_PB8 SYSCFG_CFGR1_I2C_FMP_PB8 /* Enable Fast Mode Plus on PB8 */
  164. #define SYSCFG_I2CFastModePlus_PB9 SYSCFG_CFGR1_I2C_FMP_PB9 /* Enable Fast Mode Plus on PB9 */
  165. #define SYSCFG_I2CFastModePlus_I2C1 SYSCFG_CFGR1_I2C_FMP_I2C1 /* Enable Fast Mode Plus on PB10, PB11, PF6 and PF7(only for STM32F0031 and STM32F030 devices) */
  166. #define SYSCFG_I2CFastModePlus_I2C2 SYSCFG_CFGR1_I2C_FMP_I2C2 /* Enable Fast Mode Plus on I2C2 pins, available only for STM32F072 devices */
  167. #define SYSCFG_I2CFastModePlus_PA9 SYSCFG_CFGR1_I2C_FMP_PA9 /* Enable Fast Mode Plus on PA9 (only for STM32F031 and STM32F030 devices) */
  168. #define SYSCFG_I2CFastModePlus_PA10 SYSCFG_CFGR1_I2C_FMP_PA10/* Enable Fast Mode Plus on PA10(only for STM32F031 and STM32F030 devices) */
  169. #define IS_SYSCFG_I2C_FMP(PIN) (((PIN) == SYSCFG_I2CFastModePlus_PB6) || \
  170. ((PIN) == SYSCFG_I2CFastModePlus_PB7) || \
  171. ((PIN) == SYSCFG_I2CFastModePlus_PB8) || \
  172. ((PIN) == SYSCFG_I2CFastModePlus_PB9) || \
  173. ((PIN) == SYSCFG_I2CFastModePlus_I2C1) || \
  174. ((PIN) == SYSCFG_I2CFastModePlus_I2C2) || \
  175. ((PIN) == SYSCFG_I2CFastModePlus_PA9) || \
  176. ((PIN) == SYSCFG_I2CFastModePlus_PA10))
  177. /**
  178. * @}
  179. */
  180. /** @defgroup SYSCFG_Lock_Config
  181. * @{
  182. */
  183. #define SYSCFG_Break_PVD SYSCFG_CFGR2_PVD_LOCK /*!< Connects the PVD event to the Break Input of TIM1, not available for STM32F030 devices */
  184. #define SYSCFG_Break_SRAMParity SYSCFG_CFGR2_SRAM_PARITY_LOCK /*!< Connects the SRAM_PARITY error signal to the Break Input of TIM1 */
  185. #define SYSCFG_Break_Lockup SYSCFG_CFGR2_LOCKUP_LOCK /*!< Connects Lockup output of CortexM0 to the break input of TIM1 */
  186. #define IS_SYSCFG_LOCK_CONFIG(CONFIG) (((CONFIG) == SYSCFG_Break_PVD) || \
  187. ((CONFIG) == SYSCFG_Break_SRAMParity) || \
  188. ((CONFIG) == SYSCFG_Break_Lockup))
  189. /**
  190. * @}
  191. */
  192. /** @defgroup SYSCFG_flags_definition
  193. * @{
  194. */
  195. #define SYSCFG_FLAG_PE SYSCFG_CFGR2_SRAM_PE
  196. #define IS_SYSCFG_FLAG(FLAG) (((FLAG) == SYSCFG_FLAG_PE))
  197. /**
  198. * @}
  199. */
  200. /**
  201. * @}
  202. */
  203. /* Exported macro ------------------------------------------------------------*/
  204. /* Exported functions ------------------------------------------------------- */
  205. /* Function used to set the SYSCFG configuration to the default reset state **/
  206. void SYSCFG_DeInit(void);
  207. /* SYSCFG configuration functions *********************************************/
  208. void SYSCFG_MemoryRemapConfig(uint32_t SYSCFG_MemoryRemap);
  209. void SYSCFG_DMAChannelRemapConfig(uint32_t SYSCFG_DMARemap, FunctionalState NewState);
  210. void SYSCFG_I2CFastModePlusConfig(uint32_t SYSCFG_I2CFastModePlus, FunctionalState NewState);
  211. void SYSCFG_EXTILineConfig(uint8_t EXTI_PortSourceGPIOx, uint8_t EXTI_PinSourcex);
  212. void SYSCFG_BreakConfig(uint32_t SYSCFG_Break);
  213. FlagStatus SYSCFG_GetFlagStatus(uint32_t SYSCFG_Flag);
  214. void SYSCFG_ClearFlag(uint32_t SYSCFG_Flag);
  215. #ifdef __cplusplus
  216. }
  217. #endif
  218. #endif /*__STM32F0XX_SYSCFG_H */
  219. /**
  220. * @}
  221. */
  222. /**
  223. * @}
  224. */
  225. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/