summaryrefslogtreecommitdiffstats
path: root/sw/z80/kernel/include/sio.h
diff options
context:
space:
mode:
authorleleraffa97@hotmail.it <leleraffa97@hotmail.it>2017-08-26 11:11:39 +0200
committerleleraffa97@hotmail.it <leleraffa97@hotmail.it>2017-08-26 11:11:39 +0200
commit1acc542400d15ddf32f44e3f1ddb82f9c9fe4aab (patch)
treefb439e84abdf86a1b6e9f7362ca4c3cdeef2bb8d /sw/z80/kernel/include/sio.h
parentMerge remote-tracking branch 'origin/naopross' into atlas (diff)
downloadz80uPC-1acc542400d15ddf32f44e3f1ddb82f9c9fe4aab.tar.gz
z80uPC-1acc542400d15ddf32f44e3f1ddb82f9c9fe4aab.zip
File system initialization
Simple I/O (sio) interfaced, not yet implemented
Diffstat (limited to 'sw/z80/kernel/include/sio.h')
-rw-r--r--sw/z80/kernel/include/sio.h49
1 files changed, 49 insertions, 0 deletions
diff --git a/sw/z80/kernel/include/sio.h b/sw/z80/kernel/include/sio.h
new file mode 100644
index 0000000..9dc47f6
--- /dev/null
+++ b/sw/z80/kernel/include/sio.h
@@ -0,0 +1,49 @@
+#ifndef SIO_H
+#define SIO_H
+
+#include "types.h"
+
+#define SIO_ROM 0x0
+
+#define SIO_PORT_1 0x1
+#define SIO_PORT_2 0x2
+#define SIO_PORT_3 0x3
+#define SIO_PORT_4 0x4
+#define SIO_PORT_5 0x5
+#define SIO_PORT_6 0x6
+#define SIO_PORT_7 0x7
+
+/* initialize serial interface */
+void sio_init();
+
+/* return the device address in the address space */
+void * sio_dev_addr(uint8_t dev);
+/* return the driver id to be used on dev */
+uint8_t sio_dev_driver(uint8_t dev);
+
+/* set current device in use */
+void sio_set_dev(uint8_t dev);
+/* get current device in use */
+uint8_t sio_cdev();
+
+/* get pointer in given device */
+uint16_t sio_tellg(uint8_t dev);
+/* get pointer in current device */
+uint16_t sio_ctellg();
+
+/* set pointer in given device */
+int sio_seekg(uint8_t dev, uint16_t value);
+/* set pointer in current device */
+int sio_seekg(uint16_t value);
+
+/* syscall: read one byte from the current device */
+uint8_t sio_recv();
+/* syscall: write one byte into the current device */
+void sio_send(uint8_t value);
+
+/* read n bytes from the current device */
+char * sio_read(uint8_t *buffer, size_t n);
+/* write n bytes into the current device */
+int sio_write(const uint8_t *buffer, size_t n);
+
+#endif