Commit d6cd95d3 authored by Jonathan Currier's avatar Jonathan Currier

Add windowing support. this gets us up to ~8KiB/s tranfers speeds!

parent 5717baed
......@@ -100,7 +100,27 @@ static inline int handle_pkt_S(struct mini_kerm_sm *sm, uint8_t * buffer)
/* Error out on non standard ops. this makes the parsing MUCH easier */
if (sm->line_opts.QCTL != '#')
return -1;
return 0;
static uint8_t resp[] =
"\x01\0\0Y\0 1 \0\0";
static const size_t resp_size = sizeof(resp);
resp[1] = tochar(resp_size - 2);
resp[2] = buffer[2];
resp[4] = tochar(94);
/* capps */
resp[13] = tochar(2);
/* window size
* we allow two inback packets at a time*/
resp[14] = tochar(4);
/* Adding extended packet length migh be good as well, but it requires changes
* to both checksuming, and packet length detect, where as windowing only require
* advertising support.*/
/* Again, note that this stomps the 'null' terminator, because this is not a c-string */
resp[resp_size - 1] = gen_ori_check(resp);
size_t i = 0;
sendbyte(-1, '\n');
for (i = 0; i < resp_size; i++)
sendbyte(-1, resp[i]);
sendbyte(-1, '\n');
}
/* The 'F' packet is a no-op.
......@@ -183,7 +203,6 @@ static inline int handle_pkt_D(struct mini_kerm_sm *sm, uint8_t * buffer)
}
bool kermit_valid_packet(uint8_t *buffer, size_t len);
//static int kermit_get_file(struct mini_kerm_sm *sm, uint8_t *buffer, size_t buffer_index)
static int kermit_get_file(struct mini_kerm_sm *sm, uint8_t mark)
{
/*
......@@ -193,17 +212,11 @@ static int kermit_get_file(struct mini_kerm_sm *sm, uint8_t mark)
* 1 = the handler took care of any needed resonse
*/
int success = -1;
#if 0
bool have_whole_pkt = kermit_valid_packet(buffer, buffer_index);
if (have_whole_pkt)
goto whole_pkt_start;
#else
uint8_t *buffer = sm->pkt_buffer;
size_t buffer_index = 0;
bool have_whole_pkt = false;
if (mark == 1)
buffer[buffer_index++] = mark;
#endif
while (true)
{
......@@ -225,11 +238,6 @@ static int kermit_get_file(struct mini_kerm_sm *sm, uint8_t mark)
if (!check_pkt(buffer))
buffer[3] = 0;
#if 0
whole_pkt_start:
printf("found packet len/seq/type %02x/%02x/%c\n",
unchar(buffer[1]), unchar(buffer[2]), buffer[3]);
#endif
switch (buffer[3]) {
case 'S':
......@@ -369,7 +377,6 @@ int kermit_maybe(uint8_t mark)
if (mark != 1)
return -1;
struct mini_kerm_sm *sm = init_kermit_sm();
//printf("Placing output buffer @0x%p\n", sm->outbuffer_base);
/* boot should'nt return */
if (!kermit_get_file(sm, mark))
boot(0, 0, 0, sm->outbuffer_base);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment