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
4043static 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 ];
4245static volatile bool terminal_connected = false;
4346
4447static 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-
102101void usb_serial_jtag_tx_strn (const char * str , size_t len ) {
103102 while (len ) {
104103 size_t l = len ;
0 commit comments