The official mbed C/C SDK provides the software platform and libraries to build your applications.

Fork of mbed by mbed official

Committer:
Kojto
Date:
Tue Oct 28 16:40:41 2014 +0000
Revision:
90:cb3d968589d8
Parent:
81:7d30d6019079
Release 90 of the mbed library

Changes:

- Freescale KSDK update (v1.0)
- K22 - new target addition
- KL43Z - new target addition
- Nucleo F091RC - new target addition
- Nucleo L152RE - STM32Cube driver
- Nordic - Softdevice v7.1.0
- Nvic files - BSD License
- LPC824 - various HAL fixes
- Nucleo F411RE - CMSIS - IAR files

Who changed what in which revision?

UserRevisionLine numberNew contents of line
emilmont 77:869cf507173a 1 /**
emilmont 77:869cf507173a 2 ******************************************************************************
emilmont 77:869cf507173a 3 * @file stm32l1xx.h
emilmont 77:869cf507173a 4 * @author MCD Application Team
Kojto 90:cb3d968589d8 5 * @version V2.0.0
Kojto 90:cb3d968589d8 6 * @date 5-September-2014
Kojto 90:cb3d968589d8 7 * @brief CMSIS STM32L1xx Device Peripheral Access Layer Header File.
emilmont 77:869cf507173a 8 *
emilmont 77:869cf507173a 9 * The file is the unique include file that the application programmer
emilmont 77:869cf507173a 10 * is using in the C source code, usually in main.c. This file contains:
Kojto 90:cb3d968589d8 11 * - Configuration section that allows to select:
Kojto 90:cb3d968589d8 12 * - The STM32L1xx device used in the target application
emilmont 77:869cf507173a 13 * - To use or not the peripheral’s drivers in application code(i.e.
emilmont 77:869cf507173a 14 * code will be based on direct access to peripheral’s registers
emilmont 77:869cf507173a 15 * rather than drivers API), this option is controlled by
Kojto 90:cb3d968589d8 16 * "#define USE_HAL_DRIVER"
Kojto 90:cb3d968589d8 17 *
emilmont 77:869cf507173a 18 ******************************************************************************
emilmont 77:869cf507173a 19 * @attention
emilmont 77:869cf507173a 20 *
bogdanm 81:7d30d6019079 21 * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
emilmont 77:869cf507173a 22 *
bogdanm 81:7d30d6019079 23 * Redistribution and use in source and binary forms, with or without modification,
bogdanm 81:7d30d6019079 24 * are permitted provided that the following conditions are met:
bogdanm 81:7d30d6019079 25 * 1. Redistributions of source code must retain the above copyright notice,
bogdanm 81:7d30d6019079 26 * this list of conditions and the following disclaimer.
bogdanm 81:7d30d6019079 27 * 2. Redistributions in binary form must reproduce the above copyright notice,
bogdanm 81:7d30d6019079 28 * this list of conditions and the following disclaimer in the documentation
bogdanm 81:7d30d6019079 29 * and/or other materials provided with the distribution.
bogdanm 81:7d30d6019079 30 * 3. Neither the name of STMicroelectronics nor the names of its contributors
bogdanm 81:7d30d6019079 31 * may be used to endorse or promote products derived from this software
bogdanm 81:7d30d6019079 32 * without specific prior written permission.
emilmont 77:869cf507173a 33 *
bogdanm 81:7d30d6019079 34 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
bogdanm 81:7d30d6019079 35 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
bogdanm 81:7d30d6019079 36 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
bogdanm 81:7d30d6019079 37 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
bogdanm 81:7d30d6019079 38 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
bogdanm 81:7d30d6019079 39 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
bogdanm 81:7d30d6019079 40 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
bogdanm 81:7d30d6019079 41 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
bogdanm 81:7d30d6019079 42 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
bogdanm 81:7d30d6019079 43 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
emilmont 77:869cf507173a 44 *
emilmont 77:869cf507173a 45 ******************************************************************************
emilmont 77:869cf507173a 46 */
emilmont 77:869cf507173a 47
emilmont 77:869cf507173a 48 /** @addtogroup CMSIS
emilmont 77:869cf507173a 49 * @{
emilmont 77:869cf507173a 50 */
emilmont 77:869cf507173a 51
emilmont 77:869cf507173a 52 /** @addtogroup stm32l1xx
emilmont 77:869cf507173a 53 * @{
emilmont 77:869cf507173a 54 */
emilmont 77:869cf507173a 55
emilmont 77:869cf507173a 56 #ifndef __STM32L1XX_H
emilmont 77:869cf507173a 57 #define __STM32L1XX_H
emilmont 77:869cf507173a 58
emilmont 77:869cf507173a 59 #ifdef __cplusplus
emilmont 77:869cf507173a 60 extern "C" {
Kojto 90:cb3d968589d8 61 #endif /* __cplusplus */
emilmont 77:869cf507173a 62
emilmont 77:869cf507173a 63 /** @addtogroup Library_configuration_section
emilmont 77:869cf507173a 64 * @{
emilmont 77:869cf507173a 65 */
Kojto 90:cb3d968589d8 66
emilmont 77:869cf507173a 67 /* Uncomment the line below according to the target STM32L device used in your
emilmont 77:869cf507173a 68 application
emilmont 77:869cf507173a 69 */
emilmont 77:869cf507173a 70
Kojto 90:cb3d968589d8 71 #if !defined (STM32L100xB) && !defined (STM32L100xBA) && !defined (STM32L100xC) && \
Kojto 90:cb3d968589d8 72 !defined (STM32L151xB) && !defined (STM32L151xBA) && !defined (STM32L151xC) && !defined (STM32L151xCA) && !defined (STM32L151xD) && !defined (STM32L151xE) && \
Kojto 90:cb3d968589d8 73 !defined (STM32L152xB) && !defined (STM32L152xBA) && !defined (STM32L152xC) && !defined (STM32L152xCA) && !defined (STM32L152xD) && !defined (STM32L152xE) && \
Kojto 90:cb3d968589d8 74 !defined (STM32L162xC) && !defined (STM32L162xCA) && !defined (STM32L162xD) && !defined (STM32L162xE)
Kojto 90:cb3d968589d8 75 /* #define STM32L100xB */ /*!< STM32L100C6, STM32L100R and STM32L100RB Devices */
Kojto 90:cb3d968589d8 76 /* #define STM32L100xBA */ /*!< STM32L100C6-A, STM32L100R8-A and STM32L100RB-A Devices */
Kojto 90:cb3d968589d8 77 /* #define STM32L100xC */ /*!< STM32L100RC Devices */
Kojto 90:cb3d968589d8 78 /* #define STM32L151xB */ /*!< STM32L151C6, STM32L151R6, STM32L151C8, STM32L151R8, STM32L151V8, STM32L151CB, STM32L151RB and STM32L151VB */
Kojto 90:cb3d968589d8 79 /* #define STM32L151xBA */ /*!< STM32L151C6-A, STM32L151R6-A, STM32L151C8-A, STM32L151R8-A, STM32L151V8-A, STM32L151CB-A, STM32L151RB-A and STM32L151VB-A */
Kojto 90:cb3d968589d8 80 /* #define STM32L151xC */ /*!< STM32L151CC, STM32L151UC, STM32L151RC and STM32L151VC */
Kojto 90:cb3d968589d8 81 /* #define STM32L151xCA */ /*!< STM32L151RC-A, STM32L151VC-A, STM32L151QC and STM32L151ZC */
Kojto 90:cb3d968589d8 82 /* #define STM32L151xD */ /*!< STM32L151QD, STM32L151RD, STM32L151VD & STM32L151ZD */
Kojto 90:cb3d968589d8 83 /* #define STM32L151xE */ /*!< STM32L151QE, STM32L151RE, STM32L151VE and STM32L151ZE */
Kojto 90:cb3d968589d8 84 /* #define STM32L152xB */ /*!< STM32L152C6, STM32L152R6, STM32L152C8, STM32L152R8, STM32L152V8, STM32L152CB, STM32L152RB and STM32L152VB */
Kojto 90:cb3d968589d8 85 /* #define STM32L152xBA */ /*!< STM32L152C6-A, STM32L152R6-A, STM32L152C8-A, STM32L152R8-A, STM32L152V8-A, STM32L152CB-A, STM32L152RB-A and STM32L152VB-A */
Kojto 90:cb3d968589d8 86 /* #define STM32L152xC */ /*!< STM32L152CC, STM32L152UC, STM32L152RC and STM32L152VC */
Kojto 90:cb3d968589d8 87 /* #define STM32L152xCA */ /*!< STM32L152RC-A, STM32L152VC-A, STM32L152QC and STM32L152ZC */
Kojto 90:cb3d968589d8 88 /* #define STM32L152xD */ /*!< STM32L152QD, STM32L152RD, STM32L152VD and STM32L152ZD */
Kojto 90:cb3d968589d8 89 #define STM32L152xE /*!< STM32L152QE, STM32L152RE, STM32L152VE and STM32L152ZE */
Kojto 90:cb3d968589d8 90 /* #define STM32L162xC */ /*!< STM32L162RC and STM32L162VC */
Kojto 90:cb3d968589d8 91 /* #define STM32L162xCA */ /*!< STM32L162RC-A, STM32L162VC-A, STM32L162QC and STM32L162ZC */
Kojto 90:cb3d968589d8 92 /* #define STM32L162xD */ /*!< STM32L162QD, STM32L162RD, STM32L162VD and STM32L162ZD */
Kojto 90:cb3d968589d8 93 /* #define STM32L162xE */ /*!< STM32L162RE, STM32L162VE and STM32L162ZE */
Kojto 90:cb3d968589d8 94 #endif
emilmont 77:869cf507173a 95
emilmont 77:869cf507173a 96 /* Tip: To avoid modifying this file each time you need to switch between these
emilmont 77:869cf507173a 97 devices, you can define the device in your toolchain compiler preprocessor.
emilmont 77:869cf507173a 98 */
Kojto 90:cb3d968589d8 99
Kojto 90:cb3d968589d8 100 #if !defined (USE_HAL_DRIVER)
emilmont 77:869cf507173a 101 /**
emilmont 77:869cf507173a 102 * @brief Comment the line below if you will not use the peripherals drivers.
emilmont 77:869cf507173a 103 In this case, these drivers will not be included and the application code will
emilmont 77:869cf507173a 104 be based on direct access to peripherals registers
emilmont 77:869cf507173a 105 */
Kojto 90:cb3d968589d8 106 #define USE_HAL_DRIVER
Kojto 90:cb3d968589d8 107 #endif /* USE_HAL_DRIVER */
emilmont 77:869cf507173a 108
emilmont 77:869cf507173a 109 /**
Kojto 90:cb3d968589d8 110 * @brief CMSIS Device version number V2.0.0
Kojto 90:cb3d968589d8 111 */
Kojto 90:cb3d968589d8 112 #define __STM32L1xx_CMSIS_DEVICE_VERSION_MAIN (0x02) /*!< [31:24] main version */
Kojto 90:cb3d968589d8 113 #define __STM32L1xx_CMSIS_DEVICE_VERSION_SUB1 (0x00) /*!< [23:16] sub1 version */
Kojto 90:cb3d968589d8 114 #define __STM32L1xx_CMSIS_DEVICE_VERSION_SUB2 (0x00) /*!< [15:8] sub2 version */
Kojto 90:cb3d968589d8 115 #define __STM32L1xx_CMSIS_DEVICE_VERSION_RC (0x00) /*!< [7:0] release candidate */
Kojto 90:cb3d968589d8 116 #define __STM32L1xx_CMSIS_DEVICE_VERSION ((__CMSIS_DEVICE_VERSION_MAIN << 24)\
Kojto 90:cb3d968589d8 117 |(__CMSIS_DEVICE_HAL_VERSION_SUB1 << 16)\
Kojto 90:cb3d968589d8 118 |(__CMSIS_DEVICE_HAL_VERSION_SUB2 << 8 )\
Kojto 90:cb3d968589d8 119 |(__CMSIS_DEVICE_HAL_VERSION_RC))
emilmont 77:869cf507173a 120
emilmont 77:869cf507173a 121 /**
emilmont 77:869cf507173a 122 * @}
emilmont 77:869cf507173a 123 */
emilmont 77:869cf507173a 124
Kojto 90:cb3d968589d8 125 /** @addtogroup Device_Included
emilmont 77:869cf507173a 126 * @{
emilmont 77:869cf507173a 127 */
emilmont 77:869cf507173a 128
Kojto 90:cb3d968589d8 129 #if defined(STM32L100xB)
Kojto 90:cb3d968589d8 130 #include "stm32l100xb.h"
Kojto 90:cb3d968589d8 131 #elif defined(STM32L100xBA)
Kojto 90:cb3d968589d8 132 #include "stm32l100xba.h"
Kojto 90:cb3d968589d8 133 #elif defined(STM32L100xC)
Kojto 90:cb3d968589d8 134 #include "stm32l100xc.h"
Kojto 90:cb3d968589d8 135 #elif defined(STM32L151xB)
Kojto 90:cb3d968589d8 136 #include "stm32l151xb.h"
Kojto 90:cb3d968589d8 137 #elif defined(STM32L151xBA)
Kojto 90:cb3d968589d8 138 #include "stm32l151xba.h"
Kojto 90:cb3d968589d8 139 #elif defined(STM32L151xC)
Kojto 90:cb3d968589d8 140 #include "stm32l151xc.h"
Kojto 90:cb3d968589d8 141 #elif defined(STM32L151xCA)
Kojto 90:cb3d968589d8 142 #include "stm32l151xca.h"
Kojto 90:cb3d968589d8 143 #elif defined(STM32L151xD)
Kojto 90:cb3d968589d8 144 #include "stm32l151xd.h"
Kojto 90:cb3d968589d8 145 #elif defined(STM32L151xE)
Kojto 90:cb3d968589d8 146 #include "stm32l151xe.h"
Kojto 90:cb3d968589d8 147 #elif defined(STM32L152xB)
Kojto 90:cb3d968589d8 148 #include "stm32l152xb.h"
Kojto 90:cb3d968589d8 149 #elif defined(STM32L152xBA)
Kojto 90:cb3d968589d8 150 #include "stm32l152xba.h"
Kojto 90:cb3d968589d8 151 #elif defined(STM32L152xC)
Kojto 90:cb3d968589d8 152 #include "stm32l152xc.h"
Kojto 90:cb3d968589d8 153 #elif defined(STM32L152xCA)
Kojto 90:cb3d968589d8 154 #include "stm32l152xca.h"
Kojto 90:cb3d968589d8 155 #elif defined(STM32L152xD)
Kojto 90:cb3d968589d8 156 #include "stm32l152xd.h"
Kojto 90:cb3d968589d8 157 #elif defined(STM32L152xE)
Kojto 90:cb3d968589d8 158 #include "stm32l152xe.h"
Kojto 90:cb3d968589d8 159 #elif defined(STM32L162xC)
Kojto 90:cb3d968589d8 160 #include "stm32l162xc.h"
Kojto 90:cb3d968589d8 161 #elif defined(STM32L162xCA)
Kojto 90:cb3d968589d8 162 #include "stm32l162xca.h"
Kojto 90:cb3d968589d8 163 #elif defined(STM32L162xD)
Kojto 90:cb3d968589d8 164 #include "stm32l162xd.h"
Kojto 90:cb3d968589d8 165 #elif defined(STM32L162xE)
Kojto 90:cb3d968589d8 166 #include "stm32l162xe.h"
Kojto 90:cb3d968589d8 167 #else
Kojto 90:cb3d968589d8 168 #error "Please select first the target STM32L1xx device used in your application (in stm32l1xx.h file)"
emilmont 77:869cf507173a 169 #endif
emilmont 77:869cf507173a 170
emilmont 77:869cf507173a 171 /**
emilmont 77:869cf507173a 172 * @}
emilmont 77:869cf507173a 173 */
emilmont 77:869cf507173a 174
Kojto 90:cb3d968589d8 175 /** @addtogroup Exported_types
emilmont 77:869cf507173a 176 * @{
emilmont 77:869cf507173a 177 */
Kojto 90:cb3d968589d8 178 typedef enum
Kojto 90:cb3d968589d8 179 {
Kojto 90:cb3d968589d8 180 RESET = 0,
Kojto 90:cb3d968589d8 181 SET = !RESET
Kojto 90:cb3d968589d8 182 } FlagStatus, ITStatus;
emilmont 77:869cf507173a 183
Kojto 90:cb3d968589d8 184 typedef enum
Kojto 90:cb3d968589d8 185 {
Kojto 90:cb3d968589d8 186 DISABLE = 0,
Kojto 90:cb3d968589d8 187 ENABLE = !DISABLE
Kojto 90:cb3d968589d8 188 } FunctionalState;
Kojto 90:cb3d968589d8 189 #define IS_FUNCTIONAL_STATE(STATE) (((STATE) == DISABLE) || ((STATE) == ENABLE))
emilmont 77:869cf507173a 190
Kojto 90:cb3d968589d8 191 typedef enum
Kojto 90:cb3d968589d8 192 {
Kojto 90:cb3d968589d8 193 ERROR = 0,
Kojto 90:cb3d968589d8 194 SUCCESS = !ERROR
Kojto 90:cb3d968589d8 195 } ErrorStatus;
emilmont 77:869cf507173a 196
emilmont 77:869cf507173a 197 /**
emilmont 77:869cf507173a 198 * @}
emilmont 77:869cf507173a 199 */
emilmont 77:869cf507173a 200
emilmont 77:869cf507173a 201
Kojto 90:cb3d968589d8 202 /** @addtogroup Exported_macros
emilmont 77:869cf507173a 203 * @{
emilmont 77:869cf507173a 204 */
emilmont 77:869cf507173a 205 #define SET_BIT(REG, BIT) ((REG) |= (BIT))
emilmont 77:869cf507173a 206
emilmont 77:869cf507173a 207 #define CLEAR_BIT(REG, BIT) ((REG) &= ~(BIT))
emilmont 77:869cf507173a 208
emilmont 77:869cf507173a 209 #define READ_BIT(REG, BIT) ((REG) & (BIT))
emilmont 77:869cf507173a 210
emilmont 77:869cf507173a 211 #define CLEAR_REG(REG) ((REG) = (0x0))
emilmont 77:869cf507173a 212
emilmont 77:869cf507173a 213 #define WRITE_REG(REG, VAL) ((REG) = (VAL))
emilmont 77:869cf507173a 214
emilmont 77:869cf507173a 215 #define READ_REG(REG) ((REG))
emilmont 77:869cf507173a 216
emilmont 77:869cf507173a 217 #define MODIFY_REG(REG, CLEARMASK, SETMASK) WRITE_REG((REG), (((READ_REG(REG)) & (~(CLEARMASK))) | (SETMASK)))
emilmont 77:869cf507173a 218
Kojto 90:cb3d968589d8 219 #define POSITION_VAL(VAL) (__CLZ(__RBIT(VAL)))
emilmont 77:869cf507173a 220
emilmont 77:869cf507173a 221
emilmont 77:869cf507173a 222 /**
emilmont 77:869cf507173a 223 * @}
emilmont 77:869cf507173a 224 */
emilmont 77:869cf507173a 225
Kojto 90:cb3d968589d8 226 #if defined (USE_HAL_DRIVER)
Kojto 90:cb3d968589d8 227 #include "stm32l1xx_hal.h"
Kojto 90:cb3d968589d8 228 #endif /* USE_HAL_DRIVER */
Kojto 90:cb3d968589d8 229
Kojto 90:cb3d968589d8 230
Kojto 90:cb3d968589d8 231 #ifdef __cplusplus
Kojto 90:cb3d968589d8 232 }
Kojto 90:cb3d968589d8 233 #endif /* __cplusplus */
Kojto 90:cb3d968589d8 234
Kojto 90:cb3d968589d8 235 #endif /* __STM32L1xx_H */
Kojto 90:cb3d968589d8 236 /**
emilmont 77:869cf507173a 237 * @}
emilmont 77:869cf507173a 238 */
emilmont 77:869cf507173a 239
Kojto 90:cb3d968589d8 240 /**
Kojto 90:cb3d968589d8 241 * @}
Kojto 90:cb3d968589d8 242 */
Kojto 90:cb3d968589d8 243
Kojto 90:cb3d968589d8 244
Kojto 90:cb3d968589d8 245
Kojto 90:cb3d968589d8 246
emilmont 77:869cf507173a 247 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/