stm32f0xx_syscfg.h 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. /**
  2. ******************************************************************************
  3. * @file stm32f0xx_syscfg.h
  4. * @author MCD Application Team
  5. * @version V1.0.0
  6. * @date 23-March-2012
  7. * @brief This file contains all the functions prototypes for the SYSCFG firmware
  8. * library.
  9. ******************************************************************************
  10. * @attention
  11. *
  12. * <h2><center>&copy; COPYRIGHT 2012 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)
  54. #define EXTI_PortSourceGPIOF ((uint8_t)0x05)
  55. #define IS_EXTI_PORT_SOURCE(PORTSOURCE) (((PORTSOURCE) == EXTI_PortSourceGPIOA) || \
  56. ((PORTSOURCE) == EXTI_PortSourceGPIOB) || \
  57. ((PORTSOURCE) == EXTI_PortSourceGPIOC) || \
  58. ((PORTSOURCE) == EXTI_PortSourceGPIOD) || \
  59. ((PORTSOURCE) == EXTI_PortSourceGPIOF))
  60. /**
  61. * @}
  62. */
  63. /** @defgroup SYSCFG_EXTI_Pin_sources
  64. * @{
  65. */
  66. #define EXTI_PinSource0 ((uint8_t)0x00)
  67. #define EXTI_PinSource1 ((uint8_t)0x01)
  68. #define EXTI_PinSource2 ((uint8_t)0x02)
  69. #define EXTI_PinSource3 ((uint8_t)0x03)
  70. #define EXTI_PinSource4 ((uint8_t)0x04)
  71. #define EXTI_PinSource5 ((uint8_t)0x05)
  72. #define EXTI_PinSource6 ((uint8_t)0x06)
  73. #define EXTI_PinSource7 ((uint8_t)0x07)
  74. #define EXTI_PinSource8 ((uint8_t)0x08)
  75. #define EXTI_PinSource9 ((uint8_t)0x09)
  76. #define EXTI_PinSource10 ((uint8_t)0x0A)
  77. #define EXTI_PinSource11 ((uint8_t)0x0B)
  78. #define EXTI_PinSource12 ((uint8_t)0x0C)
  79. #define EXTI_PinSource13 ((uint8_t)0x0D)
  80. #define EXTI_PinSource14 ((uint8_t)0x0E)
  81. #define EXTI_PinSource15 ((uint8_t)0x0F)
  82. #define IS_EXTI_PIN_SOURCE(PINSOURCE) (((PINSOURCE) == EXTI_PinSource0) || \
  83. ((PINSOURCE) == EXTI_PinSource1) || \
  84. ((PINSOURCE) == EXTI_PinSource2) || \
  85. ((PINSOURCE) == EXTI_PinSource3) || \
  86. ((PINSOURCE) == EXTI_PinSource4) || \
  87. ((PINSOURCE) == EXTI_PinSource5) || \
  88. ((PINSOURCE) == EXTI_PinSource6) || \
  89. ((PINSOURCE) == EXTI_PinSource7) || \
  90. ((PINSOURCE) == EXTI_PinSource8) || \
  91. ((PINSOURCE) == EXTI_PinSource9) || \
  92. ((PINSOURCE) == EXTI_PinSource10) || \
  93. ((PINSOURCE) == EXTI_PinSource11) || \
  94. ((PINSOURCE) == EXTI_PinSource12) || \
  95. ((PINSOURCE) == EXTI_PinSource13) || \
  96. ((PINSOURCE) == EXTI_PinSource14) || \
  97. ((PINSOURCE) == EXTI_PinSource15))
  98. /**
  99. * @}
  100. */
  101. /** @defgroup SYSCFG_Memory_Remap_Config
  102. * @{
  103. */
  104. #define SYSCFG_MemoryRemap_Flash ((uint8_t)0x00)
  105. #define SYSCFG_MemoryRemap_SystemMemory ((uint8_t)0x01)
  106. #define SYSCFG_MemoryRemap_SRAM ((uint8_t)0x03)
  107. #define IS_SYSCFG_MEMORY_REMAP(REMAP) (((REMAP) == SYSCFG_MemoryRemap_Flash) || \
  108. ((REMAP) == SYSCFG_MemoryRemap_SystemMemory) || \
  109. ((REMAP) == SYSCFG_MemoryRemap_SRAM))
  110. /**
  111. * @}
  112. */
  113. /** @defgroup SYSCFG_DMA_Remap_Config
  114. * @{
  115. */
  116. #define SYSCFG_DMARemap_TIM17 SYSCFG_CFGR1_TIM17_DMA_RMP /* Remap TIM17 DMA requests from channel1 to channel2 */
  117. #define SYSCFG_DMARemap_TIM16 SYSCFG_CFGR1_TIM16_DMA_RMP /* Remap TIM16 DMA requests from channel3 to channel4 */
  118. #define SYSCFG_DMARemap_USART1Rx SYSCFG_CFGR1_USART1RX_DMA_RMP /* Remap USART1 Rx DMA requests from channel3 to channel5 */
  119. #define SYSCFG_DMARemap_USART1Tx SYSCFG_CFGR1_USART1TX_DMA_RMP /* Remap USART1 Tx DMA requests from channel2 to channel4 */
  120. #define SYSCFG_DMARemap_ADC1 SYSCFG_CFGR1_ADC_DMA_RMP /* Remap ADC1 DMA requests from channel1 to channel2 */
  121. #define IS_SYSCFG_DMA_REMAP(REMAP) (((REMAP) == SYSCFG_DMARemap_TIM17) || \
  122. ((REMAP) == SYSCFG_DMARemap_TIM16) || \
  123. ((REMAP) == SYSCFG_DMARemap_USART1Rx) || \
  124. ((REMAP) == SYSCFG_DMARemap_USART1Tx) || \
  125. ((REMAP) == SYSCFG_DMARemap_ADC1))
  126. /**
  127. * @}
  128. */
  129. /** @defgroup SYSCFG_I2C_FastModePlus_Config
  130. * @{
  131. */
  132. #define SYSCFG_I2CFastModePlus_PB6 SYSCFG_CFGR1_I2C_FMP_PB6 /* Enable Fast Mode Plus on PB6 */
  133. #define SYSCFG_I2CFastModePlus_PB7 SYSCFG_CFGR1_I2C_FMP_PB7 /* Enable Fast Mode Plus on PB7 */
  134. #define SYSCFG_I2CFastModePlus_PB8 SYSCFG_CFGR1_I2C_FMP_PB8 /* Enable Fast Mode Plus on PB8 */
  135. #define SYSCFG_I2CFastModePlus_PB9 SYSCFG_CFGR1_I2C_FMP_PB9 /* Enable Fast Mode Plus on PB9 */
  136. #define IS_SYSCFG_I2C_FMP(PIN) (((PIN) == SYSCFG_I2CFastModePlus_PB6) || \
  137. ((PIN) == SYSCFG_I2CFastModePlus_PB7) || \
  138. ((PIN) == SYSCFG_I2CFastModePlus_PB8) || \
  139. ((PIN) == SYSCFG_I2CFastModePlus_PB9))
  140. /**
  141. * @}
  142. */
  143. /** @defgroup SYSCFG_Lock_Config
  144. * @{
  145. */
  146. #define SYSCFG_Break_PVD SYSCFG_CFGR2_PVD_LOCK /*!< Connects the PVD event to the Break Input of TIM1 */
  147. #define SYSCFG_Break_SRAMParity SYSCFG_CFGR2_SRAM_PARITY_LOCK /*!< Connects the SRAM_PARITY error signal to the Break Input of TIM1 */
  148. #define SYSCFG_Break_Lockup SYSCFG_CFGR2_LOCKUP_LOCK /*!< Connects Lockup output of CortexM0 to the break input of TIM1 */
  149. #define IS_SYSCFG_LOCK_CONFIG(CONFIG) (((CONFIG) == SYSCFG_Break_PVD) || \
  150. ((CONFIG) == SYSCFG_Break_SRAMParity) || \
  151. ((CONFIG) == SYSCFG_Break_Lockup))
  152. /**
  153. * @}
  154. */
  155. /** @defgroup SYSCFG_flags_definition
  156. * @{
  157. */
  158. #define SYSCFG_FLAG_PE SYSCFG_CFGR2_SRAM_PE
  159. #define IS_SYSCFG_FLAG(FLAG) (((FLAG) == SYSCFG_FLAG_PE))
  160. /**
  161. * @}
  162. */
  163. /**
  164. * @}
  165. */
  166. /* Exported macro ------------------------------------------------------------*/
  167. /* Exported functions ------------------------------------------------------- */
  168. /* Function used to set the SYSCFG configuration to the default reset state **/
  169. void SYSCFG_DeInit(void);
  170. /* SYSCFG configuration functions *********************************************/
  171. void SYSCFG_MemoryRemapConfig(uint32_t SYSCFG_MemoryRemap);
  172. void SYSCFG_DMAChannelRemapConfig(uint32_t SYSCFG_DMARemap, FunctionalState NewState);
  173. void SYSCFG_I2CFastModePlusConfig(uint32_t SYSCFG_I2CFastModePlus, FunctionalState NewState);
  174. void SYSCFG_EXTILineConfig(uint8_t EXTI_PortSourceGPIOx, uint8_t EXTI_PinSourcex);
  175. void SYSCFG_BreakConfig(uint32_t SYSCFG_Break);
  176. FlagStatus SYSCFG_GetFlagStatus(uint32_t SYSCFG_Flag);
  177. void SYSCFG_ClearFlag(uint32_t SYSCFG_Flag);
  178. #ifdef __cplusplus
  179. }
  180. #endif
  181. #endif /*__STM32F0XX_SYSCFG_H */
  182. /**
  183. * @}
  184. */
  185. /**
  186. * @}
  187. */
  188. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/