aboutsummaryrefslogtreecommitdiff
path: root/common/8b10b.pp
diff options
context:
space:
mode:
authorjaseg <git@jaseg.net>2018-12-23 12:57:40 +0900
committerjaseg <git@jaseg.net>2018-12-23 12:57:40 +0900
commit62389e00fed49b7b89f465c9cd6bb586502331be (patch)
treee38348acaef07b595459057422ee6d92f8cea9c8 /common/8b10b.pp
parent468fe59d9747078830dd489668b8c8ee8520b4a5 (diff)
download8seg-62389e00fed49b7b89f465c9cd6bb586502331be.tar.gz
8seg-62389e00fed49b7b89f465c9cd6bb586502331be.tar.bz2
8seg-62389e00fed49b7b89f465c9cd6bb586502331be.zip
ADC working
Diffstat (limited to 'common/8b10b.pp')
-rw-r--r--common/8b10b.pp1549
1 files changed, 1549 insertions, 0 deletions
diff --git a/common/8b10b.pp b/common/8b10b.pp
new file mode 100644
index 0000000..a111fdd
--- /dev/null
+++ b/common/8b10b.pp
@@ -0,0 +1,1549 @@
+# 1 "../common/8b10b.c"
+# 1 "/home/user/toys/led_tape_display/driver_fw//"
+# 1 "<built-in>"
+# 1 "<command-line>"
+# 1 "../common/8b10b.c"
+
+# 1 "/usr/arm-none-eabi/include/assert.h" 1 3
+# 9 "/usr/arm-none-eabi/include/assert.h" 3
+# 1 "/usr/arm-none-eabi/include/_ansi.h" 1 3
+# 15 "/usr/arm-none-eabi/include/_ansi.h" 3
+# 1 "/usr/arm-none-eabi/include/newlib.h" 1 3
+# 14 "/usr/arm-none-eabi/include/newlib.h" 3
+# 1 "/usr/arm-none-eabi/include/_newlib_version.h" 1 3
+# 15 "/usr/arm-none-eabi/include/newlib.h" 2 3
+# 16 "/usr/arm-none-eabi/include/_ansi.h" 2 3
+# 1 "/usr/arm-none-eabi/include/sys/config.h" 1 3
+
+
+
+# 1 "/usr/arm-none-eabi/include/machine/ieeefp.h" 1 3
+# 5 "/usr/arm-none-eabi/include/sys/config.h" 2 3
+# 1 "/usr/arm-none-eabi/include/sys/features.h" 1 3
+# 6 "/usr/arm-none-eabi/include/sys/config.h" 2 3
+# 17 "/usr/arm-none-eabi/include/_ansi.h" 2 3
+# 10 "/usr/arm-none-eabi/include/assert.h" 2 3
+# 39 "/usr/arm-none-eabi/include/assert.h" 3
+
+# 39 "/usr/arm-none-eabi/include/assert.h" 3
+void __assert (const char *, int, const char *) __attribute__ ((__noreturn__))
+ ;
+void __assert_func (const char *, int, const char *, const char *) __attribute__ ((__noreturn__))
+ ;
+# 3 "../common/8b10b.c" 2
+# 1 "/usr/arm-none-eabi/include/stdio.h" 1 3
+# 35 "/usr/arm-none-eabi/include/stdio.h" 3
+# 1 "/usr/arm-none-eabi/include/sys/cdefs.h" 1 3
+# 43 "/usr/arm-none-eabi/include/sys/cdefs.h" 3
+# 1 "/usr/arm-none-eabi/include/machine/_default_types.h" 1 3
+# 41 "/usr/arm-none-eabi/include/machine/_default_types.h" 3
+typedef signed char __int8_t;
+
+typedef unsigned char __uint8_t;
+# 55 "/usr/arm-none-eabi/include/machine/_default_types.h" 3
+typedef short int __int16_t;
+
+typedef short unsigned int __uint16_t;
+# 77 "/usr/arm-none-eabi/include/machine/_default_types.h" 3
+typedef long int __int32_t;
+
+typedef long unsigned int __uint32_t;
+# 103 "/usr/arm-none-eabi/include/machine/_default_types.h" 3
+typedef long long int __int64_t;
+
+typedef long long unsigned int __uint64_t;
+# 134 "/usr/arm-none-eabi/include/machine/_default_types.h" 3
+typedef signed char __int_least8_t;
+
+typedef unsigned char __uint_least8_t;
+# 160 "/usr/arm-none-eabi/include/machine/_default_types.h" 3
+typedef short int __int_least16_t;
+
+typedef short unsigned int __uint_least16_t;
+# 182 "/usr/arm-none-eabi/include/machine/_default_types.h" 3
+typedef long int __int_least32_t;
+
+typedef long unsigned int __uint_least32_t;
+# 200 "/usr/arm-none-eabi/include/machine/_default_types.h" 3
+typedef long long int __int_least64_t;
+
+typedef long long unsigned int __uint_least64_t;
+# 214 "/usr/arm-none-eabi/include/machine/_default_types.h" 3
+typedef long long int __intmax_t;
+
+
+
+
+
+
+
+typedef long long unsigned int __uintmax_t;
+
+
+
+
+
+
+
+typedef int __intptr_t;
+
+typedef unsigned int __uintptr_t;
+# 44 "/usr/arm-none-eabi/include/sys/cdefs.h" 2 3
+
+# 1 "/usr/lib/gcc/arm-none-eabi/7.1.0/include/stddef.h" 1 3 4
+# 216 "/usr/lib/gcc/arm-none-eabi/7.1.0/include/stddef.h" 3 4
+typedef unsigned int size_t;
+# 46 "/usr/arm-none-eabi/include/sys/cdefs.h" 2 3
+# 36 "/usr/arm-none-eabi/include/stdio.h" 2 3
+# 1 "/usr/lib/gcc/arm-none-eabi/7.1.0/include/stddef.h" 1 3 4
+# 149 "/usr/lib/gcc/arm-none-eabi/7.1.0/include/stddef.h" 3 4
+typedef int ptrdiff_t;
+# 328 "/usr/lib/gcc/arm-none-eabi/7.1.0/include/stddef.h" 3 4
+typedef unsigned int wchar_t;
+# 426 "/usr/lib/gcc/arm-none-eabi/7.1.0/include/stddef.h" 3 4
+typedef struct {
+ long long __max_align_ll __attribute__((__aligned__(__alignof__(long long))));
+ long double __max_align_ld __attribute__((__aligned__(__alignof__(long double))));
+# 437 "/usr/lib/gcc/arm-none-eabi/7.1.0/include/stddef.h" 3 4
+} max_align_t;
+# 37 "/usr/arm-none-eabi/include/stdio.h" 2 3
+
+
+
+# 1 "/usr/lib/gcc/arm-none-eabi/7.1.0/include/stdarg.h" 1 3 4
+# 40 "/usr/lib/gcc/arm-none-eabi/7.1.0/include/stdarg.h" 3 4
+typedef __builtin_va_list __gnuc_va_list;
+# 41 "/usr/arm-none-eabi/include/stdio.h" 2 3
+
+
+
+
+
+typedef __gnuc_va_list va_list;
+# 60 "/usr/arm-none-eabi/include/stdio.h" 3
+# 1 "/usr/arm-none-eabi/include/sys/reent.h" 1 3
+# 13 "/usr/arm-none-eabi/include/sys/reent.h" 3
+# 1 "/usr/arm-none-eabi/include/_ansi.h" 1 3
+# 14 "/usr/arm-none-eabi/include/sys/reent.h" 2 3
+# 1 "/usr/lib/gcc/arm-none-eabi/7.1.0/include/stddef.h" 1 3 4
+# 15 "/usr/arm-none-eabi/include/sys/reent.h" 2 3
+# 1 "/usr/arm-none-eabi/include/sys/_types.h" 1 3
+# 24 "/usr/arm-none-eabi/include/sys/_types.h" 3
+# 1 "/usr/arm-none-eabi/include/machine/_types.h" 1 3
+# 25 "/usr/arm-none-eabi/include/sys/_types.h" 2 3
+# 1 "/usr/arm-none-eabi/include/sys/lock.h" 1 3
+
+
+
+
+
+typedef int _LOCK_T;
+typedef int _LOCK_RECURSIVE_T;
+# 26 "/usr/arm-none-eabi/include/sys/_types.h" 2 3
+
+
+typedef long __blkcnt_t;
+
+
+
+typedef long __blksize_t;
+
+
+
+typedef __uint64_t __fsblkcnt_t;
+
+
+
+typedef __uint32_t __fsfilcnt_t;
+
+
+
+typedef long _off_t;
+
+
+
+
+
+typedef int __pid_t;
+
+
+
+typedef short __dev_t;
+
+
+
+typedef unsigned short __uid_t;
+
+
+typedef unsigned short __gid_t;
+
+
+
+typedef __uint32_t __id_t;
+
+
+
+
+
+
+
+typedef unsigned short __ino_t;
+# 88 "/usr/arm-none-eabi/include/sys/_types.h" 3
+typedef __uint32_t __mode_t;
+
+
+
+
+
+__extension__ typedef long long _off64_t;
+
+
+
+
+
+typedef _off_t __off_t;
+
+
+typedef _off64_t __loff_t;
+
+
+typedef long __key_t;
+
+
+
+
+
+
+
+typedef long _fpos_t;
+# 129 "/usr/arm-none-eabi/include/sys/_types.h" 3
+typedef unsigned int __size_t;
+# 145 "/usr/arm-none-eabi/include/sys/_types.h" 3
+typedef signed int _ssize_t;
+# 156 "/usr/arm-none-eabi/include/sys/_types.h" 3
+typedef _ssize_t __ssize_t;
+
+
+# 1 "/usr/lib/gcc/arm-none-eabi/7.1.0/include/stddef.h" 1 3 4
+# 357 "/usr/lib/gcc/arm-none-eabi/7.1.0/include/stddef.h" 3 4
+typedef unsigned int wint_t;
+# 160 "/usr/arm-none-eabi/include/sys/_types.h" 2 3
+
+
+
+typedef struct
+{
+ int __count;
+ union
+ {
+ wint_t __wch;
+ unsigned char __wchb[4];
+ } __value;
+} _mbstate_t;
+
+
+
+typedef _LOCK_RECURSIVE_T _flock_t;
+
+
+
+
+typedef void *_iconv_t;
+
+
+
+typedef unsigned long __clock_t;
+
+
+typedef long __time_t;
+
+
+typedef unsigned long __clockid_t;
+
+
+typedef unsigned long __timer_t;
+
+
+typedef __uint8_t __sa_family_t;
+
+
+
+typedef __uint32_t __socklen_t;
+
+
+typedef unsigned short __nlink_t;
+typedef long __suseconds_t;
+typedef unsigned long __useconds_t;
+
+
+typedef __builtin_va_list __va_list;
+# 16 "/usr/arm-none-eabi/include/sys/reent.h" 2 3
+
+
+
+
+
+
+typedef unsigned long __ULong;
+# 38 "/usr/arm-none-eabi/include/sys/reent.h" 3
+struct _reent;
+
+struct __locale_t;
+
+
+
+
+
+
+struct _Bigint
+{
+ struct _Bigint *_next;
+ int _k, _maxwds, _sign, _wds;
+ __ULong _x[1];
+};
+
+
+struct __tm
+{
+ int __tm_sec;
+ int __tm_min;
+ int __tm_hour;
+ int __tm_mday;
+ int __tm_mon;
+ int __tm_year;
+ int __tm_wday;
+ int __tm_yday;
+ int __tm_isdst;
+};
+
+
+
+
+
+
+
+struct _on_exit_args {
+ void * _fnargs[32];
+ void * _dso_handle[32];
+
+ __ULong _fntypes;
+
+
+ __ULong _is_cxa;
+};
+# 93 "/usr/arm-none-eabi/include/sys/reent.h" 3
+struct _atexit {
+ struct _atexit *_next;
+ int _ind;
+
+ void (*_fns[32])(void);
+ struct _on_exit_args _on_exit_args;
+};
+# 117 "/usr/arm-none-eabi/include/sys/reent.h" 3
+struct __sbuf {
+ unsigned char *_base;
+ int _size;
+};
+# 181 "/usr/arm-none-eabi/include/sys/reent.h" 3
+struct __sFILE {
+ unsigned char *_p;
+ int _r;
+ int _w;
+ short _flags;
+ short _file;
+ struct __sbuf _bf;
+ int _lbfsize;
+
+
+
+
+
+
+ void * _cookie;
+
+ int (* _read) (struct _reent *, void *, char *, int)
+ ;
+ int (* _write) (struct _reent *, void *, const char *, int)
+
+ ;
+ _fpos_t (* _seek) (struct _reent *, void *, _fpos_t, int);
+ int (* _close) (struct _reent *, void *);
+
+
+ struct __sbuf _ub;
+ unsigned char *_up;
+ int _ur;
+
+
+ unsigned char _ubuf[3];
+ unsigned char _nbuf[1];
+
+
+ struct __sbuf _lb;
+
+
+ int _blksize;
+ _off_t _offset;
+
+
+ struct _reent *_data;
+
+
+
+ _flock_t _lock;
+
+ _mbstate_t _mbstate;
+ int _flags2;
+};
+# 287 "/usr/arm-none-eabi/include/sys/reent.h" 3
+typedef struct __sFILE __FILE;
+
+
+
+struct _glue
+{
+ struct _glue *_next;
+ int _niobs;
+ __FILE *_iobs;
+};
+# 319 "/usr/arm-none-eabi/include/sys/reent.h" 3
+struct _rand48 {
+ unsigned short _seed[3];
+ unsigned short _mult[3];
+ unsigned short _add;
+
+
+
+
+};
+# 569 "/usr/arm-none-eabi/include/sys/reent.h" 3
+struct _reent
+{
+ int _errno;
+
+
+
+
+ __FILE *_stdin, *_stdout, *_stderr;
+
+ int _inc;
+ char _emergency[25];
+
+
+ int _unspecified_locale_info;
+ struct __locale_t *_locale;
+
+ int __sdidinit;
+
+ void (* __cleanup) (struct _reent *);
+
+
+ struct _Bigint *_result;
+ int _result_k;
+ struct _Bigint *_p5s;
+ struct _Bigint **_freelist;
+
+
+ int _cvtlen;
+ char *_cvtbuf;
+
+ union
+ {
+ struct
+ {
+ unsigned int _unused_rand;
+ char * _strtok_last;
+ char _asctime_buf[26];
+ struct __tm _localtime_buf;
+ int _gamma_signgam;
+ __extension__ unsigned long long _rand_next;
+ struct _rand48 _r48;
+ _mbstate_t _mblen_state;
+ _mbstate_t _mbtowc_state;
+ _mbstate_t _wctomb_state;
+ char _l64a_buf[8];
+ char _signal_buf[24];
+ int _getdate_err;
+ _mbstate_t _mbrlen_state;
+ _mbstate_t _mbrtowc_state;
+ _mbstate_t _mbsrtowcs_state;
+ _mbstate_t _wcrtomb_state;
+ _mbstate_t _wcsrtombs_state;
+ int _h_errno;
+ } _reent;
+
+
+
+ struct
+ {
+
+ unsigned char * _nextf[30];
+ unsigned int _nmalloc[30];
+ } _unused;
+ } _new;
+
+
+
+ struct _atexit *_atexit;
+ struct _atexit _atexit0;
+
+
+
+ void (**(_sig_func))(int);
+
+
+
+
+ struct _glue __sglue;
+ __FILE __sf[3];
+};
+# 766 "/usr/arm-none-eabi/include/sys/reent.h" 3
+extern struct _reent *_impure_ptr ;
+extern struct _reent *const _global_impure_ptr ;
+
+void _reclaim_reent (struct _reent *);
+# 61 "/usr/arm-none-eabi/include/stdio.h" 2 3
+# 1 "/usr/arm-none-eabi/include/sys/types.h" 1 3
+# 28 "/usr/arm-none-eabi/include/sys/types.h" 3
+typedef __uint8_t u_int8_t;
+
+
+typedef __uint16_t u_int16_t;
+
+
+typedef __uint32_t u_int32_t;
+
+
+typedef __uint64_t u_int64_t;
+
+typedef int register_t;
+# 62 "/usr/arm-none-eabi/include/sys/types.h" 3
+# 1 "/usr/lib/gcc/arm-none-eabi/7.1.0/include/stddef.h" 1 3 4
+# 63 "/usr/arm-none-eabi/include/sys/types.h" 2 3
+
+# 1 "/usr/arm-none-eabi/include/sys/_stdint.h" 1 3
+# 20 "/usr/arm-none-eabi/include/sys/_stdint.h" 3
+typedef __int8_t int8_t ;
+
+
+
+typedef __uint8_t uint8_t ;
+
+
+
+
+
+
+
+typedef __int16_t int16_t ;
+
+
+
+typedef __uint16_t uint16_t ;
+
+
+
+
+
+
+
+typedef __int32_t int32_t ;
+
+
+
+typedef __uint32_t uint32_t ;
+
+
+
+
+
+
+
+typedef __int64_t int64_t ;
+
+
+
+typedef __uint64_t uint64_t ;
+
+
+
+
+
+
+typedef __intmax_t intmax_t;
+
+
+
+
+typedef __uintmax_t uintmax_t;
+
+
+
+
+typedef __intptr_t intptr_t;
+
+
+
+
+typedef __uintptr_t uintptr_t;
+# 65 "/usr/arm-none-eabi/include/sys/types.h" 2 3
+
+
+# 1 "/usr/arm-none-eabi/include/machine/endian.h" 1 3
+
+
+
+
+
+# 1 "/usr/arm-none-eabi/include/machine/_endian.h" 1 3
+# 7 "/usr/arm-none-eabi/include/machine/endian.h" 2 3
+# 68 "/usr/arm-none-eabi/include/sys/types.h" 2 3
+# 1 "/usr/arm-none-eabi/include/sys/select.h" 1 3
+# 25 "/usr/arm-none-eabi/include/sys/select.h" 3
+# 1 "/usr/arm-none-eabi/include/sys/_sigset.h" 1 3
+# 41 "/usr/arm-none-eabi/include/sys/_sigset.h" 3
+typedef unsigned long __sigset_t;
+# 26 "/usr/arm-none-eabi/include/sys/select.h" 2 3
+# 1 "/usr/arm-none-eabi/include/sys/_timeval.h" 1 3
+# 35 "/usr/arm-none-eabi/include/sys/_timeval.h" 3
+typedef __suseconds_t suseconds_t;
+
+
+
+
+typedef long time_t;
+# 52 "/usr/arm-none-eabi/include/sys/_timeval.h" 3
+struct timeval {
+ time_t tv_sec;
+ suseconds_t tv_usec;
+};
+# 27 "/usr/arm-none-eabi/include/sys/select.h" 2 3
+# 1 "/usr/arm-none-eabi/include/sys/timespec.h" 1 3
+# 38 "/usr/arm-none-eabi/include/sys/timespec.h" 3
+# 1 "/usr/arm-none-eabi/include/sys/_timespec.h" 1 3
+# 45 "/usr/arm-none-eabi/include/sys/_timespec.h" 3
+struct timespec {
+ time_t tv_sec;
+ long tv_nsec;
+};
+# 39 "/usr/arm-none-eabi/include/sys/timespec.h" 2 3
+# 58 "/usr/arm-none-eabi/include/sys/timespec.h" 3
+struct itimerspec {
+ struct timespec it_interval;
+ struct timespec it_value;
+};
+# 28 "/usr/arm-none-eabi/include/sys/select.h" 2 3
+
+
+
+typedef __sigset_t sigset_t;
+# 45 "/usr/arm-none-eabi/include/sys/select.h" 3
+typedef unsigned long fd_mask;
+
+
+
+
+
+
+
+typedef struct _types_fd_set {
+ fd_mask fds_bits[(((64)+(((sizeof (fd_mask) * 8))-1))/((sizeof (fd_mask) * 8)))];
+} _types_fd_set;
+# 71 "/usr/arm-none-eabi/include/sys/select.h" 3
+
+
+int select (int __n, _types_fd_set *__readfds, _types_fd_set *__writefds, _types_fd_set *__exceptfds, struct timeval *__timeout)
+ ;
+
+int pselect (int __n, _types_fd_set *__readfds, _types_fd_set *__writefds, _types_fd_set *__exceptfds, const struct timespec *__timeout, const sigset_t *__set)
+
+ ;
+
+
+
+# 69 "/usr/arm-none-eabi/include/sys/types.h" 2 3
+
+
+
+
+typedef __uint32_t in_addr_t;
+
+
+
+
+typedef __uint16_t in_port_t;
+# 87 "/usr/arm-none-eabi/include/sys/types.h" 3
+typedef unsigned char u_char;
+
+
+
+typedef unsigned short u_short;
+
+
+
+typedef unsigned int u_int;
+
+
+
+typedef unsigned long u_long;
+
+
+
+
+
+
+
+typedef unsigned short ushort;
+typedef unsigned int uint;
+typedef unsigned long ulong;
+
+
+
+typedef __blkcnt_t blkcnt_t;
+
+
+
+
+typedef __blksize_t blksize_t;
+
+
+
+
+typedef unsigned long clock_t;
+# 135 "/usr/arm-none-eabi/include/sys/types.h" 3
+typedef long daddr_t;
+
+
+
+typedef char * caddr_t;
+
+
+
+
+typedef __fsblkcnt_t fsblkcnt_t;
+typedef __fsfilcnt_t fsfilcnt_t;
+
+
+
+
+typedef __id_t id_t;
+
+
+
+
+typedef __ino_t ino_t;
+# 173 "/usr/arm-none-eabi/include/sys/types.h" 3
+typedef __off_t off_t;
+
+
+
+typedef __dev_t dev_t;
+
+
+
+typedef __uid_t uid_t;
+
+
+
+typedef __gid_t gid_t;
+
+
+
+
+typedef __pid_t pid_t;
+
+
+
+
+typedef __key_t key_t;
+
+
+
+
+typedef _ssize_t ssize_t;
+
+
+
+
+typedef __mode_t mode_t;
+
+
+
+
+typedef __nlink_t nlink_t;
+
+
+
+
+typedef __clockid_t clockid_t;
+
+
+
+
+
+typedef __timer_t timer_t;
+
+
+
+
+
+typedef __useconds_t useconds_t;
+# 236 "/usr/arm-none-eabi/include/sys/types.h" 3
+typedef __int64_t sbintime_t;
+
+
+# 1 "/usr/arm-none-eabi/include/sys/_pthreadtypes.h" 1 3
+# 240 "/usr/arm-none-eabi/include/sys/types.h" 2 3
+# 1 "/usr/arm-none-eabi/include/machine/types.h" 1 3
+# 241 "/usr/arm-none-eabi/include/sys/types.h" 2 3
+# 62 "/usr/arm-none-eabi/include/stdio.h" 2 3
+
+
+
+
+typedef __FILE FILE;
+
+
+
+
+
+
+typedef _fpos_t fpos_t;
+
+
+
+
+
+# 1 "/usr/arm-none-eabi/include/sys/stdio.h" 1 3
+# 80 "/usr/arm-none-eabi/include/stdio.h" 2 3
+# 181 "/usr/arm-none-eabi/include/stdio.h" 3
+char * ctermid (char *);
+
+
+
+
+FILE * tmpfile (void);
+char * tmpnam (char *);
+
+char * tempnam (const char *, const char *);
+
+int fclose (FILE *);
+int fflush (FILE *);
+FILE * freopen (const char *restrict, const char *restrict, FILE *restrict);
+void setbuf (FILE *restrict, char *restrict);
+int setvbuf (FILE *restrict, char *restrict, int, size_t);
+int fprintf (FILE *restrict, const char *restrict, ...) __attribute__ ((__format__ (__printf__, 2, 3)))
+ ;
+int fscanf (FILE *restrict, const char *restrict, ...) __attribute__ ((__format__ (__scanf__, 2, 3)))
+ ;
+int printf (const char *restrict, ...) __attribute__ ((__format__ (__printf__, 1, 2)))
+ ;
+int scanf (const char *restrict, ...) __attribute__ ((__format__ (__scanf__, 1, 2)))
+ ;
+int sscanf (const char *restrict, const char *restrict, ...) __attribute__ ((__format__ (__scanf__, 2, 3)))
+ ;
+int vfprintf (FILE *restrict, const char *restrict, __gnuc_va_list) __attribute__ ((__format__ (__printf__, 2, 0)))
+ ;
+int vprintf (const char *, __gnuc_va_list) __attribute__ ((__format__ (__printf__, 1, 0)))
+ ;
+int vsprintf (char *restrict, const char *restrict, __gnuc_va_list) __attribute__ ((__format__ (__printf__, 2, 0)))
+ ;
+int fgetc (FILE *);
+char * fgets (char *restrict, int, FILE *restrict);
+int fputc (int, FILE *);
+int fputs (const char *restrict, FILE *restrict);
+int getc (FILE *);
+int getchar (void);
+char * gets (char *);
+int putc (int, FILE *);
+int putchar (int);
+int puts (const char *);
+int ungetc (int, FILE *);
+size_t fread (void * restrict, size_t _size, size_t _n, FILE *restrict);
+size_t fwrite (const void * restrict , size_t _size, size_t _n, FILE *);
+
+
+
+int fgetpos (FILE *restrict, fpos_t *restrict);
+
+int fseek (FILE *, long, int);
+
+
+
+int fsetpos (FILE *, const fpos_t *);
+
+long ftell ( FILE *);
+void rewind (FILE *);
+void clearerr (FILE *);
+int feof (FILE *);
+int ferror (FILE *);
+void perror (const char *);
+
+FILE * fopen (const char *restrict _name, const char *restrict _type);
+int sprintf (char *restrict, const char *restrict, ...) __attribute__ ((__format__ (__printf__, 2, 3)))
+ ;
+int remove (const char *);
+int rename (const char *, const char *);
+# 257 "/usr/arm-none-eabi/include/stdio.h" 3
+int fseeko (FILE *, off_t, int);
+off_t ftello ( FILE *);
+
+
+
+
+
+
+
+int snprintf (char *restrict, size_t, const char *restrict, ...) __attribute__ ((__format__ (__printf__, 3, 4)))
+ ;
+int vsnprintf (char *restrict, size_t, const char *restrict, __gnuc_va_list) __attribute__ ((__format__ (__printf__, 3, 0)))
+ ;
+int vfscanf (FILE *restrict, const char *restrict, __gnuc_va_list) __attribute__ ((__format__ (__scanf__, 2, 0)))
+ ;
+int vscanf (const char *, __gnuc_va_list) __attribute__ ((__format__ (__scanf__, 1, 0)))
+ ;
+int vsscanf (const char *restrict, const char *restrict, __gnuc_va_list) __attribute__ ((__format__ (__scanf__, 2, 0)))
+ ;
+# 284 "/usr/arm-none-eabi/include/stdio.h" 3
+int asiprintf (char **, const char *, ...) __attribute__ ((__format__ (__printf__, 2, 3)))
+ ;
+char * asniprintf (char *, size_t *, const char *, ...) __attribute__ ((__format__ (__printf__, 3, 4)))
+ ;
+char * asnprintf (char *restrict, size_t *restrict, const char *restrict, ...) __attribute__ ((__format__ (__printf__, 3, 4)))
+ ;
+
+int diprintf (int, const char *, ...) __attribute__ ((__format__ (__printf__, 2, 3)))
+ ;
+
+int fiprintf (FILE *, const char *, ...) __attribute__ ((__format__ (__printf__, 2, 3)))
+ ;
+int fiscanf (FILE *, const char *, ...) __attribute__ ((__format__ (__scanf__, 2, 3)))
+ ;
+int iprintf (const char *, ...) __attribute__ ((__format__ (__printf__, 1, 2)))
+ ;
+int iscanf (const char *, ...) __attribute__ ((__format__ (__scanf__, 1, 2)))
+ ;
+int siprintf (char *, const char *, ...) __attribute__ ((__format__ (__printf__, 2, 3)))
+ ;
+int siscanf (const char *, const char *, ...) __attribute__ ((__format__ (__scanf__, 2, 3)))
+ ;
+int sniprintf (char *, size_t, const char *, ...) __attribute__ ((__format__ (__printf__, 3, 4)))
+ ;
+int vasiprintf (char **, const char *, __gnuc_va_list) __attribute__ ((__format__ (__printf__, 2, 0)))
+ ;
+char * vasniprintf (char *, size_t *, const char *, __gnuc_va_list) __attribute__ ((__format__ (__printf__, 3, 0)))
+ ;
+char * vasnprintf (char *, size_t *, const char *, __gnuc_va_list) __attribute__ ((__format__ (__printf__, 3, 0)))
+ ;
+int vdiprintf (int, const char *, __gnuc_va_list) __attribute__ ((__format__ (__printf__, 2, 0)))
+ ;
+int vfiprintf (FILE *, const char *, __gnuc_va_list) __attribute__ ((__format__ (__printf__, 2, 0)))
+ ;
+int vfiscanf (FILE *, const char *, __gnuc_va_list) __attribute__ ((__format__ (__scanf__, 2, 0)))
+ ;
+int viprintf (const char *, __gnuc_va_list) __attribute__ ((__format__ (__printf__, 1, 0)))
+ ;
+int viscanf (const char *, __gnuc_va_list) __attribute__ ((__format__ (__scanf__, 1, 0)))
+ ;
+int vsiprintf (char *, const char *, __gnuc_va_list) __attribute__ ((__format__ (__printf__, 2, 0)))
+ ;
+int vsiscanf (const char *, const char *, __gnuc_va_list) __attribute__ ((__format__ (__scanf__, 2, 0)))
+ ;
+int vsniprintf (char *, size_t, const char *, __gnuc_va_list) __attribute__ ((__format__ (__printf__, 3, 0)))
+ ;
+# 339 "/usr/arm-none-eabi/include/stdio.h" 3
+FILE * fdopen (int, const char *);
+
+int fileno (FILE *);
+
+
+int pclose (FILE *);
+FILE * popen (const char *, const char *);
+
+
+
+void setbuffer (FILE *, char *, int);
+int setlinebuf (FILE *);
+
+
+
+int getw (FILE *);
+int putw (int, FILE *);
+
+
+int getc_unlocked (FILE *);
+int getchar_unlocked (void);
+void flockfile (FILE *);
+int ftrylockfile (FILE *);
+void funlockfile (FILE *);
+int putc_unlocked (int, FILE *);
+int putchar_unlocked (int);
+# 374 "/usr/arm-none-eabi/include/stdio.h" 3
+int dprintf (int, const char *restrict, ...) __attribute__ ((__format__ (__printf__, 2, 3)))
+ ;
+
+FILE * fmemopen (void *restrict, size_t, const char *restrict);
+
+
+FILE * open_memstream (char **, size_t *);
+int vdprintf (int, const char *restrict, __gnuc_va_list) __attribute__ ((__format__ (__printf__, 2, 0)))
+ ;
+
+
+
+int renameat (int, const char *, int, const char *);
+
+
+
+
+
+
+int _asiprintf_r (struct _reent *, char **, const char *, ...) __attribute__ ((__format__ (__printf__, 3, 4)))
+ ;
+char * _asniprintf_r (struct _reent *, char *, size_t *, const char *, ...) __attribute__ ((__format__ (__printf__, 4, 5)))
+ ;
+char * _asnprintf_r (struct _reent *, char *restrict, size_t *restrict, const char *restrict, ...) __attribute__ ((__format__ (__printf__, 4, 5)))
+ ;
+int _asprintf_r (struct _reent *, char **restrict, const char *restrict, ...) __attribute__ ((__format__ (__printf__, 3, 4)))
+ ;
+int _diprintf_r (struct _reent *, int, const char *, ...) __attribute__ ((__format__ (__printf__, 3, 4)))
+ ;
+int _dprintf_r (struct _reent *, int, const char *restrict, ...) __attribute__ ((__format__ (__printf__, 3, 4)))
+ ;
+int _fclose_r (struct _reent *, FILE *);
+int _fcloseall_r (struct _reent *);
+FILE * _fdopen_r (struct _reent *, int, const char *);
+int _fflush_r (struct _reent *, FILE *);
+int _fgetc_r (struct _reent *, FILE *);
+int _fgetc_unlocked_r (struct _reent *, FILE *);
+char * _fgets_r (struct _reent *, char *restrict, int, FILE *restrict);
+char * _fgets_unlocked_r (struct _reent *, char *restrict, int, FILE *restrict);
+
+
+
+
+int _fgetpos_r (struct _reent *, FILE *, fpos_t *);
+int _fsetpos_r (struct _reent *, FILE *, const fpos_t *);
+
+int _fiprintf_r (struct _reent *, FILE *, const char *, ...) __attribute__ ((__format__ (__printf__, 3, 4)))
+ ;
+int _fiscanf_r (struct _reent *, FILE *, const char *, ...) __attribute__ ((__format__ (__scanf__, 3, 4)))
+ ;
+FILE * _fmemopen_r (struct _reent *, void *restrict, size_t, const char *restrict);
+FILE * _fopen_r (struct _reent *, const char *restrict, const char *restrict);
+FILE * _freopen_r (struct _reent *, const char *restrict, const char *restrict, FILE *restrict);
+int _fprintf_r (struct _reent *, FILE *restrict, const char *restrict, ...) __attribute__ ((__format__ (__printf__, 3, 4)))
+ ;
+int _fpurge_r (struct _reent *, FILE *);
+int _fputc_r (struct _reent *, int, FILE *);
+int _fputc_unlocked_r (struct _reent *, int, FILE *);
+int _fputs_r (struct _reent *, const char *restrict, FILE *restrict);
+int _fputs_unlocked_r (struct _reent *, const char *restrict, FILE *restrict);
+size_t _fread_r (struct _reent *, void * restrict, size_t _size, size_t _n, FILE *restrict);
+size_t _fread_unlocked_r (struct _reent *, void * restrict, size_t _size, size_t _n, FILE *restrict);
+int _fscanf_r (struct _reent *, FILE *restrict, const char *restrict, ...) __attribute__ ((__format__ (__scanf__, 3, 4)))
+ ;
+int _fseek_r (struct _reent *, FILE *, long, int);
+int _fseeko_r (struct _reent *, FILE *, _off_t, int);
+long _ftell_r (struct _reent *, FILE *);
+_off_t _ftello_r (struct _reent *, FILE *);
+void _rewind_r (struct _reent *, FILE *);
+size_t _fwrite_r (struct _reent *, const void * restrict, size_t _size, size_t _n, FILE *restrict);
+size_t _fwrite_unlocked_r (struct _reent *, const void * restrict, size_t _size, size_t _n, FILE *restrict);
+int _getc_r (struct _reent *, FILE *);
+int _getc_unlocked_r (struct _reent *, FILE *);
+int _getchar_r (struct _reent *);
+int _getchar_unlocked_r (struct _reent *);
+char * _gets_r (struct _reent *, char *);
+int _iprintf_r (struct _reent *, const char *, ...) __attribute__ ((__format__ (__printf__, 2, 3)))
+ ;
+int _iscanf_r (struct _reent *, const char *, ...) __attribute__ ((__format__ (__scanf__, 2, 3)))
+ ;
+FILE * _open_memstream_r (struct _reent *, char **, size_t *);
+void _perror_r (struct _reent *, const char *);
+int _printf_r (struct _reent *, const char *restrict, ...) __attribute__ ((__format__ (__printf__, 2, 3)))
+ ;
+int _putc_r (struct _reent *, int, FILE *);
+int _putc_unlocked_r (struct _reent *, int, FILE *);
+int _putchar_unlocked_r (struct _reent *, int);
+int _putchar_r (struct _reent *, int);
+int _puts_r (struct _reent *, const char *);
+int _remove_r (struct _reent *, const char *);
+int _rename_r (struct _reent *, const char *_old, const char *_new)
+ ;
+int _scanf_r (struct _reent *, const char *restrict, ...) __attribute__ ((__format__ (__scanf__, 2, 3)))
+ ;
+int _siprintf_r (struct _reent *, char *, const char *, ...) __attribute__ ((__format__ (__printf__, 3, 4)))
+ ;
+int _siscanf_r (struct _reent *, const char *, const char *, ...) __attribute__ ((__format__ (__scanf__, 3, 4)))
+ ;
+int _sniprintf_r (struct _reent *, char *, size_t, const char *, ...) __attribute__ ((__format__ (__printf__, 4, 5)))
+ ;
+int _snprintf_r (struct _reent *, char *restrict, size_t, const char *restrict, ...) __attribute__ ((__format__ (__printf__, 4, 5)))
+ ;
+int _sprintf_r (struct _reent *, char *restrict, const char *restrict, ...) __attribute__ ((__format__ (__printf__, 3, 4)))
+ ;
+int _sscanf_r (struct _reent *, const char *restrict, const char *restrict, ...) __attribute__ ((__format__ (__scanf__, 3, 4)))
+ ;
+char * _tempnam_r (struct _reent *, const char *, const char *);
+FILE * _tmpfile_r (struct _reent *);
+char * _tmpnam_r (struct _reent *, char *);
+int _ungetc_r (struct _reent *, int, FILE *);
+int _vasiprintf_r (struct _reent *, char **, const char *, __gnuc_va_list) __attribute__ ((__format__ (__printf__, 3, 0)))
+ ;
+char * _vasniprintf_r (struct _reent*, char *, size_t *, const char *, __gnuc_va_list) __attribute__ ((__format__ (__printf__, 4, 0)))
+ ;
+char * _vasnprintf_r (struct _reent*, char *, size_t *, const char *, __gnuc_va_list) __attribute__ ((__format__ (__printf__, 4, 0)))
+ ;
+int _vasprintf_r (struct _reent *, char **, const char *, __gnuc_va_list) __attribute__ ((__format__ (__printf__, 3, 0)))
+ ;
+int _vdiprintf_r (struct _reent *, int, const char *, __gnuc_va_list) __attribute__ ((__format__ (__printf__, 3, 0)))
+ ;
+int _vdprintf_r (struct _reent *, int, const char *restrict, __gnuc_va_list) __attribute__ ((__format__ (__printf__, 3, 0)))
+ ;
+int _vfiprintf_r (struct _reent *, FILE *, const char *, __gnuc_va_list) __attribute__ ((__format__ (__printf__, 3, 0)))
+ ;
+int _vfiscanf_r (struct _reent *, FILE *, const char *, __gnuc_va_list) __attribute__ ((__format__ (__scanf__, 3, 0)))
+ ;
+int _vfprintf_r (struct _reent *, FILE *restrict, const char *restrict, __gnuc_va_list) __attribute__ ((__format__ (__printf__, 3, 0)))
+ ;
+int _vfscanf_r (struct _reent *, FILE *restrict, const char *restrict, __gnuc_va_list) __attribute__ ((__format__ (__scanf__, 3, 0)))
+ ;
+int _viprintf_r (struct _reent *, const char *, __gnuc_va_list) __attribute__ ((__format__ (__printf__, 2, 0)))
+ ;
+int _viscanf_r (struct _reent *, const char *, __gnuc_va_list) __attribute__ ((__format__ (__scanf__, 2, 0)))
+ ;
+int _vprintf_r (struct _reent *, const char *restrict, __gnuc_va_list) __attribute__ ((__format__ (__printf__, 2, 0)))
+ ;
+int _vscanf_r (struct _reent *, const char *restrict, __gnuc_va_list) __attribute__ ((__format__ (__scanf__, 2, 0)))
+ ;
+int _vsiprintf_r (struct _reent *, char *, const char *, __gnuc_va_list) __attribute__ ((__format__ (__printf__, 3, 0)))
+ ;
+int _vsiscanf_r (struct _reent *, const char *, const char *, __gnuc_va_list) __attribute__ ((__format__ (__scanf__, 3, 0)))
+ ;
+int _vsniprintf_r (struct _reent *, char *, size_t, const char *, __gnuc_va_list) __attribute__ ((__format__ (__printf__, 4, 0)))
+ ;
+int _vsnprintf_r (struct _reent *, char *restrict, size_t, const char *restrict, __gnuc_va_list) __attribute__ ((__format__ (__printf__, 4, 0)))
+ ;
+int _vsprintf_r (struct _reent *, char *restrict, const char *restrict, __gnuc_va_list) __attribute__ ((__format__ (__printf__, 3, 0)))
+ ;
+int _vsscanf_r (struct _reent *, const char *restrict, const char *restrict, __gnuc_va_list) __attribute__ ((__format__ (__scanf__, 3, 0)))
+ ;
+
+
+
+int fpurge (FILE *);
+ssize_t __getdelim (char **, size_t *, int, FILE *);
+ssize_t __getline (char **, size_t *, FILE *);
+
+
+void clearerr_unlocked (FILE *);
+int feof_unlocked (FILE *);
+int ferror_unlocked (FILE *);
+int fileno_unlocked (FILE *);
+int fflush_unlocked (FILE *);
+int fgetc_unlocked (FILE *);
+int fputc_unlocked (int, FILE *);
+size_t fread_unlocked (void * restrict, size_t _size, size_t _n, FILE *restrict);
+size_t fwrite_unlocked (const void * restrict , size_t _size, size_t _n, FILE *);
+# 574 "/usr/arm-none-eabi/include/stdio.h" 3
+int __srget_r (struct _reent *, FILE *);
+int __swbuf_r (struct _reent *, int, FILE *);
+# 598 "/usr/arm-none-eabi/include/stdio.h" 3
+FILE *funopen (const void * __cookie, int (*__readfn)(void * __cookie, char *__buf, int __n), int (*__writefn)(void * __cookie, const char *__buf, int __n), fpos_t (*__seekfn)(void * __cookie, fpos_t __off, int __whence), int (*__closefn)(void * __cookie))
+
+
+
+
+
+ ;
+FILE *_funopen_r (struct _reent *, const void * __cookie, int (*__readfn)(void * __cookie, char *__buf, int __n), int (*__writefn)(void * __cookie, const char *__buf, int __n), fpos_t (*__seekfn)(void * __cookie, fpos_t __off, int __whence), int (*__closefn)(void * __cookie))
+
+
+
+
+
+ ;
+# 684 "/usr/arm-none-eabi/include/stdio.h" 3
+static __inline__ int __sputc_r(struct _reent *_ptr, int _c, FILE *_p) {
+
+
+
+
+ if (--_p->_w >= 0 || (_p->_w >= _p->_lbfsize && (char)_c != '\n'))
+ return (*_p->_p++ = _c);
+ else
+ return (__swbuf_r(_ptr, _c, _p));
+}
+# 767 "/usr/arm-none-eabi/include/stdio.h" 3
+
+# 4 "../common/8b10b.c" 2
+
+# 1 "../common/8b10b.h" 1
+
+
+
+# 1 "/usr/lib/gcc/arm-none-eabi/7.1.0/include/stdint.h" 1 3 4
+# 9 "/usr/lib/gcc/arm-none-eabi/7.1.0/include/stdint.h" 3 4
+# 1 "/usr/arm-none-eabi/include/stdint.h" 1 3 4
+# 13 "/usr/arm-none-eabi/include/stdint.h" 3 4
+# 1 "/usr/arm-none-eabi/include/sys/_intsup.h" 1 3 4
+# 35 "/usr/arm-none-eabi/include/sys/_intsup.h" 3 4
+
+
+
+
+
+
+
+# 187 "/usr/arm-none-eabi/include/sys/_intsup.h" 3 4
+
+
+
+
+
+
+
+# 14 "/usr/arm-none-eabi/include/stdint.h" 2 3 4
+
+
+
+
+
+
+
+typedef __int_least8_t int_least8_t;
+typedef __uint_least8_t uint_least8_t;
+
+
+
+
+typedef __int_least16_t int_least16_t;
+typedef __uint_least16_t uint_least16_t;
+
+
+
+
+typedef __int_least32_t int_least32_t;
+typedef __uint_least32_t uint_least32_t;
+
+
+
+
+typedef __int_least64_t int_least64_t;
+typedef __uint_least64_t uint_least64_t;
+# 51 "/usr/arm-none-eabi/include/stdint.h" 3 4
+ typedef int int_fast8_t;
+ typedef unsigned int uint_fast8_t;
+# 61 "/usr/arm-none-eabi/include/stdint.h" 3 4
+ typedef int int_fast16_t;
+ typedef unsigned int uint_fast16_t;
+# 71 "/usr/arm-none-eabi/include/stdint.h" 3 4
+ typedef int int_fast32_t;
+ typedef unsigned int uint_fast32_t;
+# 81 "/usr/arm-none-eabi/include/stdint.h" 3 4
+ typedef long long int int_fast64_t;
+ typedef long long unsigned int uint_fast64_t;
+# 10 "/usr/lib/gcc/arm-none-eabi/7.1.0/include/stdint.h" 2 3 4
+# 5 "../common/8b10b.h" 2
+# 1 "/usr/lib/gcc/arm-none-eabi/7.1.0/include/stdbool.h" 1 3 4
+# 6 "../common/8b10b.h" 2
+# 1 "/usr/arm-none-eabi/include/errno.h" 1 3
+
+
+
+
+typedef int error_t;
+
+
+
+# 1 "/usr/arm-none-eabi/include/sys/errno.h" 1 3
+# 15 "/usr/arm-none-eabi/include/sys/errno.h" 3
+extern int *__errno (void);
+
+
+
+
+extern const char * const _sys_errlist[];
+extern int _sys_nerr;
+# 10 "/usr/arm-none-eabi/include/errno.h" 2 3
+# 7 "../common/8b10b.h" 2
+
+
+# 8 "../common/8b10b.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 {
+ uint8_t rd_neg, rd_pos, disp;
+};
+
+struct state_8b10b_dec {
+ uint32_t rx;
+ int bit_ctr;
+};
+
+struct state_8b10b_enc {
+ int rd;
+};
+
+void xfr_8b10b_reset(struct state_8b10b_dec *st);
+int xfr_8b10b_feed_bit(struct state_8b10b_dec *st, int bit);
+
+# 36 "../common/8b10b.h" 3 4
+_Bool
+# 36 "../common/8b10b.h"
+ xfr_8b10b_has_sync(struct state_8b10b_dec *st);
+
+void xfr_8b10b_encode_reset(struct state_8b10b_enc *st);
+int xfr_8b10b_encode(struct state_8b10b_enc *st, int data);
+# 6 "../common/8b10b.c" 2
+
+
+
+#pragma GCC diagnostic ignored "-Wunused-const-variable=0"
+static const struct entry map_5b6b[32] = {
+ {0b100111, 0b011000, 2},
+ {0b011101, 0b100010, 2},
+ {0b101101, 0b010010, 2},
+ {0b110001, 0b110001, 0},
+ {0b110101, 0b001010, 2},
+ {0b101001, 0b101001, 0},
+ {0b011001, 0b011001, 0},
+ {0b111000, 0b000111, 0},
+ {0b111001, 0b000110, 2},
+ {0b100101, 0b100101, 0},
+ {0b010101, 0b010101, 0},
+ {0b110100, 0b110100, 0},
+ {0b001101, 0b001101, 0},
+ {0b101100, 0b101100, 0},
+ {0b011100, 0b011100, 0},
+ {0b010111, 0b101000, 2},
+ {0b011011, 0b100100, 2},
+ {0b100011, 0b100011, 0},
+ {0b010011, 0b010011, 0},
+ {0b110010, 0b110010, 0},
+ {0b001011, 0b001011, 0},
+ {0b101010, 0b101010, 0},
+ {0b011010, 0b011010, 0},
+ {0b111010, 0b000101, 2},
+ {0b110011, 0b001100, 2},
+ {0b100110, 0b100110, 0},
+ {0b010110, 0b010110, 0},
+ {0b110110, 0b001001, 2},
+ {0b001110, 0b001110, 0},
+ {0b101110, 0b010001, 2},
+ {0b011110, 0b100001, 2},
+ {0b101011, 0b010100, 2}
+};
+
+static const int8_t map_6b5b[64] = {
+ [0b000101] = 23,
+ [0b000110] = 8,
+ [0b000111] = 7,
+ [0b001001] = 27,
+ [0b001010] = 4,
+ [0b001011] = 20,
+ [0b001100] = 24,
+ [0b001101] = 12,
+ [0b001101] = 12,
+ [0b001110] = 28,
+ [0b010001] = 29,
+ [0b010010] = 2,
+ [0b010011] = 18,
+ [0b010100] = 31,
+ [0b010101] = 10,
+ [0b010101] = 10,
+ [0b010110] = 26,
+ [0b010111] = 15,
+ [0b011000] = -1,
+ [0b011001] = 6,
+ [0b011010] = 22,
+ [0b011011] = 16,
+ [0b011100] = 14,
+ [0b011101] = 1,
+ [0b011110] = 30,
+ [0b100001] = 30,
+ [0b100010] = 1,
+ [0b100011] = 17,
+ [0b100100] = 16,
+ [0b100101] = 9,
+ [0b100110] = 25,
+ [0b100111] = -1,
+ [0b101000] = 15,
+ [0b101001] = 5,
+ [0b101010] = 21,
+ [0b101011] = 31,
+ [0b101100] = 13,
+ [0b101101] = 2,
+ [0b101110] = 29,
+ [0b110001] = 3,
+ [0b110010] = 19,
+ [0b110011] = 24,
+ [0b110100] = 11,
+ [0b110101] = 4,
+ [0b110110] = 27,
+ [0b111000] = 7,
+ [0b111001] = 8,
+ [0b111010] = 23
+};
+
+static const struct entry K28 = {0b001111, 0b110000};
+
+static const struct entry map_3b4b_d[8] = {
+ {0b1011, 0b0100, 2},
+ {0b1001, 0b1001, 0},
+ {0b0101, 0b0101, 0},
+ {0b1100, 0b0011, 0},
+ {0b1101, 0b0010, 2},
+ {0b1010, 0b1010, 0},
+ {0b0110, 0b0110, 0},
+ {0b1110, 0b0001, 2}
+};
+
+static const struct entry Dx_A7 = {0b0111, 0b1000, 2};
+
+static const struct entry map_3b4b_k[8] = {
+ {0b1011, 0b0100},
+ {0b0110, 0b1001},
+ {0b1010, 0b0101},
+ {0b1100, 0b0011},
+ {0b1101, 0b0010},
+ {0b0101, 0b1010},
+ {0b1001, 0b0110},
+ {0b0111, 0b1000}
+};
+
+static const int8_t map_4b3b[16] = {
+ [0b0001] = 7,
+ [0b0010] = 4,
+ [0b0011] = 3,
+ [0b0100] = -1,
+ [0b0101] = 2,
+ [0b0110] = 6,
+ [0b0111] = 7,
+ [0b1000] = 7,
+ [0b1001] = 1,
+ [0b1010] = 5,
+ [0b1011] = -1,
+ [0b1100] = 3,
+ [0b1101] = 4,
+ [0b1110] = 7,
+ [0b1111] = 0,
+ [0b0000] = 0
+};
+
+static const uint16_t k_sym_map[K_CODES_LAST] = {
+ [K28_0] = 0b0011110100,
+ [K28_1] = 0b0011111001,
+ [K28_2] = 0b0011110101,
+ [K28_3] = 0b0011110011,
+ [K28_4] = 0b0011110010,
+ [K28_5] = 0b0011111010,
+ [K28_6] = 0b0011110110,
+ [K28_7] = 0b0011111000,
+ [K23_7] = 0b1110101000,
+ [K27_7] = 0b1101101000,
+ [K29_7] = 0b1011101000,
+ [K30_7] = 0b0111101000
+};
+
+void xfr_8b10b_reset(struct state_8b10b_dec *st) {
+ st->rx = 0;
+ st->bit_ctr = 0;
+}
+
+int xfr_8b10b_feed_bit(struct state_8b10b_dec *st, int bit) {
+ uint32_t pattern = st->rx = (st->rx<<1 | !!bit) & 0x3ff;
+ uint16_t comma = k_sym_map[K28_1];
+ if (pattern == comma || pattern == ((~comma)&0x3ff)) {
+ st->bit_ctr = 1;
+ return -K28_1;
+ }
+
+ if (st->bit_ctr == 10) {
+ st->bit_ctr = 1;
+
+ for (int i=1; i<sizeof(k_sym_map)/sizeof(k_sym_map[0]); i++) {
+ if (pattern == k_sym_map[i])
+ return -i;
+ }
+
+ int p3b = map_4b3b[pattern & 0xf];
+ int p5b = map_6b5b[pattern >> 4];
+
+ if (p3b == 0 || p5b == 0)
+ return -DECODING_ERROR;
+
+ p3b = (p3b == -1) ? 0 : p3b;
+ p5b = (p5b == -1) ? 0 : p5b;
+ return p3b<<5 | p5b;
+
+ } else if (st->bit_ctr > 0) {
+ st->bit_ctr++;
+ }
+ return -DECODING_IN_PROGRESS;
+}
+
+
+# 193 "../common/8b10b.c" 3 4
+_Bool
+# 193 "../common/8b10b.c"
+ xfr_8b10b_has_sync(struct state_8b10b_dec *st) {
+ return st->bit_ctr != 0;
+}
+
+void xfr_8b10b_encode_reset(struct state_8b10b_enc *st) {
+ st->rd = -1;
+}
+
+int xfr_8b10b_encode(struct state_8b10b_enc *st, int data) {
+ if (data < 0) {
+ if (-data >= sizeof(k_sym_map)/sizeof(k_sym_map[0]))
+ return -
+# 204 "../common/8b10b.c" 3
+ 22
+# 204 "../common/8b10b.c"
+ ;
+
+ return k_sym_map[-data];
+ }
+
+ if (data > 255)
+ return -
+# 210 "../common/8b10b.c" 3
+ 22
+# 210 "../common/8b10b.c"
+ ;
+
+ int p5b = data&0x1f, p3b = data>>5;
+
+
+ int x5b = (st->rd == -1) ? map_5b6b[p5b].rd_neg : map_5b6b[p5b].rd_pos;
+ st->rd -= map_5b6b[p5b].disp * st->rd;
+
+
+
+ int x3b = (st->rd == -1) ? map_3b4b_d[p3b].rd_neg : map_3b4b_d[p3b].rd_pos;
+ if (p3b == 7) {
+ if ( (st->rd == -1 && (p5b == 17 || p5b == 18 || p5b == 20))
+ || (st->rd == 1 && (p5b == 11 || p5b == 13 || p5b == 14))) {
+
+ x3b = (st->rd == -1) ? Dx_A7.rd_neg : Dx_A7.rd_pos;
+ }
+ }
+ st->rd -= map_3b4b_d[p3b].disp * st->rd;
+
+
+ return x5b<<4 | x3b;
+}