summaryrefslogtreecommitdiff
path: root/sim
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2011-03-25 00:13:57 +0000
committerMike Frysinger <vapier@gentoo.org>2011-03-25 00:13:57 +0000
commita31d4fd99d645529ddf35a1ede3ce62a443c094b (patch)
tree1f17beddf38d327a7d7bd130ce7de60e212056e8 /sim
parentb72cc8e145a9df3d9b5fe215f89e8dfc4430f84b (diff)
downloadbinutils-a31d4fd99d645529ddf35a1ede3ce62a443c094b.tar.gz
binutils-a31d4fd99d645529ddf35a1ede3ce62a443c094b.tar.bz2
binutils-a31d4fd99d645529ddf35a1ede3ce62a443c094b.zip
sim: bfin: add hw tracing to gpio/sic port events
Makes it a lot easier to find out what's going on with interrupt lines if the ports have tracing output. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'sim')
-rw-r--r--sim/bfin/ChangeLog10
-rw-r--r--sim/bfin/dv-bfin_gpio.c38
-rw-r--r--sim/bfin/dv-bfin_sic.c26
3 files changed, 64 insertions, 10 deletions
diff --git a/sim/bfin/ChangeLog b/sim/bfin/ChangeLog
index 953192f2d23..eacab65bbf7 100644
--- a/sim/bfin/ChangeLog
+++ b/sim/bfin/ChangeLog
@@ -1,5 +1,15 @@
2011-03-24 Mike Frysinger <vapier@gentoo.org>
+ * dv-bfin_gpio.c (bfin_gpio_port_event): Call HW_TRACE at every
+ major code flow point.
+ * dv-bfin_sic.c (bfin_sic_forward_interrupts): Call HW_TRACE just
+ before calling hw_port_event on ourselves.
+ (bfin_sic_52x_port_event, bfin_sic_537_port_event,
+ bfin_sic_54x_port_event, bfin_sic_561_port_event): Call HW_TRACE
+ at the start of the function.
+
+2011-03-24 Mike Frysinger <vapier@gentoo.org>
+
* dv-bfin_gpio.c (bfin_gpio_port_event): Split dir/inen bit checking.
Normalize "level" to 0/1 values. Shift "level" over by "my_port".
Invert port->both bit check.
diff --git a/sim/bfin/dv-bfin_gpio.c b/sim/bfin/dv-bfin_gpio.c
index e9b79a80bb9..6847b52e0fd 100644
--- a/sim/bfin/dv-bfin_gpio.c
+++ b/sim/bfin/dv-bfin_gpio.c
@@ -203,10 +203,16 @@ bfin_gpio_port_event (struct hw *me, int my_port, struct hw *source,
lets us assume only those two values below. */
level = !!level;
+ HW_TRACE ((me, "pin %i set to %i", my_port, level));
+
/* Only screw with state if this pin is set as an input, and the
input is actually enabled. */
if ((port->dir & bit) || !(port->inen & bit))
- return;
+ {
+ HW_TRACE ((me, "ignoring level/int due to DIR=%i INEN=%i",
+ !!(port->dir & bit), !!(port->inen & bit)));
+ return;
+ }
/* Get the old pin state for calculating an interrupt. */
olvl = !!(port->data & bit);
@@ -224,28 +230,48 @@ bfin_gpio_port_event (struct hw *me, int my_port, struct hw *source,
{
/* Both edges. */
if (olvl == nlvl)
- return;
+ {
+ HW_TRACE ((me, "ignoring int due to EDGE=%i BOTH=%i lvl=%i->%i",
+ !!(port->edge & bit), !!(port->both & bit),
+ olvl, nlvl));
+ return;
+ }
}
else
{
/* Just one edge. */
if (!(((port->polar & bit) && olvl > nlvl)
|| (!(port->polar & bit) && olvl < nlvl)))
- return;
+ {
+ HW_TRACE ((me, "ignoring int due to EDGE=%i POLAR=%i lvl=%i->%i",
+ !!(port->edge & bit), !!(port->polar & bit),
+ olvl, nlvl));
+ return;
+ }
}
}
else
{
/* Pin is level triggered. */
if (nlvl == !!(port->polar & bit))
- return;
+ {
+ HW_TRACE ((me, "ignoring int due to EDGE=%i POLAR=%i lvl=%i",
+ !!(port->edge & bit), !!(port->polar & bit), nlvl));
+ return;
+ }
}
/* If the masks allow it, push the interrupt even higher. */
if (port->maska & bit)
- hw_port_event (me, 0, 1);
+ {
+ HW_TRACE ((me, "pin %i triggered an int via mask a", my_port));
+ hw_port_event (me, 0, 1);
+ }
if (port->maskb & bit)
- hw_port_event (me, 1, 1);
+ {
+ HW_TRACE ((me, "pin %i triggered an int via mask b", my_port));
+ hw_port_event (me, 1, 1);
+ }
}
static void
diff --git a/sim/bfin/dv-bfin_sic.c b/sim/bfin/dv-bfin_sic.c
index f77bc077bf3..3578388b493 100644
--- a/sim/bfin/dv-bfin_sic.c
+++ b/sim/bfin/dv-bfin_sic.c
@@ -127,6 +127,7 @@ bfin_sic_forward_interrupts (struct hw *me, bu32 *isr, bu32 *imask, bu32 *iar)
iar_idx = my_port / 8;
iar_off = (my_port % 8) * 4;
iar_val = (iar[iar_idx] & (0xf << iar_off)) >> iar_off;
+ HW_TRACE ((me, "forwarding int %i to CEC", IVG7 + iar_val));
hw_port_event (me, IVG7 + iar_val, 1);
}
}
@@ -763,7 +764,11 @@ bfin_sic_52x_port_event (struct hw *me, int my_port, struct hw *source,
{
struct bfin_sic *sic = hw_data (me);
bu32 idx = DEC_SIC (my_port);
- bu32 bit = 1 << DEC_PIN (my_port);
+ bu32 pin = DEC_PIN (my_port);
+ bu32 bit = 1 << pin;
+
+ HW_TRACE ((me, "processing system int from %i (SIC %u pin %u)",
+ my_port, idx, pin));
/* SIC only exists to forward interrupts from the system to the CEC. */
switch (idx)
@@ -873,7 +878,12 @@ bfin_sic_537_port_event (struct hw *me, int my_port, struct hw *source,
int source_port, int level)
{
struct bfin_sic *sic = hw_data (me);
- bu32 bit = 1 << DEC_PIN (my_port);
+ bu32 idx = DEC_SIC (my_port);
+ bu32 pin = DEC_PIN (my_port);
+ bu32 bit = 1 << pin;
+
+ HW_TRACE ((me, "processing system int from %i (SIC %u pin %u)",
+ my_port, idx, pin));
/* SIC only exists to forward interrupts from the system to the CEC. */
sic->bf537.isr |= bit;
@@ -1056,7 +1066,11 @@ bfin_sic_54x_port_event (struct hw *me, int my_port, struct hw *source,
{
struct bfin_sic *sic = hw_data (me);
bu32 idx = DEC_SIC (my_port);
- bu32 bit = 1 << DEC_PIN (my_port);
+ bu32 pin = DEC_PIN (my_port);
+ bu32 bit = 1 << pin;
+
+ HW_TRACE ((me, "processing system int from %i (SIC %u pin %u)",
+ my_port, idx, pin));
/* SIC only exists to forward interrupts from the system to the CEC. */
switch (idx)
@@ -1156,7 +1170,11 @@ bfin_sic_561_port_event (struct hw *me, int my_port, struct hw *source,
{
struct bfin_sic *sic = hw_data (me);
bu32 idx = DEC_SIC (my_port);
- bu32 bit = 1 << DEC_PIN (my_port);
+ bu32 pin = DEC_PIN (my_port);
+ bu32 bit = 1 << pin;
+
+ HW_TRACE ((me, "processing system int from %i (SIC %u pin %u)",
+ my_port, idx, pin));
/* SIC only exists to forward interrupts from the system to the CEC. */
switch (idx)