📄 stm32f10x_spi.lst
字号:
\ 0000009C 401C ADDS R0,R0,#+1
\ 0000009E 8346 MOV R11,R0
299
300 /* Calculate the Source Clock frequency based on PLL3 and PREDIV2 values */
301 sourceclock = (uint32_t) ((HSE_Value / sourceclock) * tmp * 2);
\ 000000A0 .... LDR.N R0,??DataTable1_4 ;; 0x17d7840
\ 000000A2 B0FBFBF0 UDIV R0,R0,R11
\ 000000A6 0AFB00F0 MUL R0,R10,R0
\ 000000AA 5FEA400B LSLS R11,R0,#+1
\ 000000AE 04E0 B.N ??I2S_Init_9
302 }
303 else
304 {
305 /* I2S Clock source is System clock: Get System Clock frequency */
306 RCC_GetClocksFreq(&RCC_Clocks);
\ ??I2S_Init_6:
\ 000000B0 00A8 ADD R0,SP,#+0
\ 000000B2 ........ BL RCC_GetClocksFreq
307
308 /* Get the source clock value: based on System Clock value */
309 sourceclock = RCC_Clocks.SYSCLK_Frequency;
\ 000000B6 0098 LDR R0,[SP, #+0]
\ 000000B8 8346 MOV R11,R0
310 }
311 #else /* STM32F10X_HD */
312 /* I2S Clock source is System clock: Get System Clock frequency */
313 RCC_GetClocksFreq(&RCC_Clocks);
314
315 /* Get the source clock value: based on System Clock value */
316 sourceclock = RCC_Clocks.SYSCLK_Frequency;
317 #endif /* STM32F10X_CL */
318
319 /* Compute the Real divider depending on the MCLK output state with a flaoting point */
320 if(I2S_InitStruct->I2S_MCLKOutput == I2S_MCLKOutput_Enable)
\ ??I2S_Init_9:
\ 000000BA E888 LDRH R0,[R5, #+6]
\ 000000BC 4FF40071 MOV R1,#+512
\ 000000C0 8842 CMP R0,R1
\ 000000C2 0AD1 BNE.N ??I2S_Init_10
321 {
322 /* MCLK output is enabled */
323 tmp = (uint16_t)(((((sourceclock / 256) * 10) / I2S_InitStruct->I2S_AudioFreq)) + 5);
\ 000000C4 5FEA1B20 LSRS R0,R11,#+8
\ 000000C8 0A21 MOVS R1,#+10
\ 000000CA 4843 MULS R0,R1,R0
\ 000000CC A968 LDR R1,[R5, #+8]
\ 000000CE B0FBF1F0 UDIV R0,R0,R1
\ 000000D2 401D ADDS R0,R0,#+5
\ 000000D4 80B2 UXTH R0,R0 ;; ZeroExt R0,R0,#+16,#+16
\ 000000D6 8246 MOV R10,R0
\ 000000D8 0DE0 B.N ??I2S_Init_11
324 }
325 else
326 {
327 /* MCLK output is disabled */
328 tmp = (uint16_t)(((((sourceclock / (32 * packetlength)) *10 ) / I2S_InitStruct->I2S_AudioFreq)) + 5);
\ ??I2S_Init_10:
\ 000000DA 1FFA89F9 UXTH R9,R9 ;; ZeroExt R9,R9,#+16,#+16
\ 000000DE 5FEA4910 LSLS R0,R9,#+5
\ 000000E2 BBFBF0F0 UDIV R0,R11,R0
\ 000000E6 0A21 MOVS R1,#+10
\ 000000E8 4843 MULS R0,R1,R0
\ 000000EA A968 LDR R1,[R5, #+8]
\ 000000EC B0FBF1F0 UDIV R0,R0,R1
\ 000000F0 401D ADDS R0,R0,#+5
\ 000000F2 80B2 UXTH R0,R0 ;; ZeroExt R0,R0,#+16,#+16
\ 000000F4 8246 MOV R10,R0
329 }
330
331 /* Remove the flaoting point */
332 tmp = tmp / 10;
\ ??I2S_Init_11:
\ 000000F6 0A20 MOVS R0,#+10
\ 000000F8 BAFBF0FA UDIV R10,R10,R0
333
334 /* Check the parity of the divider */
335 i2sodd = (uint16_t)(tmp & (uint16_t)0x0001);
\ 000000FC 1AF00100 ANDS R0,R10,#0x1
\ 00000100 8046 MOV R8,R0
336
337 /* Compute the i2sdiv prescaler */
338 i2sdiv = (uint16_t)((tmp - i2sodd) / 2);
\ 00000102 1FFA88F8 UXTH R8,R8 ;; ZeroExt R8,R8,#+16,#+16
\ 00000106 BAEB0800 SUBS R0,R10,R8
\ 0000010A 4008 LSRS R0,R0,#+1
\ 0000010C 0700 MOVS R7,R0
339
340 /* Get the Mask for the Odd bit (SPI_I2SPR[8]) register */
341 i2sodd = (uint16_t) (i2sodd << 8);
\ 0000010E 5FEA0828 LSLS R8,R8,#+8
342 }
343
344 /* Test if the divider is 1 or 0 or greater than 0xFF */
345 if ((i2sdiv < 2) || (i2sdiv > 0xFF))
\ ??I2S_Init_1:
\ 00000112 BFB2 UXTH R7,R7 ;; ZeroExt R7,R7,#+16,#+16
\ 00000114 022F CMP R7,#+2
\ 00000116 04D3 BCC.N ??I2S_Init_12
\ 00000118 4FF48070 MOV R0,#+256
\ 0000011C BFB2 UXTH R7,R7 ;; ZeroExt R7,R7,#+16,#+16
\ 0000011E 8742 CMP R7,R0
\ 00000120 03D3 BCC.N ??I2S_Init_13
346 {
347 /* Set the default values */
348 i2sdiv = 2;
\ ??I2S_Init_12:
\ 00000122 0220 MOVS R0,#+2
\ 00000124 0700 MOVS R7,R0
349 i2sodd = 0;
\ 00000126 0020 MOVS R0,#+0
\ 00000128 8046 MOV R8,R0
350 }
351
352 /* Write to SPIx I2SPR register the computed value */
353 SPIx->I2SPR = (uint16_t)(i2sdiv | (uint16_t)(i2sodd | (uint16_t)I2S_InitStruct->I2S_MCLKOutput));
\ ??I2S_Init_13:
\ 0000012A E888 LDRH R0,[R5, #+6]
\ 0000012C 50EA0800 ORRS R0,R0,R8
\ 00000130 3843 ORRS R0,R0,R7
\ 00000132 2084 STRH R0,[R4, #+32]
354
355 /* Configure the I2S with the SPI_InitStruct values */
356 tmpreg |= (uint16_t)(I2S_Mode_Select | (uint16_t)(I2S_InitStruct->I2S_Mode | \
357 (uint16_t)(I2S_InitStruct->I2S_Standard | (uint16_t)(I2S_InitStruct->I2S_DataFormat | \
358 (uint16_t)I2S_InitStruct->I2S_CPOL))));
\ 00000134 2888 LDRH R0,[R5, #+0]
\ 00000136 6988 LDRH R1,[R5, #+2]
\ 00000138 AA88 LDRH R2,[R5, #+4]
\ 0000013A AB89 LDRH R3,[R5, #+12]
\ 0000013C 1A43 ORRS R2,R3,R2
\ 0000013E 1143 ORRS R1,R2,R1
\ 00000140 0843 ORRS R0,R1,R0
\ 00000142 50F40060 ORRS R0,R0,#0x800
\ 00000146 0643 ORRS R6,R0,R6
359
360 /* Write to SPIx I2SCFGR */
361 SPIx->I2SCFGR = tmpreg;
\ 00000148 A683 STRH R6,[R4, #+28]
362 }
\ 0000014A 05B0 ADD SP,SP,#+20
\ 0000014C BDE8F08F POP {R4-R11,PC} ;; return
363
364 /**
365 * @brief Fills each SPI_InitStruct member with its default value.
366 * @param SPI_InitStruct : pointer to a SPI_InitTypeDef structure which will be initialized.
367 * @retval None
368 */
\ In section .text, align 2, keep-with-next
369 void SPI_StructInit(SPI_InitTypeDef* SPI_InitStruct)
370 {
371 /*--------------- Reset SPI init structure parameters values -----------------*/
372 /* Initialize the SPI_Direction member */
373 SPI_InitStruct->SPI_Direction = SPI_Direction_2Lines_FullDuplex;
\ SPI_StructInit:
\ 00000000 0021 MOVS R1,#+0
\ 00000002 0180 STRH R1,[R0, #+0]
374 /* initialize the SPI_Mode member */
375 SPI_InitStruct->SPI_Mode = SPI_Mode_Slave;
\ 00000004 0021 MOVS R1,#+0
\ 00000006 4180 STRH R1,[R0, #+2]
376 /* initialize the SPI_DataSize member */
377 SPI_InitStruct->SPI_DataSize = SPI_DataSize_8b;
\ 00000008 0021 MOVS R1,#+0
\ 0000000A 8180 STRH R1,[R0, #+4]
378 /* Initialize the SPI_CPOL member */
379 SPI_InitStruct->SPI_CPOL = SPI_CPOL_Low;
\ 0000000C 0021 MOVS R1,#+0
\ 0000000E C180 STRH R1,[R0, #+6]
380 /* Initialize the SPI_CPHA member */
381 SPI_InitStruct->SPI_CPHA = SPI_CPHA_1Edge;
\ 00000010 0021 MOVS R1,#+0
\ 00000012 0181 STRH R1,[R0, #+8]
382 /* Initialize the SPI_NSS member */
383 SPI_InitStruct->SPI_NSS = SPI_NSS_Hard;
\ 00000014 0021 MOVS R1,#+0
\ 00000016 4181 STRH R1,[R0, #+10]
384 /* Initialize the SPI_BaudRatePrescaler member */
385 SPI_InitStruct->SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_2;
\ 00000018 0021 MOVS R1,#+0
\ 0000001A 8181 STRH R1,[R0, #+12]
386 /* Initialize the SPI_FirstBit member */
387 SPI_InitStruct->SPI_FirstBit = SPI_FirstBit_MSB;
\ 0000001C 0021 MOVS R1,#+0
\ 0000001E C181 STRH R1,[R0, #+14]
388 /* Initialize the SPI_CRCPolynomial member */
389 SPI_InitStruct->SPI_CRCPolynomial = 7;
\ 00000020 0721 MOVS R1,#+7
\ 00000022 0182 STRH R1,[R0, #+16]
390 }
\ 00000024 7047 BX LR ;; return
391
392 /**
393 * @brief Fills each I2S_InitStruct member with its default value.
394 * @param I2S_InitStruct : pointer to a I2S_InitTypeDef structure which will be initialized.
395 * @retval None
396 */
\ In section .text, align 2, keep-with-next
397 void I2S_StructInit(I2S_InitTypeDef* I2S_InitStruct)
398 {
399 /*--------------- Reset I2S init structure parameters values -----------------*/
400 /* Initialize the I2S_Mode member */
401 I2S_InitStruct->I2S_Mode = I2S_Mode_SlaveTx;
\ I2S_StructInit:
\ 00000000 0021 MOVS R1,#+0
\ 00000002 0180 STRH R1,[R0, #+0]
402
403 /* Initialize the I2S_Standard member */
404 I2S_InitStruct->I2S_Standard = I2S_Standard_Phillips;
\ 00000004 0021 MOVS R1,#+0
\ 00000006 4180 STRH R1,[R0, #+2]
405
406 /* Initialize the I2S_DataFormat member */
407 I2S_InitStruct->I2S_DataFormat = I2S_DataFormat_16b;
\ 00000008 0021 MOVS R1,#+0
\ 0000000A 8180 STRH R1,[R0, #+4]
408
409 /* Initialize the I2S_MCLKOutput member */
410 I2S_InitStruct->I2S_MCLKOutput = I2S_MCLKOutput_Disable;
\ 0000000C 0021 MOVS R1,#+0
\ 0000000E C180 STRH R1,[R0, #+6]
411
412 /* Initialize the I2S_AudioFreq member */
413 I2S_InitStruct->I2S_AudioFreq = I2S_AudioFreq_Default;
\ 00000010 0221 MOVS R1,#+2
\ 00000012 8160 STR R1,[R0, #+8]
414
415 /* Initialize the I2S_CPOL member */
416 I2S_InitStruct->I2S_CPOL = I2S_CPOL_Low;
\ 00000014 0021 MOVS R1,#+0
\ 00000016 8181 STRH R1,[R0, #+12]
417 }
\ 00000018 7047 BX LR ;; return
418
419 /**
420 * @brief Enables or disables the specified SPI peripheral.
421 * @param SPIx: where x can be 1, 2 or 3 to select the SPI peripheral.
422 * @param NewState: new state of the SPIx peripheral.
423 * This parameter can be: ENABLE or DISABLE.
424 * @retval None
425 */
\ In section .text, align 2, keep-with-next
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -