misc.h

Go to the documentation of this file.
00001 /**
00002   ******************************************************************************
00003   * @file    misc.h
00004   * @author  MCD Application Team
00005   * @version V3.4.0
00006   * @date    10/15/2010
00007   * @brief   This file contains all the functions prototypes for the miscellaneous
00008   *          firmware library functions (add-on to CMSIS functions).
00009   ******************************************************************************
00010   * @copy
00011   *
00012   * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
00013   * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
00014   * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
00015   * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
00016   * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
00017   * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
00018   *
00019   * <h2><center>&copy; COPYRIGHT 2010 STMicroelectronics</center></h2>
00020   */ 
00021 
00022 /* Define to prevent recursive inclusion -------------------------------------*/
00023 #ifndef __MISC_H
00024 #define __MISC_H
00025 
00026 #ifdef __cplusplus
00027  extern "C" {
00028 #endif
00029 
00030 /* Includes ------------------------------------------------------------------*/
00031 #include "stm32f10x.h"
00032 
00033 /** @addtogroup STM32F10x_StdPeriph_Driver
00034   * @{
00035   */
00036 
00037 /** @addtogroup MISC
00038   * @{
00039   */
00040 
00041 /** @defgroup MISC_Exported_Types
00042   * @{
00043   */
00044 
00045 /** 
00046   * @brief  NVIC Init Structure definition  
00047   */
00048 
00049 typedef struct
00050 {
00051   uint8_t NVIC_IRQChannel;                    /*!< Specifies the IRQ channel to be enabled or disabled.
00052                                                    This parameter can be a value of @ref IRQn_Type 
00053                                                    (For the complete STM32 Devices IRQ Channels list, please
00054                                                     refer to stm32f10x.h file) */
00055 
00056   uint8_t NVIC_IRQChannelPreemptionPriority;  /*!< Specifies the pre-emption priority for the IRQ channel
00057                                                    specified in NVIC_IRQChannel. This parameter can be a value
00058                                                    between 0 and 15 as described in the table @ref NVIC_Priority_Table */
00059 
00060   uint8_t NVIC_IRQChannelSubPriority;         /*!< Specifies the subpriority level for the IRQ channel specified
00061                                                    in NVIC_IRQChannel. This parameter can be a value
00062                                                    between 0 and 15 as described in the table @ref NVIC_Priority_Table */
00063 
00064   FunctionalState NVIC_IRQChannelCmd;         /*!< Specifies whether the IRQ channel defined in NVIC_IRQChannel
00065                                                    will be enabled or disabled. 
00066                                                    This parameter can be set either to ENABLE or DISABLE */   
00067 } NVIC_InitTypeDef;
00068  
00069 /**
00070   * @}
00071   */
00072 
00073 /** @defgroup NVIC_Priority_Table 
00074   * @{
00075   */
00076 
00077 /**
00078 @code  
00079  The table below gives the allowed values of the pre-emption priority and subpriority according
00080  to the Priority Grouping configuration performed by NVIC_PriorityGroupConfig function
00081   ============================================================================================================================
00082     NVIC_PriorityGroup   | NVIC_IRQChannelPreemptionPriority | NVIC_IRQChannelSubPriority  | Description
00083   ============================================================================================================================
00084    NVIC_PriorityGroup_0  |                0                  |            0-15             |   0 bits for pre-emption priority
00085                          |                                   |                             |   4 bits for subpriority
00086   ----------------------------------------------------------------------------------------------------------------------------
00087    NVIC_PriorityGroup_1  |                0-1                |            0-7              |   1 bits for pre-emption priority
00088                          |                                   |                             |   3 bits for subpriority
00089   ----------------------------------------------------------------------------------------------------------------------------    
00090    NVIC_PriorityGroup_2  |                0-3                |            0-3              |   2 bits for pre-emption priority
00091                          |                                   |                             |   2 bits for subpriority
00092   ----------------------------------------------------------------------------------------------------------------------------    
00093    NVIC_PriorityGroup_3  |                0-7                |            0-1              |   3 bits for pre-emption priority
00094                          |                                   |                             |   1 bits for subpriority
00095   ----------------------------------------------------------------------------------------------------------------------------    
00096    NVIC_PriorityGroup_4  |                0-15               |            0                |   4 bits for pre-emption priority
00097                          |                                   |                             |   0 bits for subpriority                       
00098   ============================================================================================================================
00099 @endcode
00100 */
00101 
00102 /**
00103   * @}
00104   */
00105 
00106 /** @defgroup MISC_Exported_Constants
00107   * @{
00108   */
00109 
00110 /** @defgroup Vector_Table_Base 
00111   * @{
00112   */
00113 
00114 #define NVIC_VectTab_RAM             ((uint32_t)0x20000000)
00115 #define NVIC_VectTab_FLASH           ((uint32_t)0x08000000)
00116 #define IS_NVIC_VECTTAB(VECTTAB) (((VECTTAB) == NVIC_VectTab_RAM) || \
00117                                   ((VECTTAB) == NVIC_VectTab_FLASH))
00118 /**
00119   * @}
00120   */
00121 
00122 /** @defgroup System_Low_Power 
00123   * @{
00124   */
00125 
00126 #define NVIC_LP_SEVONPEND            ((uint8_t)0x10)
00127 #define NVIC_LP_SLEEPDEEP            ((uint8_t)0x04)
00128 #define NVIC_LP_SLEEPONEXIT          ((uint8_t)0x02)
00129 #define IS_NVIC_LP(LP) (((LP) == NVIC_LP_SEVONPEND) || \
00130                         ((LP) == NVIC_LP_SLEEPDEEP) || \
00131                         ((LP) == NVIC_LP_SLEEPONEXIT))
00132 /**
00133   * @}
00134   */
00135 
00136 /** @defgroup Preemption_Priority_Group 
00137   * @{
00138   */
00139 
00140 #define NVIC_PriorityGroup_0         ((uint32_t)0x700) /*!< 0 bits for pre-emption priority
00141                                                             4 bits for subpriority */
00142 #define NVIC_PriorityGroup_1         ((uint32_t)0x600) /*!< 1 bits for pre-emption priority
00143                                                             3 bits for subpriority */
00144 #define NVIC_PriorityGroup_2         ((uint32_t)0x500) /*!< 2 bits for pre-emption priority
00145                                                             2 bits for subpriority */
00146 #define NVIC_PriorityGroup_3         ((uint32_t)0x400) /*!< 3 bits for pre-emption priority
00147                                                             1 bits for subpriority */
00148 #define NVIC_PriorityGroup_4         ((uint32_t)0x300) /*!< 4 bits for pre-emption priority
00149                                                             0 bits for subpriority */
00150 
00151 #define IS_NVIC_PRIORITY_GROUP(GROUP) (((GROUP) == NVIC_PriorityGroup_0) || \
00152                                        ((GROUP) == NVIC_PriorityGroup_1) || \
00153                                        ((GROUP) == NVIC_PriorityGroup_2) || \
00154                                        ((GROUP) == NVIC_PriorityGroup_3) || \
00155                                        ((GROUP) == NVIC_PriorityGroup_4))
00156 
00157 #define IS_NVIC_PREEMPTION_PRIORITY(PRIORITY)  ((PRIORITY) < 0x10)
00158 
00159 #define IS_NVIC_SUB_PRIORITY(PRIORITY)  ((PRIORITY) < 0x10)
00160 
00161 #define IS_NVIC_OFFSET(OFFSET)  ((OFFSET) < 0x000FFFFF)
00162 
00163 /**
00164   * @}
00165   */
00166 
00167 /** @defgroup SysTick_clock_source 
00168   * @{
00169   */
00170 
00171 #define SysTick_CLKSource_HCLK_Div8    ((uint32_t)0xFFFFFFFB)
00172 #define SysTick_CLKSource_HCLK         ((uint32_t)0x00000004)
00173 #define IS_SYSTICK_CLK_SOURCE(SOURCE) (((SOURCE) == SysTick_CLKSource_HCLK) || \
00174                                        ((SOURCE) == SysTick_CLKSource_HCLK_Div8))
00175 /**
00176   * @}
00177   */
00178 
00179 /**
00180   * @}
00181   */
00182 
00183 /** @defgroup MISC_Exported_Macros
00184   * @{
00185   */
00186 
00187 /**
00188   * @}
00189   */
00190 
00191 /** @defgroup MISC_Exported_Functions
00192   * @{
00193   */
00194 
00195 void NVIC_PriorityGroupConfig(uint32_t NVIC_PriorityGroup);
00196 void NVIC_Init(NVIC_InitTypeDef* NVIC_InitStruct);
00197 void NVIC_SetVectorTable(uint32_t NVIC_VectTab, uint32_t Offset);
00198 void NVIC_SystemLPConfig(uint8_t LowPowerMode, FunctionalState NewState);
00199 void SysTick_CLKSourceConfig(uint32_t SysTick_CLKSource);
00200 
00201 #ifdef __cplusplus
00202 }
00203 #endif
00204 
00205 #endif /* __MISC_H */
00206 
00207 /**
00208   * @}
00209   */
00210 
00211 /**
00212   * @}
00213   */
00214 
00215 /**
00216   * @}
00217   */
00218 
00219 /******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE****/
STM32F10x Standard Peripherals Library: Footer

 

 

 

      For complete documentation on STM32(CORTEX M3) 32-bit Microcontrollers platform visit  www.st.com/STM32