/* dv-m68hc11sio.c -- Simulation of the 68HC11 serial device.
- Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
Written by Stephane Carrez (stcarrez@worldnet.fr)
(From a driver model Contributed by Cygnus Solutions.)
SIM_DESC sd;
struct m68hc11sio *controller;
sim_cpu *cpu;
- int check_interrupt = 0;
controller = hw_data (me);
sd = hw_system (me);
cpu->ios[M6811_SCSR] |= M6811_TDRE;
cpu->ios[M6811_SCSR] |= M6811_TC;
- /* Transmitter is enabled and we have something to sent. */
+ /* Transmitter is enabled and we have something to send. */
if ((cpu->ios[M6811_SCCR2] & M6811_TE) && controller->tx_has_char)
{
cpu->ios[M6811_SCSR] &= ~M6811_TDRE;
cpu->ios[M6811_SCSR] &= ~M6811_TC;
controller->tx_has_char = 0;
- check_interrupt = 1;
switch (controller->backend)
{
case sio_tcp:
NULL);
}
- if (check_interrupt)
- interrupts_update_pending (&cpu->cpu_interrupts);
+ interrupts_update_pending (&cpu->cpu_interrupts);
}
/* Descriptions of the SIO I/O ports. These descriptions are only used to
/* interrupts.c -- 68HC11 Interrupts Emulation
- Copyright 1999, 2000 Free Software Foundation, Inc.
+ Copyright 1999, 2000, 2001 Free Software Foundation, Inc.
Written by Stephane Carrez (stcarrez@worldnet.fr)
This file is part of GDB, GAS, and the GNU binutils.
interrupts->nb_interrupts_raised = 0;
interrupts->min_mask_cycles = CYCLES_MAX;
interrupts->max_mask_cycles = 0;
+ interrupts->last_mask_cycles = 0;
interrupts->start_mask_cycle = -1;
interrupts->xirq_start_mask_cycle = -1;
interrupts->xirq_max_mask_cycles = 0;
interrupts->xirq_min_mask_cycles = CYCLES_MAX;
+ interrupts->xirq_last_mask_cycles = 0;
for (i = 0; i < M6811_INT_NUMBER; i++)
{
{
int i;
uint8 *ioregs;
+ unsigned long clear_mask;
+ unsigned long set_mask;
+ clear_mask = 0;
+ set_mask = 0;
ioregs = &interrupts->cpu->ios[0];
for (i = 0; i < TableSize(idefs); i++)
if (!(data & idef->enabled_mask))
{
/* Disable it. */
- interrupts->pending_mask &= ~(1 << idef->int_number);
+ clear_mask |= (1 << idef->int_number);
continue;
}
}
if (!(data & idef->int_mask))
{
/* Disable it. */
- interrupts->pending_mask &= ~(1 << idef->int_number);
+ clear_mask |= (1 << idef->int_number);
continue;
}
/* Ok, raise it. */
- interrupts->pending_mask |= (1 << idef->int_number);
+ set_mask |= (1 << idef->int_number);
}
+
+ /* Some interrupts are shared (M6811_INT_SCI) so clear
+ the interrupts before setting the new ones. */
+ interrupts->pending_mask &= ~clear_mask;
+ interrupts->pending_mask |= set_mask;
}
if (t > interrupts->max_mask_cycles)
interrupts->max_mask_cycles = t;
interrupts->start_mask_cycle = -1;
+ interrupts->last_mask_cycles = t;
}
if (ccr & M6811_X_BIT)
{
if (t > interrupts->xirq_max_mask_cycles)
interrupts->xirq_max_mask_cycles = t;
interrupts->xirq_start_mask_cycle = -1;
+ interrupts->xirq_last_mask_cycles = t;
}
id = interrupts_get_current (interrupts);
{
signed64 t;
+ sim_io_printf (sd, "Interrupts Info:\n");
+ sim_io_printf (sd, " Interrupts raised: %lu\n",
+ interrupts->nb_interrupts_raised);
+
if (interrupts->start_mask_cycle >= 0)
{
t = cpu_current_cycle (interrupts->cpu);
t -= interrupts->start_mask_cycle;
if (t > interrupts->max_mask_cycles)
interrupts->max_mask_cycles = t;
- }
- if (interrupts->xirq_start_mask_cycle >= 0)
- {
- t = cpu_current_cycle (interrupts->cpu);
- t -= interrupts->xirq_start_mask_cycle;
- if (t > interrupts->xirq_max_mask_cycles)
- interrupts->xirq_max_mask_cycles = t;
+ sim_io_printf (sd, " Current interrupts masked sequence: %s\n",
+ cycle_to_string (interrupts->cpu, t));
}
-
- sim_io_printf (sd, "Interrupts Info:\n");
- sim_io_printf (sd, " Interrupts raised: %lu\n",
- interrupts->nb_interrupts_raised);
-
t = interrupts->min_mask_cycles == CYCLES_MAX ?
interrupts->max_mask_cycles :
interrupts->min_mask_cycles;
sim_io_printf (sd, " Longest interrupts masked sequence: %s\n",
cycle_to_string (interrupts->cpu, t));
+ t = interrupts->last_mask_cycles;
+ sim_io_printf (sd, " Last interrupts masked sequence: %s\n",
+ cycle_to_string (interrupts->cpu, t));
+
+ if (interrupts->xirq_start_mask_cycle >= 0)
+ {
+ t = cpu_current_cycle (interrupts->cpu);
+
+ t -= interrupts->xirq_start_mask_cycle;
+ if (t > interrupts->xirq_max_mask_cycles)
+ interrupts->xirq_max_mask_cycles = t;
+
+ sim_io_printf (sd, " XIRQ Current interrupts masked sequence: %s\n",
+ cycle_to_string (interrupts->cpu, t));
+ }
+
t = interrupts->xirq_min_mask_cycles == CYCLES_MAX ?
interrupts->xirq_max_mask_cycles :
interrupts->xirq_min_mask_cycles;
t = interrupts->xirq_max_mask_cycles;
sim_io_printf (sd, " XIRQ Max interrupts masked sequence: %s\n",
cycle_to_string (interrupts->cpu, t));
+
+ t = interrupts->xirq_last_mask_cycles;
+ sim_io_printf (sd, " XIRQ Last interrupts masked sequence: %s\n",
+ cycle_to_string (interrupts->cpu, t));
}