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

📄 stm32f10x_nvic.lst

📁 STM32利用正交编码器实现电机的控制
💻 LST
📖 第 1 页 / 共 4 页
字号:
    187          * Return         : None
    188          *******************************************************************************/
    189          void NVIC_SETPRIMASK(void)
    190          {
    191            __SETPRIMASK();
    192          }
    193          
    194          /*******************************************************************************
    195          * Function Name  : NVIC_RESETPRIMASK
    196          * Description    : Disables the PRIMASK priority.
    197          * Input          : None
    198          * Output         : None
    199          * Return         : None
    200          *******************************************************************************/
    201          void NVIC_RESETPRIMASK(void)
    202          {
    203            __RESETPRIMASK();
    204          }
    205          
    206          /*******************************************************************************
    207          * Function Name  : NVIC_SETFAULTMASK
    208          * Description    : Enables the FAULTMASK priority: Raises the execution priority to -1.
    209          * Input          : None
    210          * Output         : None
    211          * Return         : None
    212          *******************************************************************************/
    213          void NVIC_SETFAULTMASK(void)
    214          {
    215            __SETFAULTMASK();
    216          }
    217          
    218          /*******************************************************************************
    219          * Function Name  : NVIC_RESETFAULTMASK
    220          * Description    : Disables the FAULTMASK priority.
    221          * Input          : None
    222          * Output         : None
    223          * Return         : None
    224          *******************************************************************************/
    225          void NVIC_RESETFAULTMASK(void)
    226          {
    227            __RESETFAULTMASK();
    228          }
    229          
    230          /*******************************************************************************
    231          * Function Name  : NVIC_BASEPRICONFIG
    232          * Description    : The execution priority can be changed from 15 (lowest 
    233                             configurable priority) to 1.
    234          * Input          : None
    235          * Output         : None
    236          * Return         : None
    237          *******************************************************************************/
    238          void NVIC_BASEPRICONFIG(u32 NewPriority)
    239          {
    240            /* Check the parameters */
    241            assert(IS_NVIC_BASE_PRI(NewPriority));
    242            
    243            __BASEPRICONFIG(NewPriority << 0x04);
    244          }
    245          
    246          /*******************************************************************************
    247          * Function Name  : NVIC_GetBASEPRI
    248          * Description    : Returns the BASEPRI mask value.
    249          * Input          : None
    250          * Output         : None
    251          * Return         : BASEPRI register value
    252          *******************************************************************************/
    253          u32 NVIC_GetBASEPRI(void)
    254          {
    255            return (__GetBASEPRI());
    256          }
    257          
    258          /*******************************************************************************
    259          * Function Name  : NVIC_GetCurrentPendingIRQChannel
    260          * Description    : Returns the current pending IRQ channel identifier.
    261          * Input          : None
    262          * Output         : None
    263          * Return         : Pending IRQ Channel Identifier.
    264          *******************************************************************************/
    265          u16 NVIC_GetCurrentPendingIRQChannel(void)
    266          {
    267            return ((u16)((SCB->IRQControlState & (u32)0x003FF000) >> 0x0C));
    268          }
    269          
    270          /*******************************************************************************
    271          * Function Name  : NVIC_GetIRQChannelPendingBitStatus
    272          * Description    : Checks whether the specified IRQ Channel pending bit is set
    273          *                  or not.
    274          * Input          : - NVIC_IRQChannel: specifies the interrupt pending bit to check.
    275          * Output         : None
    276          * Return         : The new state of IRQ Channel pending bit(SET or RESET).
    277          *******************************************************************************/
    278          ITStatus NVIC_GetIRQChannelPendingBitStatus(u8 NVIC_IRQChannel)
    279          {
    280            ITStatus pendingirqstatus = RESET;
    281            u32 tmp = 0x00;
    282            
    283            /* Check the parameters */
    284            assert(IS_NVIC_IRQ_CHANNEL(NVIC_IRQChannel));
    285            
    286            tmp = ((u32)0x01 << (NVIC_IRQChannel & (u32)0x1F));
    287          
    288            if (((NVIC->Set[(NVIC_IRQChannel >> 0x05)]) & tmp) == tmp)
    289            {
    290              pendingirqstatus = SET;
    291            }
    292            else
    293            {
    294              pendingirqstatus = RESET;
    295            }
    296            return pendingirqstatus;
    297          }
    298          
    299          /*******************************************************************************
    300          * Function Name  : NVIC_SetIRQChannelPendingBit
    301          * Description    : Sets the NVIC抯 interrupt pending bit.
    302          * Input          : - NVIC_IRQChannel: specifies the interrupt pending bit to Set.
    303          * Output         : None
    304          * Return         : None
    305          *******************************************************************************/
    306          void NVIC_SetIRQChannelPendingBit(u8 NVIC_IRQChannel)
    307          {
    308            /* Check the parameters */
    309            assert(IS_NVIC_IRQ_CHANNEL(NVIC_IRQChannel));
    310            
    311            *(u32*)0xE000EF00 = (u32)NVIC_IRQChannel;
    312          }
    313          
    314          /*******************************************************************************
    315          * Function Name  : NVIC_ClearIRQChannelPendingBit
    316          * Description    : Clears the NVIC抯 interrupt pending bit.
    317          * Input          : - NVIC_IRQChannel: specifies the interrupt pending bit to clear.
    318          * Output         : None
    319          * Return         : None
    320          *******************************************************************************/
    321          void NVIC_ClearIRQChannelPendingBit(u8 NVIC_IRQChannel)
    322          {
    323            /* Check the parameters */
    324            assert(IS_NVIC_IRQ_CHANNEL(NVIC_IRQChannel));
    325            
    326            NVIC->Clear[(NVIC_IRQChannel >> 0x05)] = (u32)0x01 << (NVIC_IRQChannel & (u32)0x1F);
    327          }
    328          
    329          /*******************************************************************************
    330          * Function Name  : NVIC_GetCurrentActiveHandler
    331          * Description    : Returns the current active Handler (IRQ Channel and
    332          *                  SystemHandler) identifier.
    333          * Input          : None
    334          * Output         : None
    335          * Return         : Active Handler Identifier.
    336          *******************************************************************************/
    337          u16 NVIC_GetCurrentActiveHandler(void)
    338          {
    339            return ((u16)(SCB->IRQControlState & (u32)0x3FF));
    340          }
    341          
    342          /*******************************************************************************
    343          * Function Name  : NVIC_GetIRQChannelActiveBitStatus
    344          * Description    : Checks whether the specified IRQ Channel active bit is set
    345          *                  or not.
    346          * Input          : - NVIC_IRQChannel: specifies the interrupt active bit to check.
    347          * Output         : None
    348          * Return         : The new state of IRQ Channel active bit(SET or RESET).
    349          *******************************************************************************/
    350          ITStatus NVIC_GetIRQChannelActiveBitStatus(u8 NVIC_IRQChannel)
    351          {
    352            ITStatus activeirqstatus = RESET;
    353            u32 tmp = 0x00;
    354          
    355            /* Check the parameters */
    356            assert(IS_NVIC_IRQ_CHANNEL(NVIC_IRQChannel));
    357            
    358            tmp = ((u32)0x01 << (NVIC_IRQChannel & (u32)0x1F));
    359          
    360            if (((NVIC->Active[(NVIC_IRQChannel >> 0x05)]) & tmp) == tmp )
    361            {
    362              activeirqstatus = SET;
    363            }
    364            else
    365            {
    366              activeirqstatus = RESET;
    367            }
    368            return activeirqstatus;
    369          }
    370          
    371          /*******************************************************************************
    372          * Function Name  : NVIC_GetCPUID
    373          * Description    : Returns the ID number, the version number and the implementation
    374          *                  details of the Cortex-M3 core.
    375          * Input          : None
    376          * Output         : None
    377          * Return         : CPU ID.
    378          *******************************************************************************/
    379          u32 NVIC_GetCPUID(void)
    380          {
    381            return (SCB->CPUID);
    382          }
    383          
    384          /*******************************************************************************
    385          * Function Name  : NVIC_SetVectorTable
    386          * Description    : Sets the vector table location and Offset.
    387          * Input          : - NVIC_VectTab: specifies if the vector table is in RAM or
    388          *                    FLASH memory.
    389          *                    This parameter can be one of the following values:
    390          *                       - NVIC_VectTab_RAM
    391          *                       - NVIC_VectTab_FLASH
    392          *                  - Offset: Vector Table base offset field. 
    393          *                            This value must be a multiple of 0x100.
    394          * Output         : None
    395          * Return         : None
    396          *******************************************************************************/
    397          void NVIC_SetVectorTable(u32 NVIC_VectTab, u32 Offset)
    398          { 
    399            /* Check the parameters */
    400            assert(IS_NVIC_VECTTAB(NVIC_VectTab));
    401            assert(IS_NVIC_OFFSET(Offset));  
    402             
    403            SCB->ExceptionTableOffset = NVIC_VectTab | (Offset & (u32)0x1FFFFF80);
    404          }
    405          
    406          /*******************************************************************************
    407          * Function Name  : NVIC_GenerateSystemReset
    408          * Description    : Generates a system reset.
    409          * Input          : None
    410          * Output         : None
    411          * Return         : None
    412          *******************************************************************************/
    413          void NVIC_GenerateSystemReset(void)
    414          {
    415            SCB->AIRC = AIRC_VECTKEY_MASK | (u32)0x04;
    416          }
    417          

⌨️ 快捷键说明

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