Skip to content

Commit bc29275

Browse files
committed
esp32: Clean up USB_SERIAL_JTAG_PACKET_SZ_BYTES define.
Signed-off-by: Damien George <[email protected]>
1 parent ab1087c commit bc29275

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

ports/esp32/boards/ESP32_GENERIC_C3/mpconfigboard.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,3 @@
88

99
// Enable UART REPL for modules that have an external USB-UART and don't use native USB.
1010
#define MICROPY_HW_ENABLE_UART_REPL (1)
11-
12-
#define USB_SERIAL_JTAG_PACKET_SZ_BYTES (64)

ports/esp32/usb_serial_jtag.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,13 @@
3535
#include "soc/periph_defs.h"
3636
#include "freertos/portmacro.h"
3737

38-
#define USB_SERIAL_JTAG_BUF_SIZE (64)
38+
// Number of bytes in the input buffer, and number of bytes for output chunking.
39+
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 3, 0)
40+
#define USB_SERIAL_JTAG_PACKET_SZ_BYTES (64)
41+
#endif
3942

4043
static DRAM_ATTR portMUX_TYPE rx_mux = portMUX_INITIALIZER_UNLOCKED;
41-
static uint8_t rx_buf[USB_SERIAL_JTAG_BUF_SIZE];
44+
static uint8_t rx_buf[USB_SERIAL_JTAG_PACKET_SZ_BYTES];
4245
static volatile bool terminal_connected = false;
4346

4447
static void usb_serial_jtag_handle_rx(void) {
@@ -48,8 +51,8 @@ static void usb_serial_jtag_handle_rx(void) {
4851
portENTER_CRITICAL(&rx_mux);
4952
}
5053
size_t req_len = ringbuf_free(&stdin_ringbuf);
51-
if (req_len > USB_SERIAL_JTAG_BUF_SIZE) {
52-
req_len = USB_SERIAL_JTAG_BUF_SIZE;
54+
if (req_len > USB_SERIAL_JTAG_PACKET_SZ_BYTES) {
55+
req_len = USB_SERIAL_JTAG_PACKET_SZ_BYTES;
5356
}
5457
size_t len = usb_serial_jtag_ll_read_rxfifo(rx_buf, req_len);
5558
for (size_t i = 0; i < len; ++i) {
@@ -95,10 +98,6 @@ void usb_serial_jtag_poll_rx(void) {
9598
}
9699
}
97100

98-
#ifndef USB_SERIAL_JTAG_PACKET_SZ_BYTES
99-
#define USB_SERIAL_JTAG_PACKET_SZ_BYTES USB_SERIAL_JTAG_RDWR_BYTE_S
100-
#endif
101-
102101
void usb_serial_jtag_tx_strn(const char *str, size_t len) {
103102
while (len) {
104103
size_t l = len;

0 commit comments

Comments
 (0)