summaryrefslogtreecommitdiffstats
path: root/sw/z80/drivers/pio.c
diff options
context:
space:
mode:
authorNao Pross <naopross@thearcway.org>2017-10-05 16:09:59 +0200
committerNao Pross <naopross@thearcway.org>2017-10-05 16:09:59 +0200
commiteb169ea5a89909b90794e0388f89d6d372754e46 (patch)
treece7e826fd2dd4e4248cb4f1fbf8ce2885c943f49 /sw/z80/drivers/pio.c
parentTest units are now in their own folder 'z80_test', add programmer cli interface (diff)
downloadz80uPC-eb169ea5a89909b90794e0388f89d6d372754e46.tar.gz
z80uPC-eb169ea5a89909b90794e0388f89d6d372754e46.zip
Move test units to z80/tests, and drivers are now statically linked
Makefiles for the test units were getting messier, so now drivers (that need to be tested) are statically compiled in their own folder under z80/drivers. The kernel makefile and is now broken since everything has been moved.
Diffstat (limited to '')
-rw-r--r--sw/z80/drivers/pio.c (renamed from sw/z80/kernel/drivers/pio.c)14
1 files changed, 12 insertions, 2 deletions
diff --git a/sw/z80/kernel/drivers/pio.c b/sw/z80/drivers/pio.c
index 4321fb8..bdbe1c3 100644
--- a/sw/z80/kernel/drivers/pio.c
+++ b/sw/z80/drivers/pio.c
@@ -1,4 +1,4 @@
-#include "drivers/pio.h"
+#include "pio.h"
static uint8_t *pio_port = (uint8_t *) ADDR_DEV_PIO;
static uint8_t *pio_ctrl = (uint8_t *) (ADDR_DEV_PIO + 2);
@@ -34,7 +34,17 @@ void pio_set_interrupts(int port, int control)
void pio_set_interrupts_mask(int port, int control, uint8_t mask)
{
// 0x17 is a control sequence to set interrupts
- // and to interpret the next byte as a mask
+ // AND interpret the next byte as a bitmask
_pio_control(port, (control | 0x17));
_pio_control(port, mask);
}
+
+uint8_t pio_read(int port)
+{
+ return *(pio_port + port);
+}
+
+void pio_write(int port, uint8_t data)
+{
+ _pio_data(port, data);
+}