📄 stm32f10x_usart.lst
字号:
\ 00000006 0021 MOVS R1,#+0
\ 00000008 8180 STRH R1,[R0, #+4]
239 USART_InitStruct->USART_StopBits = USART_StopBits_1;
\ 0000000A C180 STRH R1,[R0, #+6]
240 USART_InitStruct->USART_Parity = USART_Parity_No ;
\ 0000000C 0181 STRH R1,[R0, #+8]
241 USART_InitStruct->USART_Mode = USART_Mode_Rx | USART_Mode_Tx;
\ 0000000E 0C22 MOVS R2,#+12
\ 00000010 4281 STRH R2,[R0, #+10]
242 USART_InitStruct->USART_HardwareFlowControl = USART_HardwareFlowControl_None;
\ 00000012 8181 STRH R1,[R0, #+12]
243 }
\ 00000014 7047 BX LR ;; return
244
245 /*******************************************************************************
246 * Function Name : USART_ClockInit
247 * Description : Initializes the USARTx peripheral Clock according to the
248 * specified parameters in the USART_ClockInitStruct .
249 * Input : - USARTx: where x can be 1, 2, 3 to select the USART peripheral.
250 * Note: The Smart Card mode is not available for UART4 and UART5.
251 * - USART_ClockInitStruct: pointer to a USART_ClockInitTypeDef
252 * structure that contains the configuration information for
253 * the specified USART peripheral.
254 * Output : None
255 * Return : None
256 *******************************************************************************/
\ In segment CODE, align 4, keep-with-next
257 void USART_ClockInit(USART_TypeDef* USARTx, USART_ClockInitTypeDef* USART_ClockInitStruct)
258 {
259 u32 tmpreg = 0x00;
260
261 /* Check the parameters */
262 assert_param(IS_USART_123_PERIPH(USARTx));
263 assert_param(IS_USART_CLOCK(USART_ClockInitStruct->USART_Clock));
264 assert_param(IS_USART_CPOL(USART_ClockInitStruct->USART_CPOL));
265 assert_param(IS_USART_CPHA(USART_ClockInitStruct->USART_CPHA));
266 assert_param(IS_USART_LASTBIT(USART_ClockInitStruct->USART_LastBit));
267
268 /*---------------------------- USART CR2 Configuration -----------------------*/
269 tmpreg = USARTx->CR2;
\ USART_ClockInit:
\ 00000000 028A LDRH R2,[R0, #+16]
270 /* Clear CLKEN, CPOL, CPHA and LBCL bits */
271 tmpreg &= CR2_CLOCK_CLEAR_Mask;
272
273 /* Configure the USART Clock, CPOL, CPHA and LastBit ------------*/
274 /* Set CLKEN bit according to USART_Clock value */
275 /* Set CPOL bit according to USART_CPOL value */
276 /* Set CPHA bit according to USART_CPHA value */
277 /* Set LBCL bit according to USART_LastBit value */
278 tmpreg |= (u32)USART_ClockInitStruct->USART_Clock | USART_ClockInitStruct->USART_CPOL |
279 USART_ClockInitStruct->USART_CPHA | USART_ClockInitStruct->USART_LastBit;
280
281 /* Write to USART CR2 */
282 USARTx->CR2 = (u16)tmpreg;
\ 00000002 064B LDR.N R3,??USART_ClockInit_0 ;; 0xf0ff
\ 00000004 1340 ANDS R3,R3,R2
\ 00000006 0A88 LDRH R2,[R1, #+0]
\ 00000008 1A43 ORRS R2,R2,R3
\ 0000000A 4B88 LDRH R3,[R1, #+2]
\ 0000000C 1343 ORRS R3,R3,R2
\ 0000000E 8A88 LDRH R2,[R1, #+4]
\ 00000010 1A43 ORRS R2,R2,R3
\ 00000012 C988 LDRH R1,[R1, #+6]
\ 00000014 1143 ORRS R1,R1,R2
\ 00000016 0182 STRH R1,[R0, #+16]
283 }
\ 00000018 7047 BX LR ;; return
\ 0000001A 00BF Nop
\ ??USART_ClockInit_0:
\ 0000001C FFF00000 DC32 0xf0ff
284
285 /*******************************************************************************
286 * Function Name : USART_ClockStructInit
287 * Description : Fills each USART_ClockInitStruct member with its default value.
288 * Input : - USART_ClockInitStruct: pointer to a USART_ClockInitTypeDef
289 * structure which will be initialized.
290 * Output : None
291 * Return : None
292 *******************************************************************************/
\ In segment CODE, align 4, keep-with-next
293 void USART_ClockStructInit(USART_ClockInitTypeDef* USART_ClockInitStruct)
294 {
295 /* USART_ClockInitStruct members default value */
296 USART_ClockInitStruct->USART_Clock = USART_Clock_Disable;
\ USART_ClockStructInit:
\ 00000000 0021 MOVS R1,#+0
\ 00000002 0180 STRH R1,[R0, #+0]
297 USART_ClockInitStruct->USART_CPOL = USART_CPOL_Low;
\ 00000004 4180 STRH R1,[R0, #+2]
298 USART_ClockInitStruct->USART_CPHA = USART_CPHA_1Edge;
\ 00000006 8180 STRH R1,[R0, #+4]
299 USART_ClockInitStruct->USART_LastBit = USART_LastBit_Disable;
\ 00000008 C180 STRH R1,[R0, #+6]
300 }
\ 0000000A 7047 BX LR ;; return
301
302 /*******************************************************************************
303 * Function Name : USART_Cmd
304 * Description : Enables or disables the specified USART peripheral.
305 * Input : - USARTx: Select the USART or the UART peripheral.
306 * This parameter can be one of the following values:
307 * - USART1, USART2, USART3, UART4 or UART5.
308 * : - NewState: new state of the USARTx peripheral.
309 * This parameter can be: ENABLE or DISABLE.
310 * Output : None
311 * Return : None
312 *******************************************************************************/
\ In segment CODE, align 4, keep-with-next
313 void USART_Cmd(USART_TypeDef* USARTx, FunctionalState NewState)
314 {
315 /* Check the parameters */
316 assert_param(IS_USART_ALL_PERIPH(USARTx));
317 assert_param(IS_FUNCTIONAL_STATE(NewState));
318
319 if (NewState != DISABLE)
\ USART_Cmd:
\ 00000000 0029 CMP R1,#+0
\ 00000002 8189 LDRH R1,[R0, #+12]
\ 00000004 03D0 BEQ.N ??USART_Cmd_0
320 {
321 /* Enable the selected USART by setting the UE bit in the CR1 register */
322 USARTx->CR1 |= CR1_UE_Set;
\ 00000006 51F40051 ORRS R1,R1,#0x2000
\ 0000000A 8181 STRH R1,[R0, #+12]
\ 0000000C 7047 BX LR
323 }
324 else
325 {
326 /* Disable the selected USART by clearing the UE bit in the CR1 register */
327 USARTx->CR1 &= CR1_UE_Reset;
\ ??USART_Cmd_0:
\ 0000000E 024A LDR.N R2,??USART_Cmd_1 ;; 0xdfff
\ 00000010 0A40 ANDS R2,R2,R1
\ 00000012 8281 STRH R2,[R0, #+12]
328 }
329 }
\ 00000014 7047 BX LR ;; return
\ 00000016 00BF Nop
\ ??USART_Cmd_1:
\ 00000018 FFDF0000 DC32 0xdfff
330
331 /*******************************************************************************
332 * Function Name : USART_ITConfig
333 * Description : Enables or disables the specified USART interrupts.
334 * Input : - USARTx: Select the USART or the UART peripheral.
335 * This parameter can be one of the following values:
336 * - USART1, USART2, USART3, UART4 or UART5.
337 * - USART_IT: specifies the USART interrupt sources to be
338 * enabled or disabled.
339 * This parameter can be one of the following values:
340 * - USART_IT_CTS: CTS change interrupt (not available for
341 * UART4 and UART5)
342 * - USART_IT_LBD: LIN Break detection interrupt
343 * - USART_IT_TXE: Tansmit Data Register empty interrupt
344 * - USART_IT_TC: Transmission complete interrupt
345 * - USART_IT_RXNE: Receive Data register not empty
346 * interrupt
347 * - USART_IT_IDLE: Idle line detection interrupt
348 * - USART_IT_PE: Parity Error interrupt
349 * - USART_IT_ERR: Error interrupt(Frame error, noise
350 * error, overrun error)
351 * - NewState: new state of the specified USARTx interrupts.
352 * This parameter can be: ENABLE or DISABLE.
353 * Output : None
354 * Return : None
355 *******************************************************************************/
\ In segment CODE, align 4, keep-with-next
356 void USART_ITConfig(USART_TypeDef* USARTx, u16 USART_IT, FunctionalState NewState)
357 {
\ USART_ITConfig:
\ 00000000 10B5 PUSH {R4,LR}
358 u32 usartreg = 0x00, itpos = 0x00, itmask = 0x00;
359 u32 usartxbase = 0x00;
360
361 /* Check the parameters */
362 assert_param(IS_USART_ALL_PERIPH(USARTx));
363 assert_param(IS_USART_CONFIG_IT(USART_IT));
364 assert_param(IS_USART_PERIPH_IT(USARTx, USART_IT)); /* The CTS interrupt is not available for UART4 and UART5 */
365 assert_param(IS_FUNCTIONAL_STATE(NewState));
366
367 usartxbase = (*(u32*)&(USARTx));
368
369 /* Get the USART register index */
370 usartreg = (((u8)USART_IT) >> 0x05);
\ 00000002 0B00 MOVS R3,R1
\ 00000004 DBB2 UXTB R3,R3
\ 00000006 5B09 LSRS R3,R3,#+5
371
372 /* Get the interrupt position */
373 itpos = USART_IT & IT_Mask;
374
375 itmask = (((u32)0x01) << itpos);
\ 00000008 0124 MOVS R4,#+1
\ 0000000A C906 LSLS R1,R1,#+27
\ 0000000C C90E LSRS R1,R1,#+27
\ 0000000E 8C40 LSLS R4,R4,R1
376
377 if (usartreg == 0x01) /* The IT is in CR1 register */
\ 00000010 012B CMP R3,#+1
\ 00000012 01D1 BNE.N ??USART_ITConfig_0
378 {
379 usartxbase += 0x0C;
\ 00000014 0C30 ADDS R0,R0,#+12
\ 00000016 04E0 B.N ??USART_ITConfig_1
380 }
381 else if (usartreg == 0x02) /* The IT is in CR2 register */
\ ??USART_ITConfig_0:
\ 00000018 022B CMP R3,#+2
\ 0000001A 01D1 BNE.N ??USART_ITConfig_2
382 {
383 usartxbase += 0x10;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -