src/emu/devcb.c
| r4225 | r4226 | |
| 98 | 98 | (*resolved->real.writedevice)(resolved->realtarget, 0, state); |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | static WRITE_LINE_DEVICE_HANDLER( trampoline_writecpu_to_write_line ) |
| 102 | { |
| 103 | const devcb_resolved_write_line *resolved = (const devcb_resolved_write_line *)device; |
| 104 | const device_config *cpu = resolved->realtarget; |
| 105 | cpu_set_input_line(cpu, resolved->real.writeline, state ? ASSERT_LINE : CLEAR_LINE); |
| 106 | } |
| 107 | |
| 101 | 108 | void devcb_resolve_write_line(devcb_resolved_write_line *resolved, const devcb_write_line *config, const device_config *device) |
| 102 | 109 | { |
| 103 | 110 | /* reset the resolved structure */ |
| r4225 | r4226 | |
| 119 | 126 | resolved->real.writespace = config->writespace; |
| 120 | 127 | } |
| 121 | 128 | |
| 129 | /* cpu line handlers */ |
| 130 | else if (config->type >= DEVCB_TYPE_CPU_LINE(0) && config->type < DEVCB_TYPE_CPU_LINE(MAX_INPUT_LINES)) |
| 131 | { |
| 132 | FPTR line = (FPTR)config->type - (FPTR)DEVCB_TYPE_CPU_LINE(0); |
| 133 | const device_config *cpu = cputag_get_cpu(device->machine, config->tag); |
| 134 | |
| 135 | if (cpu == NULL) |
| 136 | fatalerror("devcb_resolve_write_line: unable to find CPU '%s' (requested by %s '%s')", config->tag, device_get_name(device), device->tag); |
| 137 | resolved->target = resolved; |
| 138 | resolved->write = trampoline_writecpu_to_write_line; |
| 139 | resolved->realtarget = cpu; |
| 140 | resolved->real.writeline = (int) line; |
| 141 | } |
| 142 | |
| 122 | 143 | /* device handlers */ |
| 123 | 144 | else if (config->type != NULL && (config->writeline != NULL || config->writedevice != NULL)) |
| 124 | 145 | { |
src/emu/devcb.h
| r4225 | r4226 | |
| 24 | 24 | The adapted callback types supported are: |
| 25 | 25 | |
| 26 | 26 | input port (port) |
| 27 | cpu input line (cpu input line) |
| 27 | 28 | read_line_device_func: (device) |
| 28 | 29 | write_line_device_func: (device, data) |
| 29 | 30 | read8_device_func: (device, offset) |
| r4225 | r4226 | |
| 49 | 50 | #define DEVCB_TYPE_SELF ((device_type)1) |
| 50 | 51 | #define DEVCB_TYPE_INPUT ((device_type)2) |
| 51 | 52 | #define DEVCB_TYPE_MEMORY(space) ((device_type)(4 + (space))) |
| 53 | #define DEVCB_TYPE_CPU_LINE(line) ((device_type)(4 + ADDRESS_SPACES + (line))) |
| 52 | 54 | |
| 53 | 55 | |
| 54 | 56 | |
| r4225 | r4226 | |
| 72 | 74 | /* read handlers for an I/O port by tag */ |
| 73 | 75 | #define DEVCB_INPUT_PORT(tag) { DEVCB_TYPE_INPUT, (tag), NULL, NULL, NULL } |
| 74 | 76 | |
| 77 | /* write handlers for a CPU input line */ |
| 78 | #define DEVCB_CPU_INPUT_LINE(tag,line) { DEVCB_TYPE_CPU_LINE(line), (tag), NULL, NULL, NULL } |
| 75 | 79 | |
| 80 | |
| 76 | 81 | /* macros for defining read_line/write_line functions */ |
| 77 | 82 | #define READ_LINE_DEVICE_HANDLER(name) int name(ATTR_UNUSED const device_config *device) |
| 78 | 83 | #define WRITE_LINE_DEVICE_HANDLER(name) void name(ATTR_UNUSED const device_config *device, ATTR_UNUSED int state) |
| r4225 | r4226 | |
| 134 | 139 | { |
| 135 | 140 | write8_device_func writedevice; |
| 136 | 141 | write8_space_func writespace; |
| 142 | int writeline; |
| 137 | 143 | } real; /* real write function for stubs */ |
| 138 | 144 | }; |
| 139 | 145 | |