Previous 15994 Revisions Next

r2336 Tuesday 8th April, 2008 at 17:50:50 UTC by Wilbert Pol
[AT/BEBOX/IP22] Removed hardcoded dependency on a pit8253 device from the 8042kbdc code. The data is now retrieved by a callback in each driver.
[src/emu/machine]8042kbdc.c 8042kbdc.h
[src/mess/drivers]ip22.c
[src/mess/machine]at.c bebox.c

src/emu/machine/8042kbdc.c
r2335r2336
179179
180180#include "machine/pckeybrd.h"
181181#include "machine/8042kbdc.h"
182#include "machine/pit8253.h"
183182#include "machine/pcshare.h"
184183
185184#ifdef MESS
r2335r2336
213212   kbdc8042_type_t type;
214213   void (*set_gate_a20)(int a20);
215214   void (*keyboard_interrupt)(int state);
215   int (*get_out2)(running_machine *machine);
216216
217217   UINT8 inport, outport, data, command;
218218
r2335r2336
276276   kbdc8042.type = intf->type;
277277   kbdc8042.set_gate_a20 = intf->set_gate_a20;
278278   kbdc8042.keyboard_interrupt = intf->keyboard_interrupt;
279   kbdc8042.get_out2 = intf->get_out2;
279280
280281   /* ibmat bios wants 0x20 set! (keyboard locked when not set) 0x80 */
281282   kbdc8042.inport = 0xa0;
r2335r2336
391392      break;
392393
393394   case 2:
394      if (pit8253_get_output(0, 2))
395      if (kbdc8042.get_out2(machine))
395396         data |= 0x20;
396397      else
397398         data &= ~0x20;
src/emu/machine/8042kbdc.h
r2335r2336
2323   kbdc8042_type_t type;
2424   void (*set_gate_a20)(int a20);
2525   void (*keyboard_interrupt)(int state);
26   int (*get_out2)(running_machine *machine);
2627};
2728
2829
src/mess/machine/at.c
r2335r2336
231231};
232232
233233
234static int at_get_out2(running_machine *machine) {
235   return pit8253_get_output((device_config*)device_list_find_by_tag( machine->config->devicelist, PIT8254, "at_pit8254" ), 2 );
236}
237
238
234239DRIVER_INIT( atcga )
235240{
236241   static const struct kbdc8042_interface at8042 =
237242   {
238      KBDC8042_STANDARD, at_set_gate_a20, at_keyboard_interrupt
243      KBDC8042_STANDARD, at_set_gate_a20, at_keyboard_interrupt, at_get_out2
239244   };
240245   init_at_common(&at8042);
241246}
r2335r2336
246251{
247252   static const struct kbdc8042_interface at8042 =
248253   {
249      KBDC8042_AT386, at_set_gate_a20, at_keyboard_interrupt
254      KBDC8042_AT386, at_set_gate_a20, at_keyboard_interrupt, at_get_out2
250255   };
251256   init_at_common(&at8042);
252257}
r2335r2336
296301{
297302   static const struct kbdc8042_interface at8042 =
298303   {
299      KBDC8042_STANDARD, at_set_gate_a20, at_keyboard_interrupt
304      KBDC8042_STANDARD, at_set_gate_a20, at_keyboard_interrupt, at_get_out2
300305   };
301306
302307   init_at_common(&at8042);
r2335r2336
310315{
311316   static const struct kbdc8042_interface at8042 =
312317   {
313      KBDC8042_PS2, at_set_gate_a20, at_keyboard_interrupt
318      KBDC8042_PS2, at_set_gate_a20, at_keyboard_interrupt, at_get_out2
314319   };
315320   init_at_common(&at8042);
316321   pc_turbo_setup(0, 3, 0x02, 4.77/12, 1);
src/mess/machine/bebox.c
r2335r2336
799799   pic8259_set_irq_line(0, 1, state);
800800}
801801
802static int bebox_get_out2(running_machine *machine) {
803   return pit8253_get_output((device_config*)device_list_find_by_tag( machine->config->devicelist, PIT8254, "pit8254" ), 2 );
804}
802805
803806static const struct kbdc8042_interface bebox_8042_interface =
804807{
805808   KBDC8042_STANDARD,
806809   NULL,
807   bebox_keyboard_interrupt
810   bebox_keyboard_interrupt,
811   bebox_get_out2
808812};
809813
810814
src/mess/drivers/ip22.c
r2335r2336
14431443   wd33c93_exit(&scsi_intf);
14441444}
14451445
1446static int ip22_get_out2(running_machine *machine) {
1447   return pit8253_get_output((device_config*)device_list_find_by_tag( machine->config->devicelist, PIT8254, "pit8254" ), 2 );
1448}
1449
14461450static DRIVER_INIT( ip225015 )
14471451{
14481452   static const struct kbdc8042_interface at8042 =
14491453   {
1450      KBDC8042_STANDARD, NULL, NULL
1454      KBDC8042_STANDARD, NULL, NULL, ip22_get_out2
14511455   };
14521456
14531457   // IP22 uses 2 pieces of PC-compatible hardware: the 8042 PS/2 keyboard/mouse

Previous 15994 Revisions Next


© 1998-2018 The MESS Team