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 committed by Michael Cardell Widerkrantz
parent 1b9bbc4eba
commit 2ec36baaf4
No known key found for this signature in database
GPG key ID: D3DB3DDF57E704E5
3 changed files with 59 additions and 13 deletions

View file

@ -8,6 +8,11 @@
#ifndef PROTO_H
#define PROTO_H
enum mode {
MODE_CDC = 0x40,
MODE_HID = 0x80,
};
enum endpoints {
DST_HW_IFPGA,
DST_HW_AFPGA,
@ -52,7 +57,8 @@ struct frame_header {
/*@ -exportlocal @*/
void writebyte(uint8_t b);
uint8_t readbyte(void);
uint8_t readbyte(uint8_t *mode, uint8_t *mode_bytes_left);
void fwreply(struct frame_header hdr, enum fwcmd rspcode, uint8_t *buf);
int readcommand(struct frame_header *hdr, uint8_t *cmd, int state);
int readcommand(struct frame_header *hdr, uint8_t *cmd, int state,
uint8_t *mode, uint8_t *mode_bytes_left);
#endif