summaryrefslogtreecommitdiffstats
path: root/sw/z80/kernel/pio.c
diff options
context:
space:
mode:
authorNao Pross <naopross@thearcway.org>2017-06-10 17:47:36 +0200
committerNao Pross <naopross@thearcway.org>2017-06-10 17:47:36 +0200
commitb96b0d6c00ea72895582ec14f9c7dccd3fe7062a (patch)
tree1d92b474bfd2aaf7d6cc951b7ab55cfc2f0d435e /sw/z80/kernel/pio.c
parentadd serial interface and a few std library functions (diff)
downloadz80uPC-b96b0d6c00ea72895582ec14f9c7dccd3fe7062a.tar.gz
z80uPC-b96b0d6c00ea72895582ec14f9c7dccd3fe7062a.zip
add port interface header, api still to implement
fix for bug in usart.c, in function usart_write() that checked the trasmission_empty register at the wrong time causing it to overwrite the buffer.
Diffstat (limited to 'sw/z80/kernel/pio.c')
-rw-r--r--sw/z80/kernel/pio.c25
1 files changed, 7 insertions, 18 deletions
diff --git a/sw/z80/kernel/pio.c b/sw/z80/kernel/pio.c
index e8c7e24..4b9caee 100644
--- a/sw/z80/kernel/pio.c
+++ b/sw/z80/kernel/pio.c
@@ -1,29 +1,18 @@
#include "pio.h"
-static uint8_t *pio_port_a = (uint8_t *) ADDR_DEV_PIO;
-static uint8_t *pio_port_b = (uint8_t *) ADDR_DEV_PIO + 1;
-static uint8_t *pio_ctrl_a = (uint8_t *) ADDR_DEV_PIO + 2;
-static uint8_t *pio_ctrl_b = (uint8_t *) ADDR_DEV_PIO + 3;
+static uint8_t *pio_port = (uint8_t *) ADDR_DEV_PIO;
+static uint8_t *pio_ctrl = (uint8_t *) (ADDR_DEV_PIO + 2);
-void pio_data(int port, uint8_t data)
+void _pio_data(int port, uint8_t data)
{
- if (port == PIO_A)
- *pio_port_a = cmd;
- else
- *pio_port_b = cmd;
+ *(pio_port + port) = data;
}
-void pio_command(int port, uint8_t cmd)
+void _pio_command(int port, uint8_t cmd)
{
- if (port == PIO_A)
- *pio_ctrl_a = cmd;
- else
- *pio_ctrl_b = cmd;
+ *(pio_ctrl + port) = cmd;
}
-
-
-inline int pio_read_pin(int port, uint8_t pin)
+void pio_set_mode(int port, int mode)
{
-
}