OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [tags/] [stable_0_2_0_rc1/] [or1ksim/] [vapi/] [vapi.c] - Diff between revs 355 and 361

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 355 Rev 361
Line 395... Line 395...
  if(read_packet (t->id, &data)) {
  if(read_packet (t->id, &data)) {
    if(t->fd) {
    if(t->fd) {
      perror("vapi read");
      perror("vapi read");
      close(t->fd);
      close(t->fd);
      t->fd = 0;
      t->fd = 0;
 
      rebuild_fds ();
    }
    }
    return;
    return;
  }
  }
 
 
  if (config.vapi.vapi_file)
  if (runtime.vapi.vapi_file)
    fprintf (config.vapi.vapi_file, "1%08x\n", data);
    fprintf (runtime.vapi.vapi_file, "0%08x\n", data);
  debug (4, "[%08x, %08x]\n", t->id, data);
  debug (4, "[%08x, %08x]\n", t->id, data);
  if (!t->read_func)
  if (!t->read_func)
    fprintf (stderr, "WARNING: packet sent to undefined id %x, %x\n", t->id, data);
    fprintf (stderr, "WARNING: packet sent to undefined id %x, %x\n", t->id, data);
  else
  else
    t->read_func(t->id, data);
    t->read_func(t->id, data);
Line 417... Line 418...
  if (!server_fd || !fds) {
  if (!server_fd || !fds) {
    fprintf (stderr, "FATAL: Unable to maintain VAPI server.\n");
    fprintf (stderr, "FATAL: Unable to maintain VAPI server.\n");
    exit (1);
    exit (1);
  }
  }
 
 
  debug(4, ".");
  debug(5, ".");
 
 
  /* Handle everything in queue. */
  /* Handle everything in queue. */
  while(1) {
  while(1) {
    switch(poll(fds, nfds, 0)) {
    switch(poll(fds, nfds, 0)) {
    case -1:
    case -1:
Line 478... Line 479...
    return 1;
    return 1;
  }
  }
 
 
  rebuild_fds ();
  rebuild_fds ();
 
 
  if ((config.vapi.vapi_file = fopen (config.vapi.vapi_fn, "wt+")) == NULL)
  if ((runtime.vapi.vapi_file = fopen (config.vapi.vapi_fn, "wt+")) == NULL)
    fprintf (stderr, "WARNING: cannot open VAPI log file\n");
    fprintf (stderr, "WARNING: cannot open VAPI log file\n");
 
 
  return 0;
  return 0;
}
}
 
 
Line 498... Line 499...
  server_fd = 0;
  server_fd = 0;
  config.vapi.enabled = 0;
  config.vapi.enabled = 0;
  serverIP = 0;
  serverIP = 0;
  free (fds);
  free (fds);
  fds = 0;
  fds = 0;
  if (config.vapi.vapi_file)
  if (runtime.vapi.vapi_file) {
    fclose (config.vapi.vapi_file);
    /* Mark end of simulation */
 
    fprintf (runtime.vapi.vapi_file, "2%08x", 0);
 
    fclose (runtime.vapi.vapi_file);
 
  }
 
 
  while (vapi_handler) {
  while (vapi_handler) {
    t = vapi_handler;
    t = vapi_handler;
    vapi_handler = vapi_handler->next;
    vapi_handler = vapi_handler->next;
    free (t);
    free (t);
Line 556... Line 560...
 
 
/* Sends a packet to specified test */
/* Sends a packet to specified test */
int vapi_send (unsigned long id, unsigned long data)
int vapi_send (unsigned long id, unsigned long data)
{
{
  debug (4, "vapi_send [%08x %08x]\n", id, data);
  debug (4, "vapi_send [%08x %08x]\n", id, data);
  if (config.vapi.vapi_file)
  if (runtime.vapi.vapi_file)
    fprintf (config.vapi.vapi_file, "0%08x\n", data);
    fprintf (runtime.vapi.vapi_file, "1%08x\n", data);
  write_packet (id, data);
  write_packet (id, data);
}
}
 
 
/*
/*
int main ()
int main ()

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.