Add ARCH_STR command.

This commit is contained in:
iabdalkader 2016-08-14 15:12:43 +02:00
parent 381d20b697
commit 6d6ad783b7
3 changed files with 20 additions and 0 deletions

View File

@ -17,6 +17,7 @@
#include "parse.h"
#include "compile.h"
#include "runtime.h"
#include "omv_boardconfig.h"
static int xfer_bytes;
static int xfer_length;
@ -118,6 +119,14 @@ void usbdbg_data_in(void *buffer, int length)
}
break;
case USBDBG_ARCH_STR: {
int len = IM_MIN(64, (strlen(OMV_ARCH_STR)+1));
((char *)buffer)[len-1] = 0;
memcpy(buffer, OMV_ARCH_STR, len);
cmd = USBDBG_NONE;
break;
}
case USBDBG_SCRIPT_RUNNING: {
uint32_t *buf = buffer;
buf[0] = (uint32_t) script_running;
@ -221,6 +230,11 @@ void usbdbg_control(void *buffer, uint8_t request, uint32_t length)
xfer_length = length;
break;
case USBDBG_ARCH_STR:
xfer_bytes = 0;
xfer_length = length;
break;
case USBDBG_SCRIPT_EXEC:
xfer_bytes = 0;
xfer_length =length;

View File

@ -34,6 +34,7 @@ enum usbdbg_cmd {
USBDBG_FW_VERSION =0x80,
USBDBG_FRAME_SIZE =0x81,
USBDBG_FRAME_DUMP =0x82,
USBDBG_ARCH_STR =0x83,
USBDBG_SCRIPT_EXEC =0x05,
USBDBG_SCRIPT_STOP =0x06,
USBDBG_SCRIPT_SAVE =0x07,

View File

@ -20,6 +20,7 @@ __USBDBG_CMD = 48
__USBDBG_FW_VERSION = 0x80
__USBDBG_FRAME_SIZE = 0x81
__USBDBG_FRAME_DUMP = 0x82
__USBDBG_ARCH_STR = 0x83
__USBDBG_SCRIPT_EXEC = 0x05
__USBDBG_SCRIPT_STOP = 0x06
__USBDBG_SCRIPT_SAVE = 0x07
@ -161,6 +162,10 @@ def fw_version():
def enable_fb(enable):
__serial.write(struct.pack("<BBIH", __USBDBG_CMD, __USBDBG_FB_ENABLE, 0, enable))
def arch_str():
__serial.write(struct.pack("<BBI", __USBDBG_CMD, __USBDBG_ARCH_STR, 64))
return __serial.read(64).split('\0', 1)[0]
if __name__ == '__main__':
if len(sys.argv)!= 2:
print ('usage: openmv.py <script>')