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

📄 stm32f10x_spi.lst

📁 针对STM32F103的UCOS移植
💻 LST
📖 第 1 页 / 共 4 页
字号:
    339            if (NewState != DISABLE)
   \                     SPI_SSOutputCmd:
   \   00000000   0029               CMP      R1,#+0
   \   00000002   8188               LDRH     R1,[R0, #+4]
   \   00000004   03D0               BEQ.N    ??SPI_SSOutputCmd_0
    340            {
    341              /* Enable the selected SPI SS output */
    342              SPIx->CR2 |= CR2_SSOE_Set;
   \   00000006   51F00401           ORRS     R1,R1,#0x4
   \   0000000A   8180               STRH     R1,[R0, #+4]
   \   0000000C   7047               BX       LR
    343            }
    344            else
    345            {
    346              /* Disable the selected SPI SS output */
    347              SPIx->CR2 &= CR2_SSOE_Reset;
   \                     ??SPI_SSOutputCmd_0:
   \   0000000E   024A               LDR.N    R2,??SPI_SSOutputCmd_1  ;; 0xfffb
   \   00000010   0A40               ANDS     R2,R2,R1
   \   00000012   8280               STRH     R2,[R0, #+4]
    348            }
    349          }
   \   00000014   7047               BX       LR               ;; return
   \   00000016   00BF               Nop      
   \                     ??SPI_SSOutputCmd_1:
   \   00000018   FBFF0000           DC32     0xfffb
    350          
    351          /*******************************************************************************
    352          * Function Name  : SPI_DataSizeConfig
    353          * Description    : Configures the data size for the selected SPI.
    354          * Input          : - SPIx: where x can be 1 or 2 to select the SPI peripheral.
    355          *                  - SPI_DataSize: specifies the SPI data size.
    356          *                    This parameter can be one of the following values:
    357          *                       - SPI_DataSize_16b: Set data frame format to 16bit
    358          *                       - SPI_DataSize_8b: Set data frame format to 8bit
    359          * Output         : None
    360          * Return         : None
    361          *******************************************************************************/

   \                                 In segment CODE, align 4, keep-with-next
    362          void SPI_DataSizeConfig(SPI_TypeDef* SPIx, u16 SPI_DataSize)
    363          {
    364            /* Check the parameters */
    365            assert(IS_SPI_DATASIZE(SPI_DataSize));
    366          
    367            /* Clear DFF bit */
    368            SPIx->CR1 &= (u16)~SPI_DataSize_16b;
   \                     SPI_DataSizeConfig:
   \   00000000   0288               LDRH     R2,[R0, #+0]
   \   00000002   034B               LDR.N    R3,??SPI_DataSizeConfig_0  ;; 0xf7ff
   \   00000004   1340               ANDS     R3,R3,R2
   \   00000006   0380               STRH     R3,[R0, #+0]
    369            /* Set new DFF bit value */
    370            SPIx->CR1 |= SPI_DataSize;
   \   00000008   0288               LDRH     R2,[R0, #+0]
   \   0000000A   1143               ORRS     R1,R1,R2
   \   0000000C   0180               STRH     R1,[R0, #+0]
    371          }
   \   0000000E   7047               BX       LR               ;; return
   \                     ??SPI_DataSizeConfig_0:
   \   00000010   FFF70000           DC32     0xf7ff
    372          
    373          /*******************************************************************************
    374          * Function Name  : SPI_TransmitCRC
    375          * Description    : Transmit the SPIx CRC value.
    376          * Input          : - SPIx: where x can be 1 or 2 to select the SPI peripheral.
    377          * Output         : None
    378          * Return         : None
    379          *******************************************************************************/

   \                                 In segment CODE, align 4, keep-with-next
    380          void SPI_TransmitCRC(SPI_TypeDef* SPIx)
    381          {
    382            /* Enable the selected SPI CRC transmission */
    383            SPIx->CR1 |= CR1_CRCNext_Set;
   \                     SPI_TransmitCRC:
   \   00000000   0188               LDRH     R1,[R0, #+0]
   \   00000002   51F48051           ORRS     R1,R1,#0x1000
   \   00000006   0180               STRH     R1,[R0, #+0]
    384          }
   \   00000008   7047               BX       LR               ;; return
    385          
    386          /*******************************************************************************
    387          * Function Name  : SPI_CalculateCRC
    388          * Description    : Enables or disables the CRC value calculation of the
    389          *                  transfered bytes.
    390          * Input          : - SPIx: where x can be 1 or 2 to select the SPI peripheral.
    391          *                  - NewState: new state of the SPIx CRC value calculation.
    392          *                    This parameter can be: ENABLE or DISABLE.
    393          * Output         : None
    394          * Return         : None
    395          *******************************************************************************/

   \                                 In segment CODE, align 4, keep-with-next
    396          void SPI_CalculateCRC(SPI_TypeDef* SPIx, FunctionalState NewState)
    397          {
    398            /* Check the parameters */
    399            assert(IS_FUNCTIONAL_STATE(NewState));
    400          
    401            if (NewState != DISABLE)
   \                     SPI_CalculateCRC:
   \   00000000   0029               CMP      R1,#+0
   \   00000002   0188               LDRH     R1,[R0, #+0]
   \   00000004   03D0               BEQ.N    ??SPI_CalculateCRC_0
    402            {
    403              /* Enable the selected SPI CRC calculation */
    404              SPIx->CR1 |= CR1_CRCEN_Set;
   \   00000006   51F40051           ORRS     R1,R1,#0x2000
   \   0000000A   0180               STRH     R1,[R0, #+0]
   \   0000000C   7047               BX       LR
    405            }
    406            else
    407            {
    408              /* Disable the selected SPI CRC calculation */
    409              SPIx->CR1 &= CR1_CRCEN_Reset;
   \                     ??SPI_CalculateCRC_0:
   \   0000000E   024A               LDR.N    R2,??SPI_CalculateCRC_1  ;; 0xdfff
   \   00000010   0A40               ANDS     R2,R2,R1
   \   00000012   0280               STRH     R2,[R0, #+0]
    410            }
    411          }
   \   00000014   7047               BX       LR               ;; return
   \   00000016   00BF               Nop      
   \                     ??SPI_CalculateCRC_1:
   \   00000018   FFDF0000           DC32     0xdfff
    412          
    413          /*******************************************************************************
    414          * Function Name  : SPI_GetCRC
    415          * Description    : Returns the transmit or the receive CRC register value for
    416          *                  the specified SPI.
    417          * Input          : - SPIx: where x can be 1 or 2 to select the SPI peripheral.
    418          *                  - SPI_CRC: specifies the CRC register to be read.
    419          *                    This parameter can be one of the following values:
    420          *                       - SPI_CRC_Tx: Selects Tx CRC register
    421          *                       - SPI_CRC_Rx: Selects Rx CRC register
    422          * Output         : None
    423          * Return         : The selected CRC register value..
    424          *******************************************************************************/

   \                                 In segment CODE, align 4, keep-with-next
    425          u16 SPI_GetCRC(SPI_TypeDef* SPIx, u8 SPI_CRC)
    426          {
    427            u16 crcreg = 0;
    428          
    429            /* Check the parameters */
    430            assert(IS_SPI_CRC(SPI_CRC));
    431          
    432            if (SPI_CRC != SPI_CRC_Rx)
   \                     SPI_GetCRC:
   \   00000000   0129               CMP      R1,#+1
   \   00000002   01D0               BEQ.N    ??SPI_GetCRC_0
    433            {
    434              /* Get the Tx CRC register */
    435              crcreg = SPIx->TXCRCR;
   \   00000004   008B               LDRH     R0,[R0, #+24]
   \   00000006   7047               BX       LR
    436            }
    437            else
    438            {
    439              /* Get the Rx CRC register */
    440              crcreg = SPIx->RXCRCR;
   \                     ??SPI_GetCRC_0:
   \   00000008   808A               LDRH     R0,[R0, #+20]
    441            }
    442          
    443            /* Return the selected CRC register */
    444            return crcreg;
   \   0000000A   7047               BX       LR               ;; return
    445          }
    446          
    447          /*******************************************************************************
    448          * Function Name  : SPI_GetCRCPolynomial
    449          * Description    : Returns the CRC Polynomial register value for the specified SPI.
    450          * Input          : - SPIx: where x can be 1 or 2 to select the SPI peripheral.
    451          * Output         : None
    452          * Return         : The CRC Polynomial register value.
    453          *******************************************************************************/

   \                                 In segment CODE, align 4, keep-with-next
    454          u16 SPI_GetCRCPolynomial(SPI_TypeDef* SPIx)
    455          {
    456            /* Return the CRC polynomial register */
    457            return SPIx->CRCPR;
   \                     SPI_GetCRCPolynomial:
   \   00000000   008A               LDRH     R0,[R0, #+16]
   \   00000002   7047               BX       LR               ;; return
    458          }
    459          
    460          /*******************************************************************************
    461          * Function Name  : SPI_BiDirectionalLineConfig
    462          * Description    : Selects the data transfer direction in bi-directional mode
    463          *                  for the specified SPI.
    464          * Input          : - SPIx: where x can be 1 or 2 to select the SPI peripheral.
    465          *                  - SPI_Direction: specifies the data transfer direction in
    466          *                    bi-directional mode. 
    467          *                    This parameter can be one of the following values:
    468          *                       - SPI_Direction_Tx: Selects Tx transmission direction
    469          *                       - SPI_Direction_Rx: Selects Rx receive direction
    470          * Output         : None
    471          * Return         : None
    472          *******************************************************************************/

   \                                 In segment CODE, align 4, keep-with-next
    473          void SPI_BiDirectionalLineConfig(SPI_TypeDef* SPIx, u16 SPI_Direction)
    474          {
    475            /* Check the parameters */
    476            assert(IS_SPI_DIRECTION(SPI_Direction));
    477          
    478            if (SPI_Direction == SPI_Direction_Tx)
   \                     SPI_BiDirectionalLineConfig:
   \   00000000   5FF48042           MOVS     R2,#+16384
   \   00000004   9142               CMP      R1,R2
   \   00000006   0188               LDRH     R1,[R0, #+0]
   \   00000008   03D1               BNE.N    ??SPI_BiDirectionalLineConfig_0
    479            {
    480              /* Set the Tx only mode */
    481              SPIx->CR1 |= SPI_Direction_Tx;
   \   0000000A   51F48041           ORRS     R1,R1,#0x4000
   \   0000000E   0180               STRH     R1,[R0, #+0]
   \   00000010   7047               BX       LR
    482            }
    483            else
    484            {
    485              /* Set the Rx only mode */
    486              SPIx->CR1 &= SPI_Direction_Rx;
   \                     ??SPI_BiDirectionalLineConfig_0:
   \   00000012   024A               LDR.N    R2,??SPI_BiDirectionalLineConfig_1  ;; 0xbfff
   \   00000014   0A40               ANDS     R2,R2,R1
   \   00000016   0280               STRH     R2,[R0, #+0]
    487            }
    488          }
   \   00000018   7047               BX       LR               ;; return
   \   0000001A   00BF               Nop      
   \                     ??SPI_BiDirectionalLineConfig_1:
   \   0000001C   FFBF0000           DC32     0xbfff
    489          
    490          /*******************************************************************************
    491          * Function Name  : SPI_GetFlagStatus
    492          * Description    : Checks whether the specified SPI flag is set or not.
    493          * Input          : - SPIx: where x can be 1 or 2 to select the SPI peripheral.
    494          *                  - SPI_FLAG: specifies the flag to check. 
    495          *                    This parameter can be one of the following values:
    496          *                       - SPI_FLAG_BSY: Busy flag.
    497          *                       - SPI_FLAG_OVR: Overrun flag.
    498          *                       - SPI_FLAG_MODF: Mode Fault flag.
    499          *                       - SPI_FLAG_CRCERR: CRC Error flag.
    500          *                       - SPI_FLAG_TXE: Transmit buffer empty flag.
    501          *                       - SPI_FLAG_RXNE: Receive buffer not empty flag.
    502          * Output         : None
    503          * Return         : The new state of SPI_FLAG (SET or RESET).
    504          *******************************************************************************/

   \                                 In segment CODE, align 4, keep-with-next
    505          FlagStatus SPI_GetFlagStatus(SPI_TypeDef* SPIx, u16 SPI_FLAG)
    506          {
   \                     SPI_GetFlagStatus:
   \   00000000   00B5               PUSH     {LR}
    507            FlagStatus bitstatus = RESET;
    508          
    509            /* Check the parameters */
    510            assert(IS_SPI_GET_FLAG(SPI_FLAG));
    511          
    512            /* Check the status of the specified SPI flag */
    513            if ((SPIx->SR & SPI_FLAG) != (u16)RESET)
   \   00000002   0089               LDRH     R0,[R0, #+8]
   \   00000004   0842               TST      R0,R1
   \   00000006   01D0               BEQ.N    ??SPI_GetFlagStatus_0
    514            {
    515              /* SPI_FLAG is set */
    516              bitstatus = SET;
   \   00000008   0120               MOVS     R0,#+1

⌨️ 快捷键说明

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