📄 stm32f10x_usart.lst
字号:
\ 00000004 03D0 BEQ.N ??USART_Cmd_0
257 {
258 /* Enable the selected USART by setting the RUN bit in the CR1 register */
259 USARTx->CR1 |= CR1_RUN_Set;
\ 00000006 51F40051 ORRS R1,R1,#0x2000
\ 0000000A 8181 STRH R1,[R0, #+12]
\ 0000000C 7047 BX LR
260 }
261 else
262 {
263 /* Disable the selected USART by clearing the RUN bit in the CR1 register */
264 USARTx->CR1 &= CR1_RUN_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]
265 }
266 }
\ 00000014 7047 BX LR ;; return
\ 00000016 00BF Nop
\ ??USART_Cmd_1:
\ 00000018 FFDF0000 DC32 0xdfff
267
268 /*******************************************************************************
269 * Function Name : USART_ITConfig
270 * Description : Enables or disables the specified USART interrupts.
271 * Input : - USARTx: where x can be 1, 2 or 3 to select the USART
272 * peripheral.
273 * - USART_IT: specifies the USART interrupt sources to be
274 * enabled or disabled.
275 * This parameter can be one of the following values:
276 * - USART_IT_PE
277 * - USART_IT_TXE
278 * - USART_IT_TC
279 * - USART_IT_RXNE
280 * - USART_IT_IDLE
281 * - USART_IT_LBD
282 * - USART_IT_CTS
283 * - USART_IT_ERR
284 * - NewState: new state of the specified USARTx interrupts.
285 * This parameter can be: ENABLE or DISABLE.
286 * Output : None
287 * Return : None
288 *******************************************************************************/
\ In segment CODE, align 4, keep-with-next
289 void USART_ITConfig(USART_TypeDef* USARTx, u16 USART_IT, FunctionalState NewState)
290 {
\ USART_ITConfig:
\ 00000000 10B5 PUSH {R4,LR}
291 u32 usartreg = 0x00, itpos = 0x00, itmask = 0x00;
292 u32 address = 0x00;
293
294 /* Check the parameters */
295 assert(IS_USART_CONFIG_IT(USART_IT));
296 assert(IS_FUNCTIONAL_STATE(NewState));
297
298 /* Get the USART register index */
299 usartreg = (((u8)USART_IT) >> 0x05);
\ 00000002 0B00 MOVS R3,R1
\ 00000004 DBB2 UXTB R3,R3
\ 00000006 5B09 LSRS R3,R3,#+5
300
301 /* Get the interrupt position */
302 itpos = USART_IT & USART_IT_Mask;
303
304 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
305 address = *(u32*)&(USARTx);
306
307 if (usartreg == 0x01) /* The IT is in CR1 register */
\ 00000010 012B CMP R3,#+1
\ 00000012 01D1 BNE.N ??USART_ITConfig_0
308 {
309 address += 0x0C;
\ 00000014 0C30 ADDS R0,R0,#+12
\ 00000016 04E0 B.N ??USART_ITConfig_1
310 }
311 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
312 {
313 address += 0x10;
\ 0000001C 1030 ADDS R0,R0,#+16
\ 0000001E 00E0 B.N ??USART_ITConfig_1
314 }
315 else /* The IT is in CR3 register */
316 {
317 address += 0x14;
\ ??USART_ITConfig_2:
\ 00000020 1430 ADDS R0,R0,#+20
318 }
319 if (NewState != DISABLE)
\ ??USART_ITConfig_1:
\ 00000022 002A CMP R2,#+0
\ 00000024 0168 LDR R1,[R0, #+0]
\ 00000026 02D0 BEQ.N ??USART_ITConfig_3
320 {
321 *(u32*)address |= itmask;
\ 00000028 0C43 ORRS R4,R4,R1
\ 0000002A 0460 STR R4,[R0, #+0]
\ 0000002C 10BD POP {R4,PC}
322 }
323 else
324 {
325 *(u32*)address &= ~itmask;
\ ??USART_ITConfig_3:
\ 0000002E A143 BICS R1,R1,R4
\ 00000030 0160 STR R1,[R0, #+0]
326 }
327 }
\ 00000032 10BD POP {R4,PC} ;; return
328
329 /*******************************************************************************
330 * Function Name : USART_DMACmd
331 * Description : Enables or disables the USART抯 DMA interface.
332 * Input : - USARTx: where x can be 1, 2 or 3 to select the USART
333 * peripheral.
334 * - USART_DMAReq: specifies the DMA request.
335 * This parameter can be any combination of the following values:
336 * - USART_DMAReq_Tx
337 * - USART_DMAReq_Rx
338 * - NewState: new state of the DMA Request sources.
339 * This parameter can be: ENABLE or DISABLE.
340 * Output : None
341 * Return : None
342 *******************************************************************************/
\ In segment CODE, align 4, keep-with-next
343 void USART_DMACmd(USART_TypeDef* USARTx, u16 USART_DMAReq, FunctionalState NewState)
344 {
345 /* Check the parameters */
346 assert(IS_USART_DMAREQ(USART_DMAReq));
347 assert(IS_FUNCTIONAL_STATE(NewState));
348
349 if (NewState != DISABLE)
\ USART_DMACmd:
\ 00000000 002A CMP R2,#+0
\ 00000002 828A LDRH R2,[R0, #+20]
\ 00000004 02D0 BEQ.N ??USART_DMACmd_0
350 {
351 /* Enable the DMA transfer for selected requests by setting the DMAT and/or
352 DMAR bits in the USART CR3 register */
353 USARTx->CR3 |= USART_DMAReq;
\ 00000006 1143 ORRS R1,R1,R2
\ 00000008 8182 STRH R1,[R0, #+20]
\ 0000000A 7047 BX LR
354 }
355 else
356 {
357 /* Disable the DMA transfer for selected requests by clearing the DMAT and/or
358 DMAR bits in the USART CR3 register */
359 USARTx->CR3 &= (u16)~USART_DMAReq;
\ ??USART_DMACmd_0:
\ 0000000C 8A43 BICS R2,R2,R1
\ 0000000E 8282 STRH R2,[R0, #+20]
360 }
361 }
\ 00000010 7047 BX LR ;; return
362
363 /*******************************************************************************
364 * Function Name : USART_SetAddress
365 * Description : Sets the address of the USART node.
366 * Input : - USARTx: where x can be 1, 2 or 3 to select the USART
367 * peripheral.
368 * - USART_Address: Indicates the address of the USART node.
369 * Output : None
370 * Return : None
371 *******************************************************************************/
\ In segment CODE, align 4, keep-with-next
372 void USART_SetAddress(USART_TypeDef* USARTx, u8 USART_Address)
373 {
374 /* Check the parameters */
375 assert(IS_USART_ADDRESS(USART_Address));
376
377 /* Clear the USART address */
378 USARTx->CR2 &= CR2_Address_Mask;
\ USART_SetAddress:
\ 00000000 028A LDRH R2,[R0, #+16]
\ 00000002 034B LDR.N R3,??USART_SetAddress_0 ;; 0xfff0
\ 00000004 1340 ANDS R3,R3,R2
\ 00000006 0382 STRH R3,[R0, #+16]
379 /* Set the USART address node */
380 USARTx->CR2 |= USART_Address;
\ 00000008 028A LDRH R2,[R0, #+16]
\ 0000000A 1143 ORRS R1,R1,R2
\ 0000000C 0182 STRH R1,[R0, #+16]
381 }
\ 0000000E 7047 BX LR ;; return
\ ??USART_SetAddress_0:
\ 00000010 F0FF0000 DC32 0xfff0
382
383 /*******************************************************************************
384 * Function Name : USART_WakeUpConfig
385 * Description : Selects the USART WakeUp method.
386 * Input : - USARTx: where x can be 1, 2 or 3 to select the USART
387 * peripheral.
388 * - USART_WakeUp: specifies the USART wakeup method.
389 * This parameter can be one of the following values:
390 * - USART_WakeUp_IdleLine
391 * - USART_WakeUp_AddressMark
392 * Output : None
393 * Return : None
394 *******************************************************************************/
\ In segment CODE, align 4, keep-with-next
395 void USART_WakeUpConfig(USART_TypeDef* USARTx, u16 USART_WakeUp)
396 {
397 /* Check the parameters */
398 assert(IS_USART_WAKEUP(USART_WakeUp));
399
400 USARTx->CR1 &= CR3_WAKE_Mask;
\ USART_WakeUpConfig:
\ 00000000 8289 LDRH R2,[R0, #+12]
\ 00000002 034B LDR.N R3,??USART_WakeUpConfig_0 ;; 0xf7ff
\ 00000004 1340 ANDS R3,R3,R2
\ 00000006 8381 STRH R3,[R0, #+12]
401 USARTx->CR1 |= USART_WakeUp;
\ 00000008 8289 LDRH R2,[R0, #+12]
\ 0000000A 1143 ORRS R1,R1,R2
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -