|
@ -51,48 +51,6 @@ static int do_sr2(cmd_tbl_t s, int argc, char *argv[]) |
|
|
|
|
|
|
|
|
CON_CMD(sr2, 2, "read stmpe811 register 2", do_sr2); |
|
|
CON_CMD(sr2, 2, "read stmpe811 register 2", do_sr2); |
|
|
|
|
|
|
|
|
struct fileinfo { |
|
|
|
|
|
char name[256]; |
|
|
|
|
|
unsigned int total; |
|
|
|
|
|
unsigned int received; |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
static int __on_info(void *user, const char *file, unsigned int _size) |
|
|
|
|
|
{ |
|
|
|
|
|
struct fileinfo *fi = user; |
|
|
|
|
|
|
|
|
|
|
|
snprintf(fi->name, sizeof fi->name - 1, "%s", file); |
|
|
|
|
|
fi->total = _size; |
|
|
|
|
|
fi->received = 0; |
|
|
|
|
|
return 0; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static int __on_data(void *user, const void *ptr, unsigned int len) |
|
|
|
|
|
{ |
|
|
|
|
|
struct fileinfo *fi = user; |
|
|
|
|
|
|
|
|
|
|
|
memcpy((void *)(0xd0000000 + fi->received), ptr, len); |
|
|
|
|
|
|
|
|
|
|
|
iis_send_blocking(&i2s0, ptr, len); |
|
|
|
|
|
|
|
|
|
|
|
fi->received += len; |
|
|
|
|
|
return 0; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static int do_ymodem_recv(cmd_tbl_t s, int argc, char *argv[]) |
|
|
|
|
|
{ |
|
|
|
|
|
struct fileinfo fi; |
|
|
|
|
|
|
|
|
|
|
|
memset(&fi, 0, sizeof fi); |
|
|
|
|
|
|
|
|
|
|
|
serial_ymodem_recv(&serial0, &fi, __on_info, __on_data); |
|
|
|
|
|
|
|
|
|
|
|
printf("name: %s, size: %d, recv: %d\r\n", fi.name, fi.total, fi.received); |
|
|
|
|
|
return 0; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
CON_CMD(rx, 1, "recv from ymodem", do_ymodem_recv); |
|
|
|
|
|
|
|
|
|
|
|
static int do_play(cmd_tbl_t s, int argc, char *argv[]) |
|
|
static int do_play(cmd_tbl_t s, int argc, char *argv[]) |
|
|
{ |
|
|
{ |
|
|
volatile uint8_t *addr = (volatile uint8_t *)0xd0000000; |
|
|
volatile uint8_t *addr = (volatile uint8_t *)0xd0000000; |
|
|