From 62389e00fed49b7b89f465c9cd6bb586502331be Mon Sep 17 00:00:00 2001 From: jaseg Date: Sun, 23 Dec 2018 12:57:40 +0900 Subject: ADC working --- common/8b10b_test_encode.c | 108 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 common/8b10b_test_encode.c (limited to 'common/8b10b_test_encode.c') diff --git a/common/8b10b_test_encode.c b/common/8b10b_test_encode.c new file mode 100644 index 0000000..2ba75d9 --- /dev/null +++ b/common/8b10b_test_encode.c @@ -0,0 +1,108 @@ + +#include +#include + +#include "8b10b.h" + +static const char * const rc_names[] = { + [K28_0] = "K.28.0", + [K28_1] = "K.28.1", + [K28_2] = "K.28.2", + [K28_3] = "K.28.3", + [K28_4] = "K.28.4", + [K28_5] = "K.28.5", + [K28_6] = "K.28.6", + [K28_7] = "K.28.7", + [K23_7] = "K.23.7", + [K27_7] = "K.27.7", + [K29_7] = "K.29.7", + [K30_7] = "K.30.7", +}; + +int hex_to_uint(const char *s, size_t len) { + if (len > 7) + return -2; + + int acc = 0; + for (int i=0; i