📄 probe_rs232c.lst
字号:
293 gpio_init.GPIO_Pin = GPIO_Pin_9;
294 gpio_init.GPIO_Mode = GPIO_Mode_IN_FLOATING;
295 GPIO_Init(GPIOD, &gpio_init);
296
297 #else
298
299 RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE);
300
301 /* Configure GPIOB.10 as push-pull */
302 gpio_init.GPIO_Pin = GPIO_Pin_10;
303 gpio_init.GPIO_Speed = GPIO_Speed_50MHz;
304 gpio_init.GPIO_Mode = GPIO_Mode_AF_PP;
305 GPIO_Init(GPIOB, &gpio_init);
306
307 /* Configure GPIOB.11 as input floating */
308 gpio_init.GPIO_Pin = GPIO_Pin_11;
309 gpio_init.GPIO_Mode = GPIO_Mode_IN_FLOATING;
310 GPIO_Init(GPIOB, &gpio_init);
311 #endif
312
313
314
315 /* -------------------- SETUP USART3 ---------------------- */
316 usart_init.USART_BaudRate = baud_rate;
317 usart_init.USART_WordLength = USART_WordLength_8b;
318 usart_init.USART_StopBits = USART_StopBits_1;
319 usart_init.USART_Parity = USART_Parity_No ;
320 usart_init.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
321 usart_init.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;
322 usart_init.USART_Clock = USART_Clock_Disable;
323 usart_init.USART_CPOL = USART_CPOL_Low;
324 usart_init.USART_CPHA = USART_CPHA_2Edge;
325 usart_init.USART_LastBit = USART_LastBit_Disable;
326
327 USART_Init(USART3, &usart_init);
328 USART_Cmd(USART3, ENABLE);
329
330 nvic_init.NVIC_IRQChannel = USART3_IRQChannel;
331 nvic_init.NVIC_IRQChannelPreemptionPriority = 0;
332 nvic_init.NVIC_IRQChannelSubPriority = 0;
333 nvic_init.NVIC_IRQChannelCmd = ENABLE;
334 NVIC_Init(&nvic_init);
335 #endif
336 }
\ 000000A0 08B0 ADD SP,SP,#+32
\ 000000A2 70BD POP {R4-R6,PC} ;; return
\ ??ProbeRS232_InitTarget_0:
\ 000000A4 00080140 DC32 0x40010800
337
338 /*
339 *********************************************************************************************************
340 * Rx and Tx Communication Handler
341 *
342 * Description: This function handles both Rx and Tx interrupts.
343 *
344 * Argument(s): None
345 *
346 * Returns : None
347 *
348 * Note(s) : (1) This ISR handler handles the interrupt entrance/exit as expected by
349 * by uC/OS-II v2.85. If you are using a different RTOS (or no RTOS), then this
350 * procedure may need to be modified or eliminated. However, the logic in the handler
351 * need not be changed.
352 *********************************************************************************************************
353 */
354
\ In segment CODE, align 4, keep-with-next
355 void ProbeRS232_RxTxISRHandler (void)
356 {
\ ProbeRS232_RxTxISRHandler:
\ 00000000 30B5 PUSH {R4,R5,LR}
357 CPU_INT08U rx_data;
358 CPU_SR cpu_sr;
359
360
361 CPU_CRITICAL_ENTER(); /* Tell uC/OS-II that we are starting an ISR */
\ 00000002 ........ _BLF CPU_SR_Save,??CPU_SR_Save??rT
362 OSIntNesting++;
\ 00000006 1449 LDR.N R1,??ProbeRS232_RxTxISRHandler_0 ;; OSIntNesting
\ 00000008 0A78 LDRB R2,[R1, #+0]
\ 0000000A 521C ADDS R2,R2,#+1
\ 0000000C 0A70 STRB R2,[R1, #+0]
363 CPU_CRITICAL_EXIT();
\ 0000000E ........ _BLF CPU_SR_Restore,??CPU_SR_Restore??rT
364
365
366 #if (PROBE_RS232_COMM_SEL == PROBE_RS232_UART_1)
367 if(USART_GetITStatus(USART1, USART_IT_RXNE) != RESET) {
\ 00000012 .... LDR.N R4,??DataTable12 ;; 0x40013800
\ 00000014 .... LDR.N R5,??DataTable11 ;; 0x525
\ 00000016 2900 MOVS R1,R5
\ 00000018 2000 MOVS R0,R4
\ 0000001A ........ _BLF USART_GetITStatus,??USART_GetITStatus??rT
\ 0000001E 0028 CMP R0,#+0
\ 00000020 09D0 BEQ.N ??ProbeRS232_RxTxISRHandler_1
368
369 rx_data = USART_ReceiveData(USART1) & 0xFF; /* Read one byte from the receive data register */
\ 00000022 2000 MOVS R0,R4
\ 00000024 ........ _BLF USART_ReceiveData,??USART_ReceiveData??rT
\ 00000028 C0B2 UXTB R0,R0
370 ProbeRS232_RxHandler(rx_data);
\ 0000002A ........ _BLF ProbeRS232_RxHandler,??ProbeRS232_RxHandler??rT
371
372 USART_ClearITPendingBit(USART1, USART_IT_RXNE); /* Clear the USART1 Receive interrupt */
\ 0000002E 2900 MOVS R1,R5
\ 00000030 2000 MOVS R0,R4
\ 00000032 ........ _BLF USART_ClearITPendingBit,??USART_ClearITPendingBit??rT
373 }
374
375 if(USART_GetITStatus(USART1, USART_IT_TXE) != RESET) {
\ ??ProbeRS232_RxTxISRHandler_1:
\ 00000036 .... LDR.N R5,??DataTable7 ;; 0x727
\ 00000038 2900 MOVS R1,R5
\ 0000003A 2000 MOVS R0,R4
\ 0000003C ........ _BLF USART_GetITStatus,??USART_GetITStatus??rT
\ 00000040 0028 CMP R0,#+0
\ 00000042 05D0 BEQ.N ??ProbeRS232_RxTxISRHandler_2
376 ProbeRS232_TxHandler();
\ 00000044 ........ _BLF ProbeRS232_TxHandler,??ProbeRS232_TxHandler??rT
377
378 USART_ClearITPendingBit(USART1, USART_IT_TXE); /* Clear the USART1 transmit interrupt */
\ 00000048 2900 MOVS R1,R5
\ 0000004A 2000 MOVS R0,R4
\ 0000004C ........ _BLF USART_ClearITPendingBit,??USART_ClearITPendingBit??rT
379 }
380 #endif
381
382 #if (PROBE_RS232_COMM_SEL == PROBE_RS232_UART_2)
383 if(USART_GetITStatus(USART2, USART_IT_RXNE) != RESET) {
384
385 rx_data = USART_ReceiveData(USART2) & 0xFF; /* Read one byte from the receive data register */
386 ProbeRS232_RxHandler(rx_data);
387
388 USART_ClearITPendingBit(USART2, USART_IT_RXNE); /* Clear the USART1 Receive interrupt */
389 }
390
391 if(USART_GetITStatus(USART2, USART_IT_TXE) != RESET) {
392 ProbeRS232_TxHandler();
393
394 USART_ClearITPendingBit(USART2, USART_IT_TXE); /* Clear the USART1 transmit interrupt */
395 }
396 #endif
397
398 #if (PROBE_RS232_COMM_SEL == PROBE_RS232_UART_3)
399 if(USART_GetITStatus(USART3, USART_IT_RXNE) != RESET) {
400
401 rx_data = USART_ReceiveData(USART3) & 0xFF; /* Read one byte from the receive data register */
402 ProbeRS232_RxHandler(rx_data);
403
404 USART_ClearITPendingBit(USART3, USART_IT_RXNE); /* Clear the USART1 Receive interrupt */
405 }
406
407 if(USART_GetITStatus(USART3, USART_IT_TXE) != RESET) {
408 ProbeRS232_TxHandler();
409
410 USART_ClearITPendingBit(USART3, USART_IT_TXE); /* Clear the USART1 transmit interrupt */
411 }
412 #endif
413
414 OSIntExit(); /* Tell uC/OS-II that we are leaving the ISR */
\ ??ProbeRS232_RxTxISRHandler_2:
\ 00000050 ........ _BLF OSIntExit,??OSIntExit??rT
415 }
\ 00000054 30BD POP {R4,R5,PC} ;; return
\ 00000056 00BF Nop
\ ??ProbeRS232_RxTxISRHandler_0:
\ 00000058 ........ DC32 OSIntNesting
416
417 /*
418 *********************************************************************************************************
419 * Rx and Tx Communication Handler
420 *
421 * Description: These functions handle the Rx and Tx interrupts.
422 *
423 * Argument(s): None
424 *
425 * Returns : None
426 *
427 * Note(s) : These functions are empty because Rx and Tx interrupts are both handled by ProbeRS232_RxTxISRHandler()
428 *********************************************************************************************************
429 */
430
\ In segment CODE, align 4, keep-with-next
431 void ProbeRS232_RxISRHandler (void)
432 {
433 }
\ ProbeRS232_RxISRHandler:
\ 00000000 7047 BX LR ;; return
434
\ In segment CODE, align 4, keep-with-next
435 void ProbeRS232_TxISRHandler (void)
436 {
437 }
\ ProbeRS232_TxISRHandler:
\ 00000000 7047 BX LR ;; return
438
439 /*
440 *********************************************************************************************************
441 * Transmit One Byte
442 *
443 * Description: This function transmits one byte.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -