stm32f4xx_syscfg.h 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350
  1. /**
  2. ******************************************************************************
  3. * @file stm32f4xx_syscfg.h
  4. * @author MCD Application Team
  5. * @version V1.8.0
  6. * @date 04-November-2016
  7. * @brief This file contains all the functions prototypes for the SYSCFG firmware
  8. * library.
  9. ******************************************************************************
  10. * @attention
  11. *
  12. * <h2><center>&copy; COPYRIGHT 2016 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 __STM32F4xx_SYSCFG_H
  30. #define __STM32F4xx_SYSCFG_H
  31. #ifdef __cplusplus
  32. extern "C" {
  33. #endif
  34. /* Includes ------------------------------------------------------------------*/
  35. #include "stm32f4xx.h"
  36. /** @addtogroup STM32F4xx_StdPeriph_Driver
  37. * @{
  38. */
  39. /** @addtogroup SYSCFG
  40. * @{
  41. */
  42. /* Exported types ------------------------------------------------------------*/
  43. /* Exported constants --------------------------------------------------------*/
  44. /** @defgroup SYSCFG_Exported_Constants
  45. * @{
  46. */
  47. #if defined(STM32F413_423xx)
  48. /** @defgroup BITSTREAM_CLOCK Bit Stream clock source selection
  49. * @{
  50. */
  51. #define BITSTREAM_CLOCK_DFSDM2 SYSCFG_MCHDLYCR_BSCKSEL
  52. #define BITSTREAM_CLOCK_TIM2OC1 (uint32_t)0x00000000
  53. /**
  54. * @}
  55. */
  56. /** @defgroup MCHDLY_CLOCK MCHDLY Clock enable
  57. * @{
  58. */
  59. #define MCHDLY_CLOCK_DFSDM2 SYSCFG_MCHDLYCR_MCHDLY2EN
  60. #define MCHDLY_CLOCK_DFSDM1 SYSCFG_MCHDLYCR_MCHDLY1EN
  61. /**
  62. * @}
  63. */
  64. /** @defgroup DFSDM_CLOCKIN_SOURCE DFSDM Clock In Source Selection
  65. * @{
  66. */
  67. #define DFSDM2_CKIN_PAD (uint32_t)0x00000000
  68. #define DFSDM2_CKIN_DM SYSCFG_MCHDLYCR_DFSDM2CFG
  69. #define DFSDM1_CKIN_PAD (uint32_t)0x00000000
  70. #define DFSDM1_CKIN_DM SYSCFG_MCHDLYCR_DFSDM1CFG
  71. /**
  72. * @}
  73. */
  74. /** @defgroup DFSDM_CLOCKOUT_SOURCE DFSDM Clock Source Selection
  75. * @{
  76. */
  77. #define DFSDM2_CKOUT_DFSDM2 (uint32_t)0x00000000
  78. #define DFSDM2_CKOUT_M27 SYSCFG_MCHDLYCR_DFSDM2CKOSEL
  79. #define DFSDM1_CKOUT_DFSDM1 (uint32_t)0x00000000U
  80. #define DFSDM1_CKOUT_M27 SYSCFG_MCHDLYCR_DFSDM1CKOSEL
  81. /**
  82. * @}
  83. */
  84. /** @defgroup DFSDM_DATAIN0_SOURCE DFSDM Source Selection For DATAIN0
  85. * @{
  86. */
  87. #define DATAIN0_DFSDM2_PAD (uint32_t)0x00000000
  88. #define DATAIN0_DFSDM2_DATAIN1 SYSCFG_MCHDLYCR_DFSDM2D0SEL
  89. #define DATAIN0_DFSDM1_PAD (uint32_t)0x00000000
  90. #define DATAIN0_DFSDM1_DATAIN1 SYSCFG_MCHDLYCR_DFSDM1D0SEL
  91. /**
  92. * @}
  93. */
  94. /** @defgroup DFSDM_DATAIN2_SOURCE DFSDM Source Selection For DATAIN2
  95. * @{
  96. */
  97. #define DATAIN2_DFSDM2_PAD (uint32_t)0x00000000
  98. #define DATAIN2_DFSDM2_DATAIN3 SYSCFG_MCHDLYCR_DFSDM2D2SEL
  99. #define DATAIN2_DFSDM1_PAD (uint32_t)0x00000000
  100. #define DATAIN2_DFSDM1_DATAIN3 SYSCFG_MCHDLYCR_DFSDM1D2SEL
  101. /**
  102. * @}
  103. */
  104. /** @defgroup DFSDM_DATAIN4_SOURCE DFSDM Source Selection For DATAIN4
  105. * @{
  106. */
  107. #define DATAIN4_DFSDM2_PAD (uint32_t)0x00000000
  108. #define DATAIN4_DFSDM2_DATAIN5 SYSCFG_MCHDLYCR_DFSDM2D4SEL
  109. /**
  110. * @}
  111. */
  112. /** @defgroup DFSDM_DATAIN6_SOURCE DFSDM Source Selection For DATAIN6
  113. * @{
  114. */
  115. #define DATAIN6_DFSDM2_PAD (uint32_t)0x00000000
  116. #define DATAIN6_DFSDM2_DATAIN7 SYSCFG_MCHDLYCR_DFSDM2D6SEL
  117. /**
  118. * @}
  119. */
  120. /** @defgroup DFSDM_CLKIN_SOURCE DFSDM1 Source Selection For CLKIN
  121. * @{
  122. */
  123. #define DFSDM1_CLKIN0_TIM4OC2 (uint32_t)0x00000000
  124. #define DFSDM1_CLKIN2_TIM4OC2 SYSCFG_MCHDLYCR_DFSDM1CK02SEL
  125. #define DFSDM1_CLKIN1_TIM4OC1 (uint32_t)0x00000000
  126. #define DFSDM1_CLKIN3_TIM4OC1 SYSCFG_MCHDLYCR_DFSDM1CK13SEL
  127. /**
  128. * @}
  129. */
  130. /** @defgroup DFSDM_CLKIN_SOURCE DFSDM2 Source Selection For CLKIN
  131. * @{
  132. */
  133. #define DFSDM2_CLKIN0_TIM3OC4 (uint32_t)0x00000000
  134. #define DFSDM2_CLKIN4_TIM3OC4 SYSCFG_MCHDLYCR_DFSDM2CK04SEL
  135. #define DFSDM2_CLKIN1_TIM3OC3 (uint32_t)0x00000000
  136. #define DFSDM2_CLKIN5_TIM3OC3 SYSCFG_MCHDLYCR_DFSDM2CK15SEL
  137. #define DFSDM2_CLKIN2_TIM3OC2 (uint32_t)0x00000000
  138. #define DFSDM2_CLKIN6_TIM3OC2 SYSCFG_MCHDLYCR_DFSDM2CK26SEL
  139. #define DFSDM2_CLKIN3_TIM3OC1 (uint32_t)0x00000000
  140. #define DFSDM2_CLKIN7_TIM3OC1 SYSCFG_MCHDLYCR_DFSDM2CK37SEL
  141. /**
  142. * @}
  143. */
  144. #endif /* STM32F413_423xx */
  145. /** @defgroup SYSCFG_EXTI_Port_Sources
  146. * @{
  147. */
  148. #define EXTI_PortSourceGPIOA ((uint8_t)0x00)
  149. #define EXTI_PortSourceGPIOB ((uint8_t)0x01)
  150. #define EXTI_PortSourceGPIOC ((uint8_t)0x02)
  151. #define EXTI_PortSourceGPIOD ((uint8_t)0x03)
  152. #define EXTI_PortSourceGPIOE ((uint8_t)0x04)
  153. #define EXTI_PortSourceGPIOF ((uint8_t)0x05)
  154. #define EXTI_PortSourceGPIOG ((uint8_t)0x06)
  155. #define EXTI_PortSourceGPIOH ((uint8_t)0x07)
  156. #define EXTI_PortSourceGPIOI ((uint8_t)0x08)
  157. #define EXTI_PortSourceGPIOJ ((uint8_t)0x09)
  158. #define EXTI_PortSourceGPIOK ((uint8_t)0x0A)
  159. #define IS_EXTI_PORT_SOURCE(PORTSOURCE) (((PORTSOURCE) == EXTI_PortSourceGPIOA) || \
  160. ((PORTSOURCE) == EXTI_PortSourceGPIOB) || \
  161. ((PORTSOURCE) == EXTI_PortSourceGPIOC) || \
  162. ((PORTSOURCE) == EXTI_PortSourceGPIOD) || \
  163. ((PORTSOURCE) == EXTI_PortSourceGPIOE) || \
  164. ((PORTSOURCE) == EXTI_PortSourceGPIOF) || \
  165. ((PORTSOURCE) == EXTI_PortSourceGPIOG) || \
  166. ((PORTSOURCE) == EXTI_PortSourceGPIOH) || \
  167. ((PORTSOURCE) == EXTI_PortSourceGPIOI) || \
  168. ((PORTSOURCE) == EXTI_PortSourceGPIOJ) || \
  169. ((PORTSOURCE) == EXTI_PortSourceGPIOK))
  170. /**
  171. * @}
  172. */
  173. /** @defgroup SYSCFG_EXTI_Pin_Sources
  174. * @{
  175. */
  176. #define EXTI_PinSource0 ((uint8_t)0x00)
  177. #define EXTI_PinSource1 ((uint8_t)0x01)
  178. #define EXTI_PinSource2 ((uint8_t)0x02)
  179. #define EXTI_PinSource3 ((uint8_t)0x03)
  180. #define EXTI_PinSource4 ((uint8_t)0x04)
  181. #define EXTI_PinSource5 ((uint8_t)0x05)
  182. #define EXTI_PinSource6 ((uint8_t)0x06)
  183. #define EXTI_PinSource7 ((uint8_t)0x07)
  184. #define EXTI_PinSource8 ((uint8_t)0x08)
  185. #define EXTI_PinSource9 ((uint8_t)0x09)
  186. #define EXTI_PinSource10 ((uint8_t)0x0A)
  187. #define EXTI_PinSource11 ((uint8_t)0x0B)
  188. #define EXTI_PinSource12 ((uint8_t)0x0C)
  189. #define EXTI_PinSource13 ((uint8_t)0x0D)
  190. #define EXTI_PinSource14 ((uint8_t)0x0E)
  191. #define EXTI_PinSource15 ((uint8_t)0x0F)
  192. #define IS_EXTI_PIN_SOURCE(PINSOURCE) (((PINSOURCE) == EXTI_PinSource0) || \
  193. ((PINSOURCE) == EXTI_PinSource1) || \
  194. ((PINSOURCE) == EXTI_PinSource2) || \
  195. ((PINSOURCE) == EXTI_PinSource3) || \
  196. ((PINSOURCE) == EXTI_PinSource4) || \
  197. ((PINSOURCE) == EXTI_PinSource5) || \
  198. ((PINSOURCE) == EXTI_PinSource6) || \
  199. ((PINSOURCE) == EXTI_PinSource7) || \
  200. ((PINSOURCE) == EXTI_PinSource8) || \
  201. ((PINSOURCE) == EXTI_PinSource9) || \
  202. ((PINSOURCE) == EXTI_PinSource10) || \
  203. ((PINSOURCE) == EXTI_PinSource11) || \
  204. ((PINSOURCE) == EXTI_PinSource12) || \
  205. ((PINSOURCE) == EXTI_PinSource13) || \
  206. ((PINSOURCE) == EXTI_PinSource14) || \
  207. ((PINSOURCE) == EXTI_PinSource15))
  208. /**
  209. * @}
  210. */
  211. /** @defgroup SYSCFG_Memory_Remap_Config
  212. * @{
  213. */
  214. #define SYSCFG_MemoryRemap_Flash ((uint8_t)0x00)
  215. #define SYSCFG_MemoryRemap_SystemFlash ((uint8_t)0x01)
  216. #define SYSCFG_MemoryRemap_SRAM ((uint8_t)0x03)
  217. #define SYSCFG_MemoryRemap_SDRAM ((uint8_t)0x04)
  218. #if defined (STM32F40_41xxx) || defined(STM32F412xG) || defined(STM32F413_423xx)
  219. #define SYSCFG_MemoryRemap_FSMC ((uint8_t)0x02)
  220. #endif /* STM32F40_41xxx || STM32F412xG || STM32F413_423xx */
  221. #if defined (STM32F427_437xx) || defined (STM32F429_439xx)
  222. #define SYSCFG_MemoryRemap_FMC ((uint8_t)0x02)
  223. #endif /* STM32F427_437xx || STM32F429_439xx */
  224. #if defined (STM32F446xx) || defined (STM32F469_479xx)
  225. #define SYSCFG_MemoryRemap_ExtMEM ((uint8_t)0x02)
  226. #endif /* STM32F446xx || STM32F469_479xx */
  227. #if defined (STM32F40_41xxx) || defined(STM32F412xG) || defined(STM32F413_423xx)
  228. #define IS_SYSCFG_MEMORY_REMAP_CONFING(REMAP) (((REMAP) == SYSCFG_MemoryRemap_Flash) || \
  229. ((REMAP) == SYSCFG_MemoryRemap_SystemFlash) || \
  230. ((REMAP) == SYSCFG_MemoryRemap_SRAM) || \
  231. ((REMAP) == SYSCFG_MemoryRemap_FSMC))
  232. #endif /* STM32F40_41xxx || STM32F412xG || STM32F413_423xx */
  233. #if defined (STM32F401xx) || defined (STM32F410xx) || defined (STM32F411xE)
  234. #define IS_SYSCFG_MEMORY_REMAP_CONFING(REMAP) (((REMAP) == SYSCFG_MemoryRemap_Flash) || \
  235. ((REMAP) == SYSCFG_MemoryRemap_SystemFlash) || \
  236. ((REMAP) == SYSCFG_MemoryRemap_SRAM))
  237. #endif /* STM32F401xx || STM32F410xx || STM32F411xE */
  238. #if defined (STM32F427_437xx) || defined (STM32F429_439xx)
  239. #define IS_SYSCFG_MEMORY_REMAP_CONFING(REMAP) (((REMAP) == SYSCFG_MemoryRemap_Flash) || \
  240. ((REMAP) == SYSCFG_MemoryRemap_SystemFlash) || \
  241. ((REMAP) == SYSCFG_MemoryRemap_SRAM) || \
  242. ((REMAP) == SYSCFG_MemoryRemap_SDRAM) || \
  243. ((REMAP) == SYSCFG_MemoryRemap_FMC))
  244. #endif /* STM32F427_437xx || STM32F429_439xx */
  245. #if defined (STM32F446xx) || defined (STM32F469_479xx)
  246. #define IS_SYSCFG_MEMORY_REMAP_CONFING(REMAP) (((REMAP) == SYSCFG_MemoryRemap_Flash) || \
  247. ((REMAP) == SYSCFG_MemoryRemap_ExtMEM) || \
  248. ((REMAP) == SYSCFG_MemoryRemap_SystemFlash) || \
  249. ((REMAP) == SYSCFG_MemoryRemap_SRAM) || \
  250. ((REMAP) == SYSCFG_MemoryRemap_SDRAM))
  251. #endif /* STM32F446xx || STM32F469_479xx */
  252. #if defined(STM32F410xx) || defined(STM32F412xG) || defined(STM32F413_423xx)
  253. #define SYSCFG_Break_PVD SYSCFG_CFGR2_PVDL
  254. #define SYSCFG_Break_HardFault SYSCFG_CFGR2_CLL
  255. #define IS_SYSCFG_LOCK_CONFIG(BREAK) (((BREAK) == SYSCFG_Break_PVD) || \
  256. ((BREAK) == SYSCFG_Break_HardFault))
  257. #endif /* STM32F410xx || STM32F412xG || STM32F413_423xx */
  258. /**
  259. * @}
  260. */
  261. /** @defgroup SYSCFG_ETHERNET_Media_Interface
  262. * @{
  263. */
  264. #define SYSCFG_ETH_MediaInterface_MII ((uint32_t)0x00000000)
  265. #define SYSCFG_ETH_MediaInterface_RMII ((uint32_t)0x00000001)
  266. #define IS_SYSCFG_ETH_MEDIA_INTERFACE(INTERFACE) (((INTERFACE) == SYSCFG_ETH_MediaInterface_MII) || \
  267. ((INTERFACE) == SYSCFG_ETH_MediaInterface_RMII))
  268. /**
  269. * @}
  270. */
  271. /**
  272. * @}
  273. */
  274. /* Exported macro ------------------------------------------------------------*/
  275. /* Exported functions --------------------------------------------------------*/
  276. void SYSCFG_DeInit(void);
  277. void SYSCFG_MemoryRemapConfig(uint8_t SYSCFG_MemoryRemap);
  278. void SYSCFG_MemorySwappingBank(FunctionalState NewState);
  279. void SYSCFG_EXTILineConfig(uint8_t EXTI_PortSourceGPIOx, uint8_t EXTI_PinSourcex);
  280. void SYSCFG_ETH_MediaInterfaceConfig(uint32_t SYSCFG_ETH_MediaInterface);
  281. void SYSCFG_CompensationCellCmd(FunctionalState NewState);
  282. FlagStatus SYSCFG_GetCompensationCellStatus(void);
  283. #if defined(STM32F410xx) || defined(STM32F412xG) || defined(STM32F413_423xx)
  284. void SYSCFG_BreakConfig(uint32_t SYSCFG_Break);
  285. #endif /* STM32F410xx || STM32F412xG || STM32F413_423xx */
  286. #if defined(STM32F413_423xx)
  287. void DFSDM_BitstreamClock_SourceSelection(uint32_t source);
  288. void DFSDM_DisableDelayClock(uint32_t MCHDLY);
  289. void DFSDM_EnableDelayClock(uint32_t MCHDLY);
  290. void DFSDM_ClockIn_SourceSelection(uint32_t source);
  291. void DFSDM_ClockOut_SourceSelection(uint32_t source);
  292. void DFSDM_DataIn0_SourceSelection(uint32_t source);
  293. void DFSDM_DataIn2_SourceSelection(uint32_t source);
  294. void DFSDM_DataIn4_SourceSelection(uint32_t source);
  295. void DFSDM_DataIn6_SourceSelection(uint32_t source);
  296. void DFSDM1_BitStreamClk_Config(uint32_t source);
  297. void DFSDM2_BitStreamClk_Config(uint32_t source);
  298. #endif /* STM32F413_423xx */
  299. #ifdef __cplusplus
  300. }
  301. #endif
  302. #endif /*__STM32F4xx_SYSCFG_H */
  303. /**
  304. * @}
  305. */
  306. /**
  307. * @}
  308. */
  309. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/