summaryrefslogtreecommitdiffstats
path: root/sw/z80/kernel/include/sio.h
diff options
context:
space:
mode:
Diffstat (limited to 'sw/z80/kernel/include/sio.h')
-rw-r--r--sw/z80/kernel/include/sio.h48
1 files changed, 21 insertions, 27 deletions
diff --git a/sw/z80/kernel/include/sio.h b/sw/z80/kernel/include/sio.h
index 9dc47f6..276b99c 100644
--- a/sw/z80/kernel/include/sio.h
+++ b/sw/z80/kernel/include/sio.h
@@ -1,10 +1,9 @@
-#ifndef SIO_H
-#define SIO_H
+#ifndef __SIO_H__
+#define __SIO_H__
#include "types.h"
-#define SIO_ROM 0x0
-
+#define SIO_PORT_0 0x0
#define SIO_PORT_1 0x1
#define SIO_PORT_2 0x2
#define SIO_PORT_3 0x3
@@ -13,37 +12,32 @@
#define SIO_PORT_6 0x6
#define SIO_PORT_7 0x7
-/* initialize serial interface */
-void sio_init();
+/* current port in use */
+extern uint8_t sio_port;
-/* 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);
+/* current seek in the device */
+extern devsize_t sio_seek;
-/* set current device in use */
-void sio_set_dev(uint8_t dev);
-/* get current device in use */
-uint8_t sio_cdev();
+struct dev_buffer
+{
+ // TODO, bytes needed to the device buffer interface
+};
-/* get pointer in given device */
-uint16_t sio_tellg(uint8_t dev);
-/* get pointer in current device */
-uint16_t sio_ctellg();
+/* points to the buffers mapped in the I/O space */
+/* to be defined precisely in assembly */
+extern volatile struct dev_buffer sio_buffers[8];
-/* 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);
+/* initialize serial interface */
+void sio_init();
/* 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);
+/* read n bytes from the current port */
+size_t sio_read(void *buffer, size_t n);
+/* write n bytes into the current port */
+int8_t sio_write(const void *buffer, size_t n);
-#endif
+#endif // __SIO_H__