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 1366 and 1492

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

Rev 1366 Rev 1492
Line 49... Line 49...
#include "arch.h"
#include "arch.h"
#include "sim-config.h"
#include "sim-config.h"
#include "vapi.h"
#include "vapi.h"
#include "debug.h"
#include "debug.h"
 
 
 
DEFAULT_DEBUG_CHANNEL(vapi);
 
 
static unsigned int serverIP = 0;
static unsigned int serverIP = 0;
 
 
static unsigned int server_fd = 0;
static unsigned int server_fd = 0;
static unsigned int nhandlers = 0;
static unsigned int nhandlers = 0;
 
 
Line 422... Line 424...
    }
    }
    return;
    return;
  }
  }
 
 
  vapi_write_log_file (VAPI_COMMAND_REQUEST, id, data);
  vapi_write_log_file (VAPI_COMMAND_REQUEST, id, data);
  debug (4, "[%08lx, %08lx]\n", id, data);
  TRACE ("[%08lx, %08lx]\n", id, data);
 
 
  /* This packet may be for another handler */
  /* This packet may be for another handler */
  if (!handler_fits_id (t, id))
  if (!handler_fits_id (t, id))
    t = find_handler (id);
    t = find_handler (id);
  if (!t || !t->read_func)
  if (!t || !t->read_func)
Line 442... Line 444...
  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(5, ".");
  TRACE(".");
 
 
  /* 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 548... Line 550...
/* Installs a vapi handler for many VAPI id */
/* Installs a vapi handler for many VAPI id */
void vapi_install_multi_handler (unsigned long base_id, unsigned long num_ids, void (*read_func) (unsigned long, unsigned long, void *), void *dat)
void vapi_install_multi_handler (unsigned long base_id, unsigned long num_ids, void (*read_func) (unsigned long, unsigned long, void *), void *dat)
{
{
  struct vapi_handler *tt;
  struct vapi_handler *tt;
 
 
  debug(4, "vapi_install_handler %08lx, %lu, %08p\n", base_id, num_ids, read_func);
  TRACE("vapi_install_handler %08lx, %lu, %p\n", base_id, num_ids, read_func);
  if (read_func == NULL) {
  if (read_func == NULL) {
    struct vapi_handler **t = &vapi_handler;
    struct vapi_handler **t = &vapi_handler;
    while ((*t) && !handler_fits_id (*t, base_id))
    while ((*t) && !handler_fits_id (*t, base_id))
      t = &(*t)->next;
      t = &(*t)->next;
    if (!t) {
    if (!t) {
Line 598... Line 600...
}
}
 
 
/* 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 [%08lx %08lx]\n", id, data);
  TRACE ("vapi_send [%08lx %08lx]\n", id, data);
  vapi_write_log_file (VAPI_COMMAND_SEND, id, data);
  vapi_write_log_file (VAPI_COMMAND_SEND, id, data);
  write_packet (id, data);
  write_packet (id, data);
}
}
 
 
/*
/*

powered by: WebSVN 2.1.0

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