📄 stm32f10x_spi.lst
字号:
158:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** /* Check the SPI parameters */
159:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** assert_param(IS_SPI_DIRECTION_MODE(SPI_InitStruct->SPI_Direction));
160:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** assert_param(IS_SPI_MODE(SPI_InitStruct->SPI_Mode));
161:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** assert_param(IS_SPI_DATASIZE(SPI_InitStruct->SPI_DataSize));
162:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** assert_param(IS_SPI_CPOL(SPI_InitStruct->SPI_CPOL));
163:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** assert_param(IS_SPI_CPHA(SPI_InitStruct->SPI_CPHA));
164:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** assert_param(IS_SPI_NSS(SPI_InitStruct->SPI_NSS));
165:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** assert_param(IS_SPI_BAUDRATE_PRESCALER(SPI_InitStruct->SPI_BaudRatePrescaler));
166:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** assert_param(IS_SPI_FIRST_BIT(SPI_InitStruct->SPI_FirstBit));
167:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** assert_param(IS_SPI_CRC_POLYNOMIAL(SPI_InitStruct->SPI_CRCPolynomial));
168:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** /*---------------------------- SPIx CR1 Configuration ------------------------*/
169:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** /* Get the SPIx CR1 value */
170:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** tmpreg = SPIx->CR1;
171:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** /* Clear BIDIMode, BIDIOE, RxONLY, SSM, SSI, LSBFirst, BR, MSTR, CPOL and CPHA bits */
172:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** tmpreg &= CR1_CLEAR_Mask;
173:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** /* Configure SPIx: direction, NSS management, first transmitted bit, BaudRate prescaler
174:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** master/salve mode, CPOL and CPHA */
175:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** /* Set BIDImode, BIDIOE and RxONLY bits according to SPI_Direction value */
176:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** /* Set SSM, SSI and MSTR bits according to SPI_Mode and SPI_NSS values */
177:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** /* Set LSBFirst bit according to SPI_FirstBit value */
178:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** /* Set BR bits according to SPI_BaudRatePrescaler value */
179:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** /* Set CPOL bit according to SPI_CPOL value */
180:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** /* Set CPHA bit according to SPI_CPHA value */
181:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** tmpreg |= (uint16_t)((uint32_t)SPI_InitStruct->SPI_Direction | SPI_InitStruct->SPI_Mode |
35 .loc 1 181 0
36 0000 0A88 ldrh r2, [r1, #0]
37 0002 4B88 ldrh r3, [r1, #2]
38 .loc 1 152 0
39 0004 10B5 push {r4, lr}
40 .LCFI0:
41 .loc 1 181 0
42 0006 1343 orrs r3, r3, r2
43 0008 8A88 ldrh r2, [r1, #4]
44 .loc 1 170 0
45 000a 0488 ldrh r4, [r0, #0]
46 .loc 1 181 0
47 000c 1343 orrs r3, r3, r2
48 000e CA88 ldrh r2, [r1, #6]
49 .loc 1 172 0
50 0010 04F44154 and r4, r4, #12352
51 .LVL1:
52 .loc 1 181 0
53 0014 1343 orrs r3, r3, r2
54 0016 0A89 ldrh r2, [r1, #8]
55 0018 1343 orrs r3, r3, r2
56 001a 4A89 ldrh r2, [r1, #10]
57 001c 1343 orrs r3, r3, r2
58 001e 8A89 ldrh r2, [r1, #12]
59 0020 1343 orrs r3, r3, r2
60 0022 CA89 ldrh r2, [r1, #14]
61 0024 1343 orrs r3, r3, r2
62 0026 1C43 orrs r4, r4, r3
63 .LVL2:
64 0028 A4B2 uxth r4, r4
65 .LVL3:
182:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** SPI_InitStruct->SPI_DataSize | SPI_InitStruct->SPI_CPOL |
183:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** SPI_InitStruct->SPI_CPHA | SPI_InitStruct->SPI_NSS |
184:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** SPI_InitStruct->SPI_BaudRatePrescaler | SPI_InitStruct->SPI_FirstBit);
185:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** /* Write to SPIx CR1 */
186:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** SPIx->CR1 = tmpreg;
66 .loc 1 186 0
67 002a 0480 strh r4, [r0, #0] @ movhi
187:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c ****
188:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** /* Activate the SPI mode (Reset I2SMOD bit in I2SCFGR register) */
189:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** SPIx->I2SCFGR &= SPI_Mode_Select;
68 .loc 1 189 0
69 002c 838B ldrh r3, [r0, #28]
70 002e 23F40063 bic r3, r3, #2048
71 0032 1B04 lsls r3, r3, #16
72 0034 1B0C lsrs r3, r3, #16
73 0036 8383 strh r3, [r0, #28] @ movhi
190:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** /*---------------------------- SPIx CRCPOLY Configuration --------------------*/
191:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** /* Write to SPIx CRCPOLY */
192:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** SPIx->CRCPR = SPI_InitStruct->SPI_CRCPolynomial;
74 .loc 1 192 0
75 0038 0B8A ldrh r3, [r1, #16]
76 003a 0382 strh r3, [r0, #16] @ movhi
193:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** }
77 .loc 1 193 0
78 003c 10BD pop {r4, pc}
79 .LFE27:
81 003e C046 .section .text.SPI_StructInit,"ax",%progbits
82 .align 2
83 .global SPI_StructInit
84 .thumb
85 .thumb_func
87 SPI_StructInit:
88 .LFB29:
194:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c ****
195:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** /**
196:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** * @brief Initializes the SPIx peripheral according to the specified
197:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** * parameters in the I2S_InitStruct.
198:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** * @param SPIx: where x can be 2 or 3 to select the SPI peripheral
199:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** * (configured in I2S mode).
200:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** * @param I2S_InitStruct: pointer to an I2S_InitTypeDef structure that
201:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** * contains the configuration information for the specified
202:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** * SPI peripheral configured in I2S mode.
203:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** * @retval : None
204:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** */
205:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** void I2S_Init(SPI_TypeDef* SPIx, I2S_InitTypeDef* I2S_InitStruct)
206:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** {
207:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** uint16_t tmpreg = 0, i2sdiv = 2, i2sodd = 0, packetlength = 1;
208:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** uint32_t tmp = 0;
209:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** RCC_ClocksTypeDef RCC_Clocks;
210:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c ****
211:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** /* Check the I2S parameters */
212:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** assert_param(IS_SPI_23_PERIPH(SPIx));
213:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** assert_param(IS_I2S_MODE(I2S_InitStruct->I2S_Mode));
214:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** assert_param(IS_I2S_STANDARD(I2S_InitStruct->I2S_Standard));
215:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** assert_param(IS_I2S_DATA_FORMAT(I2S_InitStruct->I2S_DataFormat));
216:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** assert_param(IS_I2S_MCLK_OUTPUT(I2S_InitStruct->I2S_MCLKOutput));
217:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** assert_param(IS_I2S_AUDIO_FREQ(I2S_InitStruct->I2S_AudioFreq));
218:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** assert_param(IS_I2S_CPOL(I2S_InitStruct->I2S_CPOL));
219:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** /*----------------------- SPIx I2SCFGR & I2SPR Configuration -----------------*/
220:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** /* Clear I2SMOD, I2SE, I2SCFG, PCMSYNC, I2SSTD, CKPOL, DATLEN and CHLEN bits */
221:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** SPIx->I2SCFGR &= I2SCFGR_CLEAR_Mask;
222:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** SPIx->I2SPR = 0x0002;
223:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c ****
224:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** /* Get the I2SCFGR register value */
225:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** tmpreg = SPIx->I2SCFGR;
226:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c ****
227:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** /* If the default value has to be written, reinitialize i2sdiv and i2sodd*/
228:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** if(I2S_InitStruct->I2S_AudioFreq == I2S_AudioFreq_Default)
229:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** {
230:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** i2sodd = (uint16_t)0;
231:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** i2sdiv = (uint16_t)2;
232:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** }
233:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** /* If the requested audio frequency is not the default, compute the prescaler */
234:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** else
235:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** {
236:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** /* Check the frame length (For the Prescaler computing) */
237:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** if(I2S_InitStruct->I2S_DataFormat == I2S_DataFormat_16b)
238:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** {
239:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** /* Packet length is 16 bits */
240:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** packetlength = 1;
241:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** }
242:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** else
243:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** {
244:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** /* Packet length is 32 bits */
245:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** packetlength = 2;
246:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** }
247:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** /* Get System Clock frequency */
248:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** RCC_GetClocksFreq(&RCC_Clocks);
249:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c ****
250:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** /* Compute the Real divider depending on the MCLK output state with a flaoting point */
251:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** if(I2S_InitStruct->I2S_MCLKOutput == I2S_MCLKOutput_Enable)
252:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** {
253:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** /* MCLK output is enabled */
254:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** tmp = (uint16_t)(((10 * RCC_Clocks.SYSCLK_Frequency) / (256 * I2S_InitStruct->I2S_AudioFreq))
255:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** }
256:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** else
257:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** {
258:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** /* MCLK output is disabled */
259:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** tmp = (uint16_t)(((10 * RCC_Clocks.SYSCLK_Frequency) / (32 * packetlength * I2S_InitStruct->I
260:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** }
261:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c ****
262:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** /* Remove the flaoting point */
263:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** tmp = tmp/10;
264:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c ****
265:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** /* Check the parity of the divider */
266:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** i2sodd = (uint16_t)(tmp & (uint16_t)0x0001);
267:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c ****
268:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** /* Compute the i2sdiv prescaler */
269:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** i2sdiv = (uint16_t)((tmp - i2sodd) / 2);
270:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c ****
271:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** /* Get the Mask for the Odd bit (SPI_I2SPR[8]) register */
272:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** i2sodd = (uint16_t) (i2sodd << 8);
273:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** }
274:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c ****
275:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** /* Test if the divider is 1 or 0 */
276:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** if ((i2sdiv < 2) || (i2sdiv > 0xFF))
277:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** {
278:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** /* Set the default values */
279:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** i2sdiv = 2;
280:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** i2sodd = 0;
281:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** }
282:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** /* Write to SPIx I2SPR register the computed value */
283:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** SPIx->I2SPR = (uint16_t)(i2sdiv | i2sodd | I2S_InitStruct->I2S_MCLKOutput);
284:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c ****
285:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** /* Configure the I2S with the SPI_InitStruct values */
286:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** tmpreg |= (uint16_t)(I2S_Mode_Select | I2S_InitStruct->I2S_Mode | \
287:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** I2S_InitStruct->I2S_Standard | I2S_InitStruct->I2S_DataFormat | \
288:lib/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c **** I2S_InitStruct->I2S_CPOL);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -