Mercurial > repos > blastem
comparison io.h @ 2025:e7a516f08cec
Implement serial IO, a generic serial device type and external interrupts
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Wed, 10 Feb 2021 20:12:16 -0800 |
parents | d6c403135e64 |
children | 0f54a898db03 |
comparison
equal
deleted
inserted
replaced
2022:380bc5d4a2cf | 2025:e7a516f08cec |
---|---|
22 IO_JUSTIFIER, | 22 IO_JUSTIFIER, |
23 IO_SEGA_MULTI, | 23 IO_SEGA_MULTI, |
24 IO_EA_MULTI_A, | 24 IO_EA_MULTI_A, |
25 IO_EA_MULTI_B, | 25 IO_EA_MULTI_B, |
26 IO_SEGA_PARALLEL, | 26 IO_SEGA_PARALLEL, |
27 IO_GENERIC | 27 IO_GENERIC, |
28 IO_GENERIC_SERIAL | |
28 }; | 29 }; |
29 | 30 |
30 typedef struct { | 31 typedef struct { |
31 union { | 32 union { |
32 struct { | 33 struct { |
60 } device; | 61 } device; |
61 uint8_t output; | 62 uint8_t output; |
62 uint8_t control; | 63 uint8_t control; |
63 uint8_t input[3]; | 64 uint8_t input[3]; |
64 uint32_t slow_rise_start[8]; | 65 uint32_t slow_rise_start[8]; |
66 uint32_t serial_cycle; | |
67 uint32_t serial_divider; | |
68 uint32_t last_poll_cycle; | |
69 uint32_t transmit_end; | |
70 uint32_t receive_end; | |
65 uint8_t serial_out; | 71 uint8_t serial_out; |
72 uint8_t serial_transmitting; | |
66 uint8_t serial_in; | 73 uint8_t serial_in; |
74 uint8_t serial_receiving; | |
67 uint8_t serial_ctrl; | 75 uint8_t serial_ctrl; |
68 uint8_t device_type; | 76 uint8_t device_type; |
69 } io_port; | 77 } io_port; |
70 | 78 |
71 typedef struct { | 79 typedef struct { |
104 PSEUDO_BUTTON_MOTION=0xFF | 112 PSEUDO_BUTTON_MOTION=0xFF |
105 }; | 113 }; |
106 | 114 |
107 void setup_io_devices(tern_node * config, rom_info *rom, sega_io *io); | 115 void setup_io_devices(tern_node * config, rom_info *rom, sega_io *io); |
108 void io_adjust_cycles(io_port * pad, uint32_t current_cycle, uint32_t deduction); | 116 void io_adjust_cycles(io_port * pad, uint32_t current_cycle, uint32_t deduction); |
117 void io_run(io_port *port, uint32_t current_cycle); | |
109 void io_control_write(io_port *port, uint8_t value, uint32_t current_cycle); | 118 void io_control_write(io_port *port, uint8_t value, uint32_t current_cycle); |
110 void io_data_write(io_port * pad, uint8_t value, uint32_t current_cycle); | 119 void io_data_write(io_port * pad, uint8_t value, uint32_t current_cycle); |
120 void io_tx_write(io_port *port, uint8_t value, uint32_t current_cycle); | |
121 void io_sctrl_write(io_port *port, uint8_t value, uint32_t current_cycle); | |
111 uint8_t io_data_read(io_port * pad, uint32_t current_cycle); | 122 uint8_t io_data_read(io_port * pad, uint32_t current_cycle); |
123 uint8_t io_rx_read(io_port * port, uint32_t current_cycle); | |
124 uint8_t io_sctrl_read(io_port *port, uint32_t current_cycle); | |
125 uint32_t io_next_interrupt(io_port *port, uint32_t current_cycle); | |
112 void io_serialize(io_port *port, serialize_buffer *buf); | 126 void io_serialize(io_port *port, serialize_buffer *buf); |
113 void io_deserialize(deserialize_buffer *buf, void *vport); | 127 void io_deserialize(deserialize_buffer *buf, void *vport); |
114 | 128 |
115 void io_port_gamepad_down(io_port *port, uint8_t button); | 129 void io_port_gamepad_down(io_port *port, uint8_t button); |
116 void io_port_gamepad_up(io_port *port, uint8_t button); | 130 void io_port_gamepad_up(io_port *port, uint8_t button); |