aboutsummaryrefslogtreecommitdiff
path: root/example-fs-bb48/tty.h
diff options
context:
space:
mode:
authorNIIBE Yutaka <gniibe@fsij.org>2016-05-23 13:00:33 +0900
committerNIIBE Yutaka <gniibe@fsij.org>2016-05-23 13:00:33 +0900
commitee92bb15b361b3daee816a4e930be0032be2d9e7 (patch)
tree7c179b6a662ffaa1f44759701e05d95257c5a758 /example-fs-bb48/tty.h
parent5458b77d360be2a7c5393f57c3d30399a8b87f29 (diff)
Remove deprecated API
Diffstat (limited to 'example-fs-bb48/tty.h')
-rw-r--r--example-fs-bb48/tty.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/example-fs-bb48/tty.h b/example-fs-bb48/tty.h
new file mode 100644
index 0000000..77b7014
--- /dev/null
+++ b/example-fs-bb48/tty.h
@@ -0,0 +1,26 @@
+#define BUFSIZE 128
+#define FLAG_CONNECTED (1 << 0)
+#define FLAG_SEND_AVAIL (1 << 1)
+#define FLAG_RECV_AVAIL (1 << 2)
+
+/*
+ * Current implementation is synchronous and buffers are not yet used.
+ */
+struct stream {
+ chopstx_mutex_t mtx;
+ chopstx_cond_t cnd;
+ int sending;
+ unsigned int recv_len;
+ uint8_t recv_buf[BUFSIZE];
+ uint8_t buf_send[BUFSIZE]; /* Not yet used. */
+ uint8_t cnt_send_head; /* Not yet used. */
+ uint8_t cnt_send_tail; /* Not yet used. */
+ uint8_t cnt_recv_head; /* Not yet used. */
+ uint8_t cnt_recv_tail; /* Not yet used. */
+ uint32_t flags;
+};
+
+struct stream *stream_open (void);
+int stream_wait_connection (struct stream *st);
+int stream_send (struct stream *st, uint8_t *buf, uint8_t count);
+int stream_recv (struct stream *st, uint8_t *buf);