aboutsummaryrefslogtreecommitdiff
path: root/fw/8b10b.h
diff options
context:
space:
mode:
authorjaseg <git@jaseg.net>2018-12-20 18:54:41 +0900
committerjaseg <git@jaseg.net>2018-12-20 18:54:41 +0900
commit90038f4378b7cdbe98e32ed1e5e3055dbe4776f2 (patch)
tree3982be300f99a7eabd1d6a5c9be973822bac3044 /fw/8b10b.h
parent111b7a6bf37a271125f453bd2904cd72fd8f5b38 (diff)
download8seg-90038f4378b7cdbe98e32ed1e5e3055dbe4776f2.tar.gz
8seg-90038f4378b7cdbe98e32ed1e5e3055dbe4776f2.tar.bz2
8seg-90038f4378b7cdbe98e32ed1e5e3055dbe4776f2.zip
Add initial center firmware
Diffstat (limited to 'fw/8b10b.h')
-rw-r--r--fw/8b10b.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/fw/8b10b.h b/fw/8b10b.h
new file mode 100644
index 0000000..84763b1
--- /dev/null
+++ b/fw/8b10b.h
@@ -0,0 +1,38 @@
+#ifndef __8B10B_H__
+#define __8B10B_H__
+
+#include <stdint.h>
+#include <stdbool.h>
+
+enum k_code {
+ K28_0=1, K28_1, K28_2, K28_3,
+ K28_4, K28_5, K28_6, K28_7,
+ K23_7, K27_7, K29_7, K30_7,
+ K_CODES_LAST
+};
+
+enum decoder_return_codes {
+ _K_CODES_LAST = K_CODES_LAST,
+ DECODING_ERROR,
+ DECODING_IN_PROGRESS
+};
+
+struct entry_3b4b {
+ uint8_t rd_neg, rd_pos;
+};
+
+struct entry_5b6b {
+ uint8_t rd_neg, rd_pos;
+};
+
+struct state_8b10b {
+ uint32_t rx;
+ int bit_ctr;
+};
+
+
+void xfr_8b10b_reset(struct state_8b10b *st);
+int xfr_8b10b_feed_bit(struct state_8b10b *st, int bit);
+bool xfr_8b10b_has_sync(struct state_8b10b *st);
+
+#endif