fw: Minimal CDC implementation of new framing protocol

Throwing away mode and length from incoming data. Adding mode and
length to outgoing data.

Splitting responses into frames small enough for the USB<->UART
transceiver to handle.
This commit is contained in:
Mikael Ågren 2024-09-16 14:26:12 +02:00
parent 1b9bbc4eba
commit a0c031eb25
No known key found for this signature in database
GPG key ID: E02DA3D397792C46
3 changed files with 60 additions and 13 deletions

View file

@ -420,6 +420,9 @@ int main(void)
/*@+mustfreeonly@*/
ctx.use_uss = FALSE;
uint8_t mode = 0;
uint8_t mode_bytes_left = 0;
scramble_ram();
#if defined(SIMULATION)
@ -429,7 +432,8 @@ int main(void)
for (;;) {
switch (state) {
case FW_STATE_INITIAL:
if (readcommand(&hdr, cmd, state) == -1) {
if (readcommand(&hdr, cmd, state, &mode,
&mode_bytes_left) == -1) {
state = FW_STATE_FAIL;
break;
}
@ -438,7 +442,8 @@ int main(void)
break;
case FW_STATE_LOADING:
if (readcommand(&hdr, cmd, state) == -1) {
if (readcommand(&hdr, cmd, state, &mode,
&mode_bytes_left) == -1) {
state = FW_STATE_FAIL;
break;
}