Rev 2 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 2 | Rev 6 | ||
|---|---|---|---|
| Line 51... | Line 51... | ||
| 51 | */ |
51 | */ |
| 52 | #if !defined (STM32F0) |
52 | #if !defined (STM32F0) |
| 53 | #define STM32F0 |
53 | #define STM32F0 |
| 54 | #endif /* STM32F0 */ |
54 | #endif /* STM32F0 */ |
| 55 | 55 | ||
| 56 | /* Uncomment the line below according to the target STM32 device used in your |
56 | /** Uncomment the line below according to the target STM32 device used in your application. |
| - | 57 | * stm32f0xxxx.h file contains: |
|
| - | 58 | * - All the peripheral register's definitions, bits definitions and memory mapping for STM32F0xxxx devices |
|
| 57 | application |
59 | * - IRQ channel definition |
| - | 60 | * - Peripheral memory mapping and physical registers address definition |
|
| - | 61 | * - Peripheral pointer declaration and driver header file inclusion |
|
| - | 62 | * - Product miscellaneous configuration: assert macros
|
|
| - | 63 | * Note: These CMSIS drivers (stm32f0xxxx.h) are always supporting features of the sub-familys superset. |
|
| 58 | */ |
64 | */ |
| 59 | 65 | ||
| 60 | #if !defined (STM32F030x6) && !defined (STM32F030x8) && \ |
66 | #if !defined (STM32F030x6) && !defined (STM32F030x8) && \ |
| 61 | !defined (STM32F031x6) && !defined (STM32F038xx) && \ |
67 | !defined (STM32F031x6) && !defined (STM32F038xx) && \ |
| 62 | !defined (STM32F042x6) && !defined (STM32F048xx) && !defined (STM32F070x6) && \ |
68 | !defined (STM32F042x6) && !defined (STM32F048xx) && !defined (STM32F070x6) && \ |
| Line 66... | Line 72... | ||
| 66 | /* #define STM32F030x6 */ /*!< STM32F030x4, STM32F030x6 Devices (STM32F030xx microcontrollers where the Flash memory ranges between 16 and 32 Kbytes) */ |
72 | /* #define STM32F030x6 */ /*!< STM32F030x4, STM32F030x6 Devices (STM32F030xx microcontrollers where the Flash memory ranges between 16 and 32 Kbytes) */ |
| 67 | /* #define STM32F030x8 */ /*!< STM32F030x8 Devices (STM32F030xx microcontrollers where the Flash memory is 64 Kbytes) */ |
73 | /* #define STM32F030x8 */ /*!< STM32F030x8 Devices (STM32F030xx microcontrollers where the Flash memory is 64 Kbytes) */ |
| 68 | /* #define STM32F031x6 */ /*!< STM32F031x4, STM32F031x6 Devices (STM32F031xx microcontrollers where the Flash memory ranges between 16 and 32 Kbytes) */ |
74 | /* #define STM32F031x6 */ /*!< STM32F031x4, STM32F031x6 Devices (STM32F031xx microcontrollers where the Flash memory ranges between 16 and 32 Kbytes) */ |
| 69 | /* #define STM32F038xx */ /*!< STM32F038xx Devices (STM32F038xx microcontrollers where the Flash memory is 32 Kbytes) */ |
75 | /* #define STM32F038xx */ /*!< STM32F038xx Devices (STM32F038xx microcontrollers where the Flash memory is 32 Kbytes) */ |
| 70 | /* #define STM32F042x6 */ /*!< STM32F042x4, STM32F042x6 Devices (STM32F042xx microcontrollers where the Flash memory ranges between 16 and 32 Kbytes) */ |
76 | /* #define STM32F042x6 */ /*!< STM32F042x4, STM32F042x6 Devices (STM32F042xx microcontrollers where the Flash memory ranges between 16 and 32 Kbytes) */ |
| 71 | /* #define STM32F048x6 */ /*!< STM32F048xx Devices (STM32F042xx microcontrollers where the Flash memory is 32 Kbytes) */ |
77 | /* #define STM32F048xx */ /*!< STM32F048xx Devices (STM32F048xx microcontrollers where the Flash memory is 32 Kbytes) */ |
| 72 | /* #define STM32F051x8 */ /*!< STM32F051x4, STM32F051x6, STM32F051x8 Devices (STM32F051xx microcontrollers where the Flash memory ranges between 16 and 64 Kbytes) */ |
78 | /* #define STM32F051x8 */ /*!< STM32F051x4, STM32F051x6, STM32F051x8 Devices (STM32F051xx microcontrollers where the Flash memory ranges between 16 and 64 Kbytes) */ |
| 73 | /* #define STM32F058xx */ /*!< STM32F058xx Devices (STM32F058xx microcontrollers where the Flash memory is 64 Kbytes) */ |
79 | /* #define STM32F058xx */ /*!< STM32F058xx Devices (STM32F058xx microcontrollers where the Flash memory is 64 Kbytes) */ |
| 74 | /* #define STM32F070x6 */ /*!< STM32F070x6 Devices (STM32F070x6 microcontrollers where the Flash memory ranges between 16 and 32 Kbytes) */ |
80 | /* #define STM32F070x6 */ /*!< STM32F070x6 Devices (STM32F070x6 microcontrollers where the Flash memory ranges between 16 and 32 Kbytes) */ |
| 75 | /* #define STM32F070xB */ /*!< STM32F070xB Devices (STM32F070xB microcontrollers where the Flash memory ranges between 64 and 128 Kbytes) */ |
81 | /* #define STM32F070xB */ /*!< STM32F070xB Devices (STM32F070xB microcontrollers where the Flash memory ranges between 64 and 128 Kbytes) */ |
| 76 | /* #define STM32F071xB */ /*!< STM32F071x8, STM32F071xB Devices (STM32F071xx microcontrollers where the Flash memory ranges between 64 and 128 Kbytes) */ |
82 | /* #define STM32F071xB */ /*!< STM32F071x8, STM32F071xB Devices (STM32F071xx microcontrollers where the Flash memory ranges between 64 and 128 Kbytes) */ |
| Line 78... | Line 84... | ||
| 78 | /* #define STM32F078xx */ /*!< STM32F078xx Devices (STM32F078xx microcontrollers where the Flash memory is 128 Kbytes) */ |
84 | /* #define STM32F078xx */ /*!< STM32F078xx Devices (STM32F078xx microcontrollers where the Flash memory is 128 Kbytes) */ |
| 79 | /* #define STM32F030xC */ /*!< STM32F030xC Devices (STM32F030xC microcontrollers where the Flash memory is 256 Kbytes) */ |
85 | /* #define STM32F030xC */ /*!< STM32F030xC Devices (STM32F030xC microcontrollers where the Flash memory is 256 Kbytes) */ |
| 80 | /* #define STM32F091xC */ /*!< STM32F091xB, STM32F091xC Devices (STM32F091xx microcontrollers where the Flash memory ranges between 128 and 256 Kbytes) */ |
86 | /* #define STM32F091xC */ /*!< STM32F091xB, STM32F091xC Devices (STM32F091xx microcontrollers where the Flash memory ranges between 128 and 256 Kbytes) */ |
| 81 | /* #define STM32F098xx */ /*!< STM32F098xx Devices (STM32F098xx microcontrollers where the Flash memory is 256 Kbytes) */ |
87 | /* #define STM32F098xx */ /*!< STM32F098xx Devices (STM32F098xx microcontrollers where the Flash memory is 256 Kbytes) */ |
| 82 | #endif |
88 | #endif |
| - | 89 | /* Legacy aliases */ |
|
| - | 90 | #if defined (STM32F048x6) |
|
| - | 91 | #define STM32F048xx |
|
| - | 92 | #endif /* STM32F048x6 */ |
|
| 83 | 93 | ||
| 84 | /* Tip: To avoid modifying this file each time you need to switch between these |
94 | /* Tip: To avoid modifying this file each time you need to switch between these |
| 85 | devices, you can define the device in your toolchain compiler preprocessor. |
95 | devices, you can define the device in your toolchain compiler preprocessor. |
| 86 | */ |
96 | */ |
| 87 | #if !defined (USE_HAL_DRIVER) |
97 | #if !defined (USE_HAL_DRIVER) |
| 88 | /** |
98 | /** |
| Line 92... | Line 102... | ||
| 92 | */ |
102 | */ |
| 93 | /*#define USE_HAL_DRIVER */ |
103 | /*#define USE_HAL_DRIVER */ |
| 94 | #endif /* USE_HAL_DRIVER */ |
104 | #endif /* USE_HAL_DRIVER */ |
| 95 | 105 | ||
| 96 | /** |
106 | /** |
| 97 | * @brief CMSIS Device version number V2.3.4 |
107 | * @brief CMSIS Device version number V2.3.6 |
| 98 | */ |
108 | */ |
| 99 | #define __STM32F0_DEVICE_VERSION_MAIN (0x02) /*!< [31:24] main version */ |
109 | #define __STM32F0_DEVICE_VERSION_MAIN (0x02) /*!< [31:24] main version */ |
| 100 | #define __STM32F0_DEVICE_VERSION_SUB1 (0x03) /*!< [23:16] sub1 version */ |
110 | #define __STM32F0_DEVICE_VERSION_SUB1 (0x03) /*!< [23:16] sub1 version */ |
| 101 | #define __STM32F0_DEVICE_VERSION_SUB2 (0x04) /*!< [15:8] sub2 version */ |
111 | #define __STM32F0_DEVICE_VERSION_SUB2 (0x06) /*!< [15:8] sub2 version */ |
| 102 | #define __STM32F0_DEVICE_VERSION_RC (0x00) /*!< [7:0] release candidate */ |
112 | #define __STM32F0_DEVICE_VERSION_RC (0x00) /*!< [7:0] release candidate */ |
| 103 | #define __STM32F0_DEVICE_VERSION ((__STM32F0_DEVICE_VERSION_MAIN << 24)\ |
113 | #define __STM32F0_DEVICE_VERSION ((__STM32F0_DEVICE_VERSION_MAIN << 24)\ |
| 104 | |(__STM32F0_DEVICE_VERSION_SUB1 << 16)\ |
114 | |(__STM32F0_DEVICE_VERSION_SUB1 << 16)\ |
| 105 | |(__STM32F0_DEVICE_VERSION_SUB2 << 8 )\ |
115 | |(__STM32F0_DEVICE_VERSION_SUB2 << 8 )\ |
| 106 | |(__STM32F0_DEVICE_VERSION_RC)) |
116 | |(__STM32F0_DEVICE_VERSION_RC)) |
| Line 195... | Line 205... | ||
| 195 | 205 | ||
| 196 | #define READ_REG(REG) ((REG)) |
206 | #define READ_REG(REG) ((REG)) |
| 197 | 207 | ||
| 198 | #define MODIFY_REG(REG, CLEARMASK, SETMASK) WRITE_REG((REG), (((READ_REG(REG)) & (~(CLEARMASK))) | (SETMASK))) |
208 | #define MODIFY_REG(REG, CLEARMASK, SETMASK) WRITE_REG((REG), (((READ_REG(REG)) & (~(CLEARMASK))) | (SETMASK))) |
| 199 | 209 | ||
| - | 210 | /* Use of interrupt control for register exclusive access */ |
|
| - | 211 | /* Atomic 32-bit register access macro to set one or several bits */ |
|
| - | 212 | #define ATOMIC_SET_BIT(REG, BIT) \ |
|
| - | 213 | do { \ |
|
| - | 214 | uint32_t primask; \ |
|
| - | 215 | primask = __get_PRIMASK(); \ |
|
| - | 216 | __set_PRIMASK(1); \ |
|
| - | 217 | SET_BIT((REG), (BIT)); \ |
|
| - | 218 | __set_PRIMASK(primask); \ |
|
| - | 219 | } while(0) |
|
| - | 220 | ||
| - | 221 | /* Atomic 32-bit register access macro to clear one or several bits */ |
|
| - | 222 | #define ATOMIC_CLEAR_BIT(REG, BIT) \ |
|
| - | 223 | do { \ |
|
| - | 224 | uint32_t primask; \ |
|
| - | 225 | primask = __get_PRIMASK(); \ |
|
| - | 226 | __set_PRIMASK(1); \ |
|
| - | 227 | CLEAR_BIT((REG), (BIT)); \ |
|
| - | 228 | __set_PRIMASK(primask); \ |
|
| - | 229 | } while(0) |
|
| - | 230 | ||
| - | 231 | /* Atomic 32-bit register access macro to clear and set one or several bits */ |
|
| - | 232 | #define ATOMIC_MODIFY_REG(REG, CLEARMSK, SETMASK) \ |
|
| - | 233 | do { \ |
|
| - | 234 | uint32_t primask; \ |
|
| - | 235 | primask = __get_PRIMASK(); \ |
|
| - | 236 | __set_PRIMASK(1); \ |
|
| - | 237 | MODIFY_REG((REG), (CLEARMSK), (SETMASK)); \ |
|
| - | 238 | __set_PRIMASK(primask); \ |
|
| - | 239 | } while(0) |
|
| - | 240 | ||
| - | 241 | /* Atomic 16-bit register access macro to set one or several bits */ |
|
| - | 242 | #define ATOMIC_SETH_BIT(REG, BIT) ATOMIC_SET_BIT(REG, BIT) \ |
|
| - | 243 | ||
| - | 244 | /* Atomic 16-bit register access macro to clear one or several bits */ |
|
| - | 245 | #define ATOMIC_CLEARH_BIT(REG, BIT) ATOMIC_CLEAR_BIT(REG, BIT) \ |
|
| - | 246 | ||
| - | 247 | /* Atomic 16-bit register access macro to clear and set one or several bits */ |
|
| - | 248 | #define ATOMIC_MODIFYH_REG(REG, CLEARMSK, SETMASK) ATOMIC_MODIFY_REG(REG, CLEARMSK, SETMASK) \ |
|
| 200 | 249 | ||
| 201 | /** |
250 | /** |
| 202 | * @} |
251 | * @} |
| 203 | */ |
252 | */ |
| 204 | 253 | ||