summaryrefslogtreecommitdiffstats
path: root/app/stdio.c
diff options
context:
space:
mode:
authorroot <root@lab.panaceas.james.local>2018-04-08 01:14:30 +0100
committerroot <root@lab.panaceas.james.local>2018-04-08 01:14:30 +0100
commit25e6afd831b94b9735cc6691ee19c8edc921aca7 (patch)
treecc194e7cb067c929b3e8bc9c03552d2d300c301b /app/stdio.c
downloadclock-25e6afd831b94b9735cc6691ee19c8edc921aca7.tar.gz
clock-25e6afd831b94b9735cc6691ee19c8edc921aca7.tar.bz2
clock-25e6afd831b94b9735cc6691ee19c8edc921aca7.zip
working decoding
Diffstat (limited to 'app/stdio.c')
-rw-r--r--app/stdio.c81
1 files changed, 81 insertions, 0 deletions
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();
+}