From 25e6afd831b94b9735cc6691ee19c8edc921aca7 Mon Sep 17 00:00:00 2001 From: root Date: Sun, 8 Apr 2018 01:14:30 +0100 Subject: working decoding --- app/stdio.c | 81 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 app/stdio.c (limited to 'app/stdio.c') diff --git a/app/stdio.c b/app/stdio.c new file mode 100644 index 0000000..286d4d2 --- /dev/null +++ b/app/stdio.c @@ -0,0 +1,81 @@ +#include "project.h" + +int +_open (const char *name, + int flags, + int mode) +{ + errno = ENOSYS; + return -1; /* Always fails */ + +} /* _open () */ + +int +_close (int file) +{ + errno = EBADF; + return -1; /* Always fails */ + +} /* _close () */ + +int +_write (int file, + char *buf, + int nbytes) +{ + + int ret; + + + ret = usart6_write (buf, nbytes, 1); + + if (ret < 0) { + errno = -ret; + return -1; + } + + return ret; +} /* _write () */ + + +int +_read (int file, + char *buf, + int nbytes) +{ + + errno = -EAGAIN; + return -1; /* EOF */ + +} /* _read () */ + +int +_fstat (int file, + struct stat *st) +{ + st->st_mode = S_IFCHR; + return 0; + +} /* _fstat () */ + +int +_lseek (int file, + int offset, + int whence) +{ + return 0; + +} /* _lseek () */ + +int +isatty (int file) +{ + return 1; + +} /* _isatty () */ + + +void stdio_drain (void) +{ + usart6_drain(); +} -- cgit v1.2.3