trunk/src/emu/diserial.c
| r24023 | r24024 | |
| 40 | 40 | } |
| 41 | 41 | m_rcv_clock = NULL; |
| 42 | 42 | m_tra_clock = NULL; |
| 43 | | m_tra_baud = 0; |
| 44 | | m_rcv_baud = 0; |
| 43 | m_tra_rate = attotime::never; |
| 44 | m_rcv_rate = attotime::never; |
| 45 | 45 | m_tra_flags = 0; |
| 46 | 46 | m_rcv_register_data = 0x8000; |
| 47 | 47 | m_rcv_bit_count = 0; |
| r24023 | r24024 | |
| 67 | 67 | |
| 68 | 68 | void device_serial_interface::set_rcv_rate(int baud) |
| 69 | 69 | { |
| 70 | | m_rcv_baud = baud; |
| 70 | m_rcv_rate = baud ? attotime::from_hz(baud) : attotime::never; |
| 71 | 71 | receive_register_reset(); |
| 72 | 72 | m_rcv_clock->adjust(attotime::never); |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | void device_serial_interface::set_tra_rate(int baud) |
| 76 | 76 | { |
| 77 | | m_tra_baud = baud; |
| 77 | m_tra_rate = baud ? attotime::from_hz(baud) : attotime::never; |
| 78 | 78 | transmit_register_reset(); |
| 79 | 79 | m_tra_clock->adjust(attotime::never); |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | void device_serial_interface::set_rcv_rate(attotime rate) |
| 83 | { |
| 84 | m_rcv_rate = rate; |
| 85 | receive_register_reset(); |
| 86 | m_rcv_clock->adjust(attotime::never); |
| 87 | } |
| 88 | |
| 89 | void device_serial_interface::set_tra_rate(attotime rate) |
| 90 | { |
| 91 | m_tra_rate = rate; |
| 92 | transmit_register_reset(); |
| 93 | m_tra_clock->adjust(attotime::never); |
| 94 | } |
| 95 | |
| 96 | void device_serial_interface::set_rcv_rate(UINT32 clock, int div) |
| 97 | { |
| 98 | m_rcv_rate = attotime::from_hz(clock) / div; |
| 99 | receive_register_reset(); |
| 100 | m_rcv_clock->adjust(attotime::never); |
| 101 | } |
| 102 | |
| 103 | void device_serial_interface::set_tra_rate(UINT32 clock, int div) |
| 104 | { |
| 105 | m_tra_rate = attotime::from_hz(clock) / div; |
| 106 | transmit_register_reset(); |
| 107 | m_tra_clock->adjust(attotime::never); |
| 108 | } |
| 109 | |
| 82 | 110 | void device_serial_interface::tra_clock() |
| 83 | 111 | { |
| 84 | 112 | tra_callback(); |
| r24023 | r24024 | |
| 131 | 159 | m_rcv_flags |= RECEIVE_REGISTER_WAITING_FOR_START_BIT; |
| 132 | 160 | } |
| 133 | 161 | |
| 134 | | UINT8 device_serial_interface::check_for_start(UINT8 bit) |
| 162 | WRITE_LINE_MEMBER(device_serial_interface::rx_w) |
| 135 | 163 | { |
| 136 | | m_rcv_line = bit; |
| 164 | m_rcv_line = state; |
| 137 | 165 | if(m_rcv_flags & RECEIVE_REGISTER_SYNCHRONISED) |
| 138 | | return 0; |
| 139 | | receive_register_update_bit(bit); |
| 166 | return; |
| 167 | receive_register_update_bit(state); |
| 140 | 168 | if(m_rcv_flags & RECEIVE_REGISTER_SYNCHRONISED) |
| 141 | 169 | { |
| 142 | | if(m_rcv_clock && m_rcv_baud) |
| 170 | if(m_rcv_clock && !(m_rcv_rate.is_never())) |
| 143 | 171 | // make start delay just a bit longer to make sure we are called after the sender |
| 144 | | m_rcv_clock->adjust(attotime::from_hz((m_rcv_baud*2)/3), 0, attotime::from_hz(m_rcv_baud)); |
| 145 | | return 1; |
| 172 | m_rcv_clock->adjust(((m_rcv_rate*3)/2), 0, m_rcv_rate); |
| 146 | 173 | } |
| 147 | | return 0; |
| 174 | return; |
| 148 | 175 | } |
| 149 | 176 | |
| 150 | 177 | /* this is generic code to be used in serial chip implementations */ |
| r24023 | r24024 | |
| 283 | 310 | int i; |
| 284 | 311 | unsigned char transmit_data; |
| 285 | 312 | |
| 286 | | if(m_tra_clock && m_tra_baud) |
| 287 | | m_tra_clock->adjust(attotime::from_hz(m_tra_baud), 0, attotime::from_hz(m_tra_baud)); |
| 313 | if(m_tra_clock && !m_tra_rate.is_never()) |
| 314 | m_tra_clock->adjust(m_tra_rate, 0, m_tra_rate); |
| 288 | 315 | |
| 289 | 316 | m_tra_bit_count_transmitted = 0; |
| 290 | 317 | m_tra_bit_count = 0; |
trunk/src/emu/diserial.h
| r24023 | r24024 | |
| 91 | 91 | void receive_register_update_bit(int bit); |
| 92 | 92 | void receive_register_extract(); |
| 93 | 93 | |
| 94 | void set_rcv_rate(attotime baud); |
| 95 | void set_tra_rate(attotime baud); |
| 96 | void set_rcv_rate(UINT32 clock, int div); |
| 97 | void set_tra_rate(UINT32 clock, int div); |
| 94 | 98 | void set_rcv_rate(int baud); |
| 95 | 99 | void set_tra_rate(int baud); |
| 96 | 100 | void tra_clock(); |
| r24023 | r24024 | |
| 117 | 121 | void set_other_connection(device_serial_interface *other_connection); |
| 118 | 122 | |
| 119 | 123 | void connect(device_serial_interface *other_connection); |
| 120 | | UINT8 check_for_start(UINT8 bit); |
| 124 | DECLARE_WRITE_LINE_MEMBER(rx_w); |
| 121 | 125 | protected: |
| 122 | 126 | UINT8 m_input_state; |
| 123 | 127 | UINT8 m_connection_state; |
| r24023 | r24024 | |
| 166 | 170 | |
| 167 | 171 | emu_timer *m_rcv_clock; |
| 168 | 172 | emu_timer *m_tra_clock; |
| 169 | | int m_rcv_baud; |
| 170 | | int m_tra_baud; |
| 173 | attotime m_rcv_rate; |
| 174 | attotime m_tra_rate; |
| 171 | 175 | UINT8 m_rcv_line; |
| 172 | 176 | |
| 173 | 177 | device_serial_interface *m_other_connection; |
trunk/src/mess/drivers/ibmpc.c
| r24023 | r24024 | |
| 309 | 309 | |
| 310 | 310 | MCFG_ISA8_SLOT_ADD("mb:isa", "isa1", pc_isa8_cards, "cga", false) |
| 311 | 311 | MCFG_ISA8_SLOT_ADD("mb:isa", "isa2", pc_isa8_cards, "com", false) |
| 312 | | MCFG_ISA8_SLOT_ADD("mb:isa", "isa3", pc_isa8_cards, "fdc", false) |
| 312 | MCFG_ISA8_SLOT_ADD("mb:isa", "isa3", pc_isa8_cards, "fdc_xt", false) |
| 313 | 313 | MCFG_ISA8_SLOT_ADD("mb:isa", "isa4", pc_isa8_cards, "hdc", false) |
| 314 | 314 | MCFG_ISA8_SLOT_ADD("mb:isa", "isa5", pc_isa8_cards, NULL, false) |
| 315 | 315 | |
| r24023 | r24024 | |
| 343 | 343 | |
| 344 | 344 | MCFG_ISA8_SLOT_ADD("mb:isa", "isa1", pc_isa8_cards, "cga", false) |
| 345 | 345 | MCFG_ISA8_SLOT_ADD("mb:isa", "isa2", pc_isa8_cards, "com", false) |
| 346 | | MCFG_ISA8_SLOT_ADD("mb:isa", "isa3", pc_isa8_cards, "fdc", false) |
| 346 | MCFG_ISA8_SLOT_ADD("mb:isa", "isa3", pc_isa8_cards, "fdc_xt", false) |
| 347 | 347 | MCFG_ISA8_SLOT_ADD("mb:isa", "isa4", pc_isa8_cards, "hdc", false) |
| 348 | 348 | MCFG_ISA8_SLOT_ADD("mb:isa", "isa5", pc_isa8_cards, NULL, false) |
| 349 | 349 | MCFG_ISA8_SLOT_ADD("mb:isa", "isa6", pc_isa8_cards, NULL, false) |
trunk/src/mess/machine/keyboard.h
| r24023 | r24024 | |
| 85 | 85 | serial_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 86 | 86 | serial_keyboard_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source); |
| 87 | 87 | |
| 88 | | DECLARE_WRITE_LINE_MEMBER(rx_w) { m_tbit = state; check_for_start(state); } |
| 88 | DECLARE_WRITE_LINE_MEMBER(rx_w) { m_tbit = state; device_serial_interface::rx_w(state); } |
| 89 | 89 | DECLARE_READ_LINE_MEMBER(tx_r); |
| 90 | 90 | virtual ioport_constructor device_input_ports() const; |
| 91 | 91 | |