diff options
author | Stephane Carrez <stcarrez@nerim.fr> | 2002-03-07 19:12:44 +0000 |
---|---|---|
committer | Stephane Carrez <stcarrez@nerim.fr> | 2002-03-07 19:12:44 +0000 |
commit | 827ec39a5a8af8821006d93978623dc1ababdac1 (patch) | |
tree | 7f3e2c7e8cad430e5fa9bccc996f55a8d1f5d942 /sim/m68hc11/dv-m68hc11tim.c | |
parent | 5abb9efa086f5bd9eeacf3911d0b528cc522b870 (diff) | |
download | gdb-827ec39a5a8af8821006d93978623dc1ababdac1.zip gdb-827ec39a5a8af8821006d93978623dc1ababdac1.tar.gz gdb-827ec39a5a8af8821006d93978623dc1ababdac1.tar.bz2 |
* interp.c (sim_hw_configure): Save the HW cpu pointer in the
cpu struct.
(sim_hw_configure): Connect the capture input/output events.
* sim-main.h (_sim_cpu): New member hw_cpu.
(m68hc11cpu_set_oscillator): Declare.
(m68hc11cpu_clear_oscillator): Declare.
(m68hc11cpu_set_port): Declare.
* dv-m68hc11.c (m68hc11_options): New for oscillator commands.
(m68hc11cpu_ports): New input ports and output ports to reflect
the HC11 IOs.
(m68hc11_delete): Cleanup any running oscillator.
(attach_m68hc11_regs): Create the input oscillators.
(make_oscillator): New function.
(find_oscillator): New function.
(oscillator_handler): New function.
(reset_oscillators): New function.
(m68hc11cpu_port_event): Handle the new input ports.
(m68hc11cpu_set_oscillator): New function.
(m68hc11cpu_clear_oscillator): New function.
(get_frequency): New function.
(m68hc11_option_handler): New function.
(m68hc11cpu_set_port): New function.
(m68hc11cpu_io_write): Post the port output events.
* dv-m68hc11spi.c (set_bit_port): Use m68hc11cpu_set_port to set
the output port value.
* dv-m68hc11tim.c (m68hc11tim_port_event): Handle CAPTURE event
by latching the TCNT value in the register.
Diffstat (limited to 'sim/m68hc11/dv-m68hc11tim.c')
-rw-r--r-- | sim/m68hc11/dv-m68hc11tim.c | 36 |
1 files changed, 31 insertions, 5 deletions
diff --git a/sim/m68hc11/dv-m68hc11tim.c b/sim/m68hc11/dv-m68hc11tim.c index 144ae4b..9b0f338 100644 --- a/sim/m68hc11/dv-m68hc11tim.c +++ b/sim/m68hc11/dv-m68hc11tim.c @@ -1,5 +1,5 @@ /* dv-m68hc11tim.c -- Simulation of the 68HC11 timer devices. - Copyright (C) 1999, 2000 Free Software Foundation, Inc. + Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc. Written by Stephane Carrez (stcarrez@worldnet.fr) (From a driver model Contributed by Cygnus Solutions.) @@ -50,6 +50,12 @@ Reset the timer device. This port must be connected to the cpu-reset output port. + capture (input) + + Input capture. This port must be connected to the input + captures. It latches the current TCNT free running counter + into one of the three input capture registers. + */ @@ -58,13 +64,15 @@ enum { - RESET_PORT + RESET_PORT, + CAPTURE }; static const struct hw_port_descriptor m68hc11tim_ports[] = { - { "reset", RESET_PORT, 0, input_port, }, + { "reset", RESET_PORT, 0, input_port, }, + { "capture", CAPTURE, 0, input_port, }, { NULL, }, }; @@ -137,7 +145,6 @@ m68hc11tim_finish (struct hw *me) } - /* An event arrives on an interrupt port. */ static void @@ -151,7 +158,8 @@ m68hc11tim_port_event (struct hw *me, struct m68hc11tim *controller; sim_cpu *cpu; unsigned8 val; - + unsigned16 tcnt; + controller = hw_data (me); sd = hw_system (me); cpu = STATE_CPU (sd, 0); @@ -197,6 +205,24 @@ m68hc11tim_port_event (struct hw *me, break; } + case CAPTURE: + tcnt = (uint16) ((cpu->cpu_absolute_cycle - controller->tcnt_adjust) + / controller->clock_prescaler); + switch (level) + { + case M6811_TIC1: + case M6811_TIC2: + case M6811_TIC3: + cpu->ios[level] = tcnt >> 8; + cpu->ios[level + 1] = tcnt; + break; + + default: + hw_abort (me, "Invalid event parameter %d", level); + break; + } + break; + default: hw_abort (me, "Event on unknown port %d", my_port); break; |