mbed library sources
Fork of mbed-src by
targets/cmsis/TARGET_STM/TARGET_NUCLEO_F302R8/stm32f30x_syscfg.c@125:23cc3068a9e4, 2014-03-19 (annotated)
- Committer:
- mbed_official
- Date:
- Wed Mar 19 10:15:22 2014 +0000
- Revision:
- 125:23cc3068a9e4
Synchronized with git revision ace35dfba3748c7cdc102eb38ec6b9e1067c3252
Full URL: https://github.com/mbedmicro/mbed/commit/ace35dfba3748c7cdc102eb38ec6b9e1067c3252/
[NUCLEO_F302R8] Add cmsis and hal files + change F401RE clock to 84MHz
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbed_official | 125:23cc3068a9e4 | 1 | /** |
mbed_official | 125:23cc3068a9e4 | 2 | ****************************************************************************** |
mbed_official | 125:23cc3068a9e4 | 3 | * @file stm32f30x_syscfg.c |
mbed_official | 125:23cc3068a9e4 | 4 | * @author MCD Application Team |
mbed_official | 125:23cc3068a9e4 | 5 | * @version V1.1.0 |
mbed_official | 125:23cc3068a9e4 | 6 | * @date 27-February-2014 |
mbed_official | 125:23cc3068a9e4 | 7 | * @brief This file provides firmware functions to manage the following |
mbed_official | 125:23cc3068a9e4 | 8 | * functionalities of the SYSCFG peripheral: |
mbed_official | 125:23cc3068a9e4 | 9 | * + Remapping the memory mapped at 0x00000000 |
mbed_official | 125:23cc3068a9e4 | 10 | * + Remapping the DMA channels |
mbed_official | 125:23cc3068a9e4 | 11 | * + Enabling I2C fast mode plus driving capability for I2C plus |
mbed_official | 125:23cc3068a9e4 | 12 | * + Remapping USB interrupt line |
mbed_official | 125:23cc3068a9e4 | 13 | * + Configuring the EXTI lines connection to the GPIO port |
mbed_official | 125:23cc3068a9e4 | 14 | * + Configuring the CLASSB requirements |
mbed_official | 125:23cc3068a9e4 | 15 | * |
mbed_official | 125:23cc3068a9e4 | 16 | @verbatim |
mbed_official | 125:23cc3068a9e4 | 17 | |
mbed_official | 125:23cc3068a9e4 | 18 | =============================================================================== |
mbed_official | 125:23cc3068a9e4 | 19 | ##### How to use this driver ##### |
mbed_official | 125:23cc3068a9e4 | 20 | =============================================================================== |
mbed_official | 125:23cc3068a9e4 | 21 | [..] The SYSCFG registers can be accessed only when the SYSCFG |
mbed_official | 125:23cc3068a9e4 | 22 | interface APB clock is enabled. |
mbed_official | 125:23cc3068a9e4 | 23 | [..] To enable SYSCFG APB clock use: |
mbed_official | 125:23cc3068a9e4 | 24 | RCC_APBPeriphClockCmd(RCC_APBPeriph_SYSCFG, ENABLE); |
mbed_official | 125:23cc3068a9e4 | 25 | |
mbed_official | 125:23cc3068a9e4 | 26 | @endverbatim |
mbed_official | 125:23cc3068a9e4 | 27 | |
mbed_official | 125:23cc3068a9e4 | 28 | ****************************************************************************** |
mbed_official | 125:23cc3068a9e4 | 29 | * @attention |
mbed_official | 125:23cc3068a9e4 | 30 | * |
mbed_official | 125:23cc3068a9e4 | 31 | * <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2> |
mbed_official | 125:23cc3068a9e4 | 32 | * |
mbed_official | 125:23cc3068a9e4 | 33 | * Redistribution and use in source and binary forms, with or without modification, |
mbed_official | 125:23cc3068a9e4 | 34 | * are permitted provided that the following conditions are met: |
mbed_official | 125:23cc3068a9e4 | 35 | * 1. Redistributions of source code must retain the above copyright notice, |
mbed_official | 125:23cc3068a9e4 | 36 | * this list of conditions and the following disclaimer. |
mbed_official | 125:23cc3068a9e4 | 37 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
mbed_official | 125:23cc3068a9e4 | 38 | * this list of conditions and the following disclaimer in the documentation |
mbed_official | 125:23cc3068a9e4 | 39 | * and/or other materials provided with the distribution. |
mbed_official | 125:23cc3068a9e4 | 40 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
mbed_official | 125:23cc3068a9e4 | 41 | * may be used to endorse or promote products derived from this software |
mbed_official | 125:23cc3068a9e4 | 42 | * without specific prior written permission. |
mbed_official | 125:23cc3068a9e4 | 43 | * |
mbed_official | 125:23cc3068a9e4 | 44 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
mbed_official | 125:23cc3068a9e4 | 45 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
mbed_official | 125:23cc3068a9e4 | 46 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
mbed_official | 125:23cc3068a9e4 | 47 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
mbed_official | 125:23cc3068a9e4 | 48 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
mbed_official | 125:23cc3068a9e4 | 49 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
mbed_official | 125:23cc3068a9e4 | 50 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
mbed_official | 125:23cc3068a9e4 | 51 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
mbed_official | 125:23cc3068a9e4 | 52 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
mbed_official | 125:23cc3068a9e4 | 53 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
mbed_official | 125:23cc3068a9e4 | 54 | * |
mbed_official | 125:23cc3068a9e4 | 55 | ****************************************************************************** |
mbed_official | 125:23cc3068a9e4 | 56 | */ |
mbed_official | 125:23cc3068a9e4 | 57 | |
mbed_official | 125:23cc3068a9e4 | 58 | /* Includes ------------------------------------------------------------------*/ |
mbed_official | 125:23cc3068a9e4 | 59 | #include "stm32f30x_syscfg.h" |
mbed_official | 125:23cc3068a9e4 | 60 | |
mbed_official | 125:23cc3068a9e4 | 61 | /** @addtogroup STM32F30x_StdPeriph_Driver |
mbed_official | 125:23cc3068a9e4 | 62 | * @{ |
mbed_official | 125:23cc3068a9e4 | 63 | */ |
mbed_official | 125:23cc3068a9e4 | 64 | |
mbed_official | 125:23cc3068a9e4 | 65 | /** @defgroup SYSCFG |
mbed_official | 125:23cc3068a9e4 | 66 | * @brief SYSCFG driver modules |
mbed_official | 125:23cc3068a9e4 | 67 | * @{ |
mbed_official | 125:23cc3068a9e4 | 68 | */ |
mbed_official | 125:23cc3068a9e4 | 69 | |
mbed_official | 125:23cc3068a9e4 | 70 | /* Private typedef -----------------------------------------------------------*/ |
mbed_official | 125:23cc3068a9e4 | 71 | /* Private define ------------------------------------------------------------*/ |
mbed_official | 125:23cc3068a9e4 | 72 | /* Reset value od SYSCFG_CFGR1 register */ |
mbed_official | 125:23cc3068a9e4 | 73 | #define CFGR1_CLEAR_MASK ((uint32_t)0x7C000000) |
mbed_official | 125:23cc3068a9e4 | 74 | |
mbed_official | 125:23cc3068a9e4 | 75 | /* ------------ SYSCFG registers bit address in the alias region -------------*/ |
mbed_official | 125:23cc3068a9e4 | 76 | #define SYSCFG_OFFSET (SYSCFG_BASE - PERIPH_BASE) |
mbed_official | 125:23cc3068a9e4 | 77 | |
mbed_official | 125:23cc3068a9e4 | 78 | /* --- CFGR1 Register ---*/ |
mbed_official | 125:23cc3068a9e4 | 79 | /* Alias word address of USB_IT_RMP bit */ |
mbed_official | 125:23cc3068a9e4 | 80 | #define CFGR1_OFFSET (SYSCFG_OFFSET + 0x00) |
mbed_official | 125:23cc3068a9e4 | 81 | #define USBITRMP_BitNumber 0x05 |
mbed_official | 125:23cc3068a9e4 | 82 | #define CFGR1_USBITRMP_BB (PERIPH_BB_BASE + (CFGR1_OFFSET * 32) + (USBITRMP_BitNumber * 4)) |
mbed_official | 125:23cc3068a9e4 | 83 | |
mbed_official | 125:23cc3068a9e4 | 84 | /* --- CFGR2 Register ---*/ |
mbed_official | 125:23cc3068a9e4 | 85 | /* Alias word address of BYP_ADDR_PAR bit */ |
mbed_official | 125:23cc3068a9e4 | 86 | #define CFGR2_OFFSET (SYSCFG_OFFSET + 0x18) |
mbed_official | 125:23cc3068a9e4 | 87 | #define BYPADDRPAR_BitNumber 0x04 |
mbed_official | 125:23cc3068a9e4 | 88 | #define CFGR1_BYPADDRPAR_BB (PERIPH_BB_BASE + (CFGR2_OFFSET * 32) + (BYPADDRPAR_BitNumber * 4)) |
mbed_official | 125:23cc3068a9e4 | 89 | |
mbed_official | 125:23cc3068a9e4 | 90 | /* Private macro -------------------------------------------------------------*/ |
mbed_official | 125:23cc3068a9e4 | 91 | /* Private variables ---------------------------------------------------------*/ |
mbed_official | 125:23cc3068a9e4 | 92 | /* Private function prototypes -----------------------------------------------*/ |
mbed_official | 125:23cc3068a9e4 | 93 | /* Private functions ---------------------------------------------------------*/ |
mbed_official | 125:23cc3068a9e4 | 94 | |
mbed_official | 125:23cc3068a9e4 | 95 | /** @defgroup SYSCFG_Private_Functions |
mbed_official | 125:23cc3068a9e4 | 96 | * @{ |
mbed_official | 125:23cc3068a9e4 | 97 | */ |
mbed_official | 125:23cc3068a9e4 | 98 | |
mbed_official | 125:23cc3068a9e4 | 99 | /** @defgroup SYSCFG_Group1 SYSCFG Initialization and Configuration functions |
mbed_official | 125:23cc3068a9e4 | 100 | * @brief SYSCFG Initialization and Configuration functions |
mbed_official | 125:23cc3068a9e4 | 101 | * |
mbed_official | 125:23cc3068a9e4 | 102 | @verbatim |
mbed_official | 125:23cc3068a9e4 | 103 | =============================================================================== |
mbed_official | 125:23cc3068a9e4 | 104 | ##### SYSCFG Initialization and Configuration functions ##### |
mbed_official | 125:23cc3068a9e4 | 105 | =============================================================================== |
mbed_official | 125:23cc3068a9e4 | 106 | |
mbed_official | 125:23cc3068a9e4 | 107 | @endverbatim |
mbed_official | 125:23cc3068a9e4 | 108 | * @{ |
mbed_official | 125:23cc3068a9e4 | 109 | */ |
mbed_official | 125:23cc3068a9e4 | 110 | |
mbed_official | 125:23cc3068a9e4 | 111 | /** |
mbed_official | 125:23cc3068a9e4 | 112 | * @brief Deinitializes the SYSCFG registers to their default reset values. |
mbed_official | 125:23cc3068a9e4 | 113 | * @param None |
mbed_official | 125:23cc3068a9e4 | 114 | * @retval None |
mbed_official | 125:23cc3068a9e4 | 115 | * @note MEM_MODE bits are not affected by APB reset. |
mbed_official | 125:23cc3068a9e4 | 116 | * MEM_MODE bits took the value from the user option bytes. |
mbed_official | 125:23cc3068a9e4 | 117 | */ |
mbed_official | 125:23cc3068a9e4 | 118 | void SYSCFG_DeInit(void) |
mbed_official | 125:23cc3068a9e4 | 119 | { |
mbed_official | 125:23cc3068a9e4 | 120 | /* Reset SYSCFG_CFGR1 register to reset value without affecting MEM_MODE bits */ |
mbed_official | 125:23cc3068a9e4 | 121 | SYSCFG->CFGR1 &= SYSCFG_CFGR1_MEM_MODE; |
mbed_official | 125:23cc3068a9e4 | 122 | /* Set FPU Interrupt Enable bits to default value */ |
mbed_official | 125:23cc3068a9e4 | 123 | SYSCFG->CFGR1 |= 0x7C000000; |
mbed_official | 125:23cc3068a9e4 | 124 | /* Reset RAM Write protection bits to default value */ |
mbed_official | 125:23cc3068a9e4 | 125 | SYSCFG->RCR = 0x00000000; |
mbed_official | 125:23cc3068a9e4 | 126 | /* Set EXTICRx registers to reset value */ |
mbed_official | 125:23cc3068a9e4 | 127 | SYSCFG->EXTICR[0] = 0; |
mbed_official | 125:23cc3068a9e4 | 128 | SYSCFG->EXTICR[1] = 0; |
mbed_official | 125:23cc3068a9e4 | 129 | SYSCFG->EXTICR[2] = 0; |
mbed_official | 125:23cc3068a9e4 | 130 | SYSCFG->EXTICR[3] = 0; |
mbed_official | 125:23cc3068a9e4 | 131 | /* Set CFGR2 register to reset value */ |
mbed_official | 125:23cc3068a9e4 | 132 | SYSCFG->CFGR2 = 0; |
mbed_official | 125:23cc3068a9e4 | 133 | /* Set CFGR3 register to reset value */ |
mbed_official | 125:23cc3068a9e4 | 134 | SYSCFG->CFGR3 = 0; |
mbed_official | 125:23cc3068a9e4 | 135 | } |
mbed_official | 125:23cc3068a9e4 | 136 | |
mbed_official | 125:23cc3068a9e4 | 137 | /** |
mbed_official | 125:23cc3068a9e4 | 138 | * @brief Configures the memory mapping at address 0x00000000. |
mbed_official | 125:23cc3068a9e4 | 139 | * @param SYSCFG_MemoryRemap: selects the memory remapping. |
mbed_official | 125:23cc3068a9e4 | 140 | * This parameter can be one of the following values: |
mbed_official | 125:23cc3068a9e4 | 141 | * @arg SYSCFG_MemoryRemap_Flash: Main Flash memory mapped at 0x00000000 |
mbed_official | 125:23cc3068a9e4 | 142 | * @arg SYSCFG_MemoryRemap_SystemMemory: System Flash memory mapped at 0x00000000 |
mbed_official | 125:23cc3068a9e4 | 143 | * @arg SYSCFG_MemoryRemap_SRAM: Embedded SRAM mapped at 0x00000000 |
mbed_official | 125:23cc3068a9e4 | 144 | * @retval None |
mbed_official | 125:23cc3068a9e4 | 145 | */ |
mbed_official | 125:23cc3068a9e4 | 146 | void SYSCFG_MemoryRemapConfig(uint32_t SYSCFG_MemoryRemap) |
mbed_official | 125:23cc3068a9e4 | 147 | { |
mbed_official | 125:23cc3068a9e4 | 148 | uint32_t tmpcfgr1 = 0; |
mbed_official | 125:23cc3068a9e4 | 149 | |
mbed_official | 125:23cc3068a9e4 | 150 | /* Check the parameter */ |
mbed_official | 125:23cc3068a9e4 | 151 | assert_param(IS_SYSCFG_MEMORY_REMAP(SYSCFG_MemoryRemap)); |
mbed_official | 125:23cc3068a9e4 | 152 | |
mbed_official | 125:23cc3068a9e4 | 153 | /* Get CFGR1 register value */ |
mbed_official | 125:23cc3068a9e4 | 154 | tmpcfgr1 = SYSCFG->CFGR1; |
mbed_official | 125:23cc3068a9e4 | 155 | |
mbed_official | 125:23cc3068a9e4 | 156 | /* Clear MEM_MODE bits */ |
mbed_official | 125:23cc3068a9e4 | 157 | tmpcfgr1 &= (uint32_t) (~SYSCFG_CFGR1_MEM_MODE); |
mbed_official | 125:23cc3068a9e4 | 158 | |
mbed_official | 125:23cc3068a9e4 | 159 | /* Set the new MEM_MODE bits value */ |
mbed_official | 125:23cc3068a9e4 | 160 | tmpcfgr1 |= (uint32_t) SYSCFG_MemoryRemap; |
mbed_official | 125:23cc3068a9e4 | 161 | |
mbed_official | 125:23cc3068a9e4 | 162 | /* Set CFGR1 register with the new memory remap configuration */ |
mbed_official | 125:23cc3068a9e4 | 163 | SYSCFG->CFGR1 = tmpcfgr1; |
mbed_official | 125:23cc3068a9e4 | 164 | } |
mbed_official | 125:23cc3068a9e4 | 165 | |
mbed_official | 125:23cc3068a9e4 | 166 | /** |
mbed_official | 125:23cc3068a9e4 | 167 | * @brief Configures the DMA channels remapping. |
mbed_official | 125:23cc3068a9e4 | 168 | * @param SYSCFG_DMARemap: selects the DMA channels remap. |
mbed_official | 125:23cc3068a9e4 | 169 | * This parameter can be one of the following values: |
mbed_official | 125:23cc3068a9e4 | 170 | * @arg SYSCFG_DMARemap_TIM17: Remap TIM17 DMA requests from DMA1 channel1 to channel2 |
mbed_official | 125:23cc3068a9e4 | 171 | * @arg SYSCFG_DMARemap_TIM16: Remap TIM16 DMA requests from DMA1 channel3 to channel4 |
mbed_official | 125:23cc3068a9e4 | 172 | * @arg SYSCFG_DMARemap_TIM6DAC1Ch1: Remap TIM6/DAC1 DMA requests from DMA2 channel 3 to DMA1 channel 3 |
mbed_official | 125:23cc3068a9e4 | 173 | * @arg SYSCFG_DMARemap_TIM7DAC1Ch2: Remap TIM7/DAC2 DMA requests from DMA2 channel 4 to DMA1 channel 4 |
mbed_official | 125:23cc3068a9e4 | 174 | * @arg SYSCFG_DMARemap_ADC2ADC4: Remap ADC2 and ADC4 DMA requests from DMA2 channel1/channel3 to channel3/channel4 |
mbed_official | 125:23cc3068a9e4 | 175 | * @arg SYSCFG_DMARemap_DAC2Ch1: Remap DAC2 DMA requests to DMA1 channel5 |
mbed_official | 125:23cc3068a9e4 | 176 | * @arg SYSCFG_DMARemapCh2_SPI1_RX: Remap SPI1 RX DMA1 CH2 requests |
mbed_official | 125:23cc3068a9e4 | 177 | * @arg SYSCFG_DMARemapCh4_SPI1_RX: Remap SPI1 RX DMA CH4 requests |
mbed_official | 125:23cc3068a9e4 | 178 | * @arg SYSCFG_DMARemapCh6_SPI1_RX: Remap SPI1 RX DMA CH6 requests |
mbed_official | 125:23cc3068a9e4 | 179 | * @arg SYSCFG_DMARemapCh3_SPI1_TX: Remap SPI1 TX DMA CH2 requests |
mbed_official | 125:23cc3068a9e4 | 180 | * @arg SYSCFG_DMARemapCh5_SPI1_TX: Remap SPI1 TX DMA CH5 requests |
mbed_official | 125:23cc3068a9e4 | 181 | * @arg SYSCFG_DMARemapCh7_SPI1_TX: Remap SPI1 TX DMA CH7 requests |
mbed_official | 125:23cc3068a9e4 | 182 | * @arg SYSCFG_DMARemapCh7_I2C1_RX: Remap I2C1 RX DMA CH7 requests |
mbed_official | 125:23cc3068a9e4 | 183 | * @arg SYSCFG_DMARemapCh3_I2C1_RX: Remap I2C1 RX DMA CH3 requests |
mbed_official | 125:23cc3068a9e4 | 184 | * @arg SYSCFG_DMARemapCh5_I2C1_RX: Remap I2C1 RX DMA CH5 requests |
mbed_official | 125:23cc3068a9e4 | 185 | * @arg SYSCFG_DMARemapCh6_I2C1_TX: Remap I2C1 TX DMA CH6 requests |
mbed_official | 125:23cc3068a9e4 | 186 | * @arg SYSCFG_DMARemapCh2_I2C1_TX: Remap I2C1 TX DMA CH2 requests |
mbed_official | 125:23cc3068a9e4 | 187 | * @arg SYSCFG_DMARemapCh4_I2C1_TX: Remap I2C1 TX DMA CH4 requests |
mbed_official | 125:23cc3068a9e4 | 188 | * @arg SYSCFG_DMARemapCh4_ADC2: Remap ADC2 DMA1 Ch4 requests |
mbed_official | 125:23cc3068a9e4 | 189 | * @arg SYSCFG_DMARemapCh2_ADC2: Remap ADC2 DMA1 Ch2 requests |
mbed_official | 125:23cc3068a9e4 | 190 | * @param NewState: new state of the DMA channel remapping. |
mbed_official | 125:23cc3068a9e4 | 191 | * This parameter can be: Enable or Disable. |
mbed_official | 125:23cc3068a9e4 | 192 | * @note When enabled, DMA channel of the selected peripheral is remapped |
mbed_official | 125:23cc3068a9e4 | 193 | * @note When disabled, Default DMA channel is mapped to the selected peripheral |
mbed_official | 125:23cc3068a9e4 | 194 | * @note |
mbed_official | 125:23cc3068a9e4 | 195 | * By default TIM17 DMA requests is mapped to channel 1 |
mbed_official | 125:23cc3068a9e4 | 196 | * use SYSCFG_DMAChannelRemapConfig(SYSCFG_DMARemap_TIM17, Enable) |
mbed_official | 125:23cc3068a9e4 | 197 | * to remap TIM17 DMA requests to DMA1 channel 2 |
mbed_official | 125:23cc3068a9e4 | 198 | * use SYSCFG_DMAChannelRemapConfig(SYSCFG_DMARemap_TIM17, Disable) |
mbed_official | 125:23cc3068a9e4 | 199 | * to map TIM17 DMA requests to DMA1 channel 1 (default mapping) |
mbed_official | 125:23cc3068a9e4 | 200 | * @retval None |
mbed_official | 125:23cc3068a9e4 | 201 | */ |
mbed_official | 125:23cc3068a9e4 | 202 | void SYSCFG_DMAChannelRemapConfig(uint32_t SYSCFG_DMARemap, FunctionalState NewState) |
mbed_official | 125:23cc3068a9e4 | 203 | { |
mbed_official | 125:23cc3068a9e4 | 204 | /* Check the parameters */ |
mbed_official | 125:23cc3068a9e4 | 205 | assert_param(IS_SYSCFG_DMA_REMAP(SYSCFG_DMARemap)); |
mbed_official | 125:23cc3068a9e4 | 206 | assert_param(IS_FUNCTIONAL_STATE(NewState)); |
mbed_official | 125:23cc3068a9e4 | 207 | |
mbed_official | 125:23cc3068a9e4 | 208 | if ((SYSCFG_DMARemap & 0x80000000)!= 0x80000000) |
mbed_official | 125:23cc3068a9e4 | 209 | { |
mbed_official | 125:23cc3068a9e4 | 210 | if (NewState != DISABLE) |
mbed_official | 125:23cc3068a9e4 | 211 | { |
mbed_official | 125:23cc3068a9e4 | 212 | /* Remap the DMA channel */ |
mbed_official | 125:23cc3068a9e4 | 213 | SYSCFG->CFGR1 |= (uint32_t)SYSCFG_DMARemap; |
mbed_official | 125:23cc3068a9e4 | 214 | } |
mbed_official | 125:23cc3068a9e4 | 215 | else |
mbed_official | 125:23cc3068a9e4 | 216 | { |
mbed_official | 125:23cc3068a9e4 | 217 | /* use the default DMA channel mapping */ |
mbed_official | 125:23cc3068a9e4 | 218 | SYSCFG->CFGR1 &= (uint32_t)(~SYSCFG_DMARemap); |
mbed_official | 125:23cc3068a9e4 | 219 | } |
mbed_official | 125:23cc3068a9e4 | 220 | } |
mbed_official | 125:23cc3068a9e4 | 221 | else |
mbed_official | 125:23cc3068a9e4 | 222 | { |
mbed_official | 125:23cc3068a9e4 | 223 | if (NewState != DISABLE) |
mbed_official | 125:23cc3068a9e4 | 224 | { |
mbed_official | 125:23cc3068a9e4 | 225 | /* Remap the DMA channel */ |
mbed_official | 125:23cc3068a9e4 | 226 | SYSCFG->CFGR3 |= (uint32_t)SYSCFG_DMARemap; |
mbed_official | 125:23cc3068a9e4 | 227 | } |
mbed_official | 125:23cc3068a9e4 | 228 | else |
mbed_official | 125:23cc3068a9e4 | 229 | { |
mbed_official | 125:23cc3068a9e4 | 230 | /* use the default DMA channel mapping */ |
mbed_official | 125:23cc3068a9e4 | 231 | SYSCFG->CFGR3 &= (uint32_t)(~SYSCFG_DMARemap); |
mbed_official | 125:23cc3068a9e4 | 232 | } |
mbed_official | 125:23cc3068a9e4 | 233 | } |
mbed_official | 125:23cc3068a9e4 | 234 | } |
mbed_official | 125:23cc3068a9e4 | 235 | |
mbed_official | 125:23cc3068a9e4 | 236 | /** |
mbed_official | 125:23cc3068a9e4 | 237 | * @brief Configures the remapping capabilities of DAC/TIM triggers. |
mbed_official | 125:23cc3068a9e4 | 238 | * @param SYSCFG_TriggerRemap: selects the trigger to be remapped. |
mbed_official | 125:23cc3068a9e4 | 239 | * This parameter can be one of the following values: |
mbed_official | 125:23cc3068a9e4 | 240 | * @arg SYSCFG_TriggerRemap_DACTIM3: Remap DAC trigger from TIM8 to TIM3 |
mbed_official | 125:23cc3068a9e4 | 241 | * @arg SYSCFG_TriggerRemap_TIM1TIM17: Remap TIM1 ITR3 from TIM4 TRGO to TIM17 OC |
mbed_official | 125:23cc3068a9e4 | 242 | * @arg SYSCFG_TriggerRemap_DACHRTIM1_TRIG1: Remap DAC trigger to HRTIM1 TRIG1 |
mbed_official | 125:23cc3068a9e4 | 243 | * @arg SYSCFG_TriggerRemap_DACHRTIM1_TRIG2: Remap DAC trigger to HRTIM1 TRIG2 |
mbed_official | 125:23cc3068a9e4 | 244 | * @param NewState: new state of the trigger mapping. |
mbed_official | 125:23cc3068a9e4 | 245 | * This parameter can be: ENABLE or DISABLE. |
mbed_official | 125:23cc3068a9e4 | 246 | * @note ENABLE: Enable fast mode plus driving capability for selected pin |
mbed_official | 125:23cc3068a9e4 | 247 | * @note DISABLE: Disable fast mode plus driving capability for selected pin |
mbed_official | 125:23cc3068a9e4 | 248 | * @retval None |
mbed_official | 125:23cc3068a9e4 | 249 | */ |
mbed_official | 125:23cc3068a9e4 | 250 | void SYSCFG_TriggerRemapConfig(uint32_t SYSCFG_TriggerRemap, FunctionalState NewState) |
mbed_official | 125:23cc3068a9e4 | 251 | { |
mbed_official | 125:23cc3068a9e4 | 252 | /* Check the parameters */ |
mbed_official | 125:23cc3068a9e4 | 253 | assert_param(IS_SYSCFG_TRIGGER_REMAP(SYSCFG_TriggerRemap)); |
mbed_official | 125:23cc3068a9e4 | 254 | assert_param(IS_FUNCTIONAL_STATE(NewState)); |
mbed_official | 125:23cc3068a9e4 | 255 | |
mbed_official | 125:23cc3068a9e4 | 256 | if ((SYSCFG_TriggerRemap & 0x80000000)!= 0x80000000) |
mbed_official | 125:23cc3068a9e4 | 257 | { |
mbed_official | 125:23cc3068a9e4 | 258 | if (NewState != DISABLE) |
mbed_official | 125:23cc3068a9e4 | 259 | { |
mbed_official | 125:23cc3068a9e4 | 260 | /* Remap the trigger */ |
mbed_official | 125:23cc3068a9e4 | 261 | SYSCFG->CFGR1 |= (uint32_t)SYSCFG_TriggerRemap; |
mbed_official | 125:23cc3068a9e4 | 262 | } |
mbed_official | 125:23cc3068a9e4 | 263 | else |
mbed_official | 125:23cc3068a9e4 | 264 | { |
mbed_official | 125:23cc3068a9e4 | 265 | /* Use the default trigger mapping */ |
mbed_official | 125:23cc3068a9e4 | 266 | SYSCFG->CFGR1 &= (uint32_t)(~SYSCFG_TriggerRemap); |
mbed_official | 125:23cc3068a9e4 | 267 | } |
mbed_official | 125:23cc3068a9e4 | 268 | } |
mbed_official | 125:23cc3068a9e4 | 269 | else |
mbed_official | 125:23cc3068a9e4 | 270 | { |
mbed_official | 125:23cc3068a9e4 | 271 | if (NewState != DISABLE) |
mbed_official | 125:23cc3068a9e4 | 272 | { |
mbed_official | 125:23cc3068a9e4 | 273 | /* Remap the trigger */ |
mbed_official | 125:23cc3068a9e4 | 274 | SYSCFG->CFGR3 |= (uint32_t)SYSCFG_TriggerRemap; |
mbed_official | 125:23cc3068a9e4 | 275 | } |
mbed_official | 125:23cc3068a9e4 | 276 | else |
mbed_official | 125:23cc3068a9e4 | 277 | { |
mbed_official | 125:23cc3068a9e4 | 278 | /* Use the default trigger mapping */ |
mbed_official | 125:23cc3068a9e4 | 279 | SYSCFG->CFGR3 &= (uint32_t)(~SYSCFG_TriggerRemap); |
mbed_official | 125:23cc3068a9e4 | 280 | } |
mbed_official | 125:23cc3068a9e4 | 281 | } |
mbed_official | 125:23cc3068a9e4 | 282 | } |
mbed_official | 125:23cc3068a9e4 | 283 | |
mbed_official | 125:23cc3068a9e4 | 284 | /** |
mbed_official | 125:23cc3068a9e4 | 285 | * @brief Configures the remapping capabilities of encoder mode. |
mbed_official | 125:23cc3068a9e4 | 286 | * @ note This feature implement the so-called M/T method for measuring speed |
mbed_official | 125:23cc3068a9e4 | 287 | * and position using quadrature encoders. |
mbed_official | 125:23cc3068a9e4 | 288 | * @param SYSCFG_EncoderRemap: selects the remap option for encoder mode. |
mbed_official | 125:23cc3068a9e4 | 289 | * This parameter can be one of the following values: |
mbed_official | 125:23cc3068a9e4 | 290 | * @arg SYSCFG_EncoderRemap_No: No remap |
mbed_official | 125:23cc3068a9e4 | 291 | * @arg SYSCFG_EncoderRemap_TIM2: Timer 2 IC1 and IC2 connected to TIM15 IC1 and IC2 |
mbed_official | 125:23cc3068a9e4 | 292 | * @arg SYSCFG_EncoderRemap_TIM3: Timer 3 IC1 and IC2 connected to TIM15 IC1 and IC2 |
mbed_official | 125:23cc3068a9e4 | 293 | * @arg SYSCFG_EncoderRemap_TIM4: Timer 4 IC1 and IC2 connected to TIM15 IC1 and IC2 |
mbed_official | 125:23cc3068a9e4 | 294 | * @retval None |
mbed_official | 125:23cc3068a9e4 | 295 | */ |
mbed_official | 125:23cc3068a9e4 | 296 | void SYSCFG_EncoderRemapConfig(uint32_t SYSCFG_EncoderRemap) |
mbed_official | 125:23cc3068a9e4 | 297 | { |
mbed_official | 125:23cc3068a9e4 | 298 | /* Check the parameter */ |
mbed_official | 125:23cc3068a9e4 | 299 | assert_param(IS_SYSCFG_ENCODER_REMAP(SYSCFG_EncoderRemap)); |
mbed_official | 125:23cc3068a9e4 | 300 | |
mbed_official | 125:23cc3068a9e4 | 301 | /* Reset the encoder mode remapping bits */ |
mbed_official | 125:23cc3068a9e4 | 302 | SYSCFG->CFGR1 &= (uint32_t)(~SYSCFG_CFGR1_ENCODER_MODE); |
mbed_official | 125:23cc3068a9e4 | 303 | |
mbed_official | 125:23cc3068a9e4 | 304 | /* Set the selected configuration */ |
mbed_official | 125:23cc3068a9e4 | 305 | SYSCFG->CFGR1 |= (uint32_t)(SYSCFG_EncoderRemap); |
mbed_official | 125:23cc3068a9e4 | 306 | } |
mbed_official | 125:23cc3068a9e4 | 307 | |
mbed_official | 125:23cc3068a9e4 | 308 | /** |
mbed_official | 125:23cc3068a9e4 | 309 | * @brief Remaps the USB interrupt lines. |
mbed_official | 125:23cc3068a9e4 | 310 | * @param NewState: new state of the mapping of USB interrupt lines. |
mbed_official | 125:23cc3068a9e4 | 311 | * This parameter can be: |
mbed_official | 125:23cc3068a9e4 | 312 | * @param ENABLE: Remap the USB interrupt line as following: |
mbed_official | 125:23cc3068a9e4 | 313 | * @arg USB Device High Priority (USB_HP) interrupt mapped to line 74. |
mbed_official | 125:23cc3068a9e4 | 314 | * @arg USB Device Low Priority (USB_LP) interrupt mapped to line 75. |
mbed_official | 125:23cc3068a9e4 | 315 | * @arg USB Wakeup Interrupt (USB_WKUP) interrupt mapped to line 76. |
mbed_official | 125:23cc3068a9e4 | 316 | * @param DISABLE: Use the default USB interrupt line: |
mbed_official | 125:23cc3068a9e4 | 317 | * @arg USB Device High Priority (USB_HP) interrupt mapped to line 19. |
mbed_official | 125:23cc3068a9e4 | 318 | * @arg USB Device Low Priority (USB_LP) interrupt mapped to line 20. |
mbed_official | 125:23cc3068a9e4 | 319 | * @arg USB Wakeup Interrupt (USB_WKUP) interrupt mapped to line 42. |
mbed_official | 125:23cc3068a9e4 | 320 | * @retval None |
mbed_official | 125:23cc3068a9e4 | 321 | */ |
mbed_official | 125:23cc3068a9e4 | 322 | void SYSCFG_USBInterruptLineRemapCmd(FunctionalState NewState) |
mbed_official | 125:23cc3068a9e4 | 323 | { |
mbed_official | 125:23cc3068a9e4 | 324 | /* Check the parameter */ |
mbed_official | 125:23cc3068a9e4 | 325 | assert_param(IS_FUNCTIONAL_STATE(NewState)); |
mbed_official | 125:23cc3068a9e4 | 326 | |
mbed_official | 125:23cc3068a9e4 | 327 | /* Remap the USB interupt lines */ |
mbed_official | 125:23cc3068a9e4 | 328 | *(__IO uint32_t *) CFGR1_USBITRMP_BB = (uint32_t)NewState; |
mbed_official | 125:23cc3068a9e4 | 329 | } |
mbed_official | 125:23cc3068a9e4 | 330 | |
mbed_official | 125:23cc3068a9e4 | 331 | /** |
mbed_official | 125:23cc3068a9e4 | 332 | * @brief Configures the I2C fast mode plus driving capability. |
mbed_official | 125:23cc3068a9e4 | 333 | * @param SYSCFG_I2CFastModePlus: selects the pin. |
mbed_official | 125:23cc3068a9e4 | 334 | * This parameter can be one of the following values: |
mbed_official | 125:23cc3068a9e4 | 335 | * @arg SYSCFG_I2CFastModePlus_PB6: Configure fast mode plus driving capability for PB6 |
mbed_official | 125:23cc3068a9e4 | 336 | * @arg SYSCFG_I2CFastModePlus_PB7: Configure fast mode plus driving capability for PB7 |
mbed_official | 125:23cc3068a9e4 | 337 | * @arg SYSCFG_I2CFastModePlus_PB8: Configure fast mode plus driving capability for PB8 |
mbed_official | 125:23cc3068a9e4 | 338 | * @arg SYSCFG_I2CFastModePlus_PB9: Configure fast mode plus driving capability for PB9 |
mbed_official | 125:23cc3068a9e4 | 339 | * @arg SYSCFG_I2CFastModePlus_I2C1: Configure fast mode plus driving capability for I2C1 pins |
mbed_official | 125:23cc3068a9e4 | 340 | * @arg SYSCFG_I2CFastModePlus_I2C2: Configure fast mode plus driving capability for I2C2 pins |
mbed_official | 125:23cc3068a9e4 | 341 | * @param NewState: new state of the DMA channel remapping. |
mbed_official | 125:23cc3068a9e4 | 342 | * This parameter can be: |
mbed_official | 125:23cc3068a9e4 | 343 | * @arg ENABLE: Enable fast mode plus driving capability for selected I2C pin |
mbed_official | 125:23cc3068a9e4 | 344 | * @arg DISABLE: Disable fast mode plus driving capability for selected I2C pin |
mbed_official | 125:23cc3068a9e4 | 345 | * @note For I2C1, fast mode plus driving capability can be enabled on all selected |
mbed_official | 125:23cc3068a9e4 | 346 | * I2C1 pins using SYSCFG_I2CFastModePlus_I2C1 parameter or independently |
mbed_official | 125:23cc3068a9e4 | 347 | * on each one of the following pins PB6, PB7, PB8 and PB9. |
mbed_official | 125:23cc3068a9e4 | 348 | * @note For remaing I2C1 pins (PA14, PA15...) fast mode plus driving capability |
mbed_official | 125:23cc3068a9e4 | 349 | * can be enabled only by using SYSCFG_I2CFastModePlus_I2C1 parameter. |
mbed_official | 125:23cc3068a9e4 | 350 | * @note For all I2C2 pins fast mode plus driving capability can be enabled |
mbed_official | 125:23cc3068a9e4 | 351 | * only by using SYSCFG_I2CFastModePlus_I2C2 parameter. |
mbed_official | 125:23cc3068a9e4 | 352 | * @retval None |
mbed_official | 125:23cc3068a9e4 | 353 | */ |
mbed_official | 125:23cc3068a9e4 | 354 | void SYSCFG_I2CFastModePlusConfig(uint32_t SYSCFG_I2CFastModePlus, FunctionalState NewState) |
mbed_official | 125:23cc3068a9e4 | 355 | { |
mbed_official | 125:23cc3068a9e4 | 356 | /* Check the parameters */ |
mbed_official | 125:23cc3068a9e4 | 357 | assert_param(IS_SYSCFG_I2C_FMP(SYSCFG_I2CFastModePlus)); |
mbed_official | 125:23cc3068a9e4 | 358 | assert_param(IS_FUNCTIONAL_STATE(NewState)); |
mbed_official | 125:23cc3068a9e4 | 359 | |
mbed_official | 125:23cc3068a9e4 | 360 | if (NewState != DISABLE) |
mbed_official | 125:23cc3068a9e4 | 361 | { |
mbed_official | 125:23cc3068a9e4 | 362 | /* Enable fast mode plus driving capability for selected I2C pin */ |
mbed_official | 125:23cc3068a9e4 | 363 | SYSCFG->CFGR1 |= (uint32_t)SYSCFG_I2CFastModePlus; |
mbed_official | 125:23cc3068a9e4 | 364 | } |
mbed_official | 125:23cc3068a9e4 | 365 | else |
mbed_official | 125:23cc3068a9e4 | 366 | { |
mbed_official | 125:23cc3068a9e4 | 367 | /* Disable fast mode plus driving capability for selected I2C pin */ |
mbed_official | 125:23cc3068a9e4 | 368 | SYSCFG->CFGR1 &= (uint32_t)(~SYSCFG_I2CFastModePlus); |
mbed_official | 125:23cc3068a9e4 | 369 | } |
mbed_official | 125:23cc3068a9e4 | 370 | } |
mbed_official | 125:23cc3068a9e4 | 371 | |
mbed_official | 125:23cc3068a9e4 | 372 | /** |
mbed_official | 125:23cc3068a9e4 | 373 | * @brief Enables or disables the selected SYSCFG interrupts. |
mbed_official | 125:23cc3068a9e4 | 374 | * @param SYSCFG_IT: specifies the SYSCFG interrupt sources to be enabled or disabled. |
mbed_official | 125:23cc3068a9e4 | 375 | * This parameter can be one of the following values: |
mbed_official | 125:23cc3068a9e4 | 376 | * @arg SYSCFG_IT_IXC: Inexact Interrupt |
mbed_official | 125:23cc3068a9e4 | 377 | * @arg SYSCFG_IT_IDC: Input denormal Interrupt |
mbed_official | 125:23cc3068a9e4 | 378 | * @arg SYSCFG_IT_OFC: Overflow Interrupt |
mbed_official | 125:23cc3068a9e4 | 379 | * @arg SYSCFG_IT_UFC: Underflow Interrupt |
mbed_official | 125:23cc3068a9e4 | 380 | * @arg SYSCFG_IT_DZC: Divide-by-zero Interrupt |
mbed_official | 125:23cc3068a9e4 | 381 | * @arg SYSCFG_IT_IOC: Invalid operation Interrupt |
mbed_official | 125:23cc3068a9e4 | 382 | * @param NewState: new state of the specified SYSCFG interrupts. |
mbed_official | 125:23cc3068a9e4 | 383 | * This parameter can be: ENABLE or DISABLE. |
mbed_official | 125:23cc3068a9e4 | 384 | * @retval None |
mbed_official | 125:23cc3068a9e4 | 385 | */ |
mbed_official | 125:23cc3068a9e4 | 386 | void SYSCFG_ITConfig(uint32_t SYSCFG_IT, FunctionalState NewState) |
mbed_official | 125:23cc3068a9e4 | 387 | { |
mbed_official | 125:23cc3068a9e4 | 388 | /* Check the parameters */ |
mbed_official | 125:23cc3068a9e4 | 389 | assert_param(IS_FUNCTIONAL_STATE(NewState)); |
mbed_official | 125:23cc3068a9e4 | 390 | assert_param(IS_SYSCFG_IT(SYSCFG_IT)); |
mbed_official | 125:23cc3068a9e4 | 391 | |
mbed_official | 125:23cc3068a9e4 | 392 | if (NewState != DISABLE) |
mbed_official | 125:23cc3068a9e4 | 393 | { |
mbed_official | 125:23cc3068a9e4 | 394 | /* Enable the selected SYSCFG interrupts */ |
mbed_official | 125:23cc3068a9e4 | 395 | SYSCFG->CFGR1 |= SYSCFG_IT; |
mbed_official | 125:23cc3068a9e4 | 396 | } |
mbed_official | 125:23cc3068a9e4 | 397 | else |
mbed_official | 125:23cc3068a9e4 | 398 | { |
mbed_official | 125:23cc3068a9e4 | 399 | /* Disable the selected SYSCFG interrupts */ |
mbed_official | 125:23cc3068a9e4 | 400 | SYSCFG->CFGR1 &= ((uint32_t)~SYSCFG_IT); |
mbed_official | 125:23cc3068a9e4 | 401 | } |
mbed_official | 125:23cc3068a9e4 | 402 | } |
mbed_official | 125:23cc3068a9e4 | 403 | |
mbed_official | 125:23cc3068a9e4 | 404 | /** |
mbed_official | 125:23cc3068a9e4 | 405 | * @brief Selects the GPIO pin used as EXTI Line. |
mbed_official | 125:23cc3068a9e4 | 406 | * @param EXTI_PortSourceGPIOx : selects the GPIO port to be used as source |
mbed_official | 125:23cc3068a9e4 | 407 | * for EXTI lines where x can be (A, B, C, D, E or F). |
mbed_official | 125:23cc3068a9e4 | 408 | * @param EXTI_PinSourcex: specifies the EXTI line to be configured. |
mbed_official | 125:23cc3068a9e4 | 409 | * This parameter can be EXTI_PinSourcex where x can be (0..15) |
mbed_official | 125:23cc3068a9e4 | 410 | * @retval None |
mbed_official | 125:23cc3068a9e4 | 411 | */ |
mbed_official | 125:23cc3068a9e4 | 412 | void SYSCFG_EXTILineConfig(uint8_t EXTI_PortSourceGPIOx, uint8_t EXTI_PinSourcex) |
mbed_official | 125:23cc3068a9e4 | 413 | { |
mbed_official | 125:23cc3068a9e4 | 414 | uint32_t tmp = 0x00; |
mbed_official | 125:23cc3068a9e4 | 415 | |
mbed_official | 125:23cc3068a9e4 | 416 | /* Check the parameters */ |
mbed_official | 125:23cc3068a9e4 | 417 | assert_param(IS_EXTI_PORT_SOURCE(EXTI_PortSourceGPIOx)); |
mbed_official | 125:23cc3068a9e4 | 418 | assert_param(IS_EXTI_PIN_SOURCE(EXTI_PinSourcex)); |
mbed_official | 125:23cc3068a9e4 | 419 | |
mbed_official | 125:23cc3068a9e4 | 420 | tmp = ((uint32_t)0x0F) << (0x04 * (EXTI_PinSourcex & (uint8_t)0x03)); |
mbed_official | 125:23cc3068a9e4 | 421 | SYSCFG->EXTICR[EXTI_PinSourcex >> 0x02] &= ~tmp; |
mbed_official | 125:23cc3068a9e4 | 422 | SYSCFG->EXTICR[EXTI_PinSourcex >> 0x02] |= (((uint32_t)EXTI_PortSourceGPIOx) << (0x04 * (EXTI_PinSourcex & (uint8_t)0x03))); |
mbed_official | 125:23cc3068a9e4 | 423 | } |
mbed_official | 125:23cc3068a9e4 | 424 | |
mbed_official | 125:23cc3068a9e4 | 425 | /** |
mbed_official | 125:23cc3068a9e4 | 426 | * @brief Connects the selected parameter to the break input of TIM1. |
mbed_official | 125:23cc3068a9e4 | 427 | * @note The selected configuration is locked and can be unlocked by system reset |
mbed_official | 125:23cc3068a9e4 | 428 | * @param SYSCFG_Break: selects the configuration to be connected to break |
mbed_official | 125:23cc3068a9e4 | 429 | * input of TIM1 |
mbed_official | 125:23cc3068a9e4 | 430 | * This parameter can be any combination of the following values: |
mbed_official | 125:23cc3068a9e4 | 431 | * @arg SYSCFG_Break_PVD: PVD interrupt is connected to the break input of TIM1. |
mbed_official | 125:23cc3068a9e4 | 432 | * @arg SYSCFG_Break_SRAMParity: SRAM Parity error is connected to the break input of TIM1. |
mbed_official | 125:23cc3068a9e4 | 433 | * @arg SYSCFG_Break_HardFault: Lockup output of CortexM4 is connected to the break input of TIM1. |
mbed_official | 125:23cc3068a9e4 | 434 | * @retval None |
mbed_official | 125:23cc3068a9e4 | 435 | */ |
mbed_official | 125:23cc3068a9e4 | 436 | void SYSCFG_BreakConfig(uint32_t SYSCFG_Break) |
mbed_official | 125:23cc3068a9e4 | 437 | { |
mbed_official | 125:23cc3068a9e4 | 438 | /* Check the parameter */ |
mbed_official | 125:23cc3068a9e4 | 439 | assert_param(IS_SYSCFG_LOCK_CONFIG(SYSCFG_Break)); |
mbed_official | 125:23cc3068a9e4 | 440 | |
mbed_official | 125:23cc3068a9e4 | 441 | SYSCFG->CFGR2 |= (uint32_t) SYSCFG_Break; |
mbed_official | 125:23cc3068a9e4 | 442 | } |
mbed_official | 125:23cc3068a9e4 | 443 | |
mbed_official | 125:23cc3068a9e4 | 444 | /** |
mbed_official | 125:23cc3068a9e4 | 445 | * @brief Disables the parity check on RAM. |
mbed_official | 125:23cc3068a9e4 | 446 | * @note Disabling the parity check on RAM locks the configuration bit. |
mbed_official | 125:23cc3068a9e4 | 447 | * To re-enable the parity check on RAM perform a system reset. |
mbed_official | 125:23cc3068a9e4 | 448 | * @param None |
mbed_official | 125:23cc3068a9e4 | 449 | * @retval None |
mbed_official | 125:23cc3068a9e4 | 450 | */ |
mbed_official | 125:23cc3068a9e4 | 451 | void SYSCFG_BypassParityCheckDisable(void) |
mbed_official | 125:23cc3068a9e4 | 452 | { |
mbed_official | 125:23cc3068a9e4 | 453 | /* Disable the adddress parity check on RAM */ |
mbed_official | 125:23cc3068a9e4 | 454 | *(__IO uint32_t *) CFGR1_BYPADDRPAR_BB = (uint32_t)0x00000001; |
mbed_official | 125:23cc3068a9e4 | 455 | } |
mbed_official | 125:23cc3068a9e4 | 456 | |
mbed_official | 125:23cc3068a9e4 | 457 | /** |
mbed_official | 125:23cc3068a9e4 | 458 | * @brief Enables the ICODE SRAM write protection. |
mbed_official | 125:23cc3068a9e4 | 459 | * @note Enabling the ICODE SRAM write protection locks the configuration bit. |
mbed_official | 125:23cc3068a9e4 | 460 | * To disable the ICODE SRAM write protection perform a system reset. |
mbed_official | 125:23cc3068a9e4 | 461 | * @param None |
mbed_official | 125:23cc3068a9e4 | 462 | * @retval None |
mbed_official | 125:23cc3068a9e4 | 463 | */ |
mbed_official | 125:23cc3068a9e4 | 464 | void SYSCFG_SRAMWRPEnable(uint32_t SYSCFG_SRAMWRP) |
mbed_official | 125:23cc3068a9e4 | 465 | { |
mbed_official | 125:23cc3068a9e4 | 466 | /* Check the parameter */ |
mbed_official | 125:23cc3068a9e4 | 467 | assert_param(IS_SYSCFG_PAGE(SYSCFG_SRAMWRP)); |
mbed_official | 125:23cc3068a9e4 | 468 | |
mbed_official | 125:23cc3068a9e4 | 469 | /* Enable the write-protection on the selected ICODE SRAM page */ |
mbed_official | 125:23cc3068a9e4 | 470 | SYSCFG->RCR |= (uint32_t)SYSCFG_SRAMWRP; |
mbed_official | 125:23cc3068a9e4 | 471 | } |
mbed_official | 125:23cc3068a9e4 | 472 | |
mbed_official | 125:23cc3068a9e4 | 473 | /** |
mbed_official | 125:23cc3068a9e4 | 474 | * @brief Checks whether the specified SYSCFG flag is set or not. |
mbed_official | 125:23cc3068a9e4 | 475 | * @param SYSCFG_Flag: specifies the SYSCFG flag to check. |
mbed_official | 125:23cc3068a9e4 | 476 | * This parameter can be one of the following values: |
mbed_official | 125:23cc3068a9e4 | 477 | * @arg SYSCFG_FLAG_PE: SRAM parity error flag. |
mbed_official | 125:23cc3068a9e4 | 478 | * @retval The new state of SYSCFG_Flag (SET or RESET). |
mbed_official | 125:23cc3068a9e4 | 479 | */ |
mbed_official | 125:23cc3068a9e4 | 480 | FlagStatus SYSCFG_GetFlagStatus(uint32_t SYSCFG_Flag) |
mbed_official | 125:23cc3068a9e4 | 481 | { |
mbed_official | 125:23cc3068a9e4 | 482 | FlagStatus bitstatus = RESET; |
mbed_official | 125:23cc3068a9e4 | 483 | |
mbed_official | 125:23cc3068a9e4 | 484 | /* Check the parameter */ |
mbed_official | 125:23cc3068a9e4 | 485 | assert_param(IS_SYSCFG_FLAG(SYSCFG_Flag)); |
mbed_official | 125:23cc3068a9e4 | 486 | |
mbed_official | 125:23cc3068a9e4 | 487 | /* Check the status of the specified SPI flag */ |
mbed_official | 125:23cc3068a9e4 | 488 | if ((SYSCFG->CFGR2 & SYSCFG_CFGR2_SRAM_PE) != (uint32_t)RESET) |
mbed_official | 125:23cc3068a9e4 | 489 | { |
mbed_official | 125:23cc3068a9e4 | 490 | /* SYSCFG_Flag is set */ |
mbed_official | 125:23cc3068a9e4 | 491 | bitstatus = SET; |
mbed_official | 125:23cc3068a9e4 | 492 | } |
mbed_official | 125:23cc3068a9e4 | 493 | else |
mbed_official | 125:23cc3068a9e4 | 494 | { |
mbed_official | 125:23cc3068a9e4 | 495 | /* SYSCFG_Flag is reset */ |
mbed_official | 125:23cc3068a9e4 | 496 | bitstatus = RESET; |
mbed_official | 125:23cc3068a9e4 | 497 | } |
mbed_official | 125:23cc3068a9e4 | 498 | /* Return the SYSCFG_Flag status */ |
mbed_official | 125:23cc3068a9e4 | 499 | return bitstatus; |
mbed_official | 125:23cc3068a9e4 | 500 | } |
mbed_official | 125:23cc3068a9e4 | 501 | |
mbed_official | 125:23cc3068a9e4 | 502 | /** |
mbed_official | 125:23cc3068a9e4 | 503 | * @brief Clears the selected SYSCFG flag. |
mbed_official | 125:23cc3068a9e4 | 504 | * @param SYSCFG_Flag: selects the flag to be cleared. |
mbed_official | 125:23cc3068a9e4 | 505 | * This parameter can be any combination of the following values: |
mbed_official | 125:23cc3068a9e4 | 506 | * @arg SYSCFG_FLAG_PE: SRAM parity error flag. |
mbed_official | 125:23cc3068a9e4 | 507 | * @retval None |
mbed_official | 125:23cc3068a9e4 | 508 | */ |
mbed_official | 125:23cc3068a9e4 | 509 | void SYSCFG_ClearFlag(uint32_t SYSCFG_Flag) |
mbed_official | 125:23cc3068a9e4 | 510 | { |
mbed_official | 125:23cc3068a9e4 | 511 | /* Check the parameter */ |
mbed_official | 125:23cc3068a9e4 | 512 | assert_param(IS_SYSCFG_FLAG(SYSCFG_Flag)); |
mbed_official | 125:23cc3068a9e4 | 513 | |
mbed_official | 125:23cc3068a9e4 | 514 | SYSCFG->CFGR2 |= (uint32_t) SYSCFG_Flag; |
mbed_official | 125:23cc3068a9e4 | 515 | } |
mbed_official | 125:23cc3068a9e4 | 516 | |
mbed_official | 125:23cc3068a9e4 | 517 | /** |
mbed_official | 125:23cc3068a9e4 | 518 | * @} |
mbed_official | 125:23cc3068a9e4 | 519 | */ |
mbed_official | 125:23cc3068a9e4 | 520 | |
mbed_official | 125:23cc3068a9e4 | 521 | /** |
mbed_official | 125:23cc3068a9e4 | 522 | * @} |
mbed_official | 125:23cc3068a9e4 | 523 | */ |
mbed_official | 125:23cc3068a9e4 | 524 | |
mbed_official | 125:23cc3068a9e4 | 525 | /** |
mbed_official | 125:23cc3068a9e4 | 526 | * @} |
mbed_official | 125:23cc3068a9e4 | 527 | */ |
mbed_official | 125:23cc3068a9e4 | 528 | |
mbed_official | 125:23cc3068a9e4 | 529 | /** |
mbed_official | 125:23cc3068a9e4 | 530 | * @} |
mbed_official | 125:23cc3068a9e4 | 531 | */ |
mbed_official | 125:23cc3068a9e4 | 532 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |
mbed_official | 125:23cc3068a9e4 | 533 |