fix(uart): gate TCP forwarding by UART TX capacity

This commit is contained in:
2026-05-08 05:52:58 +08:00
parent 245d98f58e
commit 2679db4129
3 changed files with 158 additions and 21 deletions
+8
View File
@@ -281,6 +281,14 @@ uint16_t uart_trans_write(uart_channel_t channel, const uint8_t *data, uint16_t
return written;
}
uint16_t uart_trans_tx_free(uart_channel_t channel)
{
if (channel >= UART_CHANNEL_MAX) {
return 0u;
}
return ring_free(g_channels[channel].tx_head, g_channels[channel].tx_tail, UART_TX_RING_BUFFER_SIZE);
}
void uart_trans_get_stats(uart_channel_t channel, uart_stats_t *stats)
{
if (channel < UART_CHANNEL_MAX && stats != NULL) {