Martin Johnson / STM32F3-Discovery

Dependents:   Space_Invaders_Demo neopixels gpio_test_stm32f3_discovery gpio_test_systimer ... more

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers stm32f30x_misc.h Source File

stm32f30x_misc.h

Go to the documentation of this file.
00001 /**
00002   ******************************************************************************
00003   * @file    stm32f30x_misc.h
00004   * @author  MCD Application Team
00005   * @version V1.2.3
00006   * @date    10-July-2015
00007   * @brief   This file contains all the functions prototypes for the miscellaneous
00008   *          firmware library functions (add-on to CMSIS functions).
00009   ******************************************************************************
00010   * @attention
00011   *
00012   * <h2><center>&copy; COPYRIGHT 2015 STMicroelectronics</center></h2>
00013   *
00014   * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
00015   * You may not use this file except in compliance with the License.
00016   * You may obtain a copy of the License at:
00017   *
00018   *        http://www.st.com/software_license_agreement_liberty_v2
00019   *
00020   * Unless required by applicable law or agreed to in writing, software 
00021   * distributed under the License is distributed on an "AS IS" BASIS, 
00022   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00023   * See the License for the specific language governing permissions and
00024   * limitations under the License.
00025   *
00026   ******************************************************************************
00027   */
00028 
00029 /* Define to prevent recursive inclusion -------------------------------------*/
00030 #ifndef __STM32F30x_MISC_H
00031 #define __STM32F30x_MISC_H
00032 
00033 #ifdef __cplusplus
00034  extern "C" {
00035 #endif
00036 
00037 /* Includes ------------------------------------------------------------------*/
00038 #include "stm32f30x.h"
00039 
00040 /** @addtogroup STM32F30x_StdPeriph_Driver
00041   * @{
00042   */
00043 
00044 /** @addtogroup MISC
00045   * @{
00046   */
00047 
00048 /* Exported types ------------------------------------------------------------*/
00049 
00050 /** 
00051   * @brief  NVIC Init Structure definition  
00052   */
00053 
00054 typedef struct
00055 {
00056   uint8_t NVIC_IRQChannel;                    /*!< Specifies the IRQ channel to be enabled or disabled.
00057                                                    This parameter can be a value of @ref IRQn_Type (For 
00058                                                    the complete STM32 Devices IRQ Channels list, please
00059                                                     refer to stm32f30x.h file) */
00060 
00061   uint8_t NVIC_IRQChannelPreemptionPriority;  /*!< Specifies the pre-emption priority for the IRQ channel
00062                                                    specified in NVIC_IRQChannel. This parameter can be a value
00063                                                    between 0 and 15.
00064                                                    A lower priority value indicates a higher priority */
00065                                                    
00066 
00067   uint8_t NVIC_IRQChannelSubPriority;         /*!< Specifies the subpriority level for the IRQ channel specified
00068                                                    in NVIC_IRQChannel. This parameter can be a value 
00069                                                    between 0 and 15.
00070                                                    A lower priority value indicates a higher priority */
00071 
00072   FunctionalState NVIC_IRQChannelCmd;         /*!< Specifies whether the IRQ channel defined in NVIC_IRQChannel
00073                                                    will be enabled or disabled. 
00074                                                    This parameter can be set either to ENABLE or DISABLE */   
00075 } NVIC_InitTypeDef;
00076 
00077 /**  
00078   *
00079 @verbatim   
00080  The table below gives the allowed values of the pre-emption priority and subpriority according
00081  to the Priority Grouping configuration performed by NVIC_PriorityGroupConfig function
00082   ============================================================================================================================
00083     NVIC_PriorityGroup   | NVIC_IRQChannelPreemptionPriority | NVIC_IRQChannelSubPriority  | Description
00084   ============================================================================================================================
00085    NVIC_PriorityGroup_0  |                0                  |            0-15             |   0 bits for pre-emption priority
00086                          |                                   |                             |   4 bits for subpriority
00087   ----------------------------------------------------------------------------------------------------------------------------
00088    NVIC_PriorityGroup_1  |                0-1                |            0-7              |   1 bits for pre-emption priority
00089                          |                                   |                             |   3 bits for subpriority
00090   ----------------------------------------------------------------------------------------------------------------------------    
00091    NVIC_PriorityGroup_2  |                0-3                |            0-3              |   2 bits for pre-emption priority
00092                          |                                   |                             |   2 bits for subpriority
00093   ----------------------------------------------------------------------------------------------------------------------------    
00094    NVIC_PriorityGroup_3  |                0-7                |            0-1              |   3 bits for pre-emption priority
00095                          |                                   |                             |   1 bits for subpriority
00096   ----------------------------------------------------------------------------------------------------------------------------    
00097    NVIC_PriorityGroup_4  |                0-15               |            0                |   4 bits for pre-emption priority
00098                          |                                   |                             |   0 bits for subpriority                       
00099   ============================================================================================================================
00100 @endverbatim
00101 */
00102  
00103 /* Exported constants --------------------------------------------------------*/
00104 
00105 /** @defgroup MISC_Exported_Constants
00106   * @{
00107   */
00108 
00109 /** @defgroup MISC_Vector_Table_Base 
00110   * @{
00111   */
00112 
00113 #define NVIC_VectTab_RAM             ((uint32_t)0x20000000)
00114 #define NVIC_VectTab_FLASH           ((uint32_t)0x08000000)
00115 #define IS_NVIC_VECTTAB(VECTTAB) (((VECTTAB) == NVIC_VectTab_RAM) || \
00116                                   ((VECTTAB) == NVIC_VectTab_FLASH))
00117 /**
00118   * @}
00119   */
00120 
00121 /** @defgroup MISC_System_Low_Power 
00122   * @{
00123   */
00124 
00125 #define NVIC_LP_SEVONPEND            ((uint8_t)0x10)
00126 #define NVIC_LP_SLEEPDEEP            ((uint8_t)0x04)
00127 #define NVIC_LP_SLEEPONEXIT          ((uint8_t)0x02)
00128 #define IS_NVIC_LP(LP) (((LP) == NVIC_LP_SEVONPEND) || \
00129                         ((LP) == NVIC_LP_SLEEPDEEP) || \
00130                         ((LP) == NVIC_LP_SLEEPONEXIT))
00131 /**
00132   * @}
00133   */
00134 
00135 /** @defgroup MISC_Preemption_Priority_Group 
00136   * @{
00137   */
00138 
00139 #define NVIC_PriorityGroup_0         ((uint32_t)0x700) /*!< 0 bits for pre-emption priority
00140                                                             4 bits for subpriority */
00141 #define NVIC_PriorityGroup_1         ((uint32_t)0x600) /*!< 1 bits for pre-emption priority
00142                                                             3 bits for subpriority */
00143 #define NVIC_PriorityGroup_2         ((uint32_t)0x500) /*!< 2 bits for pre-emption priority
00144                                                             2 bits for subpriority */
00145 #define NVIC_PriorityGroup_3         ((uint32_t)0x400) /*!< 3 bits for pre-emption priority
00146                                                             1 bits for subpriority */
00147 #define NVIC_PriorityGroup_4         ((uint32_t)0x300) /*!< 4 bits for pre-emption priority
00148                                                             0 bits for subpriority */
00149 
00150 #define IS_NVIC_PRIORITY_GROUP(GROUP) (((GROUP) == NVIC_PriorityGroup_0) || \
00151                                        ((GROUP) == NVIC_PriorityGroup_1) || \
00152                                        ((GROUP) == NVIC_PriorityGroup_2) || \
00153                                        ((GROUP) == NVIC_PriorityGroup_3) || \
00154                                        ((GROUP) == NVIC_PriorityGroup_4))
00155 
00156 #define IS_NVIC_PREEMPTION_PRIORITY(PRIORITY)  ((PRIORITY) < 0x10)
00157 
00158 #define IS_NVIC_SUB_PRIORITY(PRIORITY)  ((PRIORITY) < 0x10)
00159 
00160 #define IS_NVIC_OFFSET(OFFSET)  ((OFFSET) < 0x000FFFFF)
00161 
00162 /**
00163   * @}
00164   */
00165 
00166 /** @defgroup MISC_SysTick_clock_source 
00167   */
00168 
00169 #define SysTick_CLKSource_HCLK_Div8    ((uint32_t)0xFFFFFFFB)
00170 #define SysTick_CLKSource_HCLK         ((uint32_t)0x00000004)
00171 #define IS_SYSTICK_CLK_SOURCE(SOURCE) (((SOURCE) == SysTick_CLKSource_HCLK) || \
00172                                        ((SOURCE) == SysTick_CLKSource_HCLK_Div8))
00173 /**
00174   * @}
00175   */
00176 
00177 /**
00178   * @}
00179   */
00180 
00181 /* Exported macro ------------------------------------------------------------*/
00182 /* Exported functions --------------------------------------------------------*/
00183 
00184 void NVIC_PriorityGroupConfig(uint32_t NVIC_PriorityGroup);
00185 void NVIC_Init(NVIC_InitTypeDef* NVIC_InitStruct);
00186 void NVIC_SetVectorTable(uint32_t NVIC_VectTab, uint32_t Offset);
00187 void NVIC_SystemLPConfig(uint8_t LowPowerMode, FunctionalState NewState);
00188 void SysTick_CLKSourceConfig(uint32_t SysTick_CLKSource);
00189 
00190 #ifdef __cplusplus
00191 }
00192 #endif
00193 
00194 #endif /* __STM32F30x_MISC_H */
00195 
00196 /**
00197   * @}
00198   */
00199 
00200 /**
00201   * @}
00202   */
00203 
00204 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/