在线时间108 小时
UID222461
注册时间2018-11-19
NXP金币8
TA的每日心情 | 开心 2020-12-18 10:54 |
---|
签到天数: 8 天 [LV.3]偶尔看看II
高级会员
- 积分
- 977
- 最后登录
- 2024-3-10
|
楼主 |
发表于 2021-1-20 20:48:14
|
显示全部楼层
- CM3_ROOT
- void UART3_IRQHandler(void)
- {
- uint32_t intsrc, tmp, tmp1;
- uint8_t tmpc, i;
- NVIC_ClearPendingIRQ(UART3_IRQn);
- /* Determine the interrupt source */
- intsrc = UART_GetIntId(LPC_UART3);
- tmp = intsrc & UART_IIR_INTID_MASK;
- #if 0
- // Receive Line Status
- if (tmp == UART_IIR_INTID_RLS)
- {
- // Check line status
- tmp1 = UART_GetLineStatus(LPC_UART3);
- // Mask out the Receive Ready and Transmit Holding empty status
- tmp1 &= (UART_LSR_OE | UART_LSR_PE | UART_LSR_FE \
- | UART_LSR_BI | UART_LSR_RXFE);
- // If any error exist
- if (tmp1)
- {
- _MSG_DBG("tmp1=%x\n", tmp1);
- UART3_IntErr(tmp1);
- }
- }
- #endif
- #if 1
- // Receive Data Available or Character time-out
- if ((tmp == UART_IIR_INTID_RDA) || (tmp == UART_IIR_INTID_CTI))
- {
- //UART_IntReceive();
- //直接发送会上位机,232是全双工通信
- //UART_SendByte(LPC_UART3, UART_ReceiveByte(LPC_UART3));
- //上一句和下面两个语句等价
- //UART_Receive((LPC_UART_TypeDef *)LPC_UART3, &tmpc, 1, NONE_BLOCKING);
- //UART_SendByte(LPC_UART3, tmpc);
- Uart_Receive_FSM(&uart_data_to_linux);
- }
- #endif
- #if 0
- // Receive Data Available or Character time-out
- if (tmp == UART_IIR_INTID_RDA)
- {
- //UART_SendByte(LPC_UART3, UART_ReceiveByte(LPC_UART3));
- //上一句和下面两个语句等价
- // UART_Receive((LPC_UART_TypeDef *)LPC_UART3, &tmpc, 1, NONE_BLOCKING);
- // UART_SendByte(LPC_UART3, tmpc);
- for (i = 0; i < 7; i++) /* 连续接收7个字节 剩余1个触发cti中断来读取,避免了接收8及8整数倍的字节数数据*/
- {
- //GucRcvBuf[i] = LPC_UART2->RBR;
- GucRcvBuf3[cti_cnt_2] = UART_ReceiveByte(LPC_UART3);
- cti_cnt_2++;
- }
- }
- if (tmp == UART_IIR_INTID_CTI)
- {
- //UART_IntReceive();
- // UART3_Flag = 1;
- // UART_SendByte(LPC_UART3, UART_ReceiveByte(LPC_UART3));
- while ((LPC_UART3->LSR & UART_LSR_RDR) == UART_LSR_RDR) /* 判断数据是否接收完毕 */
- {
- // cti_cnt++;
- // _MSG_DBG("cti=%d\n", cti_cnt);
- GucRcvBuf3[cti_cnt_2] = UART_ReceiveByte(LPC_UART3);
- cti_cnt_2++;
- }
- UART3_Flag = 1;
- }
- #endif
- }
复制代码
|
|