aboutsummaryrefslogtreecommitdiff
path: root/ports/posix
diff options
context:
space:
mode:
Diffstat (limited to 'ports/posix')
-rw-r--r--ports/posix/makefile13
-rw-r--r--ports/posix/src/port.h16
-rw-r--r--ports/posix/src/stream_stdio.c25
3 files changed, 54 insertions, 0 deletions
diff --git a/ports/posix/makefile b/ports/posix/makefile
new file mode 100644
index 0000000..58d42be
--- /dev/null
+++ b/ports/posix/makefile
@@ -0,0 +1,13 @@
+
+
+PREFIX =
+
+LDFLAGS = $(LIBDIR) $(LIBS)
+
+C_INCLUDES += \
+-Ilib/FreeRTOS/FreeRTOS/Source/portable/ThirdParty/GCC/Posix/ \
+-Iports/posix/src/
+
+C_SOURCES += \
+lib/FreeRTOS/FreeRTOS/Source/portable/ThirdParty/GCC/Posix/port.c \
+ports/posix/src/stream_stdio.c \
diff --git a/ports/posix/src/port.h b/ports/posix/src/port.h
new file mode 100644
index 0000000..7c94ce8
--- /dev/null
+++ b/ports/posix/src/port.h
@@ -0,0 +1,16 @@
+/**
+ *
+ * @brief Port specific includes go in this file
+ *
+*/
+
+#ifndef __PORT_H
+#define __PORT_H
+
+#include <pthread.h>
+#include <mqueue.h>
+#include <stdint.h>
+#include <errno.h>
+#include "stream.h"
+
+#endif
diff --git a/ports/posix/src/stream_stdio.c b/ports/posix/src/stream_stdio.c
new file mode 100644
index 0000000..d49c46e
--- /dev/null
+++ b/ports/posix/src/stream_stdio.c
@@ -0,0 +1,25 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "stream_stdio.h"
+#include "stream.h"
+#include "main.h"
+
+int read_STDIO(uint8_t* buf, size_t count, void **vptr, void *sptr)
+{
+ int x;
+ for (x = 0; x < count; x++) {
+ scanf("%c", &buf[x]);
+ }
+ return 0;
+}
+
+int write_STDIO(uint8_t* buf, size_t count, void **vptr, void *sptr)
+{
+ int x;
+ for (x = 0; x < count; x++) {
+ printf("%x", buf[x]);
+ }
+ printf("\n");
+ return 0;
+}