1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-11-20 17:58:06 +11:00
collapseos/emul/hw/rc2014/sio.h
Virgil Dupras 1195b0313b emul/rc2014: add support for Zilog SIO
Very very simplistic, but works with our driver.
2020-09-24 21:01:14 -04:00

28 lines
685 B
C

#include <stdint.h>
#include <stdbool.h>
/* Extremely simplified Zilog SIO */
typedef struct {
// Write registers WR7:0
uint8_t wr[7];
// Read registers RR2:0
uint8_t rr[2];
uint8_t rx;
uint8_t tx;
// Set to true when writing a byte while SIO is enabled and set back to
// false when sio_has_irq() is false.
bool in_int;
} SIO;
void sio_init(SIO *sio);
bool sio_has_irq(SIO *sio);
bool sio_hasrx(SIO *sio);
bool sio_hastx(SIO *sio);
uint8_t sio_read(SIO *sio);
void sio_write(SIO *sio, uint8_t val);
uint8_t sio_actl_rd(SIO *sio);
void sio_actl_wr(SIO *sio, uint8_t val);
uint8_t sio_adata_rd(SIO *sio);
void sio_adata_wr(SIO *sio, uint8_t val);