+2011-05-23 Mike Frysinger <vapier@gentoo.org>
+
+ * dv-glue.c (hw_glue_finish): Set type to glue_or when name is
+ glue-or, and set type to glue_xor when name is glue-xor.
+ (hw_glue_port_event): Return immediately when type is glue_io
+ or unmatched. Handle glue_or and glue_xor types. Move HW_TRACE
+ and hw_port_event calls from glue_and to end of function.
+
2011-05-11 Mike Frysinger <vapier@gentoo.org>
* callback.c, dv-pal.c, dv-sockser.c, hw-base.c, hw-device.c,
glue->type = glue_io;
else if (strcmp (name, "glue-and") == 0)
glue->type = glue_and;
+ else if (strcmp (name, "glue-or") == 0)
+ glue->type = glue_or;
+ else if (strcmp (name, "glue-xor") == 0)
+ glue->type = glue_xor;
else
hw_abort (me, "unimplemented glue type");
}
my_port,
(unsigned long) glue->address + port * sizeof (unsigned_word),
level));
- break;
+ return;
}
case glue_and:
{
glue->output[0] = glue->input[0];
for (i = 1; i < glue->nr_inputs; i++)
glue->output[0] &= glue->input[i];
-
- HW_TRACE ((me, "and - port %d, level %d arrived - output %d",
- my_port, level, glue->output[0]));
-
- hw_port_event (me, 0, glue->output[0]);
+ break;
+ }
+ case glue_or:
+ {
+ glue->output[0] = glue->input[0];
+ for (i = 1; i < glue->nr_inputs; i++)
+ glue->output[0] |= glue->input[i];
+ break;
+ }
+ case glue_xor:
+ {
+ glue->output[0] = glue->input[0];
+ for (i = 1; i < glue->nr_inputs; i++)
+ glue->output[0] ^= glue->input[i];
break;
}
default:
{
hw_abort (me, "operator not implemented");
- break;
+ return;
}
}
+
+ /* If we fell through, we want to generate a port event. */
+ HW_TRACE ((me, "port %d, level %d arrived - output %d",
+ my_port, level, glue->output[0]));
+
+ hw_port_event (me, 0, glue->output[0]);
}