mirror of
https://github.com/openmv/openmv.git
synced 2025-11-04 14:49:50 +08:00
Merge pull request #2288 from openmv/usbdbg_state
msic: Update GET_STATE command.
This commit is contained in:
commit
b94e8528f1
@ -38,6 +38,7 @@
|
|||||||
// Debugging configuration.
|
// Debugging configuration.
|
||||||
#define OMV_TUSBDBG_ENABLE (1)
|
#define OMV_TUSBDBG_ENABLE (1)
|
||||||
#define OMV_TUSBDBG_PACKET (64)
|
#define OMV_TUSBDBG_PACKET (64)
|
||||||
|
#define OMV_TUSBDBG_BUFFER (512)
|
||||||
|
|
||||||
// UMM heap block size
|
// UMM heap block size
|
||||||
#define OMV_UMM_BLOCK_SIZE 16
|
#define OMV_UMM_BLOCK_SIZE 16
|
||||||
|
|||||||
@ -37,6 +37,7 @@ extern unsigned char *OMV_BOARD_UID_ADDR; // Unique address.
|
|||||||
// Debugging configuration.
|
// Debugging configuration.
|
||||||
#define OMV_TUSBDBG_ENABLE (1)
|
#define OMV_TUSBDBG_ENABLE (1)
|
||||||
#define OMV_TUSBDBG_PACKET (64)
|
#define OMV_TUSBDBG_PACKET (64)
|
||||||
|
#define OMV_TUSBDBG_BUFFER (2048)
|
||||||
|
|
||||||
// UMM heap block size
|
// UMM heap block size
|
||||||
#define OMV_UMM_BLOCK_SIZE 16
|
#define OMV_UMM_BLOCK_SIZE 16
|
||||||
|
|||||||
@ -56,6 +56,7 @@
|
|||||||
// Debugging configuration.
|
// Debugging configuration.
|
||||||
#define OMV_TUSBDBG_ENABLE (1)
|
#define OMV_TUSBDBG_ENABLE (1)
|
||||||
#define OMV_TUSBDBG_PACKET (512)
|
#define OMV_TUSBDBG_PACKET (512)
|
||||||
|
#define OMV_TUSBDBG_BUFFER (2048)
|
||||||
|
|
||||||
// UMM heap block size
|
// UMM heap block size
|
||||||
#define OMV_UMM_BLOCK_SIZE 256
|
#define OMV_UMM_BLOCK_SIZE 256
|
||||||
@ -89,7 +90,7 @@
|
|||||||
#define OMV_GC_BLOCK0_MEMORY OCRM2 // Extra GC block 0.
|
#define OMV_GC_BLOCK0_MEMORY OCRM2 // Extra GC block 0.
|
||||||
#define OMV_GC_BLOCK0_SIZE (26K)
|
#define OMV_GC_BLOCK0_SIZE (26K)
|
||||||
#define OMV_GC_BLOCK1_MEMORY DTCM // Main GC block
|
#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_MEMORY DRAM // Extra GC block 1.
|
||||||
#define OMV_GC_BLOCK2_SIZE (8M)
|
#define OMV_GC_BLOCK2_SIZE (8M)
|
||||||
#define OMV_RAMFUNC_MEMORY ITCM2 // RAM code memory.
|
#define OMV_RAMFUNC_MEMORY ITCM2 // RAM code memory.
|
||||||
|
|||||||
@ -34,7 +34,7 @@ typedef struct __attribute__((packed)) {
|
|||||||
}
|
}
|
||||||
usbdbg_cmd_t;
|
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;
|
static volatile bool tinyusb_debug_mode = false;
|
||||||
ringbuf_t debug_ringbuf = { debug_ringbuf_array, sizeof(debug_ringbuf_array) };
|
ringbuf_t debug_ringbuf = { debug_ringbuf_array, sizeof(debug_ringbuf_array) };
|
||||||
|
|
||||||
|
|||||||
@ -226,9 +226,10 @@ void usbdbg_data_in(void *buffer, int length) {
|
|||||||
|
|
||||||
// The rest of this packet is packed with text buffer.
|
// The rest of this packet is packed with text buffer.
|
||||||
if (tx_buf_len) {
|
if (tx_buf_len) {
|
||||||
tx_buf_len = OMV_MIN(tx_buf_len, (40 - 1));
|
const uint32_t hdr = 16;
|
||||||
usb_cdc_get_buf((uint8_t *) buffer + 24, tx_buf_len);
|
tx_buf_len = OMV_MIN(tx_buf_len, (64 - hdr - 1));
|
||||||
((uint8_t *) buffer)[24 + tx_buf_len] = 0; // Null-terminate
|
usb_cdc_get_buf((uint8_t *) buffer + hdr, tx_buf_len);
|
||||||
|
((uint8_t *) buffer)[hdr + tx_buf_len] = 0; // Null-terminate
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd = USBDBG_NONE;
|
cmd = USBDBG_NONE;
|
||||||
|
|||||||
@ -77,7 +77,7 @@ def fb_size():
|
|||||||
|
|
||||||
def read_state():
|
def read_state():
|
||||||
__serial.write(struct.pack("<BBI", __USBDBG_CMD, __USBDBG_GET_STATE, 64))
|
__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
|
text = None
|
||||||
if flags & __USBDBG_STATE_FLAGS_TEXT:
|
if flags & __USBDBG_STATE_FLAGS_TEXT:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user