Restructure libs source to support multi platform
[fw/stlink] / example / libs_stm / inc / stm32l1xx / misc.h
diff --git a/example/libs_stm/inc/stm32l1xx/misc.h b/example/libs_stm/inc/stm32l1xx/misc.h
new file mode 100644 (file)
index 0000000..cc55190
--- /dev/null
@@ -0,0 +1,196 @@
+/**\r
+  ******************************************************************************\r
+  * @file    misc.h\r
+  * @author  MCD Application Team\r
+  * @version V1.0.0\r
+  * @date    31-December-2010\r
+  * @brief   This file contains all the functions prototypes for the miscellaneous\r
+  *          firmware library functions (add-on to CMSIS functions).\r
+  ******************************************************************************\r
+  * @attention\r
+  *\r
+  * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS\r
+  * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE\r
+  * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY\r
+  * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING\r
+  * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE\r
+  * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.\r
+  *\r
+  * <h2><center>&copy; COPYRIGHT 2010 STMicroelectronics</center></h2>\r
+  ******************************************************************************  \r
+  */ \r
+\r
+/* Define to prevent recursive inclusion -------------------------------------*/\r
+#ifndef __MISC_H\r
+#define __MISC_H\r
+\r
+#ifdef __cplusplus\r
+ extern "C" {\r
+#endif\r
+\r
+/* Includes ------------------------------------------------------------------*/\r
+#include "stm32l1xx.h"\r
+\r
+/** @addtogroup STM32L1xx_StdPeriph_Driver\r
+  * @{\r
+  */\r
+\r
+/** @addtogroup MISC\r
+  * @{\r
+  */\r
+\r
+/* Exported types ------------------------------------------------------------*/\r
+\r
+/** \r
+  * @brief  NVIC Init Structure definition  \r
+  */\r
+\r
+typedef struct\r
+{\r
+  uint8_t NVIC_IRQChannel;                    /*!< Specifies the IRQ channel to be enabled or disabled.\r
+                                                   This parameter can be a value of @ref IRQn_Type \r
+                                                   (For the complete STM32 Devices IRQ Channels list, please\r
+                                                    refer to stm32l1xx.h file) */\r
+\r
+  uint8_t NVIC_IRQChannelPreemptionPriority;  /*!< Specifies the pre-emption priority for the IRQ channel\r
+                                                   specified in NVIC_IRQChannel. This parameter can be a value\r
+                                                   between 0 and 15 as described in the table @ref NVIC_Priority_Table */\r
+\r
+  uint8_t NVIC_IRQChannelSubPriority;         /*!< Specifies the subpriority level for the IRQ channel specified\r
+                                                   in NVIC_IRQChannel. This parameter can be a value\r
+                                                   between 0 and 15 as described in the table @ref NVIC_Priority_Table */\r
+\r
+  FunctionalState NVIC_IRQChannelCmd;         /*!< Specifies whether the IRQ channel defined in NVIC_IRQChannel\r
+                                                   will be enabled or disabled. \r
+                                                   This parameter can be set either to ENABLE or DISABLE */   \r
+} NVIC_InitTypeDef;\r
+\r
+/**  \r
+  *\r
+@verbatim   \r
+ The table below gives the allowed values of the pre-emption priority and subpriority according\r
+ to the Priority Grouping configuration performed by NVIC_PriorityGroupConfig function\r
+  ============================================================================================================================\r
+    NVIC_PriorityGroup   | NVIC_IRQChannelPreemptionPriority | NVIC_IRQChannelSubPriority  | Description\r
+  ============================================================================================================================\r
+   NVIC_PriorityGroup_0  |                0                  |            0-15             |   0 bits for pre-emption priority\r
+                         |                                   |                             |   4 bits for subpriority\r
+  ----------------------------------------------------------------------------------------------------------------------------\r
+   NVIC_PriorityGroup_1  |                0-1                |            0-7              |   1 bits for pre-emption priority\r
+                         |                                   |                             |   3 bits for subpriority\r
+  ----------------------------------------------------------------------------------------------------------------------------    \r
+   NVIC_PriorityGroup_2  |                0-3                |            0-3              |   2 bits for pre-emption priority\r
+                         |                                   |                             |   2 bits for subpriority\r
+  ----------------------------------------------------------------------------------------------------------------------------    \r
+   NVIC_PriorityGroup_3  |                0-7                |            0-1              |   3 bits for pre-emption priority\r
+                         |                                   |                             |   1 bits for subpriority\r
+  ----------------------------------------------------------------------------------------------------------------------------    \r
+   NVIC_PriorityGroup_4  |                0-15               |            0                |   4 bits for pre-emption priority\r
+                         |                                   |                             |   0 bits for subpriority                       \r
+  ============================================================================================================================\r
+@endverbatim\r
+*/\r
+\r
+/* Exported constants --------------------------------------------------------*/\r
+\r
+/** @defgroup MISC_Exported_Constants\r
+  * @{\r
+  */\r
+\r
+/** @defgroup Vector_Table_Base \r
+  * @{\r
+  */\r
+\r
+#define NVIC_VectTab_RAM             ((uint32_t)0x20000000)\r
+#define NVIC_VectTab_FLASH           ((uint32_t)0x08000000)\r
+#define IS_NVIC_VECTTAB(VECTTAB) (((VECTTAB) == NVIC_VectTab_RAM) || \\r
+                                  ((VECTTAB) == NVIC_VectTab_FLASH))\r
+/**\r
+  * @}\r
+  */\r
+\r
+/** @defgroup System_Low_Power \r
+  * @{\r
+  */\r
+\r
+#define NVIC_LP_SEVONPEND            ((uint8_t)0x10)\r
+#define NVIC_LP_SLEEPDEEP            ((uint8_t)0x04)\r
+#define NVIC_LP_SLEEPONEXIT          ((uint8_t)0x02)\r
+#define IS_NVIC_LP(LP) (((LP) == NVIC_LP_SEVONPEND) || \\r
+                        ((LP) == NVIC_LP_SLEEPDEEP) || \\r
+                        ((LP) == NVIC_LP_SLEEPONEXIT))\r
+/**\r
+  * @}\r
+  */\r
+\r
+/** @defgroup Preemption_Priority_Group \r
+  * @{\r
+  */\r
+\r
+#define NVIC_PriorityGroup_0         ((uint32_t)0x700) /*!< 0 bits for pre-emption priority\r
+                                                            4 bits for subpriority */\r
+#define NVIC_PriorityGroup_1         ((uint32_t)0x600) /*!< 1 bits for pre-emption priority\r
+                                                            3 bits for subpriority */\r
+#define NVIC_PriorityGroup_2         ((uint32_t)0x500) /*!< 2 bits for pre-emption priority\r
+                                                            2 bits for subpriority */\r
+#define NVIC_PriorityGroup_3         ((uint32_t)0x400) /*!< 3 bits for pre-emption priority\r
+                                                            1 bits for subpriority */\r
+#define NVIC_PriorityGroup_4         ((uint32_t)0x300) /*!< 4 bits for pre-emption priority\r
+                                                            0 bits for subpriority */\r
+\r
+#define IS_NVIC_PRIORITY_GROUP(GROUP) (((GROUP) == NVIC_PriorityGroup_0) || \\r
+                                       ((GROUP) == NVIC_PriorityGroup_1) || \\r
+                                       ((GROUP) == NVIC_PriorityGroup_2) || \\r
+                                       ((GROUP) == NVIC_PriorityGroup_3) || \\r
+                                       ((GROUP) == NVIC_PriorityGroup_4))\r
+\r
+#define IS_NVIC_PREEMPTION_PRIORITY(PRIORITY)  ((PRIORITY) < 0x10)\r
+\r
+#define IS_NVIC_SUB_PRIORITY(PRIORITY)  ((PRIORITY) < 0x10)\r
+\r
+#define IS_NVIC_OFFSET(OFFSET)  ((OFFSET) < 0x0001FFFF)\r
+\r
+/**\r
+  * @}\r
+  */\r
+\r
+/** @defgroup SysTick_clock_source \r
+  * @{\r
+  */\r
+\r
+#define SysTick_CLKSource_HCLK_Div8    ((uint32_t)0xFFFFFFFB)\r
+#define SysTick_CLKSource_HCLK         ((uint32_t)0x00000004)\r
+#define IS_SYSTICK_CLK_SOURCE(SOURCE) (((SOURCE) == SysTick_CLKSource_HCLK) || \\r
+                                       ((SOURCE) == SysTick_CLKSource_HCLK_Div8))\r
+/**\r
+  * @}\r
+  */\r
+\r
+/**\r
+  * @}\r
+  */\r
+\r
+/* Exported macro ------------------------------------------------------------*/\r
+/* Exported functions ------------------------------------------------------- */ \r
+\r
+void NVIC_PriorityGroupConfig(uint32_t NVIC_PriorityGroup);\r
+void NVIC_Init(NVIC_InitTypeDef* NVIC_InitStruct);\r
+void NVIC_SetVectorTable(uint32_t NVIC_VectTab, uint32_t Offset);\r
+void NVIC_SystemLPConfig(uint8_t LowPowerMode, FunctionalState NewState);\r
+void SysTick_CLKSourceConfig(uint32_t SysTick_CLKSource);\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif\r
+\r
+#endif /* __MISC_H */\r
+\r
+/**\r
+  * @}\r
+  */\r
+\r
+/**\r
+  * @}\r
+  */\r
+\r
+/******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE****/\r