CMSIS library (not dsp)

Dependents:   BSP

Committer:
EricLew
Date:
Sun Nov 22 21:15:21 2015 +0000
Revision:
2:c991e443f67c
11/22/2015

Who changed what in which revision?

UserRevisionLine numberNew contents of line
EricLew 2:c991e443f67c 1 /**
EricLew 2:c991e443f67c 2 ******************************************************************************
EricLew 2:c991e443f67c 3 * @file stm32l4xx.h
EricLew 2:c991e443f67c 4 * @author MCD Application Team
EricLew 2:c991e443f67c 5 * @version V1.0.1
EricLew 2:c991e443f67c 6 * @date 16-September-2015
EricLew 2:c991e443f67c 7 * @brief CMSIS STM32L4xx Device Peripheral Access Layer Header File.
EricLew 2:c991e443f67c 8 *
EricLew 2:c991e443f67c 9 * The file is the unique include file that the application programmer
EricLew 2:c991e443f67c 10 * is using in the C source code, usually in main.c. This file contains:
EricLew 2:c991e443f67c 11 * - Configuration section that allows to select:
EricLew 2:c991e443f67c 12 * - The STM32L4xx device used in the target application
EricLew 2:c991e443f67c 13 * - To use or not the peripheral�s drivers in application code(i.e.
EricLew 2:c991e443f67c 14 * code will be based on direct access to peripheral�s registers
EricLew 2:c991e443f67c 15 * rather than drivers API), this option is controlled by
EricLew 2:c991e443f67c 16 * "#define USE_HAL_DRIVER"
EricLew 2:c991e443f67c 17 *
EricLew 2:c991e443f67c 18 ******************************************************************************
EricLew 2:c991e443f67c 19 * @attention
EricLew 2:c991e443f67c 20 *
EricLew 2:c991e443f67c 21 * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
EricLew 2:c991e443f67c 22 *
EricLew 2:c991e443f67c 23 * Redistribution and use in source and binary forms, with or without modification,
EricLew 2:c991e443f67c 24 * are permitted provided that the following conditions are met:
EricLew 2:c991e443f67c 25 * 1. Redistributions of source code must retain the above copyright notice,
EricLew 2:c991e443f67c 26 * this list of conditions and the following disclaimer.
EricLew 2:c991e443f67c 27 * 2. Redistributions in binary form must reproduce the above copyright notice,
EricLew 2:c991e443f67c 28 * this list of conditions and the following disclaimer in the documentation
EricLew 2:c991e443f67c 29 * and/or other materials provided with the distribution.
EricLew 2:c991e443f67c 30 * 3. Neither the name of STMicroelectronics nor the names of its contributors
EricLew 2:c991e443f67c 31 * may be used to endorse or promote products derived from this software
EricLew 2:c991e443f67c 32 * without specific prior written permission.
EricLew 2:c991e443f67c 33 *
EricLew 2:c991e443f67c 34 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
EricLew 2:c991e443f67c 35 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
EricLew 2:c991e443f67c 36 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
EricLew 2:c991e443f67c 37 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
EricLew 2:c991e443f67c 38 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
EricLew 2:c991e443f67c 39 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
EricLew 2:c991e443f67c 40 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
EricLew 2:c991e443f67c 41 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
EricLew 2:c991e443f67c 42 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
EricLew 2:c991e443f67c 43 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
EricLew 2:c991e443f67c 44 *
EricLew 2:c991e443f67c 45 ******************************************************************************
EricLew 2:c991e443f67c 46 */
EricLew 2:c991e443f67c 47
EricLew 2:c991e443f67c 48 /** @addtogroup CMSIS
EricLew 2:c991e443f67c 49 * @{
EricLew 2:c991e443f67c 50 */
EricLew 2:c991e443f67c 51
EricLew 2:c991e443f67c 52 /** @addtogroup stm32l4xx
EricLew 2:c991e443f67c 53 * @{
EricLew 2:c991e443f67c 54 */
EricLew 2:c991e443f67c 55
EricLew 2:c991e443f67c 56 #ifndef __STM32L4xx_H
EricLew 2:c991e443f67c 57 #define __STM32L4xx_H
EricLew 2:c991e443f67c 58
EricLew 2:c991e443f67c 59 #ifdef __cplusplus
EricLew 2:c991e443f67c 60 extern "C" {
EricLew 2:c991e443f67c 61 #endif /* __cplusplus */
EricLew 2:c991e443f67c 62
EricLew 2:c991e443f67c 63 /** @addtogroup Library_configuration_section
EricLew 2:c991e443f67c 64 * @{
EricLew 2:c991e443f67c 65 */
EricLew 2:c991e443f67c 66
EricLew 2:c991e443f67c 67 /**
EricLew 2:c991e443f67c 68 * @brief STM32 Family
EricLew 2:c991e443f67c 69 */
EricLew 2:c991e443f67c 70 #if !defined (STM32L4)
EricLew 2:c991e443f67c 71 #define STM32L4
EricLew 2:c991e443f67c 72 #endif /* STM32L4 */
EricLew 2:c991e443f67c 73
EricLew 2:c991e443f67c 74 /* Uncomment the line below according to the target STM32L4 device used in your
EricLew 2:c991e443f67c 75 application
EricLew 2:c991e443f67c 76 */
EricLew 2:c991e443f67c 77
EricLew 2:c991e443f67c 78 #if !defined (STM32L471xx) && !defined (STM32L475xx) && !defined (STM32L476xx) && !defined (STM32L485xx) && !defined (STM32L486xx)
EricLew 2:c991e443f67c 79 /* #define STM32L471xx */ /*!< STM32L471xx Devices */
EricLew 2:c991e443f67c 80 /* #define STM32L475xx */ /*!< STM32L475xx Devices */
EricLew 2:c991e443f67c 81 #define STM32L476xx !< STM32L476xx Devices
EricLew 2:c991e443f67c 82 /* #define STM32L485xx */ /*!< STM32L485xx Devices */
EricLew 2:c991e443f67c 83 /* #define STM32L486xx */ /*!< STM32L486xx Devices */
EricLew 2:c991e443f67c 84 #endif
EricLew 2:c991e443f67c 85
EricLew 2:c991e443f67c 86 /* Tip: To avoid modifying this file each time you need to switch between these
EricLew 2:c991e443f67c 87 devices, you can define the device in your toolchain compiler preprocessor.
EricLew 2:c991e443f67c 88 */
EricLew 2:c991e443f67c 89 #if !defined (USE_HAL_DRIVER)
EricLew 2:c991e443f67c 90 /**
EricLew 2:c991e443f67c 91 * @brief Comment the line below if you will not use the peripherals drivers.
EricLew 2:c991e443f67c 92 In this case, these drivers will not be included and the application code will
EricLew 2:c991e443f67c 93 be based on direct access to peripherals registers
EricLew 2:c991e443f67c 94 */
EricLew 2:c991e443f67c 95 /*#define USE_HAL_DRIVER */
EricLew 2:c991e443f67c 96 #endif /* USE_HAL_DRIVER */
EricLew 2:c991e443f67c 97
EricLew 2:c991e443f67c 98 /**
EricLew 2:c991e443f67c 99 * @brief CMSIS Device version number V1.0.1
EricLew 2:c991e443f67c 100 */
EricLew 2:c991e443f67c 101 #define __STM32L4xx_CMSIS_DEVICE_VERSION_MAIN (0x01) /*!< [31:24] main version */
EricLew 2:c991e443f67c 102 #define __STM32L4xx_CMSIS_DEVICE_VERSION_SUB1 (0x00) /*!< [23:16] sub1 version */
EricLew 2:c991e443f67c 103 #define __STM32L4xx_CMSIS_DEVICE_VERSION_SUB2 (0x01) /*!< [15:8] sub2 version */
EricLew 2:c991e443f67c 104 #define __STM32L4xx_CMSIS_DEVICE_VERSION_RC (0x00) /*!< [7:0] release candidate */
EricLew 2:c991e443f67c 105 #define __STM32L4xx_CMSIS_DEVICE_VERSION ((__CMSIS_DEVICE_VERSION_MAIN << 24)\
EricLew 2:c991e443f67c 106 |(__CMSIS_DEVICE_VERSION_SUB1 << 16)\
EricLew 2:c991e443f67c 107 |(__CMSIS_DEVICE_VERSION_SUB2 << 8 )\
EricLew 2:c991e443f67c 108 |(__CMSIS_DEVICE_VERSION_RC))
EricLew 2:c991e443f67c 109
EricLew 2:c991e443f67c 110 /**
EricLew 2:c991e443f67c 111 * @}
EricLew 2:c991e443f67c 112 */
EricLew 2:c991e443f67c 113
EricLew 2:c991e443f67c 114 /** @addtogroup Device_Included
EricLew 2:c991e443f67c 115 * @{
EricLew 2:c991e443f67c 116 */
EricLew 2:c991e443f67c 117
EricLew 2:c991e443f67c 118 #if defined(STM32L471xx)
EricLew 2:c991e443f67c 119 #include "stm32l471xx.h"
EricLew 2:c991e443f67c 120 #elif defined(STM32L475xx)
EricLew 2:c991e443f67c 121 #include "stm32l475xx.h"
EricLew 2:c991e443f67c 122 #elif defined(STM32L476xx)
EricLew 2:c991e443f67c 123 #include "stm32l476xx.h"
EricLew 2:c991e443f67c 124 #elif defined(STM32L485xx)
EricLew 2:c991e443f67c 125 #include "stm32l485xx.h"
EricLew 2:c991e443f67c 126 #elif defined(STM32L486xx)
EricLew 2:c991e443f67c 127 #include "stm32l486xx.h"
EricLew 2:c991e443f67c 128 #else
EricLew 2:c991e443f67c 129 #error "Please select first the target STM32L4xx device used in your application (in stm32l4xx.h file)"
EricLew 2:c991e443f67c 130 #endif
EricLew 2:c991e443f67c 131
EricLew 2:c991e443f67c 132 /**
EricLew 2:c991e443f67c 133 * @}
EricLew 2:c991e443f67c 134 */
EricLew 2:c991e443f67c 135
EricLew 2:c991e443f67c 136 /** @addtogroup Exported_types
EricLew 2:c991e443f67c 137 * @{
EricLew 2:c991e443f67c 138 */
EricLew 2:c991e443f67c 139 typedef enum
EricLew 2:c991e443f67c 140 {
EricLew 2:c991e443f67c 141 RESET = 0,
EricLew 2:c991e443f67c 142 SET = !RESET
EricLew 2:c991e443f67c 143 } FlagStatus, ITStatus;
EricLew 2:c991e443f67c 144
EricLew 2:c991e443f67c 145 typedef enum
EricLew 2:c991e443f67c 146 {
EricLew 2:c991e443f67c 147 DISABLE = 0,
EricLew 2:c991e443f67c 148 ENABLE = !DISABLE
EricLew 2:c991e443f67c 149 } FunctionalState;
EricLew 2:c991e443f67c 150 #define IS_FUNCTIONAL_STATE(STATE) (((STATE) == DISABLE) || ((STATE) == ENABLE))
EricLew 2:c991e443f67c 151
EricLew 2:c991e443f67c 152 typedef enum
EricLew 2:c991e443f67c 153 {
EricLew 2:c991e443f67c 154 ERROR = 0,
EricLew 2:c991e443f67c 155 SUCCESS = !ERROR
EricLew 2:c991e443f67c 156 } ErrorStatus;
EricLew 2:c991e443f67c 157
EricLew 2:c991e443f67c 158 /**
EricLew 2:c991e443f67c 159 * @}
EricLew 2:c991e443f67c 160 */
EricLew 2:c991e443f67c 161
EricLew 2:c991e443f67c 162
EricLew 2:c991e443f67c 163 /** @addtogroup Exported_macros
EricLew 2:c991e443f67c 164 * @{
EricLew 2:c991e443f67c 165 */
EricLew 2:c991e443f67c 166 #define SET_BIT(REG, BIT) ((REG) |= (BIT))
EricLew 2:c991e443f67c 167
EricLew 2:c991e443f67c 168 #define CLEAR_BIT(REG, BIT) ((REG) &= ~(BIT))
EricLew 2:c991e443f67c 169
EricLew 2:c991e443f67c 170 #define READ_BIT(REG, BIT) ((REG) & (BIT))
EricLew 2:c991e443f67c 171
EricLew 2:c991e443f67c 172 #define CLEAR_REG(REG) ((REG) = (0x0))
EricLew 2:c991e443f67c 173
EricLew 2:c991e443f67c 174 #define WRITE_REG(REG, VAL) ((REG) = (VAL))
EricLew 2:c991e443f67c 175
EricLew 2:c991e443f67c 176 #define READ_REG(REG) ((REG))
EricLew 2:c991e443f67c 177
EricLew 2:c991e443f67c 178 #define MODIFY_REG(REG, CLEARMASK, SETMASK) WRITE_REG((REG), (((READ_REG(REG)) & (~(CLEARMASK))) | (SETMASK)))
EricLew 2:c991e443f67c 179
EricLew 2:c991e443f67c 180 #define POSITION_VAL(VAL) (__CLZ(__RBIT(VAL)))
EricLew 2:c991e443f67c 181
EricLew 2:c991e443f67c 182
EricLew 2:c991e443f67c 183 /**
EricLew 2:c991e443f67c 184 * @}
EricLew 2:c991e443f67c 185 */
EricLew 2:c991e443f67c 186
EricLew 2:c991e443f67c 187 #if defined (USE_HAL_DRIVER)
EricLew 2:c991e443f67c 188 #include "stm32l4xx_hal.h"
EricLew 2:c991e443f67c 189 #endif /* USE_HAL_DRIVER */
EricLew 2:c991e443f67c 190
EricLew 2:c991e443f67c 191 #ifdef __cplusplus
EricLew 2:c991e443f67c 192 }
EricLew 2:c991e443f67c 193 #endif /* __cplusplus */
EricLew 2:c991e443f67c 194
EricLew 2:c991e443f67c 195 #endif /* __STM32L4xx_H */
EricLew 2:c991e443f67c 196 /**
EricLew 2:c991e443f67c 197 * @}
EricLew 2:c991e443f67c 198 */
EricLew 2:c991e443f67c 199
EricLew 2:c991e443f67c 200 /**
EricLew 2:c991e443f67c 201 * @}
EricLew 2:c991e443f67c 202 */
EricLew 2:c991e443f67c 203
EricLew 2:c991e443f67c 204
EricLew 2:c991e443f67c 205
EricLew 2:c991e443f67c 206
EricLew 2:c991e443f67c 207 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
EricLew 2:c991e443f67c 208