aboutsummaryrefslogtreecommitdiff
path: root/fw/protocol.h
diff options
context:
space:
mode:
authorjaseg <git@jaseg.net>2019-01-12 12:31:59 +0900
committerjaseg <git@jaseg.net>2019-01-12 12:54:29 +0900
commit43f64f0e1fad6e3586cdd5b6f0243f03db9adc23 (patch)
treeb2dc5c38e5b60230970b2e50e06de974b4b702fd /fw/protocol.h
parentc6547c6e6fa381a7811d0c47603291d82be7e440 (diff)
download8seg-43f64f0e1fad6e3586cdd5b6f0243f03db9adc23.tar.gz
8seg-43f64f0e1fad6e3586cdd5b6f0243f03db9adc23.tar.bz2
8seg-43f64f0e1fad6e3586cdd5b6f0243f03db9adc23.zip
Split receiver into logical parts
Diffstat (limited to 'fw/protocol.h')
-rw-r--r--fw/protocol.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/fw/protocol.h b/fw/protocol.h
new file mode 100644
index 0000000..508cfdd
--- /dev/null
+++ b/fw/protocol.h
@@ -0,0 +1,28 @@
+#ifndef __PROTOCOL_H__
+#define __PROTOCOL_H__
+
+#include "global.h"
+
+#define PKT_TYPE_BULK_FLAG 0x80
+
+struct proto_rx_st {
+ int packet_type;
+ int is_bulk;
+ int rxpos;
+ int address;
+ uint8_t argbuf[8];
+ int offset;
+ struct command_if_def *cmd_if;
+};
+
+struct command_if_def {
+ int packet_type_max;
+ int payload_len[0];
+};
+
+/* Callback */
+void handle_command(int command, uint8_t *args);
+
+void receive_symbol(struct proto_rx_st *st, int symbol);
+
+#endif