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

📄 stm32f10x_can.lst

📁 STM32利用正交编码器实现电机的控制
💻 LST
📖 第 1 页 / 共 4 页
字号:
    712            /* Check the status of the specified CAN flag */
    713            if ((CAN->ESR & CAN_FLAG) != (u32)RESET)
    714            {
    715              /* CAN_FLAG is set */
    716              bitstatus = SET;
    717            }
    718            else
    719            {
    720              /* CAN_FLAG is reset */
    721              bitstatus = RESET;
    722            }
    723            /* Return the CAN_FLAG status */
    724            return  bitstatus;
    725          }
    726          
    727          /*******************************************************************************
    728          * Function Name  : CAN_ClearFlag
    729          * Description    : Clears the CAN's pending flags.
    730          * Input          : CAN_FLAG: specifies the flag to clear.
    731          * Output         : None.
    732          * Return         : None.
    733          *******************************************************************************/
    734          void CAN_ClearFlag(u32 CAN_FLAG)
    735          {
    736            /* Check the parameters */
    737            assert(IS_CAN_FLAG(CAN_FLAG));
    738          
    739            /* Clear the selected CAN flags */
    740            CAN->ESR &= ~CAN_FLAG;
    741          }
    742          
    743          /*******************************************************************************
    744          * Function Name  : CAN_GetITStatus
    745          * Description    : Checks whether the specified CAN interrupt has occurred or
    746          *                  not.
    747          * Input          : CAN_IT: specifies the CAN interrupt source to check.
    748          *                  This parameter can be: CAN_IT_RQCP0, CAN_IT_RQCP1, CAN_IT_RQCP2,
    749          *                                         CAN_IT_FF0, CAN_IT_FOV0, CAN_IT_FF1,
    750          *                                         CAN_IT_FOV1, CAN_IT_EWG, CAN_IT_EPV,
    751          *                                         CAN_IT_BOF, CAN_IT_WKU or CAN_IT_SLK.
    752          * Output         : None.
    753          * Return         : The new state of CAN_IT (SET or RESET).
    754          *******************************************************************************/
    755          ITStatus CAN_GetITStatus(u32 CAN_IT)
    756          {
    757            ITStatus pendingbitstatus = RESET;
    758          
    759            /* Check the parameters */
    760            assert(IS_CAN_ITStatus(CAN_IT));
    761          
    762            switch (CAN_IT)
    763            {
    764              case CAN_IT_RQCP0:
    765                pendingbitstatus = CheckITStatus(CAN->TSR, CAN_TSR_RQCP0);
    766                break;
    767              case CAN_IT_RQCP1:
    768                pendingbitstatus = CheckITStatus(CAN->TSR, CAN_TSR_RQCP1);
    769                break;
    770              case CAN_IT_RQCP2:
    771                pendingbitstatus = CheckITStatus(CAN->TSR, CAN_TSR_RQCP2);
    772                break;
    773              case CAN_IT_FF0:
    774                pendingbitstatus = CheckITStatus(CAN->RF0R, CAN_RF0R_FULL0);
    775                break;
    776              case CAN_IT_FOV0:
    777                pendingbitstatus = CheckITStatus(CAN->RF0R, CAN_RF0R_FOVR0);
    778                break;
    779              case CAN_IT_FF1:
    780                pendingbitstatus = CheckITStatus(CAN->RF1R, CAN_RF1R_FULL1);
    781                break;
    782              case CAN_IT_FOV1:
    783                pendingbitstatus = CheckITStatus(CAN->RF1R, CAN_RF1R_FOVR1);
    784                break;
    785              case CAN_IT_EWG:
    786                pendingbitstatus = CheckITStatus(CAN->ESR, CAN_ESR_EWGF);
    787                break;
    788              case CAN_IT_EPV:
    789                pendingbitstatus = CheckITStatus(CAN->ESR, CAN_ESR_EPVF);
    790                break;
    791              case CAN_IT_BOF:
    792                pendingbitstatus = CheckITStatus(CAN->ESR, CAN_ESR_BOFF);
    793                break;
    794              case CAN_IT_SLK:
    795                pendingbitstatus = CheckITStatus(CAN->MSR, CAN_MSR_SLAKI);
    796                break;
    797              case CAN_IT_WKU:
    798                pendingbitstatus = CheckITStatus(CAN->MSR, CAN_MSR_WKUI);
    799                break;
    800          
    801              default :
    802                pendingbitstatus = RESET;
    803                break;
    804            }
    805          
    806            /* Return the CAN_IT status */
    807            return  pendingbitstatus;
    808          }
    809          
    810          /*******************************************************************************
    811          * Function Name  : CAN_ClearITPendingBit
    812          * Description    : Clears the CAN抯 interrupt pending bits.
    813          * Input          : CAN_IT: specifies the interrupt pending bit to clear.
    814          * Output         : None.
    815          * Return         : None.
    816          *******************************************************************************/
    817          void CAN_ClearITPendingBit(u32 CAN_IT)
    818          {
    819            /* Check the parameters */
    820            assert(IS_CAN_ITStatus(CAN_IT));
    821          
    822            switch (CAN_IT)
    823            {
    824              case CAN_IT_RQCP0:
    825                CAN->TSR = CAN_TSR_RQCP0; /* rc_w1*/
    826                break;
    827              case CAN_IT_RQCP1:
    828                CAN->TSR = CAN_TSR_RQCP1; /* rc_w1*/
    829                break;
    830              case CAN_IT_RQCP2:
    831                CAN->TSR = CAN_TSR_RQCP2; /* rc_w1*/
    832                break;
    833              case CAN_IT_FF0:
    834                CAN->RF0R = CAN_RF0R_FULL0; /* rc_w1*/
    835                break;
    836              case CAN_IT_FOV0:
    837                CAN->RF0R = CAN_RF0R_FOVR0; /* rc_w1*/
    838                break;
    839              case CAN_IT_FF1:
    840                CAN->RF1R = CAN_RF1R_FULL1; /* rc_w1*/
    841                break;
    842              case CAN_IT_FOV1:
    843                CAN->RF1R = CAN_RF1R_FOVR1; /* rc_w1*/
    844                break;
    845              case CAN_IT_EWG:
    846                CAN->ESR &= ~ CAN_ESR_EWGF; /* rw */
    847                break;
    848              case CAN_IT_EPV:
    849                CAN->ESR &= ~ CAN_ESR_EPVF; /* rw */
    850                break;
    851              case CAN_IT_BOF:
    852                CAN->ESR &= ~ CAN_ESR_BOFF; /* rw */
    853                break;
    854              case CAN_IT_WKU:
    855                CAN->MSR = CAN_MSR_WKUI;  /* rc_w1*/
    856                break;
    857              case CAN_IT_SLK:
    858                CAN->MSR = CAN_MSR_SLAKI;  /* rc_w1*/
    859                break;
    860              default :
    861                break;
    862            }
    863          }
    864          
    865          /*******************************************************************************
    866          * Function Name  : CheckITStatus
    867          * Description    : Checks whether the CAN interrupt has occurred or not.
    868          * Input          : CAN_Reg: specifies the CAN interrupt register to check.
    869          *                  It_Bit: specifies the interrupt source bit to check.
    870          * Output         : None.
    871          * Return         : The new state of the CAN Interrupt (SET or RESET).
    872          *******************************************************************************/
    873          static ITStatus CheckITStatus(u32 CAN_Reg, u32 It_Bit)
    874          {
    875            ITStatus pendingbitstatus = RESET;
    876          
    877            if ((CAN_Reg & It_Bit) != (u32)RESET)
    878            {
    879              /* CAN_IT is set */
    880              pendingbitstatus = SET;
    881            }
    882            else
    883            {
    884              /* CAN_IT is reset */
    885              pendingbitstatus = RESET;
    886            }
    887          
    888            return pendingbitstatus;
    889          }
    890          
    891          /******************* (C) COPYRIGHT 2007 STMicroelectronics *****END OF FILE****/

   Maximum stack usage in bytes:

     Function              CSTACK
     --------              ------
     CAN_CancelTransmit        8
     CAN_ClearFlag             8
     CAN_ClearITPendingBit     8
     CAN_DeInit                4
     CAN_FIFORelease           8
     CAN_FilterInit            8
     CAN_GetFlagStatus         8
     CAN_GetITStatus           8
     CAN_ITConfig             12
     CAN_Init                  8
     CAN_MessagePending        8
     CAN_Receive              12
     CAN_Sleep                 0
     CAN_StructInit            0
     CAN_Transmit             12
     CAN_TransmitStatus       12
     CAN_WakeUp                0
     CheckITStatus             0


   Segment part sizes:

     Function/Label                 Bytes
     --------------                 -----
     CAN_DeInit                       24
     CAN_Init                        572
     CAN_FilterInit                  458
     CAN_StructInit                   46
     CAN_ITConfig                    144
     CAN_Transmit                    484
     CAN_TransmitStatus              220
     CAN_CancelTransmit               88
     CAN_FIFORelease                  48
     CAN_MessagePending               64
     CAN_Receive                     348
     CAN_Sleep                        36
     CAN_WakeUp                       36
     CAN_GetFlagStatus                52
     CAN_ClearFlag                    44
     CAN_GetITStatus                 316
     CAN_ClearITPendingBit           286
     CheckITStatus                    18
     ??DataTable10                     4
     ??DataTable40                     4
     ??DataTable71                     4
     ??DataTable75                     4
     ??DataTable106                    4
     ??DataTable115                    4
     ??DataTable142                    4
     ??DataTable144                    4
     ??DataTable158                    4
     ??DataTable173                    4
     ?<Constant "C:\\David JIANG\\ST MCU...">
                                      88
      Others                          16

 
 3 340 bytes in segment CODE
    88 bytes in segment DATA_C
 
 3 324 bytes of CODE  memory (+ 16 bytes shared)
    88 bytes of CONST memory

Errors: none
Warnings: none

⌨️ 快捷键说明

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