1 /**
2   ******************************************************************************
3   * @file    stm32l5xx.h
4   * @author  MCD Application Team
5   * @brief   CMSIS STM32L5xx Device Peripheral Access Layer Header File.
6   *
7   *          The file is the unique include file that the application programmer
8   *          is using in the C source code, usually in main.c. This file contains:
9   *           - Configuration section that allows to select:
10   *              - The STM32L5xx device used in the target application
11   *              - To use or not the peripheral�s drivers in application code(i.e.
12   *                code will be based on direct access to peripheral�s registers
13   *                rather than drivers API), this option is controlled by
14   *                "#define USE_HAL_DRIVER"
15   *
16   ******************************************************************************
17   * @attention
18   *
19   * <h2><center>&copy; Copyright (c) 2019 STMicroelectronics.
20   * All rights reserved.</center></h2>
21   *
22   * This software component is licensed by ST under BSD 3-Clause license,
23   * the "License"; You may not use this file except in compliance with the
24   * License. You may obtain a copy of the License at:
25   *                        opensource.org/licenses/BSD-3-Clause
26   *
27   ******************************************************************************
28   */
29 
30 /** @addtogroup CMSIS
31   * @{
32   */
33 
34 /** @addtogroup stm32l5xx
35   * @{
36   */
37 
38 #ifndef STM32L5xx_H
39 #define STM32L5xx_H
40 
41 #ifdef __cplusplus
42  extern "C" {
43 #endif /* __cplusplus */
44 
45 /** @addtogroup Library_configuration_section
46   * @{
47   */
48 
49 /**
50   * @brief STM32 Family
51   */
52 #if !defined (STM32L5)
53 #define STM32L5
54 #endif /* STM32L5 */
55 
56 #if defined(__DOMAIN_NS) && (__DOMAIN_NS == 1)
57 #if defined(__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3)
58 #error "non secure build with secure option"
59 #endif
60 #endif
61 
62 /* Uncomment the line below according to the target STM32L5 device used in your
63    application
64   */
65 
66 #if !defined (STM32L552xx) && !defined (STM32L562xx)
67   /* #define STM32L552xx */   /*!< STM32L552xx Devices */
68   /* #define STM32L562xx */   /*!< STM32L562xx Devices */
69 #endif
70 
71 /*  Tip: To avoid modifying this file each time you need to switch between these
72         devices, you can define the device in your toolchain compiler preprocessor.
73   */
74 #if !defined  (USE_HAL_DRIVER)
75 /**
76  * @brief Comment the line below if you will not use the peripherals drivers.
77    In this case, these drivers will not be included and the application code will
78    be based on direct access to peripherals registers
79    */
80   /*#define USE_HAL_DRIVER */
81 #endif /* USE_HAL_DRIVER */
82 
83 /**
84   * @brief CMSIS Device version number
85   */
86 #define __STM32L5_CMSIS_VERSION_MAIN   (0x01U) /*!< [31:24] main version */
87 #define __STM32L5_CMSIS_VERSION_SUB1   (0x00U) /*!< [23:16] sub1 version */
88 #define __STM32L5_CMSIS_VERSION_SUB2   (0x02U) /*!< [15:8]  sub2 version */
89 #define __STM32L5_CMSIS_VERSION_RC     (0x00U) /*!< [7:0]  release candidate */
90 #define __STM32L5_CMSIS_VERSION        ((__STM32L5_CMSIS_VERSION_MAIN << 24U)\
91                                        |(__STM32L5_CMSIS_VERSION_SUB1 << 16U)\
92                                        |(__STM32L5_CMSIS_VERSION_SUB2 << 8U )\
93                                        |(__STM32L5_CMSIS_VERSION_RC))
94 
95 /**
96   * @}
97   */
98 
99 /** @addtogroup Device_Included
100   * @{
101   */
102 
103 #if defined(STM32L552xx)
104   #include "stm32l552xx.h"
105 #elif defined(STM32L562xx)
106   #include "stm32l562xx.h"
107 #else
108  #error "Please select first the target STM32L5xx device used in your application (in stm32l5xx.h file)"
109 #endif
110 
111 /**
112   * @}
113   */
114 
115 /** @addtogroup Exported_types
116   * @{
117   */
118 typedef enum
119 {
120   RESET = 0,
121   SET = !RESET
122 } FlagStatus, ITStatus;
123 
124 typedef enum
125 {
126   DISABLE = 0,
127   ENABLE = !DISABLE
128 } FunctionalState;
129 #define IS_FUNCTIONAL_STATE(STATE) (((STATE) == DISABLE) || ((STATE) == ENABLE))
130 
131 typedef enum
132 {
133   SUCCESS = 0,
134   ERROR = !SUCCESS
135 } ErrorStatus;
136 
137 /**
138   * @}
139   */
140 
141 
142 /** @addtogroup Exported_macros
143   * @{
144   */
145 #define SET_BIT(REG, BIT)     ((REG) |= (BIT))
146 
147 #define CLEAR_BIT(REG, BIT)   ((REG) &= ~(BIT))
148 
149 #define READ_BIT(REG, BIT)    ((REG) & (BIT))
150 
151 #define CLEAR_REG(REG)        ((REG) = (0x0))
152 
153 #define WRITE_REG(REG, VAL)   ((REG) = (VAL))
154 
155 #define READ_REG(REG)         ((REG))
156 
157 #define MODIFY_REG(REG, CLEARMASK, SETMASK)  WRITE_REG((REG), (((READ_REG(REG)) & (~(CLEARMASK))) | (SETMASK)))
158 
159 #define POSITION_VAL(VAL)     (__CLZ(__RBIT(VAL)))
160 
161 
162 /**
163   * @}
164   */
165 
166 #if defined (USE_HAL_DRIVER)
167  #include "stm32l5xx_hal.h"
168 #endif /* USE_HAL_DRIVER */
169 
170 #ifdef __cplusplus
171 }
172 #endif /* __cplusplus */
173 
174 #endif /* STM32L5xx_H */
175 /**
176   * @}
177   */
178 
179 /**
180   * @}
181   */
182 
183 
184 
185 
186 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
187