aboutsummaryrefslogtreecommitdiff
path: root/projects/cli-test/cli-test.c
diff options
context:
space:
mode:
authorFredrik Thulin <fredrik@thulin.net>2016-05-17 09:50:38 +0200
committerFredrik Thulin <fredrik@thulin.net>2016-05-18 14:12:03 +0200
commit18b11939bf24b2f75ea54eb93d7d29273262c476 (patch)
treece6d47c7e8e2320efab3862aee22e8b5d363e73e /projects/cli-test/cli-test.c
parent3b044e50d3295c04863bdb0587a6eef157e654b8 (diff)
Write in 4k-chunks, with acks for flow control.
Diffstat (limited to 'projects/cli-test/cli-test.c')
-rw-r--r--projects/cli-test/cli-test.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/projects/cli-test/cli-test.c b/projects/cli-test/cli-test.c
index 0b54e7e..5d33b27 100644
--- a/projects/cli-test/cli-test.c
+++ b/projects/cli-test/cli-test.c
@@ -49,10 +49,10 @@ extern uint32_t update_crc(uint32_t crc, uint8_t *buf, int len);
int cmd_filetransfer(struct cli_def *cli, const char *command, char *argv[], int argc)
{
- uint32_t filesize = 0, crc = 0, my_crc = 0, n = 4;
- uint8_t buf[4];
+ uint32_t filesize = 0, crc = 0, my_crc = 0, n = 4096, counter = 0;
+ uint8_t buf[4096];
- cli_print(cli, "OK, write file size (4 bytes), data, CRC-32 (4 bytes)");
+ cli_print(cli, "OK, write file size (4 bytes), data in 4096 byte chunks, CRC-32 (4 bytes)");
uart_receive_bytes(STM_UART_MGMT, (void *) &filesize, 4, 1000);
cli_print(cli, "Filesize %li", filesize);
@@ -65,6 +65,8 @@ int cmd_filetransfer(struct cli_def *cli, const char *command, char *argv[], int
uart_receive_bytes(STM_UART_MGMT, (void *) &buf, n, 1000);
filesize -= n;
my_crc = update_crc(my_crc, buf, n);
+ counter++;
+ uart_send_bytes(STM_UART_MGMT, (void *) &counter, 4);
}
uart_receive_bytes(STM_UART_MGMT, (void *) &crc, 4, 1000);