Skip to content

Instantly share code, notes, and snippets.

@mkellner
Created February 5, 2024 00:45
Show Gist options
  • Save mkellner/993ab3febf4f7dd951e3ba9473d88f76 to your computer and use it in GitHub Desktop.
Save mkellner/993ab3febf4f7dd951e3ba9473d88f76 to your computer and use it in GitHub Desktop.
1299.patch
diff --git a/build/devices/esp32/xsProj-esp32s3/main/main.c b/build/devices/esp32/xsProj-esp32s3/main/main.c
index de55f62af..034ecc455 100644
--- a/build/devices/esp32/xsProj-esp32s3/main/main.c
+++ b/build/devices/esp32/xsProj-esp32s3/main/main.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016-2023 Moddable Tech, Inc.
+ * Copyright (c) 2016-2024 Moddable Tech, Inc.
*
* This file is part of the Moddable SDK Runtime.
*
@@ -69,6 +69,7 @@
#include "tusb_cdc_acm.h"
#elif (USE_USB == 2)
#include "driver/usb_serial_jtag.h"
+ #include "hal/usb_serial_jtag_ll.h"
#endif
#else
#include "driver/uart.h"
@@ -196,7 +197,7 @@ printf("fifo_init - bad size: %ld\r\n", size);
static void debug_task(void *pvParameter)
{
#if (USE_USB == 2)
- const usb_serial_jtag_driver_config_t cfg = { .rx_buffer_size = 4096, .tx_buffer_size = 2048 };
+ const usb_serial_jtag_driver_config_t cfg = { .rx_buffer_size = 2048, .tx_buffer_size = 64 };
usb_serial_jtag_driver_install(&cfg);
#endif
@@ -405,11 +406,11 @@ uint8_t ESP_setBaud(int baud) {
WEAK void ESP_put(uint8_t *c, int count) {
#if (USE_USB == 2)
- int sent = 0;
- while (count > 0) {
- sent = usb_serial_jtag_write_bytes(c, count, 10);
- c += sent;
- count -= sent;
+ while (count-- > 0) {
+ while (0 == usb_serial_jtag_ll_write_txfifo(c, 1))
+ ;
+ usb_serial_jtag_ll_txfifo_flush();
+ c++;
}
#else
uart_write_bytes(USE_UART, (char *)c, count);
@@ -417,9 +418,11 @@ WEAK void ESP_put(uint8_t *c, int count) {
}
WEAK void ESP_putc(int c) {
- char cx = c;
+ uint8_t cx = c;
#if (USE_USB == 2)
- usb_serial_jtag_write_bytes(&cx, 1, 1);
+ while (usb_serial_jtag_ll_write_txfifo(&cx, 1) < 1)
+ ;
+ usb_serial_jtag_ll_txfifo_flush();
#else
uart_write_bytes(USE_UART, &cx, 1);
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment