1 |
/* |
/* |
2 |
* Copyright (C) 2003-2005 Anders Gavare. All rights reserved. |
* Copyright (C) 2003-2006 Anders Gavare. All rights reserved. |
3 |
* |
* |
4 |
* Redistribution and use in source and binary forms, with or without |
* Redistribution and use in source and binary forms, with or without |
5 |
* modification, are permitted provided that the following conditions are met: |
* modification, are permitted provided that the following conditions are met: |
25 |
* SUCH DAMAGE. |
* SUCH DAMAGE. |
26 |
* |
* |
27 |
* |
* |
28 |
* $Id: dev_pckbc.c,v 1.60 2005/11/25 04:25:26 debug Exp $ |
* $Id: dev_pckbc.c,v 1.64 2006/01/01 13:17:16 debug Exp $ |
29 |
* |
* |
30 |
* Standard 8042 PC keyboard controller (and a 8242WB PS2 keyboard/mouse |
* Standard 8042 PC keyboard controller (and a 8242WB PS2 keyboard/mouse |
31 |
* controller), including the 8048 keyboard chip. |
* controller), including the 8048 keyboard chip. |
582 |
/* |
/* |
583 |
* dev_pckbc_access(): |
* dev_pckbc_access(): |
584 |
*/ |
*/ |
585 |
int dev_pckbc_access(struct cpu *cpu, struct memory *mem, |
DEVICE_ACCESS(pckbc) |
|
uint64_t relative_addr, unsigned char *data, size_t len, |
|
|
int writeflag, void *extra) |
|
586 |
{ |
{ |
587 |
uint64_t idata = 0, odata = 0; |
uint64_t idata = 0, odata = 0; |
588 |
int i, port_nr = 0; |
int port_nr = 0; |
589 |
|
size_t i; |
590 |
struct pckbc_data *d = extra; |
struct pckbc_data *d = extra; |
591 |
|
|
592 |
if (writeflag == MEM_WRITE) |
if (writeflag == MEM_WRITE) |
882 |
memset(d, 0, sizeof(struct pckbc_data)); |
memset(d, 0, sizeof(struct pckbc_data)); |
883 |
|
|
884 |
if (type == PCKBC_8242) |
if (type == PCKBC_8242) |
885 |
len = 0x40; |
len = 0x18; |
886 |
|
|
887 |
if (type == PCKBC_JAZZ) { |
if (type == PCKBC_JAZZ) { |
888 |
type = PCKBC_8042; |
type = PCKBC_8042; |
894 |
d->mouse_irqnr = mouse_irqnr; |
d->mouse_irqnr = mouse_irqnr; |
895 |
d->in_use = in_use; |
d->in_use = in_use; |
896 |
d->pc_style_flag = pc_style_flag; |
d->pc_style_flag = pc_style_flag; |
|
if (d->in_use) |
|
|
d->console_handle = |
|
|
console_start_slave_inputonly(machine, "pckbc"); |
|
897 |
d->translation_table = 2; |
d->translation_table = 2; |
898 |
d->rx_int_enable = 1; |
d->rx_int_enable = 1; |
899 |
d->output_byte = 0x02; /* A20 enable on PCs */ |
d->output_byte = 0x02; /* A20 enable on PCs */ |
900 |
|
|
901 |
|
d->console_handle = console_start_slave_inputonly( |
902 |
|
machine, "pckbc", d->in_use); |
903 |
|
|
904 |
memory_device_register(mem, "pckbc", baseaddr, |
memory_device_register(mem, "pckbc", baseaddr, |
905 |
len, dev_pckbc_access, d, DM_DEFAULT, NULL); |
len, dev_pckbc_access, d, DM_DEFAULT, NULL); |
906 |
machine_add_tickfunction(machine, dev_pckbc_tick, d, PCKBC_TICKSHIFT); |
machine_add_tickfunction(machine, dev_pckbc_tick, d, PCKBC_TICKSHIFT); |