apm32f0xx_syscfg.h 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. /*!
  2. * @file apm32f0xx_syscfg.h
  3. *
  4. * @brief This file contains all the functions prototypes for the SYSCFG firmware library
  5. *
  6. * @version V1.0.3
  7. *
  8. * @date 2022-09-20
  9. *
  10. * @attention
  11. *
  12. * Copyright (C) 2020-2022 Geehy Semiconductor
  13. *
  14. * You may not use this file except in compliance with the
  15. * GEEHY COPYRIGHT NOTICE (GEEHY SOFTWARE PACKAGE LICENSE).
  16. *
  17. * The program is only for reference, which is distributed in the hope
  18. * that it will be useful and instructional for customers to develop
  19. * their software. Unless required by applicable law or agreed to in
  20. * writing, the program is distributed on an "AS IS" BASIS, WITHOUT
  21. * ANY WARRANTY OR CONDITIONS OF ANY KIND, either express or implied.
  22. * See the GEEHY SOFTWARE PACKAGE LICENSE for the governing permissions
  23. * and limitations under the License.
  24. */
  25. #ifndef __APM32F0XX_SYSCFG_H
  26. #define __APM32F0XX_SYSCFG_H
  27. #ifdef __cplusplus
  28. extern "C" {
  29. #endif
  30. #include "apm32f0xx.h"
  31. /** @addtogroup APM32F0xx_StdPeriphDriver
  32. @{
  33. */
  34. /** @addtogroup SYSCFG_Driver SYSCFG Driver
  35. @{
  36. */
  37. /** @defgroup SYSCFG_Macros Macros
  38. @{
  39. */
  40. /** Macros description */
  41. #define SYSCFG_CFG1_MEMMODE ((uint32_t)0x00000003); /*!< SYSCFG_Memory Remap Config */
  42. /**@} end of group SYSCFG_Macros*/
  43. /** @defgroup SYSCFG_Enumerations Enumerations
  44. @{
  45. */
  46. /**
  47. * @brief SYSCFG EINT Port Sources
  48. */
  49. typedef enum
  50. {
  51. SYSCFG_PORT_GPIOA = ((uint8_t)0x00), /*!< Port Source GPIOA */
  52. SYSCFG_PORT_GPIOB = ((uint8_t)0x01), /*!< Port Source GPIOB */
  53. SYSCFG_PORT_GPIOC = ((uint8_t)0x02), /*!< Port Source GPIOC */
  54. SYSCFG_PORT_GPIOD = ((uint8_t)0x03), /*!< Port Source GPIOD */
  55. SYSCFG_PORT_GPIOE = ((uint8_t)0x04), /*!< Port Source GPIOE (only for APM32F072 and APM32F091 devices) */
  56. SYSCFG_PORT_GPIOF = ((uint8_t)0x05), /*!< Port Source GPIOF */
  57. } SYSCFG_PORT_T;
  58. /**
  59. * @brief SYSCFG EINT Pin Sources
  60. */
  61. typedef enum
  62. {
  63. SYSCFG_PIN_0 = ((uint8_t)0x00), /*!< Pin Source 0 */
  64. SYSCFG_PIN_1 = ((uint8_t)0x01), /*!< Pin Source 1 */
  65. SYSCFG_PIN_2 = ((uint8_t)0x02), /*!< Pin Source 2 */
  66. SYSCFG_PIN_3 = ((uint8_t)0x03), /*!< Pin Source 3 */
  67. SYSCFG_PIN_4 = ((uint8_t)0x04), /*!< Pin Source 4 */
  68. SYSCFG_PIN_5 = ((uint8_t)0x05), /*!< Pin Source 5 */
  69. SYSCFG_PIN_6 = ((uint8_t)0x06), /*!< Pin Source 6 */
  70. SYSCFG_PIN_7 = ((uint8_t)0x07), /*!< Pin Source 7 */
  71. SYSCFG_PIN_8 = ((uint8_t)0x08), /*!< Pin Source 8 */
  72. SYSCFG_PIN_9 = ((uint8_t)0x09), /*!< Pin Source 9 */
  73. SYSCFG_PIN_10 = ((uint8_t)0x0A), /*!< Pin Source 10 */
  74. SYSCFG_PIN_11 = ((uint8_t)0x0B), /*!< Pin Source 11 */
  75. SYSCFG_PIN_12 = ((uint8_t)0x0C), /*!< Pin Source 12 */
  76. SYSCFG_PIN_13 = ((uint8_t)0x0D), /*!< Pin Source 13 */
  77. SYSCFG_PIN_14 = ((uint8_t)0x0E), /*!< Pin Source 14 */
  78. SYSCFG_PIN_15 = ((uint8_t)0x0F), /*!< Pin Source 15 */
  79. } SYSCFG_PIN_T;
  80. /**
  81. * @brief SYSCFG Memory Remap Config
  82. */
  83. typedef enum
  84. {
  85. SYSCFG_MEMORY_REMAP_FMC = ((uint8_t)0x00), /*!< SYSCFG MemoryRemap Flash */
  86. SYSCFG_MEMORY_REMAP_SYSTEM = ((uint8_t)0x01), /*!< SYSCFG MemoryRemap SystemMemory */
  87. SYSCFG_MEMORY_REMAP_SRAM = ((uint8_t)0x03), /*!< SYSCFG MemoryRemap SRAM */
  88. } SYSCFG_MEMORY_REMAP_T;
  89. /**
  90. * @brief SYSCFG DMA Remap Config
  91. */
  92. typedef enum
  93. {
  94. SYSCFG_DAM_REMAP_ADC = ((uint32_t)0x00000100), /*!< ADC DMA remap */
  95. SYSCFG_DAM_REMAP_USART1TX = ((uint32_t)0x00000200), /*!< USART1 TX DMA remap */
  96. SYSCFG_DAM_REMAP_USART1RX = ((uint32_t)0x00000400), /*!< USART1 RX DMA remap */
  97. SYSCFG_DAM_REMAP_TMR16 = ((uint32_t)0x00000800), /*!< Timer 16 DMA remap */
  98. SYSCFG_DAM_REMAP_TMR17 = ((uint32_t)0x00001000), /*!< Timer 17 DMA remap */
  99. SYSCFG_DAM_REMAP_TMR16_2 = ((uint32_t)0x00002000), /*!< Timer 16 DMA remap2(only for APM32F072) */
  100. SYSCFG_DAM_REMAP_TMR17_2 = ((uint32_t)0x00004000), /*!< Timer 17 DMA remap2(only for APM32F072) */
  101. SYSCFG_DAM_REMAP_SPI2 = ((uint32_t)0x01000000), /*!< SPI2 DMA remap(only for APM32F072) */
  102. SYSCFG_DAM_REMAP_USART2 = ((uint32_t)0x02000000), /*!< USART2 DMA remap(only for APM32F072) */
  103. SYSCFG_DAM_REMAP_USART3 = ((uint32_t)0x04000000), /*!< USART3 DMA remap(only for APM32F072) */
  104. SYSCFG_DAM_REMAP_I2C1 = ((uint32_t)0x08000000), /*!< I2C1 DMA remap(only for APM32F072) */
  105. SYSCFG_DAM_REMAP_TMR1 = ((uint32_t)0x10000000), /*!< TMR1 DMA remap(only for APM32F072) */
  106. SYSCFG_DAM_REMAP_TMR2 = ((uint32_t)0x20000000), /*!< TMR2 DMA remap(only for APM32F072) */
  107. SYSCFG_DAM_REMAP_TMR3 = ((uint32_t)0x40000000), /*!< TMR3 DMA remap(only for APM32F072) */
  108. } SYSCFG_DAM_REMAP_T;
  109. /**
  110. * @brief SYSCFG I2C FastModePlus Config
  111. */
  112. typedef enum
  113. {
  114. SYSCFG_I2C_FMP_PB6 = ((uint32_t)0x00010000), /*!< I2C PB6 Fast mode plus */
  115. SYSCFG_I2C_FMP_PB7 = ((uint32_t)0x00020000), /*!< I2C PB7 Fast mode plus */
  116. SYSCFG_I2C_FMP_PB8 = ((uint32_t)0x00040000), /*!< I2C PB8 Fast mode plus */
  117. SYSCFG_I2C_FMP_PB9 = ((uint32_t)0x00080000), /*!< I2C PB9 Fast mode plus */
  118. SYSCFG_I2C_FMP_I2C1 = ((uint32_t)0x00100000), /*!< Enable Fast Mode Plus on PB10, PB11, PF6 and PF7(only for APM32F030) */
  119. SYSCFG_I2C_FMP_I2C2 = ((uint32_t)0x00200000), /*!< Enable Fast Mode Plus on I2C2 pins(only for APM32F072 and APM32F091) */
  120. SYSCFG_I2C_FMP_PA9 = ((uint32_t)0x00400000), /*!< I2C PA9 Fast mode plus(only for APM32F030 and APM32F091) */
  121. SYSCFG_I2C_FMP_PA10 = ((uint32_t)0x00800000), /*!< I2C PA10 Fast mode plus(only for APM32F030 and APM32F091) */
  122. } SYSCFG_I2C_FMP_T;
  123. /**
  124. * @brief SYSCFG Lock Config
  125. */
  126. typedef enum
  127. {
  128. SYSCFG_LOCK_LOCKUP = ((uint32_t)0x00000001), /*!< Cortex-M0 LOCKUP bit enable */
  129. SYSCFG_LOCK_SRAM = ((uint32_t)0x00000002), /*!< SRAM parity lock bit */
  130. SYSCFG_LOCK_PVD = ((uint32_t)0x00000004), /*!< PVD lock enable bit, not available for APM32F030 devices */
  131. } SYSCFG_LOCK_T;
  132. /**
  133. * @brief IRDA ENV SOURCE
  134. */
  135. typedef enum
  136. {
  137. SYSCFG_IRDA_ENV_TMR16 = ((uint32_t)0x000000C0), /*!< Timer16 as IRDA Modulation envelope source */
  138. SYSCFG_IRDA_ENV_USART1 = ((uint32_t)0x00000040), /*!< USART1 as IRDA Modulation envelope source */
  139. SYSCFG_IRDA_ENV_USART4 = ((uint32_t)0x00000080), /*!< USART4 as IRDA Modulation envelope source */
  140. } SYSCFG_IRDA_ENV_T;
  141. /**
  142. * @brief SYSCFG flag
  143. */
  144. typedef enum
  145. {
  146. SYSCFG_CFG2_SRAMPEF = ((uint32_t)0x00000100), /*!< SRAM Parity error flag */
  147. } SYSCFG_FLAG_T;
  148. /**@} end of group SYSCFG_Enumerations*/
  149. /** @defgroup SYSCFG_Structures Structures
  150. @{
  151. */
  152. /**@} end of group SYSCFG_Structures */
  153. /** @defgroup SYSCFG_Variables Variables
  154. @{
  155. */
  156. /**@} end of group SYSCFG_Variables */
  157. /** @defgroup SYSCFG_Functions Functions
  158. @{
  159. */
  160. /* Reset */
  161. void SYSCFG_Reset(void);
  162. /* Memory Remap selects */
  163. void SYSCFG_MemoryRemapSelect(uint8_t memory);
  164. /* DMA Channel Remap */
  165. void SYSCFG_EnableDMAChannelRemap(uint32_t channel);
  166. void SYSCFG_DisableDMAChannelRemap(uint32_t channel);
  167. /* I2C Fast Mode Plus */
  168. void SYSCFG_EnableI2CFastModePlus(uint32_t pin);
  169. void SYSCFG_DisableI2CFastModePlus(uint32_t pin);
  170. /* IRDA Envelope */
  171. void SYSCFG_SelectIRDAEnv(SYSCFG_IRDA_ENV_T IRDAEnv);
  172. /* Eint Line */
  173. void SYSCFG_EINTLine(SYSCFG_PORT_T port, SYSCFG_PIN_T pin);
  174. /* Break lock */
  175. void SYSCFG_BreakLock(uint32_t lock);
  176. /* Flag */
  177. uint8_t SYSCFG_ReadStatusFlag(uint32_t flag);
  178. void SYSCFG_ClearStatusFlag(uint8_t flag);
  179. #ifdef __cplusplus
  180. }
  181. #endif
  182. #endif /* __APM32F0XX_SYSCFG_H */
  183. /**@} end of group SYSCFG_Functions */
  184. /**@} end of group SYSCFG_Driver */
  185. /**@} end of group APM32F0xx_StdPeriphDriver */