⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 stm32f10x_nvic.lst

📁 STM32利用正交编码器实现电机的控制
💻 LST
📖 第 1 页 / 共 4 页
字号:
##############################################################################
#                                                                            #
# IAR ARM ANSI C/C++ Compiler V4.42A/W32               15/May/2008  12:06:32 #
# Copyright 1999-2005 IAR Systems. All rights reserved.                      #
#                                                                            #
#    Cpu mode        =  thumb                                                #
#    Endian          =  little                                               #
#    Stack alignment =  4                                                    #
#    Source file     =  C:\David JIANG\ST MCU\Docs\STM32\AN_JIANG\TIM        #
#                       Encoder\example\FWLib\src\stm32f10x_nvic.c           #
#    Command line    =  "C:\David JIANG\ST MCU\Docs\STM32\AN_JIANG\TIM       #
#                       Encoder\example\FWLib\src\stm32f10x_nvic.c" -D       #
#                       VECT_TAB_FLASH -lcN "C:\David JIANG\ST               #
#                       MCU\Docs\STM32\AN_JIANG\TIM                          #
#                       Encoder\example\project\EWARM\BOOT_FLASH\List\" -lb  #
#                       "C:\David JIANG\ST MCU\Docs\STM32\AN_JIANG\TIM       #
#                       Encoder\example\project\EWARM\BOOT_FLASH\List\" -o   #
#                       "C:\David JIANG\ST MCU\Docs\STM32\AN_JIANG\TIM       #
#                       Encoder\example\project\EWARM\BOOT_FLASH\Obj\" -z3   #
#                       --no_cse --no_unroll --no_inline --no_code_motion    #
#                       --no_tbaa --no_clustering --no_scheduling --debug    #
#                       --cpu_mode thumb --endian little --cpu cortex-M3     #
#                       --stack_align 4 --require_prototypes --fpu None      #
#                       --dlib_config "C:\Program Files\IAR                  #
#                       Systems\Embedded Workbench                           #
#                       4.0\arm\LIB\dl7mptnnl8f.h" -I "C:\David JIANG\ST     #
#                       MCU\Docs\STM32\AN_JIANG\TIM                          #
#                       Encoder\example\project\EWARM\" -I "C:\David         #
#                       JIANG\ST MCU\Docs\STM32\AN_JIANG\TIM                 #
#                       Encoder\example\project\EWARM\..\include\" -I        #
#                       "C:\David JIANG\ST MCU\Docs\STM32\AN_JIANG\TIM       #
#                       Encoder\example\project\EWARM\..\..\FWLib\inc\" -I   #
#                       "C:\Program Files\IAR Systems\Embedded Workbench     #
#                       4.0\arm\INC\"                                        #
#    List file       =  C:\David JIANG\ST MCU\Docs\STM32\AN_JIANG\TIM        #
#                       Encoder\example\project\EWARM\BOOT_FLASH\List\stm32f #
#                       10x_nvic.lst                                         #
#    Object file     =  C:\David JIANG\ST MCU\Docs\STM32\AN_JIANG\TIM        #
#                       Encoder\example\project\EWARM\BOOT_FLASH\Obj\stm32f1 #
#                       0x_nvic.r79                                          #
#                                                                            #
#                                                                            #
##############################################################################

C:\David JIANG\ST MCU\Docs\STM32\AN_JIANG\TIM Encoder\example\FWLib\src\stm32f10x_nvic.c
      1          /******************** (C) COPYRIGHT 2007 STMicroelectronics ********************
      2          * File Name          : stm32f10x_nvic.c
      3          * Author             : MCD Application Team
      4          * Date First Issued  : 09/29/2006
      5          * Description        : This file provides all the NVIC firmware functions.
      6          ********************************************************************************
      7          * History:
      8          * 05/21/2007: V0.3
      9          * 04/02/2007: V0.2
     10          * 02/05/2007: V0.1
     11          * 09/29/2006: V0.01
     12          ********************************************************************************
     13          * THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
     14          * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
     15          * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
     16          * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
     17          * CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
     18          * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
     19          *******************************************************************************/
     20          
     21          /* Includes ------------------------------------------------------------------*/
     22          #include "stm32f10x_nvic.h"
     23          
     24          /* Private typedef -----------------------------------------------------------*/
     25          /* Private define ------------------------------------------------------------*/
     26          #define AIRC_VECTKEY_MASK    ((u32)0x05FA0000)
     27          
     28          /* Private macro -------------------------------------------------------------*/
     29          /* Private variables ---------------------------------------------------------*/
     30          /* Private function prototypes -----------------------------------------------*/
     31          /* Private functions ---------------------------------------------------------*/
     32          
     33          /*******************************************************************************
     34          * Function Name  : NVIC_DeInit
     35          * Description    : Deinitializes the NVIC peripheral registers to their default
     36          *                  reset values.
     37          * Input          : None
     38          * Output         : None
     39          * Return         : None
     40          *******************************************************************************/
     41          void NVIC_DeInit(void)
     42          {
     43            u32 index = 0;
     44            
     45            NVIC->Disable[0] = 0xFFFFFFFF;
     46            NVIC->Disable[1] = 0x000007FF;
     47            NVIC->Clear[0] = 0xFFFFFFFF;
     48            NVIC->Clear[1] = 0x000007FF;
     49            
     50            for(index = 0; index < 0x0B; index++)
     51            {
     52               NVIC->Priority[index] = 0x00000000;
     53            } 
     54          }
     55          
     56          /*******************************************************************************
     57          * Function Name  : NVIC_SCBDeInit
     58          * Description    : Deinitializes the SCB peripheral registers to their default 
     59          *                  reset values.
     60          * Input          : None
     61          * Output         : None
     62          * Return         : None
     63          *******************************************************************************/
     64          void NVIC_SCBDeInit(void)
     65          {
     66            u32 index = 0x00;
     67            
     68            SCB->IRQControlState = 0x0A000000;
     69            SCB->ExceptionTableOffset = 0x00000000;
     70            SCB->AIRC = AIRC_VECTKEY_MASK;
     71            SCB->SysCtrl = 0x00000000;
     72            SCB->ConfigCtrl = 0x00000000;
     73            for(index = 0; index < 0x03; index++)
     74            {
     75               SCB->SystemPriority[index] = 0;
     76            }
     77            SCB->SysHandlerCtrl = 0x00000000;
     78            SCB->ConfigFaultStatus = 0xFFFFFFFF;
     79            SCB->HardFaultStatus = 0xFFFFFFFF;
     80            SCB->DebugFaultStatus = 0xFFFFFFFF;
     81          }
     82          
     83          /*******************************************************************************
     84          * Function Name  : NVIC_PriorityGroupConfig
     85          * Description    : Configures the priority grouping: pre-emption priority
     86          *                  and subpriority.
     87          * Input          : - NVIC_PriorityGroup: specifies the priority grouping bits
     88          *                    length. This parameter can be one of the following values:
     89          *                       - NVIC_PriorityGroup_0: 0 bits for pre-emption priority
     90          *                         4 bits for subpriority
     91          *                       - NVIC_PriorityGroup_1: 1 bits for pre-emption priority
     92          *                         3 bits for subpriority
     93          *                       - NVIC_PriorityGroup_2: 2 bits for pre-emption priority
     94          *                         2 bits for subpriority
     95          *                       - NVIC_PriorityGroup_3: 3 bits for pre-emption priority
     96          *                         1 bits for subpriority
     97          *                       - NVIC_PriorityGroup_4: 4 bits for pre-emption priority
     98          *                         0 bits for subpriority
     99          * Output         : None
    100          * Return         : None
    101          *******************************************************************************/
    102          void NVIC_PriorityGroupConfig(u32 NVIC_PriorityGroup)
    103          {
    104            /* Check the parameters */
    105            assert(IS_NVIC_PRIORITY_GROUP(NVIC_PriorityGroup));
    106            
    107            /* Set the PRIGROUP[10:8] bits according to NVIC_PriorityGroup value */
    108            SCB->AIRC = AIRC_VECTKEY_MASK | NVIC_PriorityGroup;
    109          }
    110          
    111          /*******************************************************************************
    112          * Function Name  : NVIC_Init
    113          * Description    : Initializes the NVIC peripheral according to the specified
    114          *                  parameters in the NVIC_InitStruct.
    115          * Input          : - NVIC_InitStruct: pointer to a NVIC_InitTypeDef structure
    116          *                    that contains the configuration information for the
    117          *                    specified NVIC peripheral.
    118          * Output         : None
    119          * Return         : None
    120          *******************************************************************************/
    121          void NVIC_Init(NVIC_InitTypeDef* NVIC_InitStruct)
    122          {
    123            u32 tmppriority = 0x00, tmpreg = 0x00, tmpmask = 0x00;
    124            u32 tmppre = 0, tmpsub = 0x0F;
    125          
    126            /* Check the parameters */
    127            assert(IS_FUNCTIONAL_STATE(NVIC_InitStruct->NVIC_IRQChannelCmd));
    128            assert(IS_NVIC_IRQ_CHANNEL(NVIC_InitStruct->NVIC_IRQChannel));
    129            assert(IS_NVIC_PREEMPTION_PRIORITY(NVIC_InitStruct->NVIC_IRQChannelPreemptionPriority));  
    130            assert(IS_NVIC_SUB_PRIORITY(NVIC_InitStruct->NVIC_IRQChannelSubPriority));
    131              
    132            if (NVIC_InitStruct->NVIC_IRQChannelCmd != DISABLE)
    133            {
    134              /* Compute the Corresponding IRQ Priority --------------------------------*/    
    135              tmppriority = (0x700 - (SCB->AIRC & (u32)0x700))>> 0x08;
    136              tmppre = (0x4 - tmppriority);
    137              tmpsub = tmpsub >> tmppriority;
    138              
    139              tmppriority = (u32)NVIC_InitStruct->NVIC_IRQChannelPreemptionPriority << tmppre;
    140              tmppriority |=  NVIC_InitStruct->NVIC_IRQChannelSubPriority & tmpsub;
    141          
    142              tmppriority = tmppriority << 0x04;
    143              tmppriority = ((u32)tmppriority) << ((NVIC_InitStruct->NVIC_IRQChannel & (u8)0x03) * 0x08);
    144              
    145              tmpreg = NVIC->Priority[(NVIC_InitStruct->NVIC_IRQChannel >> 0x02)];
    146              tmpmask = (u32)0xFF << ((NVIC_InitStruct->NVIC_IRQChannel & (u8)0x03) * 0x08);
    147              tmpreg &= ~tmpmask;
    148              tmppriority &= tmpmask;  
    149              tmpreg |= tmppriority;
    150          
    151              NVIC->Priority[(NVIC_InitStruct->NVIC_IRQChannel >> 0x02)] = tmpreg;
    152              
    153              /* Enable the Selected IRQ Channels --------------------------------------*/
    154              NVIC->Enable[(NVIC_InitStruct->NVIC_IRQChannel >> 0x05)] =
    155                (u32)0x01 << (NVIC_InitStruct->NVIC_IRQChannel & (u8)0x1F);
    156            }
    157            else
    158            {
    159              /* Disable the Selected IRQ Channels -------------------------------------*/
    160              NVIC->Disable[(NVIC_InitStruct->NVIC_IRQChannel >> 0x05)] =
    161                (u32)0x01 << (NVIC_InitStruct->NVIC_IRQChannel & (u8)0x1F);
    162            }
    163          }
    164          
    165          /*******************************************************************************
    166          * Function Name  : NVIC_StructInit
    167          * Description    : Fills each NVIC_InitStruct member with its default value.
    168          * Input          : - NVIC_InitStruct: pointer to a NVIC_InitTypeDef structure which
    169          *                    will be initialized.
    170          * Output         : None
    171          * Return         : None
    172          *******************************************************************************/
    173          void NVIC_StructInit(NVIC_InitTypeDef* NVIC_InitStruct)
    174          {
    175            /* NVIC_InitStruct members default value */
    176            NVIC_InitStruct->NVIC_IRQChannel = 0x00;
    177            NVIC_InitStruct->NVIC_IRQChannelPreemptionPriority = 0x00;
    178            NVIC_InitStruct->NVIC_IRQChannelSubPriority = 0x00;
    179            NVIC_InitStruct->NVIC_IRQChannelCmd = DISABLE;
    180          }
    181          
    182          /*******************************************************************************
    183          * Function Name  : NVIC_SETPRIMASK
    184          * Description    : Enables the PRIMASK priority: Raises the execution priority to 0.
    185          * Input          : None
    186          * Output         : None

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -