ft32f0xx_syscfg.h 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  1. /**
  2. ******************************************************************************
  3. * @file ft32f0xx_syscfg.h
  4. * @author FMD AE
  5. * @brief This file contains all the functions prototypes for the SYSCFG firmware
  6. * library.
  7. * @version V1.0.0
  8. * @data 2021-07-01
  9. ******************************************************************************
  10. */
  11. /*!< Define to prevent recursive inclusion -------------------------------------*/
  12. #ifndef __FT32F0XX_SYSCFG_H
  13. #define __FT32F0XX_SYSCFG_H
  14. #ifdef __cplusplus
  15. extern "C" {
  16. #endif
  17. /*!< Includes ------------------------------------------------------------------*/
  18. #include "ft32f0xx.h"
  19. /** @addtogroup SYSCFG
  20. * @{
  21. */
  22. /* Exported types ------------------------------------------------------------*/
  23. /* Exported constants --------------------------------------------------------*/
  24. /** @defgroup SYSCFG_Exported_Constants
  25. * @{
  26. */
  27. /** @defgroup SYSCFG_EXTI_Port_Sources
  28. * @{
  29. */
  30. #define EXTI_PortSourceGPIOA ((uint8_t)0x00)
  31. #define EXTI_PortSourceGPIOB ((uint8_t)0x01)
  32. #define EXTI_PortSourceGPIOC ((uint8_t)0x02)
  33. #define EXTI_PortSourceGPIOD ((uint8_t)0x03)
  34. #define EXTI_PortSourceGPIOE ((uint8_t)0x04)
  35. #define EXTI_PortSourceGPIOF ((uint8_t)0x05)
  36. #define IS_EXTI_PORT_SOURCE(PORTSOURCE) (((PORTSOURCE) == EXTI_PortSourceGPIOA) || \
  37. ((PORTSOURCE) == EXTI_PortSourceGPIOB) || \
  38. ((PORTSOURCE) == EXTI_PortSourceGPIOC) || \
  39. ((PORTSOURCE) == EXTI_PortSourceGPIOD) || \
  40. ((PORTSOURCE) == EXTI_PortSourceGPIOE) || \
  41. ((PORTSOURCE) == EXTI_PortSourceGPIOF))
  42. /**
  43. * @}
  44. */
  45. /** @defgroup SYSCFG_EXTI_Pin_sources
  46. * @{
  47. */
  48. #define EXTI_PinSource0 ((uint8_t)0x00)
  49. #define EXTI_PinSource1 ((uint8_t)0x01)
  50. #define EXTI_PinSource2 ((uint8_t)0x02)
  51. #define EXTI_PinSource3 ((uint8_t)0x03)
  52. #define EXTI_PinSource4 ((uint8_t)0x04)
  53. #define EXTI_PinSource5 ((uint8_t)0x05)
  54. #define EXTI_PinSource6 ((uint8_t)0x06)
  55. #define EXTI_PinSource7 ((uint8_t)0x07)
  56. #define EXTI_PinSource8 ((uint8_t)0x08)
  57. #define EXTI_PinSource9 ((uint8_t)0x09)
  58. #define EXTI_PinSource10 ((uint8_t)0x0A)
  59. #define EXTI_PinSource11 ((uint8_t)0x0B)
  60. #define EXTI_PinSource12 ((uint8_t)0x0C)
  61. #define EXTI_PinSource13 ((uint8_t)0x0D)
  62. #define EXTI_PinSource14 ((uint8_t)0x0E)
  63. #define EXTI_PinSource15 ((uint8_t)0x0F)
  64. #define IS_EXTI_PIN_SOURCE(PINSOURCE) (((PINSOURCE) == EXTI_PinSource0) || \
  65. ((PINSOURCE) == EXTI_PinSource1) || \
  66. ((PINSOURCE) == EXTI_PinSource2) || \
  67. ((PINSOURCE) == EXTI_PinSource3) || \
  68. ((PINSOURCE) == EXTI_PinSource4) || \
  69. ((PINSOURCE) == EXTI_PinSource5) || \
  70. ((PINSOURCE) == EXTI_PinSource6) || \
  71. ((PINSOURCE) == EXTI_PinSource7) || \
  72. ((PINSOURCE) == EXTI_PinSource8) || \
  73. ((PINSOURCE) == EXTI_PinSource9) || \
  74. ((PINSOURCE) == EXTI_PinSource10) || \
  75. ((PINSOURCE) == EXTI_PinSource11) || \
  76. ((PINSOURCE) == EXTI_PinSource12) || \
  77. ((PINSOURCE) == EXTI_PinSource13) || \
  78. ((PINSOURCE) == EXTI_PinSource14) || \
  79. ((PINSOURCE) == EXTI_PinSource15))
  80. /**
  81. * @}
  82. */
  83. /** @defgroup SYSCFG_Memory_Remap_Config
  84. * @{
  85. */
  86. #define SYSCFG_MemoryRemap_Flash ((uint8_t)0x00)
  87. #define SYSCFG_MemoryRemap_SystemMemory ((uint8_t)0x01)
  88. #define SYSCFG_MemoryRemap_SRAM ((uint8_t)0x03)
  89. #define IS_SYSCFG_MEMORY_REMAP(REMAP) (((REMAP) == SYSCFG_MemoryRemap_Flash) || \
  90. ((REMAP) == SYSCFG_MemoryRemap_SystemMemory) || \
  91. ((REMAP) == SYSCFG_MemoryRemap_SRAM))
  92. /**
  93. * @}
  94. */
  95. /** @defgroup SYSCFG_DMA_Remap_Config
  96. * @{
  97. */
  98. #define SYSCFG_DMARemap_TIM3 SYSCFG_CFGR1_TIM3_DMA_RMP /* Remap TIM3 DMA requests from channel4 to channel6*/
  99. #define SYSCFG_DMARemap_TIM2 SYSCFG_CFGR1_TIM2_DMA_RMP /* Remap TIM2 DMA requests from channel3/4 to channel7*/
  100. #define SYSCFG_DMARemap_TIM1 SYSCFG_CFGR1_TIM1_DMA_RMP /* Remap TIM1 DMA requests from channel2/3/4 to channel6*/
  101. #define SYSCFG_DMARemap_I2C1 SYSCFG_CFGR1_I2C1_DMA_RMP /* Remap I2C1 DMA requests from channel3/2 to channel7/6*/
  102. #define SYSCFG_DMARemap_USART3 SYSCFG_CFGR1_USART3_DMA_RMP /* Remap USART3 DMA requests from channel6/7 to channel3/2*/
  103. #define SYSCFG_DMARemap_USART2 SYSCFG_CFGR1_USART2_DMA_RMP /* Remap USART2 DMA requests from channel4/5 to channel6/7*/
  104. #define SYSCFG_DMARemap_SPI2 SYSCFG_CFGR1_SPI2_DMA_RMP /* Remap SPI2 DMA requests from channel4/5 to channel6/7*/
  105. #define SYSCFG_DMARemap_TIM17_2 SYSCFG_CFGR1_TIM17_DMA_RMP2 /* Remap TIM17 DMA requests from channel1/2 to channel7*/
  106. #define SYSCFG_DMARemap_TIM16_2 SYSCFG_CFGR1_TIM16_DMA_RMP2 /* Remap TIM16 DMA requests from channel3/4 to channel6*/
  107. #define SYSCFG_DMARemap_TIM17 SYSCFG_CFGR1_TIM17_DMA_RMP /* Remap TIM17 DMA requests from channel1 to channel2*/
  108. #define SYSCFG_DMARemap_TIM16 SYSCFG_CFGR1_TIM16_DMA_RMP /* Remap TIM16 DMA requests from channel3 to channel4*/
  109. #define SYSCFG_DMARemap_USART1Rx SYSCFG_CFGR1_USART1RX_DMA_RMP /* Remap USART1 Rx DMA requests from channel3 to channel5*/
  110. #define SYSCFG_DMARemap_USART1Tx SYSCFG_CFGR1_USART1TX_DMA_RMP /* Remap USART1 Tx DMA requests from channel2 to channel4*/
  111. #define SYSCFG_DMARemap_ADC1 SYSCFG_CFGR1_ADC_DMA_RMP /* Remap ADC1 DMA requests from channel1 to channel2*/
  112. #define IS_SYSCFG_DMA_REMAP(REMAP) (((REMAP) == SYSCFG_DMARemap_TIM17) || \
  113. ((REMAP) == SYSCFG_DMARemap_TIM16) || \
  114. ((REMAP) == SYSCFG_DMARemap_USART1Rx) || \
  115. ((REMAP) == SYSCFG_DMARemap_USART1Tx) || \
  116. ((REMAP) == SYSCFG_CFGR1_TIM3_DMA_RMP) || \
  117. ((REMAP) == SYSCFG_CFGR1_TIM2_DMA_RMP) || \
  118. ((REMAP) == SYSCFG_CFGR1_TIM1_DMA_RMP) || \
  119. ((REMAP) == SYSCFG_CFGR1_I2C1_DMA_RMP) || \
  120. ((REMAP) == SYSCFG_CFGR1_USART3_DMA_RMP) || \
  121. ((REMAP) == SYSCFG_CFGR1_USART2_DMA_RMP) || \
  122. ((REMAP) == SYSCFG_CFGR1_SPI2_DMA_RMP) || \
  123. ((REMAP) == SYSCFG_CFGR1_TIM17_DMA_RMP2) || \
  124. ((REMAP) == SYSCFG_CFGR1_TIM16_DMA_RMP2) || \
  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 SYSCFG_I2CFastModePlus_I2C1 SYSCFG_CFGR1_I2C_FMP_I2C1 /* Enable Fast Mode Plus on PB10, PB11, PF6 and PF7*/
  137. #define SYSCFG_I2CFastModePlus_I2C2 SYSCFG_CFGR1_I2C_FMP_I2C2 /* Enable Fast Mode Plus on I2C2 pins*/
  138. #define SYSCFG_I2CFastModePlus_PA9 SYSCFG_CFGR1_I2C_FMP_PA9 /* Enable Fast Mode Plus on PA9*/
  139. #define SYSCFG_I2CFastModePlus_PA10 SYSCFG_CFGR1_I2C_FMP_PA10/* Enable Fast Mode Plus on PA10*/
  140. #define IS_SYSCFG_I2C_FMP(PIN) (((PIN) == SYSCFG_I2CFastModePlus_PB6) || \
  141. ((PIN) == SYSCFG_I2CFastModePlus_PB7) || \
  142. ((PIN) == SYSCFG_I2CFastModePlus_PB8) || \
  143. ((PIN) == SYSCFG_I2CFastModePlus_PB9) || \
  144. ((PIN) == SYSCFG_I2CFastModePlus_I2C1) || \
  145. ((PIN) == SYSCFG_I2CFastModePlus_I2C2) || \
  146. ((PIN) == SYSCFG_I2CFastModePlus_PA9) || \
  147. ((PIN) == SYSCFG_I2CFastModePlus_PA10))
  148. /**
  149. * @}
  150. */
  151. /** @defgroup SYSCFG_Lock_Config
  152. * @{
  153. */
  154. #define SYSCFG_Break_PVD SYSCFG_CFGR2_PVD_LOCK /*!< Connects the PVD event to the Break Input of TIM1 */
  155. #define SYSCFG_Break_Lockup SYSCFG_CFGR2_LOCKUP_LOCK /*!< Connects Lockup output of CortexM0 to the break input of TIM1 */
  156. #define IS_SYSCFG_LOCK_CONFIG(CONFIG) (((CONFIG) == SYSCFG_Break_PVD) || \
  157. ((CONFIG) == SYSCFG_Break_Lockup))
  158. /**
  159. * @}
  160. */
  161. /**
  162. * @}
  163. */
  164. /** @defgroup SYSCFG_ISR_WRAPPER
  165. * @{
  166. */
  167. #define SYSCFG_ITLINE0 ((uint32_t) 0x00000000)
  168. #define SYSCFG_ITLINE1 ((uint32_t) 0x00000001)
  169. #define SYSCFG_ITLINE2 ((uint32_t) 0x00000002)
  170. #define SYSCFG_ITLINE3 ((uint32_t) 0x00000003)
  171. #define SYSCFG_ITLINE4 ((uint32_t) 0x00000004)
  172. #define SYSCFG_ITLINE5 ((uint32_t) 0x00000005)
  173. #define SYSCFG_ITLINE6 ((uint32_t) 0x00000006)
  174. #define SYSCFG_ITLINE7 ((uint32_t) 0x00000007)
  175. #define SYSCFG_ITLINE8 ((uint32_t) 0x00000008)
  176. #define SYSCFG_ITLINE9 ((uint32_t) 0x00000009)
  177. #define SYSCFG_ITLINE10 ((uint32_t) 0x0000000A)
  178. #define SYSCFG_ITLINE11 ((uint32_t) 0x0000000B)
  179. #define SYSCFG_ITLINE12 ((uint32_t) 0x0000000C)
  180. #define SYSCFG_ITLINE13 ((uint32_t) 0x0000000D)
  181. #define SYSCFG_ITLINE14 ((uint32_t) 0x0000000E)
  182. #define SYSCFG_ITLINE15 ((uint32_t) 0x0000000F)
  183. #define SYSCFG_ITLINE16 ((uint32_t) 0x00000010)
  184. #define SYSCFG_ITLINE17 ((uint32_t) 0x00000011)
  185. #define SYSCFG_ITLINE18 ((uint32_t) 0x00000012)
  186. #define SYSCFG_ITLINE19 ((uint32_t) 0x00000013)
  187. #define SYSCFG_ITLINE20 ((uint32_t) 0x00000014)
  188. #define SYSCFG_ITLINE21 ((uint32_t) 0x00000015)
  189. #define SYSCFG_ITLINE22 ((uint32_t) 0x00000016)
  190. #define SYSCFG_ITLINE23 ((uint32_t) 0x00000017)
  191. #define SYSCFG_ITLINE24 ((uint32_t) 0x00000018)
  192. #define SYSCFG_ITLINE25 ((uint32_t) 0x00000019)
  193. #define SYSCFG_ITLINE26 ((uint32_t) 0x0000001A)
  194. #define SYSCFG_ITLINE27 ((uint32_t) 0x0000001B)
  195. #define SYSCFG_ITLINE28 ((uint32_t) 0x0000001C)
  196. #define SYSCFG_ITLINE29 ((uint32_t) 0x0000001D)
  197. #define SYSCFG_ITLINE30 ((uint32_t) 0x0000001E)
  198. #define SYSCFG_ITLINE31 ((uint32_t) 0x0000001F)
  199. /**
  200. * @}
  201. */
  202. /** @defgroup IRDA_ENV_SEL
  203. * @{
  204. */
  205. #define SYSCFG_IRDA_ENV_SEL_TIM16 (SYSCFG_CFGR1_IRDA_ENV_SEL_0&SYSCFG_CFGR1_IRDA_ENV_SEL_1) /* Timer16 is selected as IRDA Modulation envelope source */
  206. #define SYSCFG_IRDA_ENV_SEL_USART1 (SYSCFG_CFGR1_IRDA_ENV_SEL_0) /* USART1 is selected as IRDA Modulation envelope source.*/
  207. #define SYSCFG_IRDA_ENV_SEL_USART2 (SYSCFG_CFGR1_IRDA_ENV_SEL_1) /* USART2 is selected as IRDA Modulation envelope source.*/
  208. #define IS_SYSCFG_IRDA_ENV(ENV) (((ENV) == SYSCFG_IRDA_ENV_SEL_TIM16) || \
  209. ((ENV) == SYSCFG_IRDA_ENV_SEL_USART1) || \
  210. ((ENV) == SYSCFG_IRDA_ENV_SEL_USART2))
  211. /**
  212. * @}
  213. */
  214. /**
  215. * @}
  216. */
  217. /* Exported macro ------------------------------------------------------------*/
  218. /* Exported functions ------------------------------------------------------- */
  219. /* Function used to set the SYSCFG configuration to the default reset state **/
  220. void SYSCFG_DeInit(void);
  221. /* SYSCFG configuration functions *********************************************/
  222. void SYSCFG_MemoryRemapConfig(uint32_t SYSCFG_MemoryRemap);
  223. void SYSCFG_DMAChannelRemapConfig(uint32_t SYSCFG_DMARemap, FunctionalState NewState);
  224. void SYSCFG_I2CFastModePlusConfig(uint32_t SYSCFG_I2CFastModePlus, FunctionalState NewState);
  225. void SYSCFG_IRDAEnvSelection(uint32_t SYSCFG_IRDAEnv);
  226. void SYSCFG_EXTILineConfig(uint8_t EXTI_PortSourceGPIOx, uint8_t EXTI_PinSourcex);
  227. void SYSCFG_BreakConfig(uint32_t SYSCFG_Break);
  228. #ifdef __cplusplus
  229. }
  230. #endif
  231. #endif /*__FT32F0XX_SYSCFG_H */
  232. /**
  233. * @}
  234. */
  235. /**
  236. * @}
  237. */
  238. /************************ (C) COPYRIGHT FMD *****END OF FILE****/