aboutsummaryrefslogtreecommitdiff
path: root/sim/m68hc11/dv-m68hc11eepr.c
diff options
context:
space:
mode:
authorStephane Carrez <stcarrez@nerim.fr>2000-08-11 18:44:59 +0000
committerStephane Carrez <stcarrez@nerim.fr>2000-08-11 18:44:59 +0000
commit63348d048f2d0bdaa82071e72708c7345ba2a3bf (patch)
tree5685aee1a9fafe24cfae4efa3e730b05c901243f /sim/m68hc11/dv-m68hc11eepr.c
parent351aa9f6577b96f8e044432d2f04d2f6521c4873 (diff)
downloadgdb-63348d048f2d0bdaa82071e72708c7345ba2a3bf.zip
gdb-63348d048f2d0bdaa82071e72708c7345ba2a3bf.tar.gz
gdb-63348d048f2d0bdaa82071e72708c7345ba2a3bf.tar.bz2
Use address mapping levels for 68hc11 simulator (kill overlap hack)
Diffstat (limited to 'sim/m68hc11/dv-m68hc11eepr.c')
-rw-r--r--sim/m68hc11/dv-m68hc11eepr.c37
1 files changed, 22 insertions, 15 deletions
diff --git a/sim/m68hc11/dv-m68hc11eepr.c b/sim/m68hc11/dv-m68hc11eepr.c
index 1e26d85..df3b371 100644
--- a/sim/m68hc11/dv-m68hc11eepr.c
+++ b/sim/m68hc11/dv-m68hc11eepr.c
@@ -88,7 +88,8 @@ struct m68hc11eepr
address_word base_address; /* control register base */
int attach_space;
unsigned size;
-
+ int mapped;
+
/* Current state of the eeprom programing:
- eeprom_wmode indicates whether the EEPROM address and byte have
been latched.
@@ -205,8 +206,10 @@ attach_m68hc11eepr_regs (struct hw *me,
/* Attach the two IO registers that control the EEPROM.
The EEPROM is only attached at reset time because it may
be enabled/disabled by the EEON bit in the CONFIG register. */
- hw_attach_address (hw_parent (me), 0, io_map, M6811_PPROG, 1, me);
- hw_attach_address (hw_parent (me), 0, io_map, M6811_CONFIG, 1, me);
+ hw_attach_address (hw_parent (me), M6811_IO_LEVEL,
+ io_map, M6811_PPROG, 1, me);
+ hw_attach_address (hw_parent (me), M6811_IO_LEVEL,
+ io_map, M6811_CONFIG, 1, me);
if (hw_find_property (me, "file") == NULL)
controller->file_name = "m6811.eeprom";
@@ -218,7 +221,8 @@ attach_m68hc11eepr_regs (struct hw *me,
controller->eeprom = (char*) malloc (attach_size + 1);
controller->eeprom_min_cycles = 10000;
controller->size = attach_size + 1;
-
+ controller->mapped = 0;
+
m6811eepr_memory_rw (controller, O_RDONLY);
}
@@ -267,19 +271,23 @@ m68hc11eepr_port_event (struct hw *me,
see Motorola spec). */
if (cpu->ios[M6811_CONFIG] & M6811_EEON)
{
- hw_attach_address (hw_parent (me), 0,
- controller->attach_space,
- controller->base_address,
- controller->size - 1,
- me);
+ if (controller->mapped)
+ hw_attach_address (hw_parent (me), M6811_EEPROM_LEVEL,
+ controller->attach_space,
+ controller->base_address,
+ controller->size - 1,
+ me);
+ controller->mapped = 0;
}
else
{
- hw_detach_address (hw_parent (me), 0,
- controller->attach_space,
- controller->base_address,
- controller->size - 1,
- me);
+ if (!controller->mapped)
+ hw_detach_address (hw_parent (me), M6811_EEPROM_LEVEL,
+ controller->attach_space,
+ controller->base_address,
+ controller->size - 1,
+ me);
+ controller->mapped = 1;
}
break;
}
@@ -297,7 +305,6 @@ m68hc11eepr_finish (struct hw *me)
struct m68hc11eepr *controller;
controller = HW_ZALLOC (me, struct m68hc11eepr);
- me->overlap_mode_hw = 1;
set_hw_data (me, controller);
set_hw_io_read_buffer (me, m68hc11eepr_io_read_buffer);
set_hw_io_write_buffer (me, m68hc11eepr_io_write_buffer);