示例#1
0
void
hw_finish (struct hw *me)
{
  if (hw_finished_p (me))
    hw_abort (me, "Attempt to finish finished device");

  /* Fill in the (hopefully) defined address/size cells values */
  if (hw_find_property (me, "#address-cells") != NULL)
    me->nr_address_cells_of_hw_unit =
      hw_find_integer_property (me, "#address-cells");
  else
    me->nr_address_cells_of_hw_unit = 2;
  if (hw_find_property (me, "#size-cells") != NULL)
    me->nr_size_cells_of_hw_unit =
      hw_find_integer_property (me, "#size-cells");
  else
    me->nr_size_cells_of_hw_unit = 1;

  /* Fill in the (hopefully) defined trace variable */
  if (hw_find_property (me, "trace?") != NULL)
    me->trace_of_hw_p = hw_find_boolean_property (me, "trace?");
  /* allow global variable to define default tracing */
  else if (! hw_trace_p (me)
	   && hw_find_property (hw_root (me), "global-trace?") != NULL
	   && hw_find_boolean_property (hw_root (me), "global-trace?"))
    me->trace_of_hw_p = 1;


  /* Allow the real device to override any methods */
  me->base_of_hw->descriptor->to_finish (me);
  me->base_of_hw->finished_p = 1;
}
示例#2
0
文件: sim-hw.c 项目: kidaa/HDTheatre
void
hw_trace (struct hw *me,
          const char *fmt,
          ...)
{
    if (hw_trace_p (me)) /* to be sure, to be sure */
    {
        va_list ap;
        va_start (ap, fmt);
        sim_io_eprintf (hw_system (me), "%s: ", hw_path (me));
        sim_io_evprintf (hw_system (me), fmt, ap);
        sim_io_eprintf (hw_system (me), "\n");
        va_end (ap);
    }
}