Merge pull request #2288 from openmv/usbdbg_state

msic: Update GET_STATE command.
This commit is contained in:
Ibrahim Abdelkader 2024-07-16 21:37:24 +02:00 committed by GitHub
commit b94e8528f1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 10 additions and 6 deletions

View File

@ -38,6 +38,7 @@
// Debugging configuration.
#define OMV_TUSBDBG_ENABLE (1)
#define OMV_TUSBDBG_PACKET (64)
#define OMV_TUSBDBG_BUFFER (512)
// UMM heap block size
#define OMV_UMM_BLOCK_SIZE 16

View File

@ -37,6 +37,7 @@ extern unsigned char *OMV_BOARD_UID_ADDR; // Unique address.
// Debugging configuration.
#define OMV_TUSBDBG_ENABLE (1)
#define OMV_TUSBDBG_PACKET (64)
#define OMV_TUSBDBG_BUFFER (2048)
// UMM heap block size
#define OMV_UMM_BLOCK_SIZE 16

View File

@ -56,6 +56,7 @@
// Debugging configuration.
#define OMV_TUSBDBG_ENABLE (1)
#define OMV_TUSBDBG_PACKET (512)
#define OMV_TUSBDBG_BUFFER (2048)
// UMM heap block size
#define OMV_UMM_BLOCK_SIZE 256
@ -89,7 +90,7 @@
#define OMV_GC_BLOCK0_MEMORY OCRM2 // Extra GC block 0.
#define OMV_GC_BLOCK0_SIZE (26K)
#define OMV_GC_BLOCK1_MEMORY DTCM // Main GC block
#define OMV_GC_BLOCK1_SIZE (293K)
#define OMV_GC_BLOCK1_SIZE (290K)
#define OMV_GC_BLOCK2_MEMORY DRAM // Extra GC block 1.
#define OMV_GC_BLOCK2_SIZE (8M)
#define OMV_RAMFUNC_MEMORY ITCM2 // RAM code memory.

View File

@ -34,7 +34,7 @@ typedef struct __attribute__((packed)) {
}
usbdbg_cmd_t;
static uint8_t debug_ringbuf_array[512];
static uint8_t debug_ringbuf_array[OMV_TUSBDBG_BUFFER];
static volatile bool tinyusb_debug_mode = false;
ringbuf_t debug_ringbuf = { debug_ringbuf_array, sizeof(debug_ringbuf_array) };

View File

@ -226,9 +226,10 @@ void usbdbg_data_in(void *buffer, int length) {
// The rest of this packet is packed with text buffer.
if (tx_buf_len) {
tx_buf_len = OMV_MIN(tx_buf_len, (40 - 1));
usb_cdc_get_buf((uint8_t *) buffer + 24, tx_buf_len);
((uint8_t *) buffer)[24 + tx_buf_len] = 0; // Null-terminate
const uint32_t hdr = 16;
tx_buf_len = OMV_MIN(tx_buf_len, (64 - hdr - 1));
usb_cdc_get_buf((uint8_t *) buffer + hdr, tx_buf_len);
((uint8_t *) buffer)[hdr + tx_buf_len] = 0; // Null-terminate
}
cmd = USBDBG_NONE;

View File

@ -77,7 +77,7 @@ def fb_size():
def read_state():
__serial.write(struct.pack("<BBI", __USBDBG_CMD, __USBDBG_GET_STATE, 64))
flags, w, h, size, res0, res1, text_buf = struct.unpack("IIIIII40s", __serial.read(64))
flags, w, h, size, text_buf = struct.unpack("IIII48s", __serial.read(64))
text = None
if flags & __USBDBG_STATE_FLAGS_TEXT: