📄 stm32f10x_spi.lst
字号:
277
278 /*******************************************************************************
279 * Function Name : SPI_ReceiveData
280 * Description : Returns the most recent received data by the SPIx peripheral.
281 * Input : - SPIx: where x can be 1 or 2 to select the SPI peripheral.
282 * Output : None
283 * Return : The value of the received data.
284 *******************************************************************************/
\ In section .XML, align 4, keep-with-next
285 u16 SPI_ReceiveData(SPI_TypeDef* SPIx)
286 {
287 /* Return the data in the DR register */
288 return SPIx->DR;
\ SPI_ReceiveData:
\ 00000000 8089 LDRH R0,[R0, #+12]
\ 00000002 7047 BX LR ;; return
289 }
290
291 /*******************************************************************************
292 * Function Name : SPI_NSSInternalSoftwareConfig
293 * Description : Configures internally by software the NSS pin for the selected
294 * SPI.
295 * Input : - SPIx: where x can be 1 or 2 to select the SPI peripheral.
296 * - SPI_NSSInternalSoft: specifies the SPI NSS internal state.
297 * This parameter can be one of the following values:
298 * - SPI_NSSInternalSoft_Set: Set NSS pin internally
299 * - SPI_NSSInternalSoft_Reset: Reset NSS pin internally
300 * Output : None
301 * Return : None
302 *******************************************************************************/
\ In section .XML, align 4, keep-with-next
303 void SPI_NSSInternalSoftwareConfig(SPI_TypeDef* SPIx, u16 SPI_NSSInternalSoft)
304 {
305 /* Check the parameters */
306 assert_param(IS_SPI_NSS_INTERNAL(SPI_NSSInternalSoft));
307
308 if (SPI_NSSInternalSoft != SPI_NSSInternalSoft_Reset)
\ SPI_NSSInternalSoftwareConfig:
\ 00000000 064A LDR.N R2,??SPI_NSSInternalSoftwareConfig_0 ;; 0xfeff
\ 00000002 89B2 UXTH R1,R1 ;; ZeroExtS R1,R1,#+16,#+16
\ 00000004 9142 CMP R1,R2
\ 00000006 04D0 BEQ.N ??SPI_NSSInternalSoftwareConfig_1
309 {
310 /* Set NSS pin internally by software */
311 SPIx->CR1 |= SPI_NSSInternalSoft_Set;
\ 00000008 0288 LDRH R2,[R0, #+0]
\ 0000000A 52F48072 ORRS R2,R2,#0x100
\ 0000000E 0280 STRH R2,[R0, #+0]
\ 00000010 03E0 B.N ??SPI_NSSInternalSoftwareConfig_2
312 }
313 else
314 {
315 /* Reset NSS pin internally by software */
316 SPIx->CR1 &= SPI_NSSInternalSoft_Reset;
\ ??SPI_NSSInternalSoftwareConfig_1:
\ 00000012 0288 LDRH R2,[R0, #+0]
\ 00000014 014B LDR.N R3,??SPI_NSSInternalSoftwareConfig_0 ;; 0xfeff
\ 00000016 1340 ANDS R3,R3,R2
\ 00000018 0380 STRH R3,[R0, #+0]
317 }
318 }
\ ??SPI_NSSInternalSoftwareConfig_2:
\ 0000001A 7047 BX LR ;; return
\ ??SPI_NSSInternalSoftwareConfig_0:
\ 0000001C FFFE0000 DC32 0xfeff
319
320 /*******************************************************************************
321 * Function Name : SPI_SSOutputCmd
322 * Description : Enables or disables the SS output for the selected SPI.
323 * Input : - SPIx: where x can be 1 or 2 to select the SPI peripheral.
324 * - NewState: new state of the SPIx SS output.
325 * This parameter can be: ENABLE or DISABLE.
326 * Output : None
327 * Return : None
328 *******************************************************************************/
\ In section .XML, align 4, keep-with-next
329 void SPI_SSOutputCmd(SPI_TypeDef* SPIx, FunctionalState NewState)
330 {
331 /* Check the parameters */
332 assert_param(IS_FUNCTIONAL_STATE(NewState));
333
334 if (NewState != DISABLE)
\ SPI_SSOutputCmd:
\ 00000000 C9B2 UXTB R1,R1 ;; ZeroExtS R1,R1,#+24,#+24
\ 00000002 0029 CMP R1,#+0
\ 00000004 04D0 BEQ.N ??SPI_SSOutputCmd_0
335 {
336 /* Enable the selected SPI SS output */
337 SPIx->CR2 |= CR2_SSOE_Set;
\ 00000006 8288 LDRH R2,[R0, #+4]
\ 00000008 52F00402 ORRS R2,R2,#0x4
\ 0000000C 8280 STRH R2,[R0, #+4]
\ 0000000E 03E0 B.N ??SPI_SSOutputCmd_1
338 }
339 else
340 {
341 /* Disable the selected SPI SS output */
342 SPIx->CR2 &= CR2_SSOE_Reset;
\ ??SPI_SSOutputCmd_0:
\ 00000010 8288 LDRH R2,[R0, #+4]
\ 00000012 024B LDR.N R3,??SPI_SSOutputCmd_2 ;; 0xfffb
\ 00000014 1340 ANDS R3,R3,R2
\ 00000016 8380 STRH R3,[R0, #+4]
343 }
344 }
\ ??SPI_SSOutputCmd_1:
\ 00000018 7047 BX LR ;; return
\ 0000001A 00BF Nop
\ ??SPI_SSOutputCmd_2:
\ 0000001C FBFF0000 DC32 0xfffb
345
346 /*******************************************************************************
347 * Function Name : SPI_DataSizeConfig
348 * Description : Configures the data size for the selected SPI.
349 * Input : - SPIx: where x can be 1 or 2 to select the SPI peripheral.
350 * - SPI_DataSize: specifies the SPI data size.
351 * This parameter can be one of the following values:
352 * - SPI_DataSize_16b: Set data frame format to 16bit
353 * - SPI_DataSize_8b: Set data frame format to 8bit
354 * Output : None
355 * Return : None
356 *******************************************************************************/
\ In section .XML, align 4, keep-with-next
357 void SPI_DataSizeConfig(SPI_TypeDef* SPIx, u16 SPI_DataSize)
358 {
359 /* Check the parameters */
360 assert_param(IS_SPI_DATASIZE(SPI_DataSize));
361
362 /* Clear DFF bit */
363 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]
364 /* Set new DFF bit value */
365 SPIx->CR1 |= SPI_DataSize;
\ 00000008 0288 LDRH R2,[R0, #+0]
\ 0000000A 0A43 ORRS R2,R2,R1
\ 0000000C 0280 STRH R2,[R0, #+0]
366 }
\ 0000000E 7047 BX LR ;; return
\ ??SPI_DataSizeConfig_0:
\ 00000010 FFF70000 DC32 0xf7ff
367
368 /*******************************************************************************
369 * Function Name : SPI_TransmitCRC
370 * Description : Transmit the SPIx CRC value.
371 * Input : - SPIx: where x can be 1 or 2 to select the SPI peripheral.
372 * Output : None
373 * Return : None
374 *******************************************************************************/
\ In section .XML, align 4, keep-with-next
375 void SPI_TransmitCRC(SPI_TypeDef* SPIx)
376 {
377 /* Enable the selected SPI CRC transmission */
378 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]
379 }
\ 00000008 7047 BX LR ;; return
380
381 /*******************************************************************************
382 * Function Name : SPI_CalculateCRC
383 * Description : Enables or disables the CRC value calculation of the
384 * transfered bytes.
385 * Input : - SPIx: where x can be 1 or 2 to select the SPI peripheral.
386 * - NewState: new state of the SPIx CRC value calculation.
387 * This parameter can be: ENABLE or DISABLE.
388 * Output : None
389 * Return : None
390 *******************************************************************************/
\ In section .XML, align 4, keep-with-next
391 void SPI_CalculateCRC(SPI_TypeDef* SPIx, FunctionalState NewState)
392 {
393 /* Check the parameters */
394 assert_param(IS_FUNCTIONAL_STATE(NewState));
395
396 if (NewState != DISABLE)
\ SPI_CalculateCRC:
\ 00000000 C9B2 UXTB R1,R1 ;; ZeroExtS R1,R1,#+24,#+24
\ 00000002 0029 CMP R1,#+0
\ 00000004 04D0 BEQ.N ??SPI_CalculateCRC_0
397 {
398 /* Enable the selected SPI CRC calculation */
399 SPIx->CR1 |= CR1_CRCEN_Set;
\ 00000006 0288 LDRH R2,[R0, #+0]
\ 00000008 52F40052 ORRS R2,R2,#0x2000
\ 0000000C 0280 STRH R2,[R0, #+0]
\ 0000000E 03E0 B.N ??SPI_CalculateCRC_1
400 }
401 else
402 {
403 /* Disable the selected SPI CRC calculation */
404 SPIx->CR1 &= CR1_CRCEN_Reset;
\ ??SPI_CalculateCRC_0:
\ 00000010 0288 LDRH R2,[R0, #+0]
\ 00000012 024B LDR.N R3,??SPI_CalculateCRC_2 ;; 0xdfff
\ 00000014 1340 ANDS R3,R3,R2
\ 00000016 0380 STRH R3,[R0, #+0]
405 }
406 }
\ ??SPI_CalculateCRC_1:
\ 00000018 7047 BX LR ;; return
\ 0000001A 00BF Nop
\ ??SPI_CalculateCRC_2:
\ 0000001C FFDF0000 DC32 0xdfff
407
408 /*******************************************************************************
409 * Function Name : SPI_GetCRC
410 * Description : Returns the transmit or the receive CRC register value for
411 * the specified SPI.
412 * Input : - SPIx: where x can be 1 or 2 to select the SPI peripheral.
413 * - SPI_CRC: specifies the CRC register to be read.
414 * This parameter can be one of the following values:
415 * - SPI_CRC_Tx: Selects Tx CRC register
416 * - SPI_CRC_Rx: Selects Rx CRC register
417 * Output : None
418 * Return : The selected CRC register value..
419 *******************************************************************************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -