refactor: 清理UART调试代码并保留RTT诊断
This commit is contained in:
@@ -192,6 +192,7 @@ int uart_trans_start(uart_channel_t channel)
|
||||
ctx->tx_tail = 0u;
|
||||
ctx->tx_dma_len = 0u;
|
||||
ctx->tx_busy = false;
|
||||
memset(&ctx->stats, 0, sizeof(ctx->stats));
|
||||
|
||||
__HAL_UART_ENABLE_IT(ctx->huart, UART_IT_IDLE);
|
||||
if (HAL_UART_Receive_DMA(ctx->huart, ctx->rx_dma_buffer, UART_RX_DMA_BUFFER_SIZE) != HAL_OK) {
|
||||
@@ -302,6 +303,7 @@ void uart_trans_idle_handler(uart_channel_t channel)
|
||||
}
|
||||
|
||||
huart = g_channels[channel].huart;
|
||||
g_channels[channel].stats.idle_events++;
|
||||
dma_write_index = (uint16_t)(UART_RX_DMA_BUFFER_SIZE - __HAL_DMA_GET_COUNTER(huart->hdmarx));
|
||||
if (dma_write_index >= UART_RX_DMA_BUFFER_SIZE) {
|
||||
dma_write_index = 0u;
|
||||
@@ -316,6 +318,7 @@ void uart_trans_rx_half_cplt_handler(uart_channel_t channel)
|
||||
return;
|
||||
}
|
||||
|
||||
g_channels[channel].stats.rx_half_events++;
|
||||
process_rx_snapshot(channel, UART_RX_DMA_BUFFER_SIZE / 2u);
|
||||
}
|
||||
|
||||
@@ -325,6 +328,7 @@ void uart_trans_rx_cplt_handler(uart_channel_t channel)
|
||||
return;
|
||||
}
|
||||
|
||||
g_channels[channel].stats.rx_full_events++;
|
||||
process_rx_snapshot(channel, 0u);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user