Repostiory containing DAPLink source code with Reset Pin workaround for HANI_IOT board.

Upstream: https://github.com/ARMmbed/DAPLink

Committer:
Pawel Zarembski
Date:
Tue Apr 07 12:55:42 2020 +0200
Revision:
0:01f31e923fe2
hani: DAPLink with reset workaround

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Pawel Zarembski 0:01f31e923fe2 1 /**
Pawel Zarembski 0:01f31e923fe2 2 ******************************************************************************
Pawel Zarembski 0:01f31e923fe2 3 * @file stm32f1xx.h
Pawel Zarembski 0:01f31e923fe2 4 * @author MCD Application Team
Pawel Zarembski 0:01f31e923fe2 5 * @version V4.1.0
Pawel Zarembski 0:01f31e923fe2 6 * @date 29-April-2016
Pawel Zarembski 0:01f31e923fe2 7 * @brief CMSIS STM32F1xx Device Peripheral Access Layer Header File.
Pawel Zarembski 0:01f31e923fe2 8 *
Pawel Zarembski 0:01f31e923fe2 9 * The file is the unique include file that the application programmer
Pawel Zarembski 0:01f31e923fe2 10 * is using in the C source code, usually in main.c. This file contains:
Pawel Zarembski 0:01f31e923fe2 11 * - Configuration section that allows to select:
Pawel Zarembski 0:01f31e923fe2 12 * - The STM32F1xx device used in the target application
Pawel Zarembski 0:01f31e923fe2 13 * - To use or not the peripheral’s drivers in application code(i.e.
Pawel Zarembski 0:01f31e923fe2 14 * code will be based on direct access to peripheral’s registers
Pawel Zarembski 0:01f31e923fe2 15 * rather than drivers API), this option is controlled by
Pawel Zarembski 0:01f31e923fe2 16 * "#define USE_HAL_DRIVER"
Pawel Zarembski 0:01f31e923fe2 17 *
Pawel Zarembski 0:01f31e923fe2 18 ******************************************************************************
Pawel Zarembski 0:01f31e923fe2 19 * @attention
Pawel Zarembski 0:01f31e923fe2 20 *
Pawel Zarembski 0:01f31e923fe2 21 * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
Pawel Zarembski 0:01f31e923fe2 22 *
Pawel Zarembski 0:01f31e923fe2 23 * Redistribution and use in source and binary forms, with or without modification,
Pawel Zarembski 0:01f31e923fe2 24 * are permitted provided that the following conditions are met:
Pawel Zarembski 0:01f31e923fe2 25 * 1. Redistributions of source code must retain the above copyright notice,
Pawel Zarembski 0:01f31e923fe2 26 * this list of conditions and the following disclaimer.
Pawel Zarembski 0:01f31e923fe2 27 * 2. Redistributions in binary form must reproduce the above copyright notice,
Pawel Zarembski 0:01f31e923fe2 28 * this list of conditions and the following disclaimer in the documentation
Pawel Zarembski 0:01f31e923fe2 29 * and/or other materials provided with the distribution.
Pawel Zarembski 0:01f31e923fe2 30 * 3. Neither the name of STMicroelectronics nor the names of its contributors
Pawel Zarembski 0:01f31e923fe2 31 * may be used to endorse or promote products derived from this software
Pawel Zarembski 0:01f31e923fe2 32 * without specific prior written permission.
Pawel Zarembski 0:01f31e923fe2 33 *
Pawel Zarembski 0:01f31e923fe2 34 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
Pawel Zarembski 0:01f31e923fe2 35 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Pawel Zarembski 0:01f31e923fe2 36 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
Pawel Zarembski 0:01f31e923fe2 37 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
Pawel Zarembski 0:01f31e923fe2 38 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
Pawel Zarembski 0:01f31e923fe2 39 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
Pawel Zarembski 0:01f31e923fe2 40 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
Pawel Zarembski 0:01f31e923fe2 41 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
Pawel Zarembski 0:01f31e923fe2 42 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Pawel Zarembski 0:01f31e923fe2 43 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Pawel Zarembski 0:01f31e923fe2 44 *
Pawel Zarembski 0:01f31e923fe2 45 ******************************************************************************
Pawel Zarembski 0:01f31e923fe2 46 */
Pawel Zarembski 0:01f31e923fe2 47
Pawel Zarembski 0:01f31e923fe2 48 /** @addtogroup CMSIS
Pawel Zarembski 0:01f31e923fe2 49 * @{
Pawel Zarembski 0:01f31e923fe2 50 */
Pawel Zarembski 0:01f31e923fe2 51
Pawel Zarembski 0:01f31e923fe2 52 /** @addtogroup stm32f1xx
Pawel Zarembski 0:01f31e923fe2 53 * @{
Pawel Zarembski 0:01f31e923fe2 54 */
Pawel Zarembski 0:01f31e923fe2 55
Pawel Zarembski 0:01f31e923fe2 56 #ifndef __STM32F1XX_H
Pawel Zarembski 0:01f31e923fe2 57 #define __STM32F1XX_H
Pawel Zarembski 0:01f31e923fe2 58
Pawel Zarembski 0:01f31e923fe2 59 #ifdef __cplusplus
Pawel Zarembski 0:01f31e923fe2 60 extern "C" {
Pawel Zarembski 0:01f31e923fe2 61 #endif /* __cplusplus */
Pawel Zarembski 0:01f31e923fe2 62
Pawel Zarembski 0:01f31e923fe2 63 /** @addtogroup Library_configuration_section
Pawel Zarembski 0:01f31e923fe2 64 * @{
Pawel Zarembski 0:01f31e923fe2 65 */
Pawel Zarembski 0:01f31e923fe2 66
Pawel Zarembski 0:01f31e923fe2 67 /**
Pawel Zarembski 0:01f31e923fe2 68 * @brief STM32 Family
Pawel Zarembski 0:01f31e923fe2 69 */
Pawel Zarembski 0:01f31e923fe2 70 #if !defined (STM32F1)
Pawel Zarembski 0:01f31e923fe2 71 #define STM32F1
Pawel Zarembski 0:01f31e923fe2 72 #endif /* STM32F1 */
Pawel Zarembski 0:01f31e923fe2 73
Pawel Zarembski 0:01f31e923fe2 74 /* Uncomment the line below according to the target STM32L device used in your
Pawel Zarembski 0:01f31e923fe2 75 application
Pawel Zarembski 0:01f31e923fe2 76 */
Pawel Zarembski 0:01f31e923fe2 77
Pawel Zarembski 0:01f31e923fe2 78 #if !defined (STM32F100xB) && !defined (STM32F100xE) && !defined (STM32F101x6) && \
Pawel Zarembski 0:01f31e923fe2 79 !defined (STM32F101xB) && !defined (STM32F101xE) && !defined (STM32F101xG) && !defined (STM32F102x6) && !defined (STM32F102xB) && !defined (STM32F103x6) && \
Pawel Zarembski 0:01f31e923fe2 80 !defined (STM32F103xB) && !defined (STM32F103xE) && !defined (STM32F103xG) && !defined (STM32F105xC) && !defined (STM32F107xC)
Pawel Zarembski 0:01f31e923fe2 81 /* #define STM32F100xB */ /*!< STM32F100C4, STM32F100R4, STM32F100C6, STM32F100R6, STM32F100C8, STM32F100R8, STM32F100V8, STM32F100CB, STM32F100RB and STM32F100VB */
Pawel Zarembski 0:01f31e923fe2 82 /* #define STM32F100xE */ /*!< STM32F100RC, STM32F100VC, STM32F100ZC, STM32F100RD, STM32F100VD, STM32F100ZD, STM32F100RE, STM32F100VE and STM32F100ZE */
Pawel Zarembski 0:01f31e923fe2 83 /* #define STM32F101x6 */ /*!< STM32F101C4, STM32F101R4, STM32F101T4, STM32F101C6, STM32F101R6 and STM32F101T6 Devices */
Pawel Zarembski 0:01f31e923fe2 84 /* #define STM32F101xB */ /*!< STM32F101C8, STM32F101R8, STM32F101T8, STM32F101V8, STM32F101CB, STM32F101RB, STM32F101TB and STM32F101VB */
Pawel Zarembski 0:01f31e923fe2 85 /* #define STM32F101xE */ /*!< STM32F101RC, STM32F101VC, STM32F101ZC, STM32F101RD, STM32F101VD, STM32F101ZD, STM32F101RE, STM32F101VE and STM32F101ZE */
Pawel Zarembski 0:01f31e923fe2 86 /* #define STM32F101xG */ /*!< STM32F101RF, STM32F101VF, STM32F101ZF, STM32F101RG, STM32F101VG and STM32F101ZG */
Pawel Zarembski 0:01f31e923fe2 87 /* #define STM32F102x6 */ /*!< STM32F102C4, STM32F102R4, STM32F102C6 and STM32F102R6 */
Pawel Zarembski 0:01f31e923fe2 88 /* #define STM32F102xB */ /*!< STM32F102C8, STM32F102R8, STM32F102CB and STM32F102RB */
Pawel Zarembski 0:01f31e923fe2 89 /* #define STM32F103x6 */ /*!< STM32F103C4, STM32F103R4, STM32F103T4, STM32F103C6, STM32F103R6 and STM32F103T6 */
Pawel Zarembski 0:01f31e923fe2 90 /* #define STM32F103xB */ /*!< STM32F103C8, STM32F103R8, STM32F103T8, STM32F103V8, STM32F103CB, STM32F103RB, STM32F103TB and STM32F103VB */
Pawel Zarembski 0:01f31e923fe2 91 /* #define STM32F103xE */ /*!< STM32F103RC, STM32F103VC, STM32F103ZC, STM32F103RD, STM32F103VD, STM32F103ZD, STM32F103RE, STM32F103VE and STM32F103ZE */
Pawel Zarembski 0:01f31e923fe2 92 /* #define STM32F103xG */ /*!< STM32F103RF, STM32F103VF, STM32F103ZF, STM32F103RG, STM32F103VG and STM32F103ZG */
Pawel Zarembski 0:01f31e923fe2 93 /* #define STM32F105xC */ /*!< STM32F105R8, STM32F105V8, STM32F105RB, STM32F105VB, STM32F105RC and STM32F105VC */
Pawel Zarembski 0:01f31e923fe2 94 /* #define STM32F107xC */ /*!< STM32F107RB, STM32F107VB, STM32F107RC and STM32F107VC */
Pawel Zarembski 0:01f31e923fe2 95 #endif
Pawel Zarembski 0:01f31e923fe2 96
Pawel Zarembski 0:01f31e923fe2 97 /* Tip: To avoid modifying this file each time you need to switch between these
Pawel Zarembski 0:01f31e923fe2 98 devices, you can define the device in your toolchain compiler preprocessor.
Pawel Zarembski 0:01f31e923fe2 99 */
Pawel Zarembski 0:01f31e923fe2 100
Pawel Zarembski 0:01f31e923fe2 101 #if !defined (USE_HAL_DRIVER)
Pawel Zarembski 0:01f31e923fe2 102 /**
Pawel Zarembski 0:01f31e923fe2 103 * @brief Comment the line below if you will not use the peripherals drivers.
Pawel Zarembski 0:01f31e923fe2 104 In this case, these drivers will not be included and the application code will
Pawel Zarembski 0:01f31e923fe2 105 be based on direct access to peripherals registers
Pawel Zarembski 0:01f31e923fe2 106 */
Pawel Zarembski 0:01f31e923fe2 107 /*#define USE_HAL_DRIVER */
Pawel Zarembski 0:01f31e923fe2 108 #endif /* USE_HAL_DRIVER */
Pawel Zarembski 0:01f31e923fe2 109
Pawel Zarembski 0:01f31e923fe2 110 /**
Pawel Zarembski 0:01f31e923fe2 111 * @brief CMSIS Device version number
Pawel Zarembski 0:01f31e923fe2 112 */
Pawel Zarembski 0:01f31e923fe2 113 #define __STM32F1_CMSIS_VERSION_MAIN (0x04) /*!< [31:24] main version */
Pawel Zarembski 0:01f31e923fe2 114 #define __STM32F1_CMSIS_VERSION_SUB1 (0x01) /*!< [23:16] sub1 version */
Pawel Zarembski 0:01f31e923fe2 115 #define __STM32F1_CMSIS_VERSION_SUB2 (0x00) /*!< [15:8] sub2 version */
Pawel Zarembski 0:01f31e923fe2 116 #define __STM32F1_CMSIS_VERSION_RC (0x00) /*!< [7:0] release candidate */
Pawel Zarembski 0:01f31e923fe2 117 #define __STM32F1_CMSIS_VERSION ((__STM32F1_CMSIS_VERSION_MAIN << 24)\
Pawel Zarembski 0:01f31e923fe2 118 |(__STM32F1_CMSIS_VERSION_SUB1 << 16)\
Pawel Zarembski 0:01f31e923fe2 119 |(__STM32F1_CMSIS_VERSION_SUB2 << 8 )\
Pawel Zarembski 0:01f31e923fe2 120 |(__STM32F1_CMSIS_VERSION_RC))
Pawel Zarembski 0:01f31e923fe2 121
Pawel Zarembski 0:01f31e923fe2 122 /**
Pawel Zarembski 0:01f31e923fe2 123 * @}
Pawel Zarembski 0:01f31e923fe2 124 */
Pawel Zarembski 0:01f31e923fe2 125
Pawel Zarembski 0:01f31e923fe2 126 /** @addtogroup Device_Included
Pawel Zarembski 0:01f31e923fe2 127 * @{
Pawel Zarembski 0:01f31e923fe2 128 */
Pawel Zarembski 0:01f31e923fe2 129
Pawel Zarembski 0:01f31e923fe2 130 #if defined(STM32F100xB)
Pawel Zarembski 0:01f31e923fe2 131 #include "stm32f100xb.h"
Pawel Zarembski 0:01f31e923fe2 132 #elif defined(STM32F100xE)
Pawel Zarembski 0:01f31e923fe2 133 #include "stm32f100xe.h"
Pawel Zarembski 0:01f31e923fe2 134 #elif defined(STM32F101x6)
Pawel Zarembski 0:01f31e923fe2 135 #include "stm32f101x6.h"
Pawel Zarembski 0:01f31e923fe2 136 #elif defined(STM32F101xB)
Pawel Zarembski 0:01f31e923fe2 137 #include "stm32f101xb.h"
Pawel Zarembski 0:01f31e923fe2 138 #elif defined(STM32F101xE)
Pawel Zarembski 0:01f31e923fe2 139 #include "stm32f101xe.h"
Pawel Zarembski 0:01f31e923fe2 140 #elif defined(STM32F101xG)
Pawel Zarembski 0:01f31e923fe2 141 #include "stm32f101xg.h"
Pawel Zarembski 0:01f31e923fe2 142 #elif defined(STM32F102x6)
Pawel Zarembski 0:01f31e923fe2 143 #include "stm32f102x6.h"
Pawel Zarembski 0:01f31e923fe2 144 #elif defined(STM32F102xB)
Pawel Zarembski 0:01f31e923fe2 145 #include "stm32f102xb.h"
Pawel Zarembski 0:01f31e923fe2 146 #elif defined(STM32F103x6)
Pawel Zarembski 0:01f31e923fe2 147 #include "stm32f103x6.h"
Pawel Zarembski 0:01f31e923fe2 148 #elif defined(STM32F103xB)
Pawel Zarembski 0:01f31e923fe2 149 #include "stm32f103xb.h"
Pawel Zarembski 0:01f31e923fe2 150 #elif defined(STM32F103xE)
Pawel Zarembski 0:01f31e923fe2 151 #include "stm32f103xe.h"
Pawel Zarembski 0:01f31e923fe2 152 #elif defined(STM32F103xG)
Pawel Zarembski 0:01f31e923fe2 153 #include "stm32f103xg.h"
Pawel Zarembski 0:01f31e923fe2 154 #elif defined(STM32F105xC)
Pawel Zarembski 0:01f31e923fe2 155 #include "stm32f105xc.h"
Pawel Zarembski 0:01f31e923fe2 156 #elif defined(STM32F107xC)
Pawel Zarembski 0:01f31e923fe2 157 #include "stm32f107xc.h"
Pawel Zarembski 0:01f31e923fe2 158 #else
Pawel Zarembski 0:01f31e923fe2 159 #error "Please select first the target STM32F1xx device used in your application (in stm32f1xx.h file)"
Pawel Zarembski 0:01f31e923fe2 160 #endif
Pawel Zarembski 0:01f31e923fe2 161
Pawel Zarembski 0:01f31e923fe2 162 /**
Pawel Zarembski 0:01f31e923fe2 163 * @}
Pawel Zarembski 0:01f31e923fe2 164 */
Pawel Zarembski 0:01f31e923fe2 165
Pawel Zarembski 0:01f31e923fe2 166 /** @addtogroup Exported_types
Pawel Zarembski 0:01f31e923fe2 167 * @{
Pawel Zarembski 0:01f31e923fe2 168 */
Pawel Zarembski 0:01f31e923fe2 169 typedef enum
Pawel Zarembski 0:01f31e923fe2 170 {
Pawel Zarembski 0:01f31e923fe2 171 RESET = 0,
Pawel Zarembski 0:01f31e923fe2 172 SET = !RESET
Pawel Zarembski 0:01f31e923fe2 173 } FlagStatus, ITStatus;
Pawel Zarembski 0:01f31e923fe2 174
Pawel Zarembski 0:01f31e923fe2 175 typedef enum
Pawel Zarembski 0:01f31e923fe2 176 {
Pawel Zarembski 0:01f31e923fe2 177 DISABLE = 0,
Pawel Zarembski 0:01f31e923fe2 178 ENABLE = !DISABLE
Pawel Zarembski 0:01f31e923fe2 179 } FunctionalState;
Pawel Zarembski 0:01f31e923fe2 180 #define IS_FUNCTIONAL_STATE(STATE) (((STATE) == DISABLE) || ((STATE) == ENABLE))
Pawel Zarembski 0:01f31e923fe2 181
Pawel Zarembski 0:01f31e923fe2 182 typedef enum
Pawel Zarembski 0:01f31e923fe2 183 {
Pawel Zarembski 0:01f31e923fe2 184 ERROR = 0,
Pawel Zarembski 0:01f31e923fe2 185 SUCCESS = !ERROR
Pawel Zarembski 0:01f31e923fe2 186 } ErrorStatus;
Pawel Zarembski 0:01f31e923fe2 187
Pawel Zarembski 0:01f31e923fe2 188 /**
Pawel Zarembski 0:01f31e923fe2 189 * @}
Pawel Zarembski 0:01f31e923fe2 190 */
Pawel Zarembski 0:01f31e923fe2 191
Pawel Zarembski 0:01f31e923fe2 192
Pawel Zarembski 0:01f31e923fe2 193 /** @addtogroup Exported_macros
Pawel Zarembski 0:01f31e923fe2 194 * @{
Pawel Zarembski 0:01f31e923fe2 195 */
Pawel Zarembski 0:01f31e923fe2 196 #define SET_BIT(REG, BIT) ((REG) |= (BIT))
Pawel Zarembski 0:01f31e923fe2 197
Pawel Zarembski 0:01f31e923fe2 198 #define CLEAR_BIT(REG, BIT) ((REG) &= ~(BIT))
Pawel Zarembski 0:01f31e923fe2 199
Pawel Zarembski 0:01f31e923fe2 200 #define READ_BIT(REG, BIT) ((REG) & (BIT))
Pawel Zarembski 0:01f31e923fe2 201
Pawel Zarembski 0:01f31e923fe2 202 #define CLEAR_REG(REG) ((REG) = (0x0))
Pawel Zarembski 0:01f31e923fe2 203
Pawel Zarembski 0:01f31e923fe2 204 #define WRITE_REG(REG, VAL) ((REG) = (VAL))
Pawel Zarembski 0:01f31e923fe2 205
Pawel Zarembski 0:01f31e923fe2 206 #define READ_REG(REG) ((REG))
Pawel Zarembski 0:01f31e923fe2 207
Pawel Zarembski 0:01f31e923fe2 208 #define MODIFY_REG(REG, CLEARMASK, SETMASK) WRITE_REG((REG), (((READ_REG(REG)) & (~(CLEARMASK))) | (SETMASK)))
Pawel Zarembski 0:01f31e923fe2 209
Pawel Zarembski 0:01f31e923fe2 210 #define POSITION_VAL(VAL) (__CLZ(__RBIT(VAL)))
Pawel Zarembski 0:01f31e923fe2 211
Pawel Zarembski 0:01f31e923fe2 212
Pawel Zarembski 0:01f31e923fe2 213 /**
Pawel Zarembski 0:01f31e923fe2 214 * @}
Pawel Zarembski 0:01f31e923fe2 215 */
Pawel Zarembski 0:01f31e923fe2 216
Pawel Zarembski 0:01f31e923fe2 217 #if defined (USE_HAL_DRIVER)
Pawel Zarembski 0:01f31e923fe2 218 #include "stm32f1xx_hal.h"
Pawel Zarembski 0:01f31e923fe2 219 #endif /* USE_HAL_DRIVER */
Pawel Zarembski 0:01f31e923fe2 220
Pawel Zarembski 0:01f31e923fe2 221
Pawel Zarembski 0:01f31e923fe2 222 #ifdef __cplusplus
Pawel Zarembski 0:01f31e923fe2 223 }
Pawel Zarembski 0:01f31e923fe2 224 #endif /* __cplusplus */
Pawel Zarembski 0:01f31e923fe2 225
Pawel Zarembski 0:01f31e923fe2 226 #endif /* __STM32F1xx_H */
Pawel Zarembski 0:01f31e923fe2 227 /**
Pawel Zarembski 0:01f31e923fe2 228 * @}
Pawel Zarembski 0:01f31e923fe2 229 */
Pawel Zarembski 0:01f31e923fe2 230
Pawel Zarembski 0:01f31e923fe2 231 /**
Pawel Zarembski 0:01f31e923fe2 232 * @}
Pawel Zarembski 0:01f31e923fe2 233 */
Pawel Zarembski 0:01f31e923fe2 234
Pawel Zarembski 0:01f31e923fe2 235
Pawel Zarembski 0:01f31e923fe2 236
Pawel Zarembski 0:01f31e923fe2 237
Pawel Zarembski 0:01f31e923fe2 238 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/